]> Dogcows Code - chaz/yoink/commitdiff
remove some unused stlplus modules
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 1 Jul 2011 08:01:10 +0000 (02:01 -0600)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 1 Jul 2011 08:01:10 +0000 (02:01 -0600)
also updated copyright timespan and formatted files for tabstops of 8
characters

203 files changed:
Makefile
README
TODO
build/arch/win32/makedeps.mk
build/arch/win32/rules.mk
build/config.lua
build/dialog.c
configure
data/rules.mk
data/scenes/Classic.lua
doc/yoink_readme.7
options.lua
scripts/man2html.lua
scripts/unix2dos.sh [moved from build/arch/win32/unix2dos.sh with 74% similarity]
src/Animation.cc
src/Animation.hh
src/Character.cc
src/Character.hh
src/GameState.hh
src/Heroine.cc
src/Heroine.hh
src/Hud.cc
src/Hud.hh
src/Main.cc
src/Main.hh
src/Scene.cc
src/Scene.hh
src/TilemapFont.cc
src/TilemapFont.hh
src/Typesetter.cc
src/Typesetter.hh
src/moof/aabb.cc
src/moof/aabb.hh
src/moof/application.cc
src/moof/application.hh
src/moof/backend.cc
src/moof/backend.hh
src/moof/camera.cc
src/moof/camera.hh
src/moof/contact.hh
src/moof/cullable.hh
src/moof/debug.hh
src/moof/dispatcher.cc
src/moof/dispatcher.hh
src/moof/drawable.hh
src/moof/entity.hh
src/moof/event.hh
src/moof/frustum.cc
src/moof/frustum.hh
src/moof/hash.cc
src/moof/hash.hh
src/moof/image.cc
src/moof/image.hh
src/moof/interpolator.hh
src/moof/line.hh
src/moof/log.cc
src/moof/log.hh
src/moof/manager.hh
src/moof/math.hh
src/moof/mesh.cc
src/moof/mesh.hh
src/moof/mesh_bindings.cc
src/moof/modal_dialog.hh
src/moof/network.hh
src/moof/opengl.hh
src/moof/plane.cc
src/moof/plane.hh
src/moof/ray.hh
src/moof/resource.cc
src/moof/resource.hh
src/moof/rigid_body.hh
src/moof/runloop.cc
src/moof/runloop.hh
src/moof/script.hh
src/moof/service.cc
src/moof/service.hh
src/moof/settings.cc
src/moof/settings.hh
src/moof/shape.hh
src/moof/sound.cc
src/moof/sound.hh
src/moof/sound_bindings.cc
src/moof/sphere.hh
src/moof/sprite.cc
src/moof/sprite.hh
src/moof/string.cc
src/moof/string.hh
src/moof/thread.cc
src/moof/thread.hh
src/moof/timer.cc
src/moof/timer.hh
src/moof/video.cc
src/moof/video.hh
src/rules.mk
src/stlplus/rules.mk
src/stlplus/strings/format_types.hpp [deleted file]
src/stlplus/strings/print_address.cpp [deleted file]
src/stlplus/strings/print_address.hpp [deleted file]
src/stlplus/strings/print_basic.hpp [deleted file]
src/stlplus/strings/print_bitset.hpp [deleted file]
src/stlplus/strings/print_bitset.tpp [deleted file]
src/stlplus/strings/print_bool.cpp [deleted file]
src/stlplus/strings/print_bool.hpp [deleted file]
src/stlplus/strings/print_cstring.cpp [deleted file]
src/stlplus/strings/print_cstring.hpp [deleted file]
src/stlplus/strings/print_digraph.hpp [deleted file]
src/stlplus/strings/print_digraph.tpp [deleted file]
src/stlplus/strings/print_float.cpp [deleted file]
src/stlplus/strings/print_float.hpp [deleted file]
src/stlplus/strings/print_foursome.hpp [deleted file]
src/stlplus/strings/print_foursome.tpp [deleted file]
src/stlplus/strings/print_hash.hpp [deleted file]
src/stlplus/strings/print_hash.tpp [deleted file]
src/stlplus/strings/print_inf.cpp [deleted file]
src/stlplus/strings/print_inf.hpp [deleted file]
src/stlplus/strings/print_int.cpp [deleted file]
src/stlplus/strings/print_int.hpp [deleted file]
src/stlplus/strings/print_list.hpp [deleted file]
src/stlplus/strings/print_list.tpp [deleted file]
src/stlplus/strings/print_map.hpp [deleted file]
src/stlplus/strings/print_map.tpp [deleted file]
src/stlplus/strings/print_matrix.hpp [deleted file]
src/stlplus/strings/print_matrix.tpp [deleted file]
src/stlplus/strings/print_ntree.hpp [deleted file]
src/stlplus/strings/print_ntree.tpp [deleted file]
src/stlplus/strings/print_pair.hpp [deleted file]
src/stlplus/strings/print_pair.tpp [deleted file]
src/stlplus/strings/print_pointer.hpp [deleted file]
src/stlplus/strings/print_pointer.tpp [deleted file]
src/stlplus/strings/print_sequence.hpp [deleted file]
src/stlplus/strings/print_sequence.tpp [deleted file]
src/stlplus/strings/print_set.hpp [deleted file]
src/stlplus/strings/print_set.tpp [deleted file]
src/stlplus/strings/print_simple_ptr.hpp [deleted file]
src/stlplus/strings/print_simple_ptr.tpp [deleted file]
src/stlplus/strings/print_smart_ptr.hpp [deleted file]
src/stlplus/strings/print_smart_ptr.tpp [deleted file]
src/stlplus/strings/print_stl.hpp [deleted file]
src/stlplus/strings/print_stlplus.hpp [deleted file]
src/stlplus/strings/print_string.cpp [deleted file]
src/stlplus/strings/print_string.hpp [deleted file]
src/stlplus/strings/print_triple.hpp [deleted file]
src/stlplus/strings/print_triple.tpp [deleted file]
src/stlplus/strings/print_vector.cpp [deleted file]
src/stlplus/strings/print_vector.hpp [deleted file]
src/stlplus/strings/print_vector.tpp [deleted file]
src/stlplus/strings/string_address.cpp [deleted file]
src/stlplus/strings/string_address.hpp [deleted file]
src/stlplus/strings/string_basic.hpp [deleted file]
src/stlplus/strings/string_bitset.hpp [deleted file]
src/stlplus/strings/string_bitset.tpp [deleted file]
src/stlplus/strings/string_bool.cpp [deleted file]
src/stlplus/strings/string_bool.hpp [deleted file]
src/stlplus/strings/string_cstring.cpp [deleted file]
src/stlplus/strings/string_cstring.hpp [deleted file]
src/stlplus/strings/string_digraph.hpp [deleted file]
src/stlplus/strings/string_digraph.tpp [deleted file]
src/stlplus/strings/string_float.cpp [deleted file]
src/stlplus/strings/string_float.hpp [deleted file]
src/stlplus/strings/string_foursome.hpp [deleted file]
src/stlplus/strings/string_foursome.tpp [deleted file]
src/stlplus/strings/string_hash.hpp [deleted file]
src/stlplus/strings/string_hash.tpp [deleted file]
src/stlplus/strings/string_inf.cpp [deleted file]
src/stlplus/strings/string_inf.hpp [deleted file]
src/stlplus/strings/string_int.cpp [deleted file]
src/stlplus/strings/string_int.hpp [deleted file]
src/stlplus/strings/string_list.hpp [deleted file]
src/stlplus/strings/string_list.tpp [deleted file]
src/stlplus/strings/string_map.hpp [deleted file]
src/stlplus/strings/string_map.tpp [deleted file]
src/stlplus/strings/string_matrix.hpp [deleted file]
src/stlplus/strings/string_matrix.tpp [deleted file]
src/stlplus/strings/string_ntree.hpp [deleted file]
src/stlplus/strings/string_ntree.tpp [deleted file]
src/stlplus/strings/string_pair.hpp [deleted file]
src/stlplus/strings/string_pair.tpp [deleted file]
src/stlplus/strings/string_pointer.hpp [deleted file]
src/stlplus/strings/string_pointer.tpp [deleted file]
src/stlplus/strings/string_sequence.hpp [deleted file]
src/stlplus/strings/string_sequence.tpp [deleted file]
src/stlplus/strings/string_set.hpp [deleted file]
src/stlplus/strings/string_set.tpp [deleted file]
src/stlplus/strings/string_simple_ptr.hpp [deleted file]
src/stlplus/strings/string_simple_ptr.tpp [deleted file]
src/stlplus/strings/string_smart_ptr.hpp [deleted file]
src/stlplus/strings/string_smart_ptr.tpp [deleted file]
src/stlplus/strings/string_stl.hpp [deleted file]
src/stlplus/strings/string_stlplus.hpp [deleted file]
src/stlplus/strings/string_string.cpp [deleted file]
src/stlplus/strings/string_string.hpp [deleted file]
src/stlplus/strings/string_triple.hpp [deleted file]
src/stlplus/strings/string_triple.tpp [deleted file]
src/stlplus/strings/string_utilities.cpp [deleted file]
src/stlplus/strings/string_utilities.hpp [deleted file]
src/stlplus/strings/string_vector.cpp [deleted file]
src/stlplus/strings/string_vector.hpp [deleted file]
src/stlplus/strings/string_vector.tpp [deleted file]
src/stlplus/strings/strings.hpp [deleted file]
src/stlplus/strings/strings_fixes.hpp [deleted file]
src/win32.rc
src/yoink.cc
src/yoink.hh

index e104a4ef1710d7c12629c9f3e4ffbb4292e4257d..a0c754b694dbf64e9d42fc277ec02fcacfcbd9a7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
 
 # Set V to `1' to echo each build command in full.  The default behavior
 # will keep output minimal.
-V              = 0
+V      = 0
 
 SHELL  = /bin/sh
 
@@ -35,7 +35,7 @@ include config.mk
 
 DATA_TARGETS   :=
 EXEC_TARGETS   :=
-SUBDIRS                        :=
+SUBDIRS                :=
 
 define include_func =
 ifeq (,$$d)
@@ -43,13 +43,13 @@ dir := $1
 else
 dir    := $$d/$1
 endif
-sp                             := $$(sp).x
+sp     := $$(sp).x
 dirstack_$$(sp)        := $$d
 datstack_$$(sp) := $$(data)
 exestack_$$(sp) := $$(exec)
-d                              := $$(dir)
-data :=
-exec :=
+d      := $$(dir)
+data   :=
+exec   :=
 include $$(dir)/rules.mk
 SUBDIRS += $$d $$b
 data   := $$(sort $$(data) $$(appdir_$$b) $$(mandir_$$b) $$(pkgdatadir_$$b) $$(desktop_$$b))
@@ -59,7 +59,7 @@ clean   := $$(clean) $$(deps) $$(exec) $$(data)
 DEPFILE := $$(DEPFILE) $$(deps)
 DATA_TARGETS += $$(data)
 EXEC_TARGETS += $$(exec)
-d              := $$(dirstack_$$(sp))
+d      := $$(dirstack_$$(sp))
 data   := $$(datstack_$$(sp))
 exec   := $$(exestack_$$(sp))
 sp     := $$(basename $$(sp))
@@ -68,7 +68,7 @@ include       = $(foreach i,$1,$(eval $(call include_func,$i)))
 
 targets                = $(EXEC_TARGETS) $(DATA_TARGETS)
 builddir       = build/obj
-b                      = $(builddir)/$(d)
+b              = $(builddir)/$(d)
 this           = $(d)/rules.mk
 
 ifeq (gzip,$(manCompression))
@@ -85,7 +85,7 @@ endif
 #
 
 $(call include,src data doc)
--include build/$(platform)/rules.mk
+-include build/arch/$(platform)/rules.mk
 
 
 #
@@ -98,7 +98,7 @@ PKG_CFLAGS    += -MD -MP -MF $(@:%.o=%.d) -MT $@
 endif
 
 # Include current directory to allow sources to include config.h.
-override CPPFLAGS      += -I.
+override CPPFLAGS      += -I. -DHAVE_CONFIG_H=1
 TGT_CXXFLAGS           = $(TGT_CFLAGS)
 ARFLAGS                = rc
 INSTALL                = install
@@ -106,51 +106,51 @@ INSTALL           = install
 tarname                = $(TARNAME)-$(VERSION)
 
 cmd_compile_c  = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(CPPFLAGS) \
-                                 $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+                 $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
 cmd_compile_cc = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) \
-                                 $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
-cmd_link_c             = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(CPPFLAGS) \
-                                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
-                                 $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
-cmd_link_cc            = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) \
-                                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
-                                 $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
-cmd_ar                 = $(AR) $(ARFLAGS) $@ $^; $(RANLIB) $@
+                 $(TARGET_ARCH) -c $(OUTPUT_OPTION) $<
+cmd_link_c     = $(CC) $(PKG_CFLAGS) $(TGT_CFLAGS) $(CFLAGS) $(CPPFLAGS) \
+                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
+                 $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
+cmd_link_cc    = $(CXX) $(PKG_CXXFLAGS) $(TGT_CXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) \
+                 $(PKG_LDFLAGS) $(TGT_LDFLAGS) $(LDFLAGS) \
+                 $(TARGET_ARCH) $^ $(LOADLIBES) $(PKG_LDLIBS) $(TGT_LDLIBS) $(LDLIBS) -o $@
+cmd_ar         = $(AR) $(ARFLAGS) $@ $^; $(RANLIB) $@
 cmd_compile_rc = $(WINDRES) $(CPPFLAGS) $(TARGET_ARCH) $(OUTPUT_OPTION) -i $<
-cmd_sed                        = sed -f config.sed <$< >$@
-cmd_gzip               = gzip -c $< >$@
-cmd_bzip2              = bzip2 -c $< >$@
-cmd_xxd                        = id=$(subst .,_,$(notdir $<)); \
-                                 printf "\#include <stddef.h>\nsize_t\tdata_%s_size = %d;\nchar\tdata_%s[] = {\n" \
-                                 $$id $$(wc -c <$<) $$id >$@; \
-                                 xxd -i <$< >>$@; \
-                                 printf ", 0x00\n};\n" >>$@
+cmd_sed                = sed -f config.sed <$< >$@
+cmd_gzip       = gzip -c $< >$@
+cmd_bzip2      = bzip2 -c $< >$@
+cmd_xxd                = id=$(subst .,_,$(notdir $<)); \
+                 printf "\#include <stddef.h>\nsize_t\tdata_%s_size = %d;\nchar\tdata_%s[] = {\n" \
+                 $$id $$(wc -c <$<) $$id >$@; \
+                 xxd -i <$< >>$@; \
+                 printf ", 0x00\n};\n" >>$@
 cmd_configure  = ./configure
 func_install   = mkdir -p $(DESTDIR)$3 && $(INSTALL) -m $1 $2 $(DESTDIR)$3
-func_remove            = rm -f $1
-func_dist              = git archive HEAD --prefix='$(tarname)/' | $1 >"$(tarname).tar.$2" && \
-                                 (md5 "$(tarname).tar.$2" 2>/dev/null || md5sum "$(tarname).tar.$2")
+func_remove    = rm -f $1
+func_dist      = git archive HEAD --prefix='$(tarname)/' | $1 >"$(tarname).tar.$2" && \
+                 (md5 "$(tarname).tar.$2" 2>/dev/null || md5sum "$(tarname).tar.$2")
 
 compile_c      = $(call func_print,CC,$@) $(cmd_compile_c)
 compile_cc     = $(call func_print,CXX,$@) $(cmd_compile_cc)
 compile_rc     = $(call func_print,RC,$@) $(cmd_compile_rc)
 link_c         = $(call func_print,LINK,$@) $(cmd_link_c)
 link_cc                = $(call func_print,LINK,$@) $(cmd_link_cc)
-ar                     = $(call func_print,AR,$@) $(cmd_ar)
-sed                    = $(call func_print,SED,$@) $(cmd_sed)
+ar             = $(call func_print,AR,$@) $(cmd_ar)
+sed            = $(call func_print,SED,$@) $(cmd_sed)
 gzip           = $(call func_print,GZIP,$@) $(cmd_gzip)
 bzip2          = $(call func_print,BZIP2,$@) $(cmd_bzip2)
-xxd                    = $(call func_print,XXD,$@) $(cmd_xxd)
+xxd            = $(call func_print,XXD,$@) $(cmd_xxd)
 configure      = $(call func_print,MAKE,$@) $(cmd_configure)
 dist           = $(call func_print,DIST,$1) $(func_dist)
-install                = $(call func_print,CP,$(DESTDIR)$(3:%/=%)/$(notdir $2)) $(func_install)
+install                = $(call func_print,CP,$(DESTDIR:%/=%)$(3:%/=%)/$(notdir $2)) $(func_install)
 remove         = $(call func_print,RM,$1) $(func_remove)
 
 ifeq (1,$V)
-Q                      =
+Q              =
 func_print     =
 else
-Q                      = @
+Q              = @
 func_print     = printf "\x20\x20$1\t%s\n" $2;
 endif
 
@@ -214,7 +214,8 @@ install-data: $(DATA_TARGETS)
        $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(pkgdatadir_$d),\
                $(call install,644,$f,$(dir $(f:$d%=$(pkgdatadir)%)));))
        $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(mandir_$d),\
-               $(call install,644,$f,$(dir $(f:$d%=$(mandir)/man$(shell echo "$f" | sed 's/[^.]*\.\([^.]*\).*/\1/')%)));))
+               $(call install,644,$f,\
+               $(dir $(f:$d%=$(mandir)/man$(shell echo "$f" | sed 's/[^.]*\.\([^.]*\).*/\1/')%)));))
 
 install-exec: $(EXEC_TARGETS)
        $(Q)$(foreach d,$(SUBDIRS),$(foreach f,$(bindir_$d),\
@@ -246,7 +247,7 @@ dist: dist-$(archiveFormat)
 # Prevent make from removing any build targets.
 #
 
-.SECONDARY:    $(clean)
+.SECONDARY: $(clean)
 
 .PHONY: all clean distclean install install-data install-exec
 .PHONY: install-desktop-entry
diff --git a/README b/README
index 0cab8cce8b8e178eba795c62eb7ac3f2b2e4ba76..b993ffdeb6e306d5483c2c86c59bf49e7ab2d8a8 100644 (file)
--- a/README
+++ b/README
@@ -80,7 +80,7 @@ DESCRIPTION
      o   Stick to the coding style of the source code files you edit.  Follow
          the general style of method and variable naming, as well as white
          space formatting.  In particular, use literal tabs with an assumed
-         tabstop of 4 characters.  Also, try to limit line lengths to 75
+         tabstop of 8 characters.  Also, try to limit line lengths to 78
          characters.
 
      o   For legal reasons, don't include other peoples' code with your patch.
diff --git a/TODO b/TODO
index dc4b35674ec46c8360153bbb4467995abb880fc7..4ecad27865a51e4af8c02f6993cac253195438e9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,8 +2,8 @@
 The roadmap and ticket tracker are available on the website:
 There are lists of goals and tasks on the website:
 
-Roadmap:        http://www.dogcows.com/yoink/roadmap
-Ticket Tracker: http://www.dogcows.com/yoink/report/1
+Roadmap:       http://www.dogcows.com/yoink/roadmap
+Ticket Tracker:        http://www.dogcows.com/yoink/report/1
 
 
 Other than that, the itself code is documented with stuff that needs doing:
index fbdbecdefbc25c86631b2ff6ccaa941e7e825b6b..03766157694a16450710ea2c1c7c738ca7080c51 100644 (file)
 #   make -f deps.mk -j2 host=i486-mingw32 prefix=/usr/i486-mingw32
 #   sudo make install
 #
-# A lot of temporary files and directories are downloaded or extracted to
-# the current directory, so you may want to make from a clean directory.
+# A lot of temporary files and directories are downloaded or extracted to the
+# current directory, so you may want to make from a clean directory.
 #
 
-
 host   = i686-mingw32
 prefix = /usr/i686-mingw32/usr
 
@@ -50,9 +49,9 @@ endif
 
 
 ###########################################################################
-BOOST                  = boost_1_46_1
-BOOST_CKSUM            = 7375679575f4c8db605d426fc721d506
-BOOST_EXT              = .tar.bz2
+BOOST          = boost_1_46_1
+BOOST_CKSUM    = 7375679575f4c8db605d426fc721d506
+BOOST_EXT      = .tar.bz2
 BOOST_VERSION  = 1.46.1
 
 $(BOOST)$(BOOST_EXT):
@@ -69,7 +68,7 @@ install-$(BOOST): $(BOOST)$(BOOST_EXT)
 
 
 ###########################################################################
-SDL                    = SDL-1.2.14
+SDL            = SDL-1.2.14
 SDL_CKSUM      = e52086d1b508fa0b76c52ee30b55bec4
 SDL_EXT                = .tar.gz
 
@@ -89,9 +88,9 @@ install-$(SDL): $(SDL)
 
 
 ###########################################################################
-LIBOGG                 = libogg-1.2.2
+LIBOGG         = libogg-1.2.2
 LIBOGG_CKSUM   = 5a9fcabc9a1b7c6f1cd75ddc78f36c56
-LIBOGG_EXT             = .tar.gz
+LIBOGG_EXT     = .tar.gz
 
 $(LIBOGG)$(LIBOGG_EXT):
        $(call getdist,$@,http://downloads.xiph.org/releases/ogg/$@)
@@ -109,7 +108,7 @@ install-$(LIBOGG): $(LIBOGG)
 
 
 ###########################################################################
-LIBVORBIS              = libvorbis-1.3.2
+LIBVORBIS      = libvorbis-1.3.2
 LIBVORBIS_CKSUM        = c870b9bd5858a0ecb5275c14486d9554
 LIBVORBIS_EXT  = .tar.gz
 
@@ -129,9 +128,9 @@ install-$(LIBVORBIS): $(LIBVORBIS) install-$(LIBOGG)
 
 
 ###########################################################################
-OPENAL                 = openal-soft-1.13-bin
+OPENAL         = openal-soft-1.13-bin
 OPENAL_CKSUM   = b545d3ebb8138cc581cd67f988638f43
-OPENAL_EXT             = .zip
+OPENAL_EXT     = .zip
 OPENAL_VERSION = 1.13
 
 define OPENAL_PCFILE
@@ -167,9 +166,9 @@ install-$(OPENAL): $(OPENAL)$(OPENAL_EXT)
 
 
 ###########################################################################
-ZLIB                   = zlib-1.2.5
-ZLIB_CKSUM             = c735eab2d659a96e5a594c9e8541ad63
-ZLIB_EXT               = .tar.gz
+ZLIB           = zlib-1.2.5
+ZLIB_CKSUM     = c735eab2d659a96e5a594c9e8541ad63
+ZLIB_EXT       = .tar.gz
 ZLIB_VERSION   = 1.2.5
 
 define ZLIB_PCFILE
@@ -208,9 +207,9 @@ install-$(ZLIB): $(ZLIB)
 
 
 ###########################################################################
-LIBPNG                 = libpng-1.5.2
+LIBPNG         = libpng-1.5.2
 LIBPNG_CKSUM   = 31d448eb93a1646359a23f1b23434ab3
-LIBPNG_EXT             = .tar.gz
+LIBPNG_EXT     = .tar.gz
 
 define LIBPNG_PATCH
 diff -ur libpng-1.5.2.orig/configure.pc libpng-1.5.2/configure.pc
@@ -248,7 +247,7 @@ install-$(LIBPNG): $(LIBPNG) install-$(ZLIB)
 
 
 ###########################################################################
-LUA                    = lua-5.1.4
+LUA            = lua-5.1.4
 LUA_CKSUM      = d0870f2de55d59c1c8419f36e8fac150
 LUA_EXT                = .tar.gz
 
index 0f5eae5e40ed961cb49f35f4dc641b7b0f5195be..3e3c49d0f9db9f9ec692d934d0351896fdcad990 100644 (file)
@@ -1,17 +1,13 @@
+
 #
-# Yoink
-# Run this script to create a win32 package.
-#
-# You should typically only run this through the "portable" and "installer"
-# makes targets in the package root directory.  The build system will take
-# care to pass the correct arguments.
+# Rules to create win32 packages.
 #
 
 docs           = AUTHORS COPYING README TODO
 libraries      = libogg-0 libpng15 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1
 
-MAN2HTML       = lua doc/man2html.lua
-UNIX2DOS       = arch/win32/unix2dos.sh
+MAN2HTML       = $${LUA:-lua} scripts/man2html.lua
+UNIX2DOS       = scripts/unix2dos.sh
 MAKENSIS       = makensis
 
 stagedir       = $(builddir)/$(tarname)
index fa522cf9247a31b0b530e5923d78fe63737d178b..6a72455103bbc068824fb24ee5530e08365ef658 100644 (file)
@@ -71,8 +71,8 @@ end
 
 local arguments                = parseArguments(unpack(arg))
 local interactive      = arguments["--interactive"]
-local rules                    = arguments["--rules"]      or "options.lua"
-local configfile       = arguments["--configfile"] or "config.mk"
+local rules            = arguments["--rules"]          or "options.lua"
+local configfile       = arguments["--configfile"]     or "config.mk"
 local printendmsg      = arguments["--print-instructions"]
 local exportHeader     = arguments["--export-header"]
 local exportTerms      = arguments["--export-terms"]
@@ -92,7 +92,9 @@ local function beginProcess(title, caption)
        return function(progress, caption)
                if progress ~= nil
                then
-                       if 0.0 <= progress and progress <= 1.0 then progress = progress * 100 end
+                       if 0.0 <= progress and progress <= 1.0 then
+                               progress = progress * 100
+                       end
                        return updater(progress, caption)
                end
                print()
@@ -103,16 +105,12 @@ end
 local function loadDialog(name, configfile)
        local dialog
        local result, err = pcall(function() dialog = require "dialog" end)
-       if not result
-       then
-               printWarning(err)
-               return nil
-       end
+       if not result then printWarning(err) return nil end
        dialog.title = string.format("%s - %s Configuration", configfile, name)
-       printInfo = dialog.msgbox
-       printWarning = dialog.msgbox
-       printError = dialog.msgbox
-       beginProcess = dialog.gauge
+       printInfo       = dialog.msgbox
+       printWarning    = dialog.msgbox
+       printError      = dialog.msgbox
+       beginProcess    = dialog.gauge
        return dialog
 end
 
@@ -185,20 +183,20 @@ local Option = util.class()
 ---------------------------------------------------------------------------
 
 function Option:__init(rule, lookup, objects)
-       self.name               = rule.name
+       self.name       = rule.name
        self.caption    = rule.caption
-       self.help               = rule.help
-       self.value              = rule.value
-       self.symbol             = rule.symbol
+       self.help       = rule.help
+       self.value      = rule.value
+       self.symbol     = rule.symbol
        self.cmdline    = rule.cmdline
-       self.config             = rule.config
-       self.export             = rule.export
+       self.config     = rule.config
+       self.export     = rule.export
        self.visible    = rule.visible
-       self.check              = rule.check
-       self.temp               = rule.temp
-       self.before             = rule.before   
-       self.after              = rule.after    
-       self.lookup             = lookup or {}
+       self.check      = rule.check
+       self.temp       = rule.temp
+       self.before     = rule.before   
+       self.after      = rule.after    
+       self.lookup     = lookup or {}
        self.objects    = objects or {}
 
        if type(self.check) == "function"   then setfenv(self.check, self.lookup) end
@@ -327,7 +325,6 @@ function Option:writeSymbol(fd)
        if self.symbol ~= nil and not self.temp
        then
                fd:write(util.align(self.symbol, "= " .. tostring(self.lookup[self.symbol]), 16) .. "\n")
-               --fd:write(string.format("%s\t= %s\n", self.symbol, tostring(self.lookup[self.symbol])))
        end
 end
 
@@ -339,7 +336,7 @@ end
 function Option:writeSedLine(fd)
        if self.export
        then
-               local value     = self:toExpandedString():gsub("/", "\\/")
+               local value = self:toExpandedString():gsub("/", "\\/")
                local function writeLine(key)
                        key = tostring(key):gsub("/", "\\/")
                        fd:write(string.format("s/@%s@/%s/g\n", key, value))
@@ -398,11 +395,11 @@ function Option:printHelpLine()
 end
 
 function Option:getHelpText()
-       local value             = self:toString()
-       local help              = self.help or "No help available.\n"
-       local name              = self.name or "Unnamed"
+       local value     = self:toString()
+       local help      = self.help or "No help available.\n"
+       local name      = self.name or "Unnamed"
        local symbol    = self:getSymbol() or "None"
-       local arg               = self:getArg() or "None"
+       local arg       = self:getArg() or "None"
 
        local problem   = self:getProblem()
        if problem then problem = "\nProblem(s):\n" .. problem
@@ -591,7 +588,7 @@ end
 function BooleanOption:writeCppLine(fd)
        if self.config
        then
-               local value     = self.lookup[self.symbol]
+               local value = self.lookup[self.symbol]
                local function writeLine(key)
                        -- Reverse the value if key starts with a bang.
                        local value = value
@@ -813,8 +810,7 @@ function GroupOption:showMenu(dialog)
                                dialog.msgbox(value.name, value:getHelpText(), {["--no-collapse"] = true})
                                selected = value:getMenuItem()
                        else
-                               dialog.msgbox("No Help",
-                                                         "Sorry, no help is available for this option.")
+                               dialog.msgbox("No Help", "Sorry, no help is available for this option.")
                        end
                else
                        running = false
@@ -964,8 +960,7 @@ if interactive then loadDialog(name, configfile) end
 options:convertDependenciesToDependants()
 checkSymbols(options:getObjects())
 
-if dialog
-then
+if dialog then
        local action = options:runMenu()
        if action == "exit" or action == "error"
        then
@@ -975,8 +970,7 @@ then
                options:saveToFile(configfile)
                print("configuration saved to " .. configfile)
        end
-elseif options:isValid()
-then
+elseif options:isValid() then
        options:saveToFile(configfile)
 else
        printError("Uh oh!", [[
index ee8a2a8a669c61157eb4ccdced3ca442ca807858..e4c76d723ede46818557fbb4d7568548d6db9fdb 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2011, Charles McGarvey  [*******************************
+/*]  Copyright (c) 2011, Charles McGarvey  [**********************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #define LUA_DIALOG_NAME                "dialog"
 #define LUA_DIALOG_VERSION     "1.0"
@@ -41,13 +39,12 @@ static void printarray(const char* argv[])
 /**
  * Fork and execute a command with arguments and optionally get a file
  * descriptor connected to one of the child's own file descriptors.  The
- * process id of the child is returned, or -1 on error.  If fd is not NULL,
- * a pipe will be created and connected to *fd.  If *fd is 0, then *fd will
- * be set to a write file descriptor connected to the child's standard
- * input.  If *fd is not 0, then *fd will be set to a read file descriptor
- * set connected to the specified file descriptor of the child.  In either
- * case, the caller has the responsibility to close fd when it is no longer
- * needed.
+ * process id of the child is returned, or -1 on error.  If fd is not NULL, a
+ * pipe will be created and connected to *fd.  If *fd is 0, then *fd will be
+ * set to a write file descriptor connected to the child's standard input.  If
+ * *fd is not 0, then *fd will be set to a read file descriptor set connected
+ * to the specified file descriptor of the child.  In either case, the caller
+ * has the responsibility to close fd when it is no longer needed.
  */
 static pid_t myexec(const char* command, char* const argv[], int* fd) 
 {
@@ -55,31 +52,24 @@ static pid_t myexec(const char* command, char* const argv[], int* fd)
        int p[2];
        pid_t child;
 
-       if (fd)
-       {
+       if (fd) {
                if (pipe(p) != 0) return -1;
                parentFd = (*fd == 0);
        }
-       if (!(child = fork()))
-       {
-               if (fd)
-               {
+       if (!(child = fork())) {
+               if (fd) {
                        close(p[parentFd]);
                        if (dup2(p[!parentFd], *fd) == -1) _exit(127);
                }
                execv(command, argv);
                _exit(127);
        }
-       if (child == -1)
-       {
+       if (child == -1) {
                if (parentFd != -1)
-               {
                        close(p[0]); close(p[1]);
-               }
                return -1;
        }
-       if (parentFd != -1)
-       {
+       if (parentFd != -1) {
                close(p[!parentFd]);
                *fd = p[parentFd];
        }
@@ -99,8 +89,8 @@ static int mywait(pid_t pid)
 
 
 /**
- * Read from a file descriptor until EOF and push contents to the top of
- * the Lua stack.  Closes the file descriptor afterward.
+ * Read from a file descriptor until EOF and push contents to the top of the
+ * Lua stack.  Closes the file descriptor afterward.
  */
 static void pushstream(lua_State* L, int fd)
 {
@@ -109,8 +99,7 @@ static void pushstream(lua_State* L, int fd)
 
        char buffer[BUFSIZ];
        ssize_t bytes;
-       while ((bytes = read(fd, buffer, sizeof(buffer))))
-       {
+       while ((bytes = read(fd, buffer, sizeof(buffer)))) {
                if (bytes == -1) break;
                luaL_addlstring(&B, buffer, bytes);
        }
@@ -125,8 +114,7 @@ static void pushstream(lua_State* L, int fd)
 static void writelstring(int fd, const char* str, size_t len)
 {
        ssize_t bytes;
-       while ((bytes = write(fd, str, len)))
-       {
+       while ((bytes = write(fd, str, len))) {
                if (bytes == -1) break;
                str += bytes;
                len -= bytes;
@@ -168,8 +156,7 @@ static void addstrings(const char* argv[], ...)
        int i; for (i = 0; argv[i]; ++i);
        va_start(ap, argv);
        const char* arg = va_arg(ap, const char*);
-       while (arg)
-       {
+       while (arg) {
                argv[i++] = arg;
                arg = va_arg(ap, const char*);
        }
@@ -197,8 +184,7 @@ static void addcommand(lua_State* L, const char* argv[])
        lua_getfield(L, -1, "command");
        lua_getfield(L, -2, "title");
        addstrings(argv, lua_tostring(L, -2), NULL);
-       if (lua_isstring(L, -1))
-       {
+       if (lua_isstring(L, -1)) {
                addstrings(argv, "--backtitle", lua_tostring(L, -1), NULL);
        }
        lua_pop(L, 3);
@@ -261,8 +247,7 @@ static int addextra(lua_State* L, const char* argv[], int n)
 {
        if (!lua_istable(L, n)) return 0;
        lua_pushnil(L);
-       while (lua_next(L, n))
-       {
+       while (lua_next(L, n)) {
                addstrings(argv, lua_tostring(L, -2), NULL);
                if (lua_isstring(L, -1)) addstrings(argv, lua_tostring(L, -1), NULL);
                lua_pop(L, 1);
@@ -296,29 +281,24 @@ static void addmenuitems(lua_State* L, const char* argv[])
        if (searchstrings(argv, "--item-help") != -1) fields = 3;
 
        if (!lua_istable(L, 3)) luaL_argerror(L, 3, "menu items");
-       int i; for (i = 1;; ++i)
-       {
+       int i; for (i = 1;; ++i) {
                lua_pushinteger(L, i);
                lua_gettable(L, 3);
-               if (lua_isnil(L, -1))
-               {
+               if (lua_isnil(L, -1)) {
                        lua_pop(L, 1);
                        break;
                }
-               else if (lua_istable(L, -1))
-               {
+               else if (lua_istable(L, -1)) {
                        int subtable = lua_gettop(L);
                        lua_pushnil(L);
-                       int j; for (j = 0; j < fields; ++j)
-                       {
+                       int j; for (j = 0; j < fields; ++j) {
                                if (!lua_next(L, subtable)) luaL_argerror(L, 3, "not enough fields");
                                addstrings(argv, lua_tostring(L, -1), NULL);
                                lua_pop(L, 1);
                        }
                        lua_pop(L, 1);
                }
-               else
-               {
+               else {
                        if (fields == 2) addstrings(argv, "", "", NULL);
                        else addstrings(argv, "", "", "", NULL);
                }
@@ -356,8 +336,7 @@ static void closegauge(lua_State* L)
 {
        lua_getfield(L, LUA_REGISTRYINDEX, "dialog_gauge_pid");
        lua_getfield(L, LUA_REGISTRYINDEX, "dialog_gauge_fd");
-       if (!lua_isnumber(L, -2) || !lua_isnumber(L, -1))
-       {
+       if (!lua_isnumber(L, -2) || !lua_isnumber(L, -1)) {
                lua_pop(L, 2);
                return;
        }
@@ -385,8 +364,7 @@ static void closegauge(lua_State* L)
  */
 static int updategauge(lua_State* L)
 {
-       if (!lua_isnumber(L, 1))
-       {
+       if (!lua_isnumber(L, 1)) {
                closegauge(L);
                return 0;
        }
@@ -399,15 +377,13 @@ static int updategauge(lua_State* L)
        if (0.0 <= percent && percent <= 1.0) percent *= 100.0;
        lua_pushinteger(L, (lua_Integer)percent);
        lua_replace(L, 1);
-       if (lua_isstring(L, 2))
-       {
+       if (lua_isstring(L, 2)) {
                writestring(fd, "XXX");
                tostream(L, 1, fd);
                tostream(L, 2, fd);
                writestring(fd, "XXX");
        }
-       else
-       {
+       else {
                tostream(L, 1, fd);
        }
        return 0;
@@ -530,32 +506,28 @@ static int dialog_yesno(lua_State* L)
 LUALIB_API int luaopen_dialog(lua_State* L)
 {
        const struct luaL_Reg dialog_funcs[] = {
-               {"gauge",               dialog_gauge},
+               {"gauge",       dialog_gauge},
                {"inputbox",    dialog_inputbox},
-               {"menu",                dialog_menu},
-               {"msgbox",              dialog_msgbox},
-               {"yesno",               dialog_yesno},
+               {"menu",        dialog_menu},
+               {"msgbox",      dialog_msgbox},
+               {"yesno",       dialog_yesno},
                {NULL, NULL}
        };
        luaL_register(L, LUA_DIALOG_NAME, dialog_funcs);
 
        const char* names[] = {getenv("DIALOG"), "dialog", "cdialog"};
-       int i; for (i = 0; i < 3; ++i)
-       {
-               if (names[i])
-               {
+       int i; for (i = 0; i < 3; ++i) {
+               if (names[i]) {
                        char* path = strdup(getenv("PATH"));
                        char* token; char** paths = &path;
-                       while ((token = strsep(paths, ":")))
-                       {
+                       while ((token = strsep(paths, ":"))) {
                                luaL_Buffer B;
                                luaL_buffinit(L, &B);
                                luaL_addstring(&B, token);
                                luaL_addstring(&B, "/");
                                luaL_addstring(&B, names[i]);
                                luaL_pushresult(&B);
-                               if (access(lua_tostring(L, -1), X_OK) == 0)
-                               {
+                               if (access(lua_tostring(L, -1), X_OK) == 0) {
                                        lua_setfield(L, -2, "command");
                                        goto break2;
                                }
@@ -564,7 +536,7 @@ LUALIB_API int luaopen_dialog(lua_State* L)
                        free(path);
                }
        }
-    luaL_error(L, "cannot find dialog executable in the path; set DIALOG");
+       luaL_error(L, "cannot find dialog executable in the path; set DIALOG");
 
 break2:
 
index 09df45fdf580bdfd3bfddbca3e903027fe9e7db3..27d212487401f0aeb374cb02400a3aed703da550 100755 (executable)
--- a/configure
+++ b/configure
@@ -11,7 +11,7 @@ die () {
 
 [ -f build/config.lua ] || die 1 <<"END"
 You must first `cd' to the project directory root where the Makefile is.
-There is no support for out-of-tree builds.
+There is no support for out-of-source-tree builds.
 END
 
 LUA=${LUA:-lua}
@@ -30,5 +30,3 @@ END
 export PATH="./build:$PATH"
 exec "$LUA" build/config.lua "$@" -L./build
 
-# vi:ts=4
-
index 1968532d47411594a74f912ef6e4a6d52a573cb1..64f76590d423f21b25c067daeb66177bf8153e2d 100644 (file)
@@ -4,10 +4,10 @@
 #
 
 pkgdatadir_$d := $(shell find $d -name "*.ac"  \
-                                 -o -name "*.lua" \
-                              -o -name "*.gz"  \
-                              -o -name "*.ogg" \
-                              -o -name "*.png") $d/yoinkrc
+                             -o -name "*.lua" \
+                             -o -name "*.gz"  \
+                             -o -name "*.ogg" \
+                             -o -name "*.png") $d/yoinkrc
 # Install resource files to pkgdatadir.
 
 desktop_$b := $b/yoink.desktop         # Install desktop entry file.
index b1364b02a64cadca5823868697c2dac5cc111605..c60f68b5987c1180e1c67ca5aad9c7eb8d893822 100644 (file)
@@ -68,12 +68,13 @@ Event = {}
 
 do
        local mysound = yoink.sound("Explosion")
-       --local mysound = yoink.sound()
-       --mysound:sample("Explosion")
+       mysound = yoink.sound()
+       mysound:sample("Pop")
        local count = 0
        function Event.Think()
                if count % 300 == 0 then
-                       --mysound:play()
+                       mysound:play()
+                       LogDebug("Hello world!")
                end
                count = count + 1
        end
index e61ddf6429e8f0ed8ea78627a042380e40ea5f07..c35ae2da6828ae02b4758f508092d128c221a975 100644 (file)
@@ -108,7 +108,7 @@ that, please observe the following:
 .It
 Stick to the coding style of the source code files you edit.  Follow the
 general style of method and variable naming, as well as white space
-formatting.  In particular, use literal tabs with an assumed tabstop of 4
+formatting.  In particular, use literal tabs with an assumed tabstop of 8
 characters.  Also, try to limit line lengths to 75 characters.
 .It
 For legal reasons, don't include other peoples' code with your patch.  You
index 30d1c756f73ddc67cc4770d548eeac4c4965e9d9..4839144d99f97a9ca19c30b40c6ecf39645a4bd5 100644 (file)
@@ -102,15 +102,15 @@ return string.format("%s %s", project, version),
                        check   = function(value)
                                if value == ""
                                then
-                                       CC              = "gcc"
-                                       CXX             = "g++"
-                                       AR              = "ar"
+                                       CC      = "gcc"
+                                       CXX     = "g++"
+                                       AR      = "ar"
                                        RANLIB  = "ranlib"
                                        WINDRES = "windres"
                                else
-                                       CC              = value .. "-gcc"
-                                       CXX             = value .. "-g++"
-                                       AR              = value .. "-ar"
+                                       CC      = value .. "-gcc"
+                                       CXX     = value .. "-g++"
+                                       AR      = value .. "-ar"
                                        RANLIB  = value .. "-ranlib"
                                        WINDRES = value .. "-windres"
                                end
@@ -314,11 +314,11 @@ If in doubt, say No.
                        check   = function(value)
                                if value
                                then
-                                       PKG_CFLAGS = PKG_CFLAGS:setFlag("-pg")
-                                       PKG_LDFLAGS = PKG_LDFLAGS:setFlag("-pg")
+                                       PKG_CFLAGS      = PKG_CFLAGS:setFlag("-pg")
+                                       PKG_LDFLAGS     = PKG_LDFLAGS:setFlag("-pg")
                                else
-                                       PKG_CFLAGS = PKG_CFLAGS:unsetFlag("-pg")
-                                       PKG_LDFLAGS = PKG_LDFLAGS:unsetFlag("-pg")
+                                       PKG_CFLAGS      = PKG_CFLAGS:unsetFlag("-pg")
+                                       PKG_LDFLAGS     = PKG_LDFLAGS:unsetFlag("-pg")
                                end
                                return value
                        end
@@ -351,10 +351,8 @@ without these extra codepaths.
 If in doubt, say No.
 ]],
                        check   = function(value)
-                               if value
-                               then
+                               if value then
                                        CFLAGS = CFLAGS:setFlag("-Wall", "-g")
-                                       CFLAGS = CFLAGS:replaceFlag("%-O%d?", "-O0")
                                end
                                return value
                        end
@@ -592,6 +590,3 @@ If in doubt, say None.
        }
 }
 
-
--- vi:ft=lua
-
index e33a12622d2a1663536012e195d19a6a43ee2c47..c7663c5f976d7fe25f07d3ad85c3447e0784b304 100755 (executable)
@@ -18,13 +18,13 @@ end
 -----
 
 function die(...) print("die:", ...); os.exit(1) end
-function isReadable(file) return os.execute("test -r "..file) == 0 end
+function readable(file) return os.execute("test -r "..file) == 0 end
 
 arg.hideEmail = false
 arg.output = "yoink.html"
 
 arg.input = "yoink.6"
-if not isReadable(arg.input) then arg.input = "build/doc/yoink.6" end
+if not readable(arg.input) then arg.input = "build/doc/yoink.6" end
 
 do
        local t = {
@@ -42,7 +42,11 @@ do
                                        showhelp(); os.exit(1)
                                end
                                skip = t[v](args, i)
-                               if tonumber(skip) then skip = skip + 1 else skip = 1 end
+                               if tonumber(skip) then
+                                       skip = skip + 1
+                               else
+                                       skip = 1
+                               end
                        end
                        skip = skip - 1
                end
@@ -51,10 +55,10 @@ end
 parseArgs(arg)
 
 filters = {
-       function(t)                                             -- 1. Edit page title
+       function(t)                     -- 1. Edit page title
                return t:gsub("(<title>).*(</title>)", "%1Yoink Manual%2")
        end,
-       function(t)                                             -- 2. Insert footer before </body>
+       function(t)                     -- 2. Insert footer before </body>
                return t:gsub("</body>", [[
 <p style="font-size: 9px; text-align: center;">
        This manual page was generated on ]]..os.date("%d %b %Y")..[[.
similarity index 74%
rename from build/arch/win32/unix2dos.sh
rename to scripts/unix2dos.sh
index c3ee7a8d336f5ef54c3a721c3fdb26198f8bf6a1..41e4085cdb70e67caab2e0334170890fe0463c68 100755 (executable)
@@ -5,11 +5,11 @@
 # An implementation of unix2dos using sed.
 #
 
-if [ -f "$1" ];
+if [ -f "$1" ]
 then
        TMPFILE="$1.$$"
        sed 's/\r*$/\r/' "$1" >$TMPFILE
-       if [ ! "$2" ];
+       if [ ! "$2" ]
        then
                mv -f "$TMPFILE" "$1"
        else
@@ -18,7 +18,7 @@ then
        rm -f "$TMPFILE"
 else
        echo "`basename $0` infile [outfile]"
-       echo "  convert a file from unix to dos file format"
+       echo "  convert a text file from unix to dos line-endings"
        exit 1
 fi 
 
index a9710ce66b525e0536789394ca014b5323a89b2f..5ab26d216704ec1ea5c15dcd84977e9a1286d4a9 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <map>
 #include <stdexcept>
 
 
 /**
- * The collection of nested animation classes.  The animation
- * implementation consists of an impl class which is allocated and
- * initialized with the interface object.  This class contains the specific
- * fields which are required to run a single instance of an animation.  The
- * sequence data is loaded in a different class which can be shared amongst
- * multiple animation implementation instances.
+ * The collection of nested animation classes.  The animation implementation
+ * consists of an impl class which is allocated and initialized with the
+ * interface object.  This class contains the specific fields which are
+ * required to run a single instance of an animation.  The sequence data is
+ * loaded in a different class which can be shared amongst multiple animation
+ * implementation instances.
  */
-
 class Animation::impl
 {
 public:
 
        /**
         * Contains "global" animation data for the various animations which
-        * get loaded.  This is a mippleton, so it will be shared amongst any
+        * get loaded.  This is a manager, so it will be shared amongst any
         * animation which wants to use these loaded sequences.
         */
-
        class Data : public moof::manager<Data>
        {
        public:
 
                /**
-                * A frame of an animation sequence.  A frame is merely an index
-                * which presumably represents a "slide" or tile which should be
-                * displayed, and the duration that is how long the slide will be
-                * shown.
+                * A frame of an animation sequence.  A frame is merely an
+                * index which presumably represents a "slide" or tile which
+                * should be displayed, and the duration that is how long the
+                * slide will be shown.
                 */
-
                class Frame
                {
                public:
 
-                       unsigned        mIndex;                                 ///< Frame index.
-                       moof::scalar    mDuration;                              ///< Frame duration.
+                       unsigned        mIndex;         ///< Frame index.
+                       moof::scalar    mDuration;      ///< Frame duration.
 
                        /**
-                        * Construction is initialization.  The frame data is loaded
-                        * from a frame map which is probably loaded within an
-                        * animation file.
+                        * Construction is initialization.  The frame data is
+                        * loaded from a frame map which is probably loaded
+                        * within an animation file.
                         */
-               
                        Frame(const moof::script::slot& table) :
                                mIndex(0),
                                mDuration(1.0)
@@ -73,28 +67,26 @@ public:
                        }
                };
 
-
                /**
-                * A sequence is just a few attributes and a list of frames in the
-                * order that they should be played.
+                * A sequence is just a few attributes and a list of frames in
+                * the order that they should be played.
                 */
-
                class Sequence
                {
                public:
 
                        std::vector<Frame>      mFrames;        ///< List of frames.
-                       moof::scalar                    mDelay;         ///< Scale frame durations.
-                       bool                            mLoop;          ///< Does the sequence repeat?
-                       std::string                     mNext;          ///< Next sequence name.
+                       moof::scalar            mDelay;         ///< Scale frame durations.
+                       bool                    mLoop;          ///< Does the sequence repeat?
+                       std::string             mNext;          ///< Next sequence name.
 
                        /**
-                        * Construction is initialization.  The constructor loads
-                        * sequence data from the sequence map, presumably loaded from
-                        * an animation file.  The rest of the loading takes place in
-                        * the frame's constructor which loads each individual frame.
+                        * Construction is initialization.  The constructor
+                        * loads sequence data from the sequence map,
+                        * presumably loaded from an animation file.  The rest
+                        * of the loading takes place in the frame's
+                        * constructor which loads each individual frame.
                         */
-
                        Sequence(const moof::script::slot& table) :
                                mDelay(0.0),
                                mLoop(true)
@@ -106,35 +98,27 @@ public:
                                // TODO - sequence class/type not yet implemented
 
                                moof::script::slot frameTable = table.push_field("frames");
-                               if (frameTable.is_table())
-                               {
+                               if (frameTable.is_table()) {
                                        int max = frameTable.length();
-                                       for (int index = 1; index <= max; ++index)
-                                       {
+                                       for (int index = 1; index <= max; ++index) {
                                                moof::script::slot top = frameTable.push_field(index);
 
                                                if (top.is_table())
-                                               {
                                                        mFrames.push_back(Frame(top));
-                                               }
                                                else
-                                               {
                                                        moof::log_warning << "invalid frame at index "
                                                                                   << index << std::endl;
-                                               }
                                        }
                                }
                                frameTable.remove();
                        }
                };
 
-
                /**
                 * Starts loading a file with animation data.  Such a file is
                 * formatted as a map of named sequences.   The sequence
                 * constructor loads each individual sequence.
                 */
-
                void init(const std::string& name)
                {
                        moof::script script;
@@ -144,8 +128,7 @@ public:
                        moof::log::import(script);
                        importAnimationBindings(script);
 
-                       if (script.do_file(path) != moof::script::success)
-                       {
+                       if (script.do_file(path) != moof::script::success) {
                                std::string str;
                                script[-1].get(str);
                                moof::log_warning(str);
@@ -165,12 +148,10 @@ public:
                        return 0;
                }
 
-
                void importAnimationBindings(moof::script& script)
                {
                        script.import_function("DefineSequence",
-                                                                 boost::bind(&Data::defineSequence,
-                                                                                         this, _1));
+                                       boost::bind(&Data::defineSequence, this, _1));
 
                        script.globals().set_field("ATTACK",    1);
                        script.globals().set_field("CHARGE",    2);
@@ -181,15 +162,12 @@ public:
                        script.globals().set_field("STAND",     7);
                }
 
-
                std::map<std::string,Sequence> mSequences;      ///< List of sequences.
        };
 
-
        /**
         * Construction is intialization.
         */
-
        impl(const std::string& name) :
                mData(Data::instance(name)),
                mCurrentSequence(0),
@@ -198,59 +176,50 @@ public:
                mTimeAccum(0),
                mFrameDuration(0) {}
 
-
        /**
         * Sets up the animation classes to "play" a named sequence.  If
         * another sequence was active, it will be replaced.  Future updates
         * will progress the new sequence.
         */
-
        void startSequence(const std::string& name)
        {
                std::map<std::string,Data::Sequence>::iterator it;
 
                it = mData->mSequences.find(name);
-               if (it != mData->mSequences.end())
-               {
+               if (it != mData->mSequences.end()) {
                        mCurrentSequence = &(*it).second;
                        mFrameCounter = 0;
                        mFrameIndex = mCurrentSequence->mFrames[0].mIndex;
                        mTimeAccum = 0.0;
                        mFrameDuration = mCurrentSequence->mDelay *
-                                                        mCurrentSequence->mFrames[0].mDuration;
+                               mCurrentSequence->mFrames[0].mDuration;
                }
        }
 
        /**
         * Updates or progresses the animation sequence.  If the time interval
-        * surpasses the duration of the current frame, a new frame becomes the
-        * current frame.  If the last frame of a sequence expires, the active
-        * sequence will switch automatically to the designated "next"
+        * surpasses the duration of the current frame, a new frame becomes
+        * the current frame.  If the last frame of a sequence expires, the
+        * active sequence will switch automatically to the designated "next"
         * sequence, or if none is specified but the sequence is set to loop,
         * the first frame of the sequence will become the current frame, and
         * the animation essentially starts over again.
         */
-
        void update(moof::scalar t, moof::scalar dt)
        {
                if (!mCurrentSequence) return;
 
                mTimeAccum += dt;
 
-               if (mTimeAccum >= mFrameDuration)
-               {
-                       if (++mFrameCounter >= mCurrentSequence->mFrames.size())
-                       {
-                               if (!mCurrentSequence->mNext.empty())
-                               {
+               if (mTimeAccum >= mFrameDuration) {
+                       if (++mFrameCounter >= mCurrentSequence->mFrames.size()) {
+                               if (!mCurrentSequence->mNext.empty()) {
                                        startSequence(mCurrentSequence->mNext);
                                }
-                               else if (mCurrentSequence->mLoop)
-                               {
+                               else if (mCurrentSequence->mLoop) {
                                        mFrameCounter = 0;
                                }
-                               else
-                               {
+                               else {
                                        mFrameCounter--;
                                        mCurrentSequence = 0;
                                }
@@ -263,21 +232,19 @@ public:
                }
        }
 
-       boost::shared_ptr<Data> mData;                          ///< Internal data.
+       boost::shared_ptr<Data> mData;                  ///< Internal data.
 
-       Data::Sequence*                 mCurrentSequence;       ///< Active sequence.
-       unsigned                                mFrameCounter;          ///< Current frame.
-       unsigned                                mFrameIndex;            ///< Index of current frame.
-       moof::scalar                            mTimeAccum;                     ///< Time accumulation.
-       moof::scalar                            mFrameDuration;         ///< Scaled frame duration.
+       Data::Sequence*         mCurrentSequence;       ///< Active sequence.
+       unsigned                mFrameCounter;          ///< Current frame.
+       unsigned                mFrameIndex;            ///< Index of current frame.
+       moof::scalar            mTimeAccum;             ///< Time accumulation.
+       moof::scalar            mFrameDuration;         ///< Scaled frame duration.
 };
 
-
 Animation::Animation(const std::string& name) :
        // pass through
        impl_(new Animation::impl(name)) {}
 
-
 void Animation::startSequence(const std::string& name)
 {
        // pass through
@@ -290,12 +257,10 @@ void Animation::update(moof::scalar t, moof::scalar dt)
        impl_->update(t, dt);
 }
 
-
 /**
  * Gets the index for the current frame.  This is presumably called by some
  * drawing code which will draw the correct current frame.
  */
-
 unsigned Animation::getFrame() const
 {
        return impl_->mFrameIndex;
index 97e916d8b5f3a77ae502cd50c878b79733020355..c8cdca8ed752c4b3addfdc4ee0ccd61906cabc19 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _ANIMATION_HH_
 #define _ANIMATION_HH_
@@ -34,7 +32,6 @@ typedef boost::shared_ptr<Animation> AnimationP;
  * is determined.  This class is generic enough that a frame can mean just
  * about anything to whatever drawing context is used to render the frame.
  */
-
 class Animation
 {
 public:
@@ -46,13 +43,11 @@ public:
                return AnimationP(new Animation(name));
        }
 
-
        void startSequence(const std::string& name);
 
        void update(moof::scalar t, moof::scalar dt);
        unsigned getFrame() const;
 
-
 private:
 
        class impl;
index 3cae68009e4b998bf8b4b823538204bf6c803a66..c6a47f9c9ed1f5e605e42b23d6d7fcbfc8702286 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <iostream>
 
@@ -42,6 +40,7 @@ private:
        moof::vector2 location;
 };
 
+
 class ResistanceForce
 {
 public:
@@ -85,7 +84,6 @@ Character::Character(const std::string& name) :
        prev_state_ = state_;
 }
 
-
 void Character::update(moof::scalar t, moof::scalar dt)
 {
        moof::rigid_body2::update(t, dt); // update physics
@@ -103,7 +101,6 @@ void Character::update(moof::scalar t, moof::scalar dt)
        tilemap.tile(frame);
 }
 
-
 void Character::draw(moof::scalar alpha) const
 {
        moof::state2 state = moof::rigid_body2::state(alpha);
@@ -121,7 +118,6 @@ void Character::draw(moof::scalar alpha) const
        tilemap.draw(coords);
 }
 
-
 /*int Character::getOctant(const moof::Aabb<3>& aabb) const
 {
        int octantNum = -1;
@@ -232,7 +228,6 @@ void Character::draw(moof::scalar alpha) const
 }
 */
 
-
 void Character::addImpulse(moof::vector2 impulse)
 {
        state_.momentum += impulse;
index bdbdb29414f0a6ce436e440691bab99ae53f203a..bb2d5e6dd69f9efeb920408401df4daa1ccab14a 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _CHARACTER_HH_
 #define _CHARACTER_HH_
 class Character;
 typedef boost::shared_ptr<Character> CharacterP;
 
-
 /**
  * Parent class of animate objects with "personalities."  This basically
  * includes the heroine herself and the bad guys.
  */
-
 class Character : public moof::rigid_body2
 {
 public:
@@ -52,7 +48,7 @@ public:
        //virtual int getOctant(const moof::Aabb<3>& aabb) const;
 
        moof::sprite    tilemap;
-       Animation               animation;
+       Animation       animation;
 };
 
 
index 66b7a7d938e1d9cbe5109a124404b4578b5e834d..ecf9e05e08b60af28a0dfc07847d52bb42756ad6 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _GAMESTATE_HH_
 #define _GAMESTATE_HH_
 
 struct GameState
 {
-       moof::script                            script;
+       moof::script                    script;
        std::vector<std::string>        sceneList;
 
-       HeroineP                                        heroine;
-       SceneP                                          scene;
+       HeroineP                        heroine;
+       SceneP                          scene;
 
-       moof::lerp_scalar                       interp;
+       moof::lerp_scalar               interp;
 
-       moof::camera                            camera;
+       moof::camera                    camera;
 };
 
 
index a20691855b7fb44a42fcc0eb9962780170fba576..4ca4ce8702006cd46bd55c79ec5465d71f947fda 100644 (file)
@@ -1,88 +1,87 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <moof/log.hh>
 #include <moof/sound.hh>
 
 #include "Heroine.hh"
        
+
 Heroine::Heroine() :
        Character("Heroine") {}
 
-
 void Heroine::update(moof::scalar t, moof::scalar dt)
 {
        Character::update(t, dt);
 
-       moof::vector3 at(0.0, 0.0, 0.0);
-       const moof::vector3 up(0.0, 1.0, 0.0);
+       moof::vector3           at(0.0, 0.0, 0.0);
+       const moof::vector3     up(0.0, 1.0, 0.0);
 
        if (state_.velocity[0] < 0.0) at[0] = -1.0;
-       else                          at[0] = 1.0;
+       else at[0] = 1.0;
 
        moof::sound::listener_position(moof::promote(state_.position));
        moof::sound::listener_velocity(moof::promote(state_.velocity));
        moof::sound::listener_orientation(at, up);
 }
 
-
 bool Heroine::handle_event(const moof::event& event)
 {
        moof::scalar force = 40.0;
        
        switch (event.type)
        {
-               case SDL_KEYDOWN:
-                       if (event.key.keysym.sym == SDLK_a)
-                       {
-                               state_.force += moof::vector2(-force, 0.0);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_d)
-                       {
-                               state_.force += moof::vector2(force, 0.0);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_s)
-                       {
-                               state_.force += moof::vector2(0.0, -force);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_w)
-                       {
-                               state_.force += moof::vector2(0.0, force);
-                               return true;
-                       }
+       case SDL_KEYDOWN:
+               if (event.key.keysym.sym == SDLK_a)
+               {
+                       state_.force += moof::vector2(-force, 0.0);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_d)
+               {
+                       state_.force += moof::vector2(force, 0.0);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_s)
+               {
+                       state_.force += moof::vector2(0.0, -force);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_w)
+               {
+                       state_.force += moof::vector2(0.0, force);
+                       return true;
+               }
+               break;
 
-               case SDL_KEYUP:
-                       if (event.key.keysym.sym == SDLK_a)
-                       {
-                               state_.force += moof::vector2(force, 0.0);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_d)
-                       {
-                               state_.force += moof::vector2(-force, 0.0);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_s)
-                       {
-                               state_.force += moof::vector2(0.0, force);
-                               return true;
-                       }
-                       else if (event.key.keysym.sym == SDLK_w)
-                       {
-                               state_.force += moof::vector2(0.0, -force);
-                               return true;
-                       }
+       case SDL_KEYUP:
+               if (event.key.keysym.sym == SDLK_a)
+               {
+                       state_.force += moof::vector2(force, 0.0);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_d)
+               {
+                       state_.force += moof::vector2(-force, 0.0);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_s)
+               {
+                       state_.force += moof::vector2(0.0, force);
+                       return true;
+               }
+               else if (event.key.keysym.sym == SDLK_w)
+               {
+                       state_.force += moof::vector2(0.0, -force);
+                       return true;
+               }
+               break;
        }
        return false;
 }
index 6eb5a547eca85d8a803961ed23d4954abe23aedc..4cbf8b1a4d9e1e449feedd541bf60dd52fe91e9c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _HEROINE_HH_
 #define _HEROINE_HH_
 class Heroine;
 typedef boost::shared_ptr<Heroine> HeroineP;
 
-
 /**
  * The protagonist.
  */
-
 class Heroine : public Character
 {
 public:
index cc25dd582171a80551192c1148f65bba4a378a12..dde53ee37b5f486c807dfda50680841387163c21 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <moof/aabb.hh>
 #include <moof/log.hh>
@@ -62,11 +60,8 @@ void ProgressBar::setProgress(moof::scalar progress)
 
 void ProgressBar::draw(moof::scalar alpha) const
 {
-       if (moof::is_equal(mProgress, 0.0))
-       {
-               // don't draw anything if the progress is 0%
-               return;
-       }
+       if (moof::is_equal(mProgress, 0.0)) return;
+       // don't draw anything if the progress is 0%
 
        glColor4f(1.0f, 1.0f, 1.0f, 0.85f);
        mTilemap.bind();
@@ -113,13 +108,12 @@ Hud::Hud(GameState& state) :
        resize(video->width(), video->height());
 }
 
-
 void Hud::resize(int width, int height)
 {
        moof::matrix_orthographic_RH(mProjection, SCALAR(0.0), 
-                                                                moof::scalar(width), SCALAR(0.0),
-                                                                moof::scalar(height),
-                                                                SCALAR(1.0), SCALAR(-1.0), moof::z_clip_neg_one);
+                       moof::scalar(width), SCALAR(0.0),
+                       moof::scalar(height), SCALAR(1.0),
+                       SCALAR(-1.0), moof::z_clip_neg_one);
 
        // position the two progress bars at the top-left of the screen
        mBar1.resize(moof::rectangle(20, height - 51, 0.7 * width, height - 3));
@@ -129,7 +123,6 @@ void Hud::resize(int width, int height)
        setBar2Progress(0.0);
 }
 
-
 void Hud::update(moof::scalar t, moof::scalar dt)
 {
        state_.interp.update(t, dt);
@@ -167,20 +160,20 @@ bool Hud::handle_event(const moof::event& event)
 {
        switch (event.type)
        {
-               case SDL_KEYUP:
-                       if (event.key.keysym.sym == SDLK_h)
-                       {
-                               // don't want the hud anymore
-                               //parent().remove_child(this);
-
-                               moof::log_warning("okay bye bye hud");
-                               return true;
-                       }
-                       break;
-
-               case SDL_VIDEORESIZE:
-                       resize(event.resize.w, event.resize.h);
-                       break;
+       case SDL_KEYUP:
+               if (event.key.keysym.sym == SDLK_h)
+               {
+                       // don't want the hud anymore
+                       //parent().remove_child(this);
+
+                       moof::log_warning("okay bye bye hud");
+                       return true;
+               }
+               break;
+
+       case SDL_VIDEORESIZE:
+               resize(event.resize.w, event.resize.h);
+               break;
        }
 
        return false;
index 30c01363435a73becfe351528b1d07f0514fa0bb..05882ed0121f439250925846594991335bb13cad 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _HUD_HH_
 #define _HUD_HH_
@@ -25,6 +23,7 @@
 #include "GameState.hh"
 
 
+// forward declarations
 class rectangle;
 
 // TODO this stuff is still just hacked up
index a674bbcb0dd9675a560cd2e6564f8c17da1aa7b4..8b011638735b48061d32fdafcdbf8096095bbfaa 100644 (file)
@@ -1,26 +1,26 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
-#include <cstdlib>             // atexit
+#include <cstdlib>     // atexit
 #include <exception>
 #include <functional>
 #include <iostream>
 #include <string>
 
-#if PLATFORM_WIN32
-inline int isatty(int dummy) { return 0; }
-#else
+#if PLATFORM_POSIX
 #include <termios.h>
+#else
+inline int isatty(int dummy) { return 0; }
 #endif
 
 #include <stlplus/portability/file_system.hpp>
@@ -53,7 +53,6 @@ Main::Main(moof::settings& settings) :
 #endif
 }
 
-
 void Main::update(moof::scalar t, moof::scalar dt)
 {
        yoink.update(t, dt);
@@ -78,35 +77,31 @@ void Main::handle_event(const moof::event& event)
 
        switch (event.type)
        {
-               case SDL_KEYUP:
-
-                       if (event.key.keysym.sym == SDLK_f)
-                       {
-                               moof::video::current()->toggle_fullscreen();
-                       }
-                       else if (event.key.keysym.sym == SDLK_l)
-                       {
-                               moof::video::current()->toggle_cursor_captured();
-                               moof::video::current()->toggle_cursor_visible();
-                       }
-                       else if (event.key.keysym.sym == SDLK_ESCAPE)
-                       {
-                               stop();
-                       }
-                       break;
-
-               case SDL_VIDEORESIZE:
-
-                       glViewport(0, 0, event.resize.w, event.resize.h);
-                       break;
-
-               case SDL_QUIT:
-
+       case SDL_KEYUP:
+               if (event.key.keysym.sym == SDLK_f)
+               {
+                       moof::video::current()->toggle_fullscreen();
+               }
+               else if (event.key.keysym.sym == SDLK_l)
+               {
+                       moof::video::current()->toggle_cursor_captured();
+                       moof::video::current()->toggle_cursor_visible();
+               }
+               else if (event.key.keysym.sym == SDLK_ESCAPE)
+               {
                        stop();
+               }
+               break;
+
+       case SDL_VIDEORESIZE:
+               glViewport(0, 0, event.resize.w, event.resize.h);
+               break;
+
+       case SDL_QUIT:
+               stop();
        }
 }
 
-
 std::string Main::search_paths()
 {
        // Add search paths; they should be searched in this order:
@@ -152,7 +147,6 @@ std::string Main::config_paths()
        return path;
 }
 
-
 void Main::setup_opengl()
 {
        glEnable(GL_TEXTURE_2D);
@@ -187,27 +181,26 @@ void Main::setup_opengl()
        glLightfv(GL_LIGHT0, GL_SPECULAR, spec);
 }
 
-
 void Main::print_usage()
 {
        std::cout << "Usage: "
-                         << PACKAGE" [-h|--help] [-i|--info] [OPTION=VALUE]..."
-                         << std::endl
-                         << "The alien-smashing action game." << std::endl
-                         << std::endl
-                         << "Options:" << std::endl
-                         << "  -h, --help" << std::endl
-                         << "      show this help and exit" << std::endl
-                         << "  -i, --info" << std::endl
-                         << "      show version and build information" << std::endl
-                         << "  detail=1|2|3" << std::endl
-                         << "      the level of detail of game scenes" << std::endl
-                         << "  fullscreen=true|false" << std::endl
-                         << "      if true, uses the entire display" << std::endl
-                         << "  framerate=num" << std::endl
-                         << "      number of frames to draw per second" << std::endl
-                         << std::endl
-                         << "See documentation for more options." << std::endl;
+                 << PACKAGE" [-h|--help] [-i|--info] [OPTION=VALUE]..."
+                 << std::endl
+                 << "The alien-smashing action game." << std::endl
+                 << std::endl
+                 << "Options:" << std::endl
+                 << "  -h, --help" << std::endl
+                 << "      show this help and exit" << std::endl
+                 << "  -i, --info" << std::endl
+                 << "      show version and build information" << std::endl
+                 << "  detail=1|2|3" << std::endl
+                 << "      the level of detail of game scenes" << std::endl
+                 << "  fullscreen=true|false" << std::endl
+                 << "      if true, uses the entire display" << std::endl
+                 << "  framerate=num" << std::endl
+                 << "      number of frames to draw per second" << std::endl
+                 << std::endl
+                 << "See documentation for more options." << std::endl;
 }
 
 void Main::print_info(int argc, char* argv[])
@@ -220,27 +213,14 @@ void Main::print_info(int argc, char* argv[])
 #endif
 }
 
-void Main::print_option(const std::string& option, bool enabled)
-{
-       if (isatty(1) == 1)
-       {
-               if (enabled) std::cout << "\033[1;94m";
-               else std::cout << "\033[1m";
-       }
-       if (!enabled) std::cout << "-";
-       std::cout << option;
-       if (isatty(1) == 1) std::cout << "\033[0m";
-       std::cout << " ";
-}
-
 
 void hello()
 {
        if (isatty(1) == 1) std::cout << "\033[94m";
        std::cout << std::endl << PACKAGE_STRING << std::endl
-                         << "Compiled " << __TIME__ " " __DATE__ << std::endl
-                         << "Send patches and bug reports to <"
-                         PACKAGE_BUGREPORT << ">." << std::endl << moof::log::endl;
+                 << "Compiled " << __TIME__" "__DATE__ << std::endl
+                 << "Send patches and bug reports to <"PACKAGE_BUGREPORT">."
+                 << std::endl << moof::log::endl;
 }
 
 void goodbye()
@@ -297,18 +277,16 @@ int main(int argc, char* argv[])
        catch (const std::exception& e)
        {
                moof::modal_dialog dialog(moof::modal_dialog::error,
-                                                                 PACKAGE_STRING, "unhandled exception",
-                                                                 e.what());
+                               PACKAGE_STRING, "unhandled exception",
+                               e.what());
                dialog.run();
        }
        catch (const char* e)
        {
                moof::modal_dialog dialog(moof::modal_dialog::error,
-                                                                 PACKAGE_STRING, "unhandled exception",
-                                                                 e);
+                               PACKAGE_STRING, "unhandled exception", e);
                dialog.run();
        }
-
        return 1;
 }
 
index 088bd3c1b67e393303165f1a774e6370e84d57be..65ad901ccf700a8bb1d1a59cfae0609e27e50f71 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MAIN_HH_
 #define _MAIN_HH_
@@ -34,7 +32,7 @@ class Main : public moof::application
 {
 public:
 
-       Main(moof::settings& settings);
+       explicit Main(moof::settings& settings);
 
        void update(moof::scalar t, moof::scalar dt);
        void draw(moof::scalar alpha) const;
@@ -53,8 +51,6 @@ private:
         */
        static void setup_opengl();
 
-       static void print_option(const std::string& option, bool enabled);
-
        moof::dispatcher::handle        video_reloaded_;
        moof::timer                                     hotload_timer_;
 
index af54c28768cfa92af735ccb9858d211f0a0789b2..dc6ab75cac02f218bebd54d1b173382c64086389 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <map>
 
@@ -36,12 +34,12 @@ struct Scene::impl : public moof::manager<impl>
                        NONE    = 0,
                        LEFT    = 1,
                        RIGHT   = 2,
-                       TOP             = 3
+                       TOP     = 3
                };
 
                Quad(const moof::vector3* vertices[4],
-                        const moof::image_handle& texture,
-                        int tileIndex) :
+                               const moof::image_handle& texture,
+                               int tileIndex) :
                        mTilemap(texture, tileIndex),
                        mBlending(false),
                        mFog(false),
@@ -112,9 +110,9 @@ struct Scene::impl : public moof::manager<impl>
                
                moof::sprite    mTilemap;
 
-               bool                    mBlending;
-               bool                    mFog;
-               Surface                 mSurface;
+               bool            mBlending;
+               bool            mFog;
+               Surface         mSurface;
        };
 
 
@@ -123,9 +121,9 @@ struct Scene::impl : public moof::manager<impl>
        moof::image_handle      mTexture;
 
        std::list< boost::shared_ptr<impl::Quad> >      mObjects;
-       std::list<moof::line2>                                          mLines;
+       std::list<moof::line2>                          mLines;
 
-       moof::aabb<3>                           mBounds;
+       moof::aabb<3>                                   mBounds;
 
 
        enum AXIS
@@ -264,14 +262,13 @@ struct Scene::impl : public moof::manager<impl>
 
        int rotate(moof::script& script)
        {
-               size_t                  index = 0;
+               size_t          index = 0;
                moof::scalar    value;
 
                script[1].require_number().get(index);
                script[2].require_number().get(value);
 
-               moof::matrix_rotate_about_world_axis(mTransform, index,
-                                                                                        moof::rad(value));
+               moof::matrix_rotate_about_world_axis(mTransform, index, moof::rad(value));
 
                return 0;
        }
@@ -350,7 +347,7 @@ struct Scene::impl : public moof::manager<impl>
                        }
                }
 
-               Quad::Surface   surface = Quad::NONE;
+               Quad::Surface surface = Quad::NONE;
                table.get(surface, "surface");
 
                if (surface != Quad::NONE)
@@ -365,7 +362,6 @@ struct Scene::impl : public moof::manager<impl>
 
                        mLines.push_back(moof::line<2>(bl, tr));
                }
-
                return 0;
        }
 
@@ -374,8 +370,8 @@ struct Scene::impl : public moof::manager<impl>
                moof::script::slot param = script[1];
                moof::script::slot top = script[-1];
 
-               int             index = 0;
-               int             width = 1;
+               int     index = 0;
+               int     width = 1;
                bool    blending = false;
                bool    fog = false;
 
@@ -479,7 +475,7 @@ void Scene::draw_if_visible(moof::scalar alpha,
 
 
 bool Scene::castRay(const moof::ray<2>& ray,
-                                       std::list<moof::ray<2>::contact>& hits) const
+               std::list<moof::ray<2>::contact>& hits) const
 {
        std::list< moof::line<2> >& lines = impl_->mLines;
        std::list< moof::line<2> >::const_iterator it;
@@ -558,4 +554,3 @@ bool Scene::checkForCollision(Character& character)
        return false;
 }
 
-
index 8c60cc50bb0f533b9e3fa1c83b24b0fbc153b30b..7f36f9b897f7536446a04d522e31751582c708ad 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _SCENE_HH_
 #define _SCENE_HH_
 #include <moof/script.hh>
 
 
-class Character;
-
-
+// forward declarations
 namespace moof {
 class settings;
 }
+class Character;
 
 class Scene;
 typedef boost::shared_ptr<Scene> SceneP;
index b060ccf26e038c2c5c7c28834c0fde3f2c64644e..f0facbb81b25edc5bbed4d0ab1e87e6a62614dba 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <iostream>
 
index 3a7d378bccedde576340338fcbebcbca271054d5..b3759a93aee111e12e5d45215daf3d684a2bbe7c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _TILEMAPFONT_HH_
 #define _TILEMAPFONT_HH_
index 1b21f76ea404ff99091b1a790e36502f5251161e..e6689e52d9817ba5c0534a008a475fea812c90c0 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <algorithm>
 #include <cstdarg>
index 19e6dbfa7aedec91962eb9808b5346a6611148cf..ac2e3f1198028dc743cf5e4b8ac66cb316c37873 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _TYPESETTER_HH_
 #define _TYPESETTER_HH_
index cbad71bf624704d345c84127a87e1cc062558273..f403f7aa28f34c88629405eb9b077e6817945376 100644 (file)
@@ -1,21 +1,17 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "aabb.hh"
 #include "script.hh"
 
-
 namespace moof {
 
-
 void import_aabb_class(script& script)
 {
 }
index b2fc4b0d23835ce44d1d7a6bb48afbe06bc6f3db..3228b5a225a412927a0601b68c5a77bc608a5383 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_AABB_HH_
 #define _MOOF_AABB_HH_
@@ -31,9 +29,9 @@
 namespace moof {
 
 
+// forward declarations
 class script;
 
-
 template <int D = 3>
 struct aabb : public cullable, public drawable, public shape<D>
 {
@@ -42,7 +40,6 @@ struct aabb : public cullable, public drawable, public shape<D>
        vector min;
        vector max;
 
-
        aabb() {}
 
        aabb(const vector& a, const vector& b)
@@ -66,7 +63,6 @@ struct aabb : public cullable, public drawable, public shape<D>
                init(a, b);
        }
 
-
        void init(const vector2& a, const vector2& b)
        {
                if (a[0] < b[0])
@@ -125,13 +121,11 @@ struct aabb : public cullable, public drawable, public shape<D>
                }
        }
 
-
        vector center() const
        {
                return (min + max) / 2.0;
        }
 
-
        plane xy_plane() const
        {
                plane plane;
@@ -156,7 +150,6 @@ struct aabb : public cullable, public drawable, public shape<D>
                return plane;
        }
 
-
        void get_corners(vector2 corners[4]) const
        {
                corners[0][0] = min[0]; corners[0][1] = min[1];
@@ -193,12 +186,10 @@ struct aabb : public cullable, public drawable, public shape<D>
                corners[7][2] = min[2];
        }
 
-
        void enclose_vertices(const vector vertices[], unsigned count)
        {
                min.zero();
                max.zero();
-
                for (unsigned i = 1; i < count; ++i)
                {
                        min.minimize(vertices[i]);
@@ -206,7 +197,6 @@ struct aabb : public cullable, public drawable, public shape<D>
                }
        }
 
-
        void draw(scalar alpha = 0.0) const
        {
                glRect(min[0], min[1], max[0], max[1]);
@@ -224,21 +214,25 @@ void import_aabb_class(script& script);
 template <>
 inline void aabb<3>::draw(scalar alpha) const
 {
-       scalar vertices[] = {min[0], min[1], min[2],
-                                                min[0], max[1], min[2],
-                                                max[0], max[1], min[2],
-                                                max[0], min[1], min[2],
-                                                min[0], max[1], max[2],
-                                                min[0], min[1], max[2],
-                                                max[0], min[1], max[2],
-                                                max[0], max[1], max[2]};
-
-       GLubyte indices[] = {0, 1, 2, 3,
-                                                1, 2, 7, 4,
-                                                3, 0, 5, 6,
-                                                2, 3, 6, 7,
-                                                5, 0, 1, 4,
-                                                4, 5, 6, 7};
+       scalar vertices[] = {
+               min[0], min[1], min[2],
+               min[0], max[1], min[2],
+               max[0], max[1], min[2],
+               max[0], min[1], min[2],
+               min[0], max[1], max[2],
+               min[0], min[1], max[2],
+               max[0], min[1], max[2],
+               max[0], max[1], max[2]
+       };
+
+       GLubyte indices[] = {
+               0, 1, 2, 3,
+               1, 2, 7, 4,
+               3, 0, 5, 6,
+               2, 3, 6, 7,
+               5, 0, 1, 4,
+               4, 5, 6, 7
+       };
 
        glEnableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -247,8 +241,7 @@ inline void aabb<3>::draw(scalar alpha) const
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        image::reset_binding();
 
-       glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE,
-                                  indices);
+       glDrawElements(GL_QUADS, sizeof(indices), GL_UNSIGNED_BYTE, indices);
 
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
        //glDisableClientState(GL_VERTEX_ARRAY);
@@ -262,7 +255,6 @@ inline bool aabb<3>::is_visible(const frustum& frustum) const
        return frustum.contains(*this);
 }
 
-
 typedef aabb<2>                aabb2;
 typedef aabb2          rectangle;
 typedef aabb<3>                aabb3;
index 0da5bae4b449a989b878c427a541bd065d0ee00f..e0b73b78d9ac053e7a5f8805a2431acc4c730235 100644 (file)
@@ -1,15 +1,13 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
-#include <cstdlib>                                     // exit, srand
+#include <cstdlib>                     // exit, srand
 #include <boost/noncopyable.hpp>
 
 #include <SDL/SDL.h>
@@ -42,20 +40,19 @@ application::application(settings& settings) :
        settings.get("framerate", framerate);
        framerate = SCALAR(1.0) / framerate;
 
-       //timer::default_source().scale(SCALAR(0.76));
-
        //update_timer_.init(boost::bind(&application::dispatch_update,
-                                                                  //this, _1, _2),
-                                          //timestep_, timer::repeat);
+               //this, _1, _2), timestep_, timer::repeat);
        //add_timer(update_timer_);
        
        game_time_.reset(timestep_);
+       //game_time_.scale(SCALAR(0.5));
 
        draw_timer_.init(boost::bind(&application::dispatch_draw,
-                                                                this, _1, _2), framerate, timer::repeat);
+                               this, _1, _2), framerate, timer::repeat);
        add_timer(draw_timer_);
-}
 
+       //timer::default_source().scale(SCALAR(0.2));
+}
 
 void application::dispatch_update(timer& timer, scalar t)
 {
@@ -65,27 +62,23 @@ void application::dispatch_update(timer& timer, scalar t)
        {
                switch (event.type)
                {
-                       case SDL_KEYDOWN:
-
-                               if (event.key.keysym.sym == SDLK_ESCAPE &&
-                                               (SDL_GetModState() & KMOD_CTRL) )
-                               {
-                                       // emergency escape
-                                       log_warning("escape forced");
-                                       exit(1);
-                               }
-                               break;
-
-                       case SDL_VIDEORESIZE:
-
-                               video::current()->resize(event.resize.w, event.resize.h);
-                               break;
+               case SDL_KEYDOWN:
+                       if (event.key.keysym.sym == SDLK_ESCAPE &&
+                                       (SDL_GetModState() & KMOD_CTRL))
+                       {
+                               log_warning("escape forced");
+                               exit(1);
+                       }
+                       break;
+
+               case SDL_VIDEORESIZE:
+                       video::current()->resize(event.resize.w,
+                                       event.resize.h);
+                       break;
                }
-
                handle_event(event);
        }
 
-
        const int MAX_CONSECUTIVE_UPDATES = 15;
 
        log_debug("updating", timer.expiration(), "/", t);
@@ -96,9 +89,8 @@ void application::dispatch_update(timer& timer, scalar t)
        int i = 0;
        while (timestep_ <= accum_ && i < MAX_CONSECUTIVE_UPDATES)
        {
-               log_debug("UPDATING");
-               update(game_time_.ticks(), timestep_);
-               game_time_.step();
+               scalar dt = game_time_.step();
+               update(game_time_.ticks(), dt);
                accum_ -= timestep_;
        }
 
@@ -116,7 +108,7 @@ void application::dispatch_draw(timer& timer, scalar t)
 
        scalar alpha = accum_ * inverse_timestep_;
        
-       alpha = cml::clamp(alpha, SCALAR(-1.0), SCALAR(2.0));
+       //alpha = cml::clamp(alpha, SCALAR(-1.0), SCALAR(2.0));
        if (alpha < SCALAR(0.0)) log_warning("alpha:", alpha);
        else if (alpha > SCALAR(1.0)) log_warning("alpha:", alpha);
        else log_debug("alpha:", alpha);
@@ -125,9 +117,11 @@ void application::dispatch_draw(timer& timer, scalar t)
 
        scalar begin = timer::ticks();
        video::current()->swap(t);
-
        scalar duration = timer::ticks() - begin;
-       log_debug("flip duration:", duration);
+       log_debug("flip duration:", duration, begin, timer::ticks());
+
+       log_info("draw difference:", t - last_draw_);
+       last_draw_ = t;
 }
 
 
index 84490580704b27d393f6fa6117a2c6fe90f12ae3..5c808670bde984ce524873d45b8e6d7fe0ddeece 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_APPLICATION_HH_
 #define _MOOF_APPLICATION_HH_
 namespace moof {
 
 
+// forward declarations
 class settings;
 
 class application : public runloop
 {
 public:
 
-       application(settings& settings);
+       explicit application(settings& settings);
        virtual ~application() {}
 
        virtual void update(scalar t, scalar dt) = 0;
        virtual void draw(scalar alpha) const = 0;
        virtual void handle_event(const event& event) = 0;
 
-
 private:
 
        void dispatch_update(timer& timer, scalar t);
        void dispatch_draw(timer& timer, scalar t);
 
-       scalar  last_update_;
-       scalar  accum_;
+       scalar          last_update_;
+       scalar          last_draw_;
+       scalar          accum_;
        game_time       game_time_;
 
-       timer   update_timer_;
-       timer   draw_timer_;
+       timer           update_timer_;
+       timer           draw_timer_;
 
-       scalar  timestep_;
-       scalar  inverse_timestep_;
+       scalar          timestep_;
+       scalar          inverse_timestep_;
 };
 
 
index 2dd199d216c846d11b0517f87c4e9a9fcc762d46..fa3ad3102ab546a9cc630f49ff3d4a8a2fcb046b 100644 (file)
@@ -1,13 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <stdexcept>
 
 namespace moof {
 
 
-struct impl
-{
-       static bool             is_initialized;
-       static int              retain_count;
-};
-
-bool   impl::is_initialized = false;
-int            impl::retain_count = 0;
-
+static int retain_count = 0;
 
 backend::backend()
 {
-       if (impl::retain_count++ == 0)
+       if (retain_count++ == 0)
        {
-#if defined(_WIN32)
+#if PLATFORM_WIN32
                if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0)
 #else
                if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0)
@@ -47,45 +41,40 @@ backend::backend()
                {
                        char name[128];
                        SDL_VideoDriverName(name, sizeof(name));
-                       log_info << "initialized SDL; using video driver `"
-                                        << name << "'" << std::endl;
+                       log_info << "initialized SDL; using video driver `" <<
+                               name << "'" << std::endl;
                }
-
                if (FE_Init() != 0)
                {
                        throw std::runtime_error(FE_GetError());
                }
        }
-
-       impl::is_initialized = true;
 }
 
 backend::backend(const backend& backend)
 {
-       ++impl::retain_count;
+       ++retain_count;
 }
 
-backend& backend::operator=(const backend& backend)
+backend& backend::operator = (const backend& backend)
 {
-       ++impl::retain_count;
+       ++retain_count;
        return *this;
 }
 
 backend::~backend()
 {
-       if (--impl::retain_count == 0)
+       if (--retain_count == 0)
        {
                log_info("shutting down SDL...");
                FE_Quit();
                SDL_Quit();
-
-               impl::is_initialized = false;
        }
 }
 
 bool backend::is_initialized()
 {
-       return impl::is_initialized;
+       return 0 < retain_count;
 }
 
 
index b40a72a67a4d2f7ca0a1ed61817a6638ecccb106..b25e53ae7fbf14c382a93c3b1c6646724a7b26f8 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_BACKEND_HH_
 #define _MOOF_BACKEND_HH_
@@ -23,18 +21,17 @@ namespace moof {
 
 /**
  * Some classes and subsystems require certain backend libraries to be
- * initialized.  This is the mechanism to accomplish that.  Classes which
- * rely on any backend libraries just need to instantiate this class as a
- * member.  Backend cleanup will occur automagically when there are no more
- * instances.
+ * initialized.  This is the mechanism to accomplish that.  Classes which rely
+ * on any backend libraries just need to instantiate this class as a member.
+ * Backend cleanup will occur automagically when there are no more instances.
  */
 class backend
 {
 public:
 
        /**
-        * Construct a backend reference, initializing the backend if it hasn't
-        * already been initialized.
+        * Construct a backend reference, initializing the backend if it
+        * hasn't already been initialized.
         */
        backend();
 
@@ -44,11 +41,10 @@ public:
         */
        static bool is_initialized();
 
-
-       // The rest of this stuff is to implement the reference counting.
+       /* The rest of this stuff is to implement the reference counting. */
 
        backend(const backend& backend);
-       backend& operator=(const backend& backend);
+       backend& operator = (const backend& backend);
        ~backend();
 };
 
index 093b7d197d93658834b2c954aed5b38ec3f8b00b..95488dbc69bbab43afa1dcfeab0dc5a170f47e06 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "camera.hh"
 #include "opengl.hh"
@@ -30,23 +28,21 @@ void camera::look_at(const vector3& point)
 {
        // FIXME: this doesn't work as expected
        quaternion_rotation_aim_at(state_.orientation, state_.position, point,
-                                                          vector3(0.0, 1.0, 0.0));
+                       vector3(0.0, 1.0, 0.0));
 }
 
-
 void camera::projection(const matrix4& projection)
 {
        projection_ = projection;
 }
 
-void camera::projection(scalar fovy, scalar aspect, scalar abutting,
-                                                  scalar distant)
+void camera::projection(scalar fovy,
+               scalar aspect, scalar abutting, scalar distant)
 {
        matrix_perspective_yfov_RH(projection_, fovy, aspect, abutting,
-                                                                       distant, z_clip_neg_one);
+                       distant, z_clip_neg_one);
 }
 
-
 void camera::upload_to_gl(scalar alpha) const
 {
        calculate(alpha);
@@ -72,7 +68,6 @@ void camera::calculate(scalar alpha) const
        frustum_.init(modelview_, projection_);
 }
 
-
 void camera::update(scalar t, scalar dt)
 {
        rigid_body3::update(t, dt);
@@ -83,66 +78,58 @@ void camera::draw(scalar alpha) const
        sphere_.draw(alpha);
 }
 
-
 void camera::handle_event(const event& event)
 {
        const scalar ds = 50.0;
 
        switch (event.type)
        {
-               case SDL_KEYDOWN:
-                       if (event.key.keysym.sym == SDLK_RIGHT)
-                       {
-                               state_.position[0] -= ds;
-                       }
-                       else if (event.key.keysym.sym == SDLK_LEFT)
-                       {
-                               state_.position[0] += ds;
-                       }
-                       else if (event.key.keysym.sym == SDLK_UP)
-                       {
-                               state_.position[1] -= ds;
-                       }
-                       else if (event.key.keysym.sym == SDLK_DOWN)
-                       {
-                               state_.position[1] += ds;
-                       }
-                       else if (event.key.keysym.sym == SDLK_PAGEUP)
-                       {
-                               state_.position[2] += ds;
-                       }
-                       else if (event.key.keysym.sym == SDLK_PAGEDOWN)
-                       {
-                               state_.position[2] -= ds;
-                       }
+       case SDL_KEYDOWN:
+               switch (event.key.keysym.sym)
+               {
+               case SDLK_RIGHT:
+                       state_.position[0] -= ds; break;
+               case SDLK_LEFT:
+                       state_.position[0] += ds; break;
+               case SDLK_UP:
+                       state_.position[1] -= ds; break;
+               case SDLK_DOWN:
+                       state_.position[1] += ds; break;
+               case SDLK_PAGEUP:
+                       state_.position[2] += ds; break;
+               case SDLK_PAGEDOWN:
+                       state_.position[2] -= ds; break;
+               default:
                        break;
+               }
+               break;
 
-               case SDL_MOUSEMOTION:
-                       {
-                               scalar xrel = rad(scalar(event.motion.xrel) / 6.0);
-                               scalar yrel = rad(scalar(event.motion.yrel) / 6.0);
+       case SDL_MOUSEMOTION:
+       {
+               scalar xrel = rad(scalar(event.motion.xrel) / 6.0);
+               scalar yrel = rad(scalar(event.motion.yrel) / 6.0);
 
-                               quaternion rotation = state_.orientation;
+               quaternion rotation = state_.orientation;
 
-                               quaternion_rotate_about_world_x(rotation, yrel);
-                               //mRotation.normalize();
-                               quaternion_rotate_about_world_y(rotation, xrel);
+               quaternion_rotate_about_world_x(rotation, yrel);
+               //mRotation.normalize();
+               quaternion_rotate_about_world_y(rotation, xrel);
 
-                               rotation.normalize();
-                               state_.orientation = rotation;
-                       }
-                       break;
+               rotation.normalize();
+               state_.orientation = rotation;
+               break;
+       }
 
-               case SDL_MOUSEBUTTONDOWN:
-                       if (event.button.button == SDL_BUTTON_WHEELUP)
-                       {
-                               state_.position[2] -= ds;
-                       }
-                       else if (event.button.button == SDL_BUTTON_WHEELDOWN)
-                       {
-                               state_.position[2] -= ds;
-                       }
+       case SDL_MOUSEBUTTONDOWN:
+               switch (event.button.button)
+               {
+               case SDL_BUTTON_WHEELUP:
+                       state_.position[2] -= ds;
+                       break;
+               case SDL_BUTTON_WHEELDOWN:
+                       state_.position[2] += ds;
                        break;
+               }
        }
 }
 
index b3aac0e080cd06a00e1c8a9b87d10f8c71b9e667..43e547163d9a0ff8206a3a91475b75d85050e0a4 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_CAMERA_HH_
 #define _MOOF_CAMERA_HH_
@@ -61,21 +59,18 @@ public:
                return frustum_;
        }
 
-
        void upload_to_gl(scalar alpha = 0) const;
 
        void update(scalar t, scalar dt);
        void draw(scalar alpha = 0) const;
        void handle_event(const event& event);
 
-
 private:
 
        void calculate(scalar alpha) const;
 
-       mutable matrix4                 modelview_;
-       matrix4                                 projection_;
-
+       mutable matrix4         modelview_;
+       matrix4                 projection_;
        mutable class frustum   frustum_;
 };
 
index a14718a64117b5bfcf264dc96de92122993c6ef3..1d1998e19e69b273ad88acaaed6ce649089e06c1 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_CONTACT_HH_
 #define _MOOF_CONTACT_HH_
@@ -28,9 +26,9 @@ struct contact
 {
        typedef moof::vector< scalar, fixed<D> > vector;
 
-       vector  point;                  // point of contact
-       scalar  distance;               // distance of penetration
-       vector  normal;                 // normal of surface at point of contact
+       vector  point;          // point of contact
+       scalar  distance;       // distance of penetration
+       vector  normal;         // normal of surface at point of contact
 
        bool operator < (const contact& rhs)
        {
index 4e4391e3187d64c05017e1bf1a3868add0276d41..3f0169a391670dc427bf149296a3d2d704f68a2b 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_CULLABLE_HH_
 #define _MOOF_CULLABLE_HH_
 namespace moof {
 
 
+// forward declarations
 class frustum;
 
 /**
  * Interface for anything that can be culled.
  */
-
 class cullable
 {
 public:
+
        virtual ~cullable() {}
 
        virtual bool is_visible(const frustum& frustum) const
index 837340f242eb7bef7999e7dd7ab1913d3a0cf3c3..baa0304ae535db72e3baf4ce6272614c4357e724 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_DEBUG_HH_
 #define _MOOF_DEBUG_HH_
index 96babe48194eb1d91243ccad2fa412cf10207e72..c0aeae5c3ec6c3bafca835d3cd7f02c7a4abbf8e 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <map>
 
@@ -25,29 +23,25 @@ public:
                dispatcher_(dispatcher),
                id_(0) {}
 
-       dispatcher::handle getNewHandle()
+       dispatcher::handle new_handle()
        {
-               ++id_;
-               dispatcher::handle handle(dispatcher_->impl_, id_);
+               dispatcher::handle handle(dispatcher_->impl_, --id_);
                return handle;
        }
 
        typedef std::pair<unsigned,dispatcher::function>        callback;
-       typedef std::multimap<std::string,callback>                     callback_lookup;
-       typedef callback_lookup::iterator                                       callback_it;
-
-       typedef std::multimap<unsigned,std::string>                     handle_lookup;
-       typedef handle_lookup::iterator                                         handle_it;
+       typedef std::multimap<std::string,callback>             callback_lookup;
+       typedef callback_lookup::iterator                       callback_it;
 
+       typedef std::multimap<unsigned,std::string>             handle_lookup;
+       typedef handle_lookup::iterator                         handle_it;
 
        handle add_target(const std::string& event,
-                                         const function& callback,
-                                         handle handle)
+                       const function& callback, handle handle)
        {
-               callbacks_.insert(std::make_pair(event, std::make_pair(handle.id(),
-                                                                                                                          callback)));
+               callbacks_.insert(std::make_pair(event,
+                                       std::make_pair(handle.id(), callback)));
                handles_.insert(std::make_pair(handle.id(), event));
-
                return handle;
        }
 
@@ -55,7 +49,8 @@ public:
        {
                std::pair<handle_it,handle_it> matching(handles_.equal_range(id));
 
-               for (handle_it it = matching.first; it != matching.second; ++it)
+               for (handle_it it = matching.first;
+                               it != matching.second; ++it)
                {
                        callback_it first = callbacks_.find((*it).second);
                        callback_it last = callbacks_.end();
@@ -85,16 +80,13 @@ public:
                }
        }
 
-
-       dispatcher*             dispatcher_;
-
-       unsigned                id_;
+       dispatcher*     dispatcher_;
+       unsigned        id_;
 
        callback_lookup callbacks_;
        handle_lookup   handles_;
 };
 
-
 void dispatcher::handle::clear()
 {
        boost::shared_ptr<impl> dispatcher;
@@ -109,36 +101,31 @@ void dispatcher::handle::clear()
 dispatcher::dispatcher() :
        impl_(new dispatcher::impl(this)) {}
 
-
-dispatcher::handle dispatcher::add_target(const std::string& event,
-                                                                                 const function& callback)
+dispatcher::handle
+dispatcher::add_target(const std::string& event, const function& callback)
 {
-       return add_target(event, callback, impl_->getNewHandle());
+       return add_target(event, callback, impl_->new_handle());
 }
 
 dispatcher::handle dispatcher::add_target(const std::string& event,
-                                                                                 const function& callback,
-                                                                                 handle handle)
+               const function& callback, handle handle)
 {
        // pass through
        return impl_->add_target(event, callback, handle);
 }
 
-
 void dispatcher::remove_target(unsigned id)
 {
        // pass through
        return impl_->remove_target(id);
 }
 
-
 void dispatcher::dispatch(const std::string& event)
 {
        // pass through
        impl_->dispatch(event);
 }
 
-
 dispatcher& dispatcher::global()
 {
        static dispatcher dispatcher;
index a4207c42170bffd68ee1a48713e857b9430c911b..f2613e8fdeb2d11aba27b51c7758ef3e6fbdd989 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_DISPATCH_HH_
 #define _MOOF_DISPATCH_HH_
@@ -31,7 +29,6 @@ namespace moof {
 /**
  * Dispatcher of messages to interested parties.
  */
-
 class dispatcher
 {
        class impl;
@@ -39,7 +36,6 @@ class dispatcher
 
        void remove_target(unsigned id);
 
-
 public:
 
        class handle
@@ -84,17 +80,16 @@ public:
        private:
 
                boost::weak_ptr<impl>   dispatcher_;
-               mutable unsigned                id_;
+               mutable unsigned        id_;
        };
 
        typedef boost::function<void(void)> function;
 
-
        dispatcher();
 
        handle add_target(const std::string& event, const function& callback);
        handle add_target(const std::string& event, const function& callback,
-                                          handle handle);
+                       handle handle);
 
        void dispatch(const std::string& event);
 
index 3882995fe900aceb46ed455433a44ebe81d5d8cf..2f5c6cd09b4ac20261c93722caa39e9cffb6e0d6 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_DRAWABLE_HH_
 #define _MOOF_DRAWABLE_HH_
@@ -29,8 +27,8 @@ namespace moof {
 class drawable
 {
 public:
-       virtual ~drawable() {}
 
+       virtual ~drawable() {}
        virtual void draw(scalar alpha) const = 0;
 };
 
index f95a94cc1fba513549ac4e56fd6ec0e8fa17dbb0..92b4dc5dd7b074b747020d3a7fc807c7da49ebc5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_ENTITY_HH_
 #define _MOOF_ENTITY_HH_
 namespace moof {
 
 
+// forward declarations
 class frustum;
 
-
-class entity;
-
-/**
- * Entity pointer.
- */
-typedef boost::shared_ptr<entity> entity_ptr;
-
-
 /**
  * Interface for game objects that can be drawn to the screen and have a
  * specified volume (take up space).
@@ -57,7 +47,8 @@ public:
         * timestep.
         * \param frustum The camera frustum for determining visibility.
         */
-       virtual void draw_if_visible(scalar alpha, const frustum& frustum) const
+       virtual void
+       draw_if_visible(scalar alpha, const frustum& frustum) const
        {
                if (is_visible(frustum)) draw(alpha);
        }
@@ -74,7 +65,6 @@ public:
                return sphere_.is_visible(frustum) && aabb_.is_visible(frustum);
        }
 
-
        /**
         * Get the axis-aligned bounding box surrounding the entity.
         * \return The AABB.
@@ -92,13 +82,14 @@ public:
                return sphere_;
        }
 
-
 protected:
 
-       moof::aabb3             aabb_;
+       moof::aabb3     aabb_;
        moof::sphere3   sphere_;
 };
 
+typedef boost::shared_ptr<entity> entity_ptr;
+
 
 } // namespace moof
 
index c717db49ea09b6acb3e7f0122afa688c091cccd6..8635e5f8d77c021c3312e05b7c7ae648e7c5b4ac 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_EVENT_HH_
 #define _MOOF_EVENT_HH_
index aaeceb094fb4ecacc2e2c2fbf1d49835eb345c74..c525c1a42cec0181d66d17982b43db21ec0d5ecf 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "aabb.hh"
 #include "frustum.hh"
@@ -20,72 +18,55 @@ namespace moof {
 void frustum::init(const matrix4& modelview, const matrix4& projection)
 {
        scalar planes[6][4];
-
        extract_frustum_planes(modelview, projection, planes, z_clip_neg_one);
 
-       planes_[0] = plane(planes[0][0], planes[0][1],
-                                          planes[0][2], planes[0][3]);
-       planes_[1] = plane(planes[1][0], planes[1][1],
-                                          planes[1][2], planes[1][3]);
-       planes_[2] = plane(planes[2][0], planes[2][1],
-                                          planes[2][2], planes[2][3]);
-       planes_[3] = plane(planes[3][0], planes[3][1],
-                                          planes[3][2], planes[3][3]);
-       planes_[4] = plane(planes[4][0], planes[4][1],
-                                          planes[4][2], planes[4][3]);
-       planes_[5] = plane(planes[5][0], planes[5][1],
-                                          planes[5][2], planes[5][3]);
+       planes_[0] = plane(planes[0][0], planes[0][1], planes[0][2], planes[0][3]);
+       planes_[1] = plane(planes[1][0], planes[1][1], planes[1][2], planes[1][3]);
+       planes_[2] = plane(planes[2][0], planes[2][1], planes[2][2], planes[2][3]);
+       planes_[3] = plane(planes[3][0], planes[3][1], planes[3][2], planes[3][3]);
+       planes_[4] = plane(planes[4][0], planes[4][1], planes[4][2], planes[4][3]);
+       planes_[5] = plane(planes[5][0], planes[5][1], planes[5][2], planes[5][3]);
 }
 
 void frustum::init(const matrix4& modelview, scalar fovy, scalar aspect,
-                                  scalar abutting, scalar distant)
+               scalar abutting, scalar distant)
 {
        matrix4 projection;
-
-       matrix_perspective_yfov_RH(projection, fovy, aspect, abutting,
-                                                                       distant, z_clip_neg_one);
-
+       matrix_perspective_yfov_RH(projection,
+                       fovy, aspect, abutting, distant, z_clip_neg_one);
        init(modelview, projection);
 }
 
 frustum::collision frustum::contains(const aabb<3>& aabb) const
 {
-       vector3 corners[8];
-       int nTotalInside = 0;
-
+       int     total = 0;
+       vector3 corners[8];
        aabb.get_corners(corners);
 
        for (int i = 0; i < 6; ++i)
        {
-               int nInside = 8;
-
+               int num = 8;
                for (int j = 0; j < 8; ++j)
                {
                        if (planes_[i].intersects(corners[j]) == plane::negative)
-                       {
-                               --nInside;
-                       }
+                               --num;
                }
-
-               if (nInside == 0)      return outside;
-               else if (nInside == 8) ++nTotalInside;
+               if (num == 0) return outside;
+               else if (num == 8) ++total;
        }
 
-       if (nTotalInside == 6) return inside;
-       else                   return intersecting;
+       if (total == 6) return inside;
+       return intersecting;
 }
 
-
-frustum::collision frustum::contains(const sphere<3>& sphere) const
+frustum::collision frustum::contains(const sphere3& sphere) const
 {
        for (int i = 0; i < 6; ++i)
        {
                plane::halfspace halfspace = planes_[i].intersects(sphere);
-               
-               if (halfspace == plane::negative)       return outside;
+               if (halfspace == plane::negative) return outside;
                else if (halfspace == plane::intersecting) return intersecting;
        }
-
        return inside;
 }
 
index 1e44701402577b26c2edc29c3c1dc948a717d471..c603a97884c056e1fc408bf7bbace8305728d8f4 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_FRUSTUM_HH_
 #define _MOOF_FRUSTUM_HH_
 #include <moof/math.hh>
 #include <moof/plane.hh>
 
-
 namespace moof {
 
-
 template <int D> class aabb;
 template <int D> class sphere;
 
-
 /**
- * A six-sided volume for representing the space visible by a position
- * looking outward.
+ * A six-sided volume for representing the space visible by a position looking
+ * outward.
  */
 class frustum
 {
@@ -38,8 +33,8 @@ public:
 
        enum collision
        {
-               outside                 = 0,
-               inside                  = 1,
+               outside         = 0,
+               inside          = 1,
                intersecting    = 2
        };
 
@@ -56,18 +51,16 @@ public:
 
        void init(const matrix4& modelview, const matrix4& projection);
        void init(const matrix4& modelview, scalar fovy, scalar aspect,
-                         scalar abutting, scalar distant);
+                       scalar abutting, scalar distant);
 
        collision contains(const aabb<3>& aabb) const;
        collision contains(const sphere<3>& sphere) const;
 
-
 private:
 
        plane planes_[6]; // left, right, bottom, top, near, far
 };
 
-
 } // namespace moof
 
 #endif // _MOOF_FRUSTUM_HH_
index dbbc9befae9b337a352ab65591b84bd81ba69d13..ae09b1cf1df5f1b24e9507f7cde4b3c7b7aa66ac 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "hash.hh"
 
@@ -31,8 +29,8 @@ namespace moof {
 // 2. It will not produce the same results on little-endian and big-endian
 //    machines.
 
-unsigned hash_function::operator()(const void* key, int len,
-                                                                  unsigned int seed) const
+unsigned
+hash_function::operator()(const void* key, int len, unsigned int seed) const
 {
        // 'm' and 'r' are mixing constants generated offline.
        // They're not really 'magic', they just happen to work well.
index ea63db152ad53f05bc7b3643b45437a5b13a2efc..8b14ac5596bc65957c3491f76dc49db2eaced093 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_HASH_HH_
 #define _MOOF_HASH_HH_
@@ -27,12 +25,10 @@ namespace moof {
 
 using stlplus::hash;
 
-
 struct hash_function
 {
        // generic hash function
-       unsigned operator () (const void* key, int len,
-                                                 unsigned seed = -1) const;
+       unsigned operator () (const void* key, int len, unsigned seed = -1) const;
 
        unsigned operator () (const std::string& val) const
        {
index b9076f0c9ec1a46d3808851136155971574c6d4a..09f797ca8f3fc3d9235fb7ccf4f1ad21f5f84eae 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <cstring>             // strncmp
 #include <fstream>
@@ -60,19 +58,20 @@ image::image(const std::string& path) :
        wrap_s_(GL_CLAMP),
        wrap_t_(GL_CLAMP)
 {
-       std::ifstream file(path.c_str());
-       if (!file.good()) throw std::runtime_error("no valid image found at " + path);
+       std::ifstream file(path.c_str(), std::ifstream::binary);
+       if (!file.good())
+               throw std::runtime_error("no valid image found at " + path);
 
        png_byte        signature[8];
        size_t          bytesRead;
 
-       int bpp;
+       int             bpp;
 
        png_byte        colors;
        png_bytepp      rows = 0;
 
        png_textp       texts = 0;
-       int                     nutext_s;
+       int             nutext_s;
 
        bytesRead = file.read((char*)signature, sizeof(signature)).gcount();
        if (bytesRead < sizeof(signature) ||
@@ -80,10 +79,11 @@ image::image(const std::string& path) :
 
        struct png
        {
-               png_structp context;
+               png_structp     context;
                png_infop       info;
                png() :
-                       context(png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0)),
+                       context(png_create_read_struct(PNG_LIBPNG_VER_STRING,
+                                               0, 0, 0)),
                        info(png_create_info_struct(context))
                {
                        if (!context || !info) throw 0;
@@ -91,7 +91,7 @@ image::image(const std::string& path) :
                ~png()
                {
                        png_destroy_read_struct(context ? &context : 0,
-                                                                       info    ? &info    : 0, 0);
+                                       info ? &info : 0, 0);
                }
        } png;
 
@@ -105,17 +105,17 @@ image::image(const std::string& path) :
        colors = png_get_color_type(png.context, png.info);
        switch (colors)
        {
-               case PNG_COLOR_TYPE_PALETTE:
-                       png_set_palette_to_rgb(png.context);
-                       break;
+       case PNG_COLOR_TYPE_PALETTE:
+               png_set_palette_to_rgb(png.context);
+               break;
 
-               case PNG_COLOR_TYPE_GRAY:
-                       if (bpp < 8) png_set_expand(png.context);
-                       break;
+       case PNG_COLOR_TYPE_GRAY:
+               if (bpp < 8) png_set_expand(png.context);
+               break;
 
-               case PNG_COLOR_TYPE_GRAY_ALPHA:
-                       png_set_gray_to_rgb(png.context);
-                       break;
+       case PNG_COLOR_TYPE_GRAY_ALPHA:
+               png_set_gray_to_rgb(png.context);
+               break;
        }
 
        if (bpp == 16) png_set_strip_16(png.context);
@@ -127,14 +127,14 @@ image::image(const std::string& path) :
        depth_ = bpp * channels_;
 
        // read comments
-       bool    isTexture = false;
+       bool texture = false;
        png_get_text(png.context, png.info, &texts, &nutext_s);
        for (int i = 0; i < nutext_s; ++i)
        {
                if (strncmp(texts[i].key, "X-Yoink-Texture", 11) == 0)
                {
                        set_texture_info(texts[i].text);
-                       isTexture = true;
+                       texture = true;
                        break;
                }
        }
@@ -146,12 +146,13 @@ image::image(const std::string& path) :
        pixels_ = new char[width_ * pitch_];
 
        rows = new png_bytep[height_];
-       if (isTexture)
+       if (texture)
        {
                log_debug("texture detected; loading flipped");
                for (int i = 0; i < height_; ++i)
                {
-                       rows[height_-1-i] = (png_bytep)(pixels_ + i * channels_ * width_);
+                       rows[height_-1-i] = (png_bytep)(pixels_ +
+                                       i * channels_ * width_);
                }
        }
        else
@@ -159,7 +160,8 @@ image::image(const std::string& path) :
                log_debug("no texture attributes found");
                for (int i = 0; i < height_; ++i)
                {
-                       rows[i] = (png_bytep)(pixels_ + i * channels_ * width_);
+                       rows[i] = (png_bytep)(pixels_ +
+                                       i * channels_ * width_);
                }
        }
 
@@ -202,11 +204,9 @@ void image::set_as_icon() const
        );
 
        SDL_WM_SetIcon(context, 0);
-
        SDL_FreeSurface(context);
 }
 
-
 bool image::tile_coordinates(int index, scalar coords[8]) const
 {
        // make sure the index represents a real tile
@@ -227,7 +227,6 @@ bool image::tile_coordinates(int index, scalar coords[8]) const
        return true;
 }
 
-
 void image::bind() const
 {
        ASSERT(video::current() && "should have a video context set");
@@ -251,25 +250,20 @@ void image::reset_binding()
        global_object_ = 0;
 }
 
-
 /*
  * Upload the image to GL so that it will be accessible by a much more
  * manageable handle and hopefully reside in video memory.
  */
 void image::upload_to_gl() const
 {
-       if (object_)
-       {
-               // already loaded
-               return;
-       }
+       if (object_) return;    // already loaded
 
        glGenTextures(1, (GLuint*)&object_);
        glBindTexture(GL_TEXTURE_2D, (GLuint)object_);
 
        GLuint mode;
        if (channels_ == 3) mode = GL_RGB;
-       else                mode = GL_RGBA;
+       else mode = GL_RGBA;
        
        glTexImage2D
        //gluBuild2DMipmaps
@@ -299,11 +293,7 @@ void image::unload_from_gl() const
 {
        if (object_)
        {
-               if (object_ == global_object_)
-               {
-                       global_object_ = 0;
-               }
-
+               if (object_ == global_object_) global_object_ = 0;
                glDeleteTextures(1, (GLuint*)&object_);
                object_ = 0;
        }
@@ -327,7 +317,6 @@ void image::set_properties() const
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t_);
 }
 
-
 void image::set_texture_info(const std::string& info)
 {
        script script;
index 6aa251bad0a658a3ca48fd24ba61c87f124d9e9e..62f8699abb029503b1e87b2db97c56d96bc1d356 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_IMAGE_HH_
 #define _MOOF_IMAGE_HH_
@@ -33,9 +31,7 @@ public:
 
        static const int no_tile = -1;
 
-
        explicit image(const std::string& path);
-
        ~image();
 
        int width() const
@@ -63,7 +59,6 @@ public:
                return channels_;
        }
 
-
        std::string comment() const
        {
                return comment_;
@@ -74,10 +69,8 @@ public:
                return pixels_;
        }
 
-
        void set_as_icon() const;
 
-
        /**
         * Calculate texture coordinates for a tile at a certain index.  Tiles
         * are indexed start with zero as the top-left tile and moving across,
@@ -93,11 +86,9 @@ public:
         */
        bool tile_coordinates(int index, scalar coords[8]) const;
 
-
        void bind() const;
        static void reset_binding();
 
-
 private:
 
        void upload_to_gl() const;
@@ -106,26 +97,25 @@ private:
        void set_properties() const;
        void set_texture_info(const std::string& info);
 
-
-       char*                           pixels_;
+       char*                   pixels_;
 
        mutable unsigned        object_;
        static unsigned         global_object_;
 
-       int                                     width_;
-       int                                     height_;
-       int                                     depth_;
-       int                                     pitch_;
-       int                                     channels_;
+       int                     width_;
+       int                     height_;
+       int                     depth_;
+       int                     pitch_;
+       int                     channels_;
 
-       std::string                     comment_;
+       std::string             comment_;
 
-       unsigned                        min_filter_;
-       unsigned                        mag_filter_;
-       int                                     tile_s_;
-       int                                     tile_t_;
-       unsigned                        wrap_s_;
-       unsigned                        wrap_t_;
+       unsigned                min_filter_;
+       unsigned                mag_filter_;
+       int                     tile_s_;
+       int                     tile_t_;
+       unsigned                wrap_s_;
+       unsigned                wrap_t_;
 
        //mutable dispatcher::handle    new_context_;
 };
index 0a7aa012b480747e69c7e3577c1c6f3c8546f9f8..83dd0c9bdf095d1f289f8d8ec15896c294afd0b5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_INTERPOLATOR_HH_
 #define _MOOF_INTERPOLATOR_HH_
@@ -40,10 +38,9 @@ public:
        {
                stop            = 0,    /// Interpolator will stop when done.
                repeat          = 1,    /// Interpolator will go back to the beginning.
-               oscillate       = 2             /// Interpolator will reverse direction.
+               oscillate       = 2     /// Interpolator will reverse direction.
        };
 
-
        /**
         * Construct an uninitialized interpolator.
         */
@@ -57,7 +54,8 @@ public:
         * \param t The duration of the interpolation.
         * \param mode The interpolation mode.
         */
-       interpolator(const T& a, const T& b, scalar t = 1.0, mode mode = stop) :
+       interpolator(const T& a, const T& b,
+                       scalar t = 1.0, mode mode = stop) :
                state_(a),
                prior_(a),
                a_(a),
@@ -86,7 +84,6 @@ public:
                is_done_ = false;
        }
 
-
        /**
         * Update the interpolation state with a timeslice.
         * \param t The total time in seconds.
@@ -104,42 +101,40 @@ public:
                        {
                                switch (mode_)
                                {
-                                       case stop:
-                                               alpha_ = SCALAR(1.0);
-                                               is_done_ = true;
-                                               break;
-                                       case repeat:
-                                               alpha_ -= SCALAR(1.0);
-                                               break;
-                                       case oscillate:
-                                               alpha_ = SCALAR(2.0) - alpha_;
-                                               scale_ = -scale_;
-                                               break;
+                               case stop:
+                                       alpha_ = SCALAR(1.0);
+                                       is_done_ = true;
+                                       break;
+                               case repeat:
+                                       alpha_ -= SCALAR(1.0);
+                                       break;
+                               case oscillate:
+                                       alpha_ = SCALAR(2.0) - alpha_;
+                                       scale_ = -scale_;
+                                       break;
                                }
                        }
                        else if (alpha_ < 0.0)
                        {
                                switch (mode_)
                                {
-                                       case stop:
-                                               alpha_ = SCALAR(0.0);
-                                               is_done_ = true;
-                                               break;
-                                       case repeat:
-                                               alpha_ += SCALAR(1.0);
-                                               break;
-                                       case oscillate:
-                                               alpha_ = -alpha_;
-                                               scale_ = -scale_;
-                                               break;
+                               case stop:
+                                       alpha_ = SCALAR(0.0);
+                                       is_done_ = true;
+                                       break;
+                               case repeat:
+                                       alpha_ += SCALAR(1.0);
+                                       break;
+                               case oscillate:
+                                       alpha_ = -alpha_;
+                                       scale_ = -scale_;
+                                       break;
                                }
                        }
-
                        state_ = function_(a_, b_, alpha_);
                }
        }
 
-
        /**
         * Get the interpolated value.
         * \return The interpolated value.
@@ -169,7 +164,6 @@ public:
                return is_done_;
        }
 
-
 private:
 
        T       state_;
@@ -195,7 +189,6 @@ struct linear_interpolation_function
        }
 };
 
-
 typedef interpolator<linear_interpolation_function> lerp_scalar;
 
 
index 0ba6bb368c6d56b628ed8ec9a38862fb91e0abac..8f5794d52850643b1531587f3e4f0a537f249a9e 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_LINE_HH_
 #define _MOOF_LINE_HH_
@@ -36,18 +34,15 @@ struct line : public drawable, public shape<D>
 {
        typedef moof::vector< scalar, fixed<D> > vector;
 
-
        vector  a;
        vector  b;
 
-
        line() {}
 
        line(const vector& point1, const vector& point2) :
                a(point1),
                b(point2) {}
 
-
        vector direction() const
        {
                return b - a;
@@ -58,31 +53,31 @@ struct line : public drawable, public shape<D>
                return direction().length();
        }
 
-
        bool intersect(const line& other, contact<D>& hit) const
        {
                scalar d = (other.b[1] - other.a[1]) * (b[0] - a[0]) -
-                                  (other.b[0] - other.a[0]) * (b[1] - a[1]);
+                       (other.b[0] - other.a[0]) * (b[1] - a[1]);
 
-               if (d == SCALAR(0.0)) return false;                     // lines are parallel
+               if (d == SCALAR(0.0)) return false;     // lines are parallel
                // ignoring the (somewhat remote) possibility of coincidence
 
-               scalar m = ((other.b[0] - other.a[0]) * (a[1] - other.a[1]) -
-                                       (other.b[1] - other.a[1]) * (a[0] - other.a[0])) / d;
+               scalar m = ((other.b[0] - other.a[0]) *
+                               (a[1] - other.a[1]) -
+                               (other.b[1] - other.a[1]) *
+                               (a[0] - other.a[0])) / d;
 
                scalar n = ((b[0] - a[0]) * (b[1] - other.a[1]) -
-                                       (b[1] - a[1]) * (b[0] - other.a[0])) / d;
+                               (b[1] - a[1]) * (b[0] - other.a[0])) / d;
 
                if (m < SCALAR(0.0) || m > SCALAR(1.0) ||       // not intersecting
-                       n < SCALAR(0.0) || n > SCALAR(1.0)) return false;
+                       n < SCALAR(0.0) || n > SCALAR(1.0))
+                       return false;
 
                vector2 tangent = b - a;
                vector2 normal = perp(tangent).normalize();
 
                if (dot(normal, other.a - other.b) < SCALAR(0.0))
-               {
                        normal = -normal;
-               }
 
                hit.point = a + m * tangent;
                hit.normal = normal;
@@ -104,7 +99,6 @@ struct line : public drawable, public shape<D>
                if (projection < SCALAR(0.0) || projection > surfaceLength)
                {
                        // try endpoints
-                       
                        if (other.intersect(a, hit))
                        {
                                hit.normal = -hit.normal;
@@ -117,7 +111,6 @@ struct line : public drawable, public shape<D>
                                hit.point = b;
                                return true;
                        }
-                       
                        return false;
                }
 
@@ -126,7 +119,7 @@ struct line : public drawable, public shape<D>
 
                scalar distance = normal.length();
 
-               if (distance > other.radius) false;             // not intersecting
+               if (distance > other.radius) false;     // not intersecting
 
                normal.normalize();
 
@@ -137,8 +130,8 @@ struct line : public drawable, public shape<D>
                return true;
        }
 
-
-       bool intersect_ray(const ray<2>& ray, moof::ray<2>::contact& hit) const
+       bool
+       intersect_ray(const ray<2>& ray, moof::ray<2>::contact& hit) const
        {
                vector2 v1 = a - ray.point;
                scalar  a1 = signed_angle_2D(v1, b - ray.point);
@@ -170,7 +163,6 @@ struct line : public drawable, public shape<D>
                hit.normal = perp(a - b);
                return true;
 
-
                /*
                // solve: Cx + r*Dx = Ax + s(Bx - Ax)
                //        Cy + r*Dy = Ay + s(By - Ay)
@@ -222,7 +214,6 @@ struct line : public drawable, public shape<D>
                */
        }
 
-
        void draw(scalar alpha = 0.0) const
        {
                image::reset_binding();
@@ -233,7 +224,6 @@ struct line : public drawable, public shape<D>
        }
 };
 
-
 typedef line<2>                line2;
 typedef line<3>                line3;
 
@@ -248,7 +238,7 @@ struct polygon : public drawable, public shape<D>
        polygon() {}
 
        bool intersect_ray(const ray<D>& ray,
-                                          typename moof::ray<D>::contact& hit)
+                       typename moof::ray<D>::contact& hit)
        {
                return false;
        }
@@ -257,22 +247,17 @@ struct polygon : public drawable, public shape<D>
        {
                image::reset_binding();
                glBegin(GL_POLYGON);
-               for (int i = 0; i < D; ++i)
-               {
-                       glVertex(points[0]);
-               }
+                       for (int i = 0; i < D; ++i) glVertex(points[0]);
                glEnd();
        }
 };
 
-
 typedef polygon<2,3>   triangle2;
 typedef polygon<3,3>   triangle3;
 
 
 template <int D>
-bool intersect(const line<D>& line, const sphere<D>& sphere,
-                          contact<D>& hit)
+bool intersect(const line<D>& line, const sphere<D>& sphere, contact<D>& hit)
 {
        return false;
 }
index d0acf2e103334e98c99a562b8688b2f644c0a9aa..514649653a4d4fbd1491e597d7527cd2f01eb7b4 100644 (file)
@@ -1,23 +1,24 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
+
+#if HAVE_INCLUDE_H
+#include "config.h"
+#endif
 
 #include <fstream>
 
-#if !defined(__WIN32)
+#if PLATFORM_POSIX
 #include <termios.h>
 #else
 inline int isatty(int dummy) { return 0; }
 #endif
 
-
 #include "log.hh"
 #include "script.hh"
 
@@ -38,27 +39,29 @@ enum log::level log::level()
        return global_level_;
 }
 
-
 log::log(enum level level) :
        level_(level)
 {
        if (isatty(1) == 0)
                switch (level)
                {
-                       case log::error:        prefix_ = "  error: ";  break;
-                       case log::warning:      prefix_ = "warning: ";  break;
-                       case log::info:         prefix_ = "   info: ";  break;
-                       case log::debug:        prefix_ = "  debug: ";  break;
-                       case log::none:         break;
+               case log::error:        prefix_ = "  error: ";  break;
+               case log::warning:      prefix_ = "warning: ";  break;
+               case log::info:         prefix_ = "   info: ";  break;
+               case log::debug:        prefix_ = "  debug: ";  break;
+               case log::none:         break;
                }
        else
                switch (level)
                {
-                       case log::error:        prefix_ = "\033[30;101m  error: ";      break;
-                       case log::warning:      prefix_ = "\033[30;103mwarning: ";      break;
-                       case log::info:         prefix_ = "   info: ";                          break;
-                       case log::debug:        prefix_ = "\033[2m  debug: ";           break;
-                       case log::none:         break;
+               case log::error:        prefix_ = "\033[30;101m  error: ";
+                                       break;
+               case log::warning:      prefix_ = "\033[30;103mwarning: ";
+                                       break;
+               case log::info:         prefix_ = "   info: ";
+                                       break;
+               case log::debug:        prefix_ = "\033[2m  debug: ";
+               case log::none:         break;
                }
 }
 
@@ -66,22 +69,20 @@ std::ostream& operator << (class log& log, log::endl_ endl)
 {
        if (log::global_level_ < log.level_) return null_log;
        if (isatty(1) == 0) return moof::log << std::endl;
-       else return moof::log << "\033[0m" << std::endl;
+       return moof::log << "\033[0m" << std::endl;
 }
 
 std::ostream& operator << (std::ostream& stream, log::endl_ endl)
 {
        if (isatty(1) == 0) return stream << std::endl;
-       else return stream << "\033[0m" << std::endl;
+       return stream << "\033[0m" << std::endl;
 }
 
-
 std::ostream& log(std::cout);
 
 static std::ofstream null_log_;
 std::ostream& null_log(null_log_);
 
-
 // These objects are intentionally not deconstructed so that logging will
 // still be available after this module has been cleaned up.
 class log& log_error(*new class log(log::error));
@@ -89,7 +90,6 @@ class log& log_warning(*new class log(log::warning));
 class log& log_info(*new class log(log::info));
 class log& log_debug(*new class log(log::debug));
 
-
 static int log_script(script& script, enum log::level level)
 {
        static class log* logs[] = {
@@ -102,8 +102,7 @@ static int log_script(script& script, enum log::level level)
 
        script::slot param = script[1];
 
-       while (!param.is_none())
-       {
+       while (!param.is_none()) {
                (*logs[level])(param);
                ++param.index;
        }
@@ -114,15 +113,15 @@ static int log_script(script& script, enum log::level level)
 void log::import(script& script)
 {
        script.import_function("LogError",
-                                                 boost::bind(log_script, _1, log::error));
+                       boost::bind(log_script, _1, log::error));
        script.import_function("LogWarning",
-                                                 boost::bind(log_script, _1, log::warning));
+                       boost::bind(log_script, _1, log::warning));
        script.import_function("LogInfo",
-                                                 boost::bind(log_script, _1, log::info));
+                       boost::bind(log_script, _1, log::info));
        script.import_function("print",
-                                                 boost::bind(log_script, _1, log::info));
+                       boost::bind(log_script, _1, log::info));
        script.import_function("LogDebug",
-                                                 boost::bind(log_script, _1, log::debug));
+                       boost::bind(log_script, _1, log::debug));
 }
 
 
index cad63e939a572a7c058aa6ad2e5c51fe12c19441..addf37c135f9066025c019aa7818ef16b93851d4 100644 (file)
@@ -1,22 +1,20 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_LOG_HH_
 #define _MOOF_LOG_HH_
 
 /**
  * \file log.hh
- * Functions related to logging the process.
- * The logging functions are log_error(), log_warning(), and log_info(),
- * listed from most critical to least critical.
+ * Functions related to logging the process.  The logging functions are
+ * log_error(), log_warning(), and log_info(), listed from most critical to
+ * least critical.
  */
 
 #include <cstdlib>             // exit
@@ -27,9 +25,9 @@
 namespace moof {
 
 
+// forward declarations
 class script;
 
-
 /**
  * A class for handling a log priority.  There are two ways to log
  * messages: by treating a log object as a function whose parameters are
@@ -46,14 +44,13 @@ public:
         */
        enum level
        {
-               none            = 0,            ///< Disable all logging.
-               error           = 1,            ///< Log only errors.
-               warning         = 2,            ///< Log warnings and errors.
-               info            = 3,            ///< Log everything.
-               debug           = 4,            ///< Log absolutely everything.
+               none            = 0,    ///< Disable all logging.
+               error           = 1,    ///< Log only errors.
+               warning         = 2,    ///< Log warnings and errors.
+               info            = 3,    ///< Log everything.
+               debug           = 4,    ///< Log absolutely everything.
        };
 
-
        /**
         * Set the lowest-priority log message that will be outputted to the
         * log.  Any logging with a lower priority will be ignored.
@@ -68,14 +65,12 @@ public:
         */
        static enum level level();
 
-
        /**
         * Import log functions to a script.
         * \param The script.
         */
        static void import(script& script);
 
-
        /**
         * Construct a log with a certain priority and prefix string.
         * \param level The log level.
@@ -83,7 +78,6 @@ public:
         */
        log(enum level level);
 
-
        /**
         * Output this to end a line.  This is equivalent to std::endl except
         * this will also reset terminal format attributes.
@@ -92,7 +86,6 @@ public:
        {
        } endl;
 
-
        template <class A>
        void operator () (const A& a)
        {
@@ -119,19 +112,15 @@ public:
 
        template <class A, class B, class C, class D, class E>
        void operator () (const A& a,
-                                         const B& b,
-                                         const C& c,
-                                         const D& d,
-                                         const E& e)
+                       const B& b,
+                       const C& c,
+                       const D& d,
+                       const E& e)
        {
-               *this << a << " "
-                         << b << " "
-                         << c << " "
-                         << d << " "
-                         << e << endl;
+               *this << a << " " << b << " " << c << " " << d << " " << e <<
+                       endl;
        }
 
-
 private:
 
        template <class T> friend std::ostream& operator << (log&, const T&);
@@ -139,11 +128,10 @@ private:
 
        static enum level       global_level_;
 
-       enum level                      level_;
-       std::string                     prefix_;
+       enum level              level_;
+       std::string             prefix_;
 };
 
-
 extern std::ostream&   log;
 extern std::ostream&   null_log;
 
index 98b102dddfafbcfa598fb7937071308812d61c15..a3963e8a1341f8929f6407722bee32938063791b 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_MANAGER_HH_
 #define _MOOF_MANAGER_HH_
@@ -47,7 +45,6 @@ public:
                return boost::shared_ptr<T>(retain(name), &release);
        }
 
-
 private:
 
        typedef stlplus::hash<std::string,T*,hash_function> ptr_lookup;
@@ -68,7 +65,8 @@ private:
                        {
                                new_object->name_ = name;
                                new_object->init(name);
-                               ptr_lookup_.insert(std::make_pair(name, new_object));
+                               ptr_lookup_.insert(std::make_pair(name,
+                                                       new_object));
                        }
                        return new_object; 
                }
@@ -85,8 +83,8 @@ private:
 
 
        static ptr_lookup       ptr_lookup_;
-       std::string                     name_;
-       unsigned                        retain_count_;
+       std::string             name_;
+       unsigned                retain_count_;
 };
 
 template <class T>
index 14e8c78626acdb41bfedac1b8609e19d9588818b..e7cd3f03951f873c04ec37dcb3e02a91993f78e6 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_MATH_HH_
 #define _MOOF_MATH_HH_
  * General math-related types and functions.
  */
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <cmath>
 
 #include <cml/cml.h>
 #include <SDL/SDL_opengl.h>
 
-
 #if ENABLE_DOUBLE_PRECISION
 typedef GLdouble       GLscalar;
 #define GL_SCALAR      GL_DOUBLE
@@ -41,7 +40,6 @@ namespace moof {
 
 using namespace cml;
 
-
 typedef GLscalar scalar;
 
 typedef vector< scalar, fixed<2> > vector2;
@@ -52,11 +50,10 @@ typedef matrix< scalar, fixed<2,2>, col_basis, col_major > matrix2;
 typedef matrix< scalar, fixed<3,3>, col_basis, col_major > matrix3;
 typedef matrix< scalar, fixed<4,4>, col_basis, col_major > matrix4;
 
-typedef quaternion< scalar, fixed<>, vector_first, positive_cross >    quaternion;
+typedef quaternion< scalar, fixed<>, vector_first, positive_cross > quaternion;
 
 typedef constants<scalar> constants;
 
-
 inline vector3 demote(const vector4& vec)
 {
        return vector3(vec[0], vec[1], vec[2]);
@@ -90,10 +87,10 @@ inline bool is_equal(scalar a, scalar b, scalar epsilon = EPSILON)
 }
 
 
-// Here are some generic implementations of a few simple integrators.  To
-// use, you need one type representing the state and another containing the
-// derivatives of the primary state variables.  The state class must
-// implement these methods:
+// Here are some generic implementations of a few simple integrators.  To use,
+// you need one type representing the state and another containing the
+// derivatives of the primary state variables.  The state class must implement
+// these methods:
 //
 // void calculate_derivative(Derivative_Type& derivative, scalar absoluteTime);
 // void step(const Derivative_Type& derivative, scalar deltaTime);
@@ -118,12 +115,10 @@ inline D evaluate(S state,  scalar t, scalar dt, const D& derivative)
        return evaluate<S,D>(state, t + dt);
 }
 
-
 template <class S, class D>
 inline void euler(S& state, scalar t, scalar dt)
 {
        D a = evaluate<S,D>(state, t);
-
        state.step(a, dt);
 }
 
@@ -132,7 +127,6 @@ inline void rk2(S& state, scalar t, scalar dt)
 {
        D a = evaluate<S,D>(state, t);
        D b = evaluate<S,D>(state, t, dt * SCALAR(0.5), a);
-
        state.step(b, dt);
 }
 
@@ -143,7 +137,6 @@ inline void rk4(S& state, scalar t, scalar dt)
        D b = evaluate<S,D>(state, t, dt * SCALAR(0.5), a);
        D c = evaluate<S,D>(state, t, dt * SCALAR(0.5), b);
        D d = evaluate<S,D>(state, t, dt, c);
-
        state.step((a + (b + c) * SCALAR(2.0) + d) * SCALAR(1.0/6.0), dt);
 }
 
index e380adfd19d6eb2ea9e9bc2bc9799eb0c2bf8362..32550f7fcfb3361aff55ea7e2748c0c2c62531df 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <cstring>
 #include <fstream>
@@ -18,8 +16,6 @@
 #include <boost/algorithm/string/trim.hpp>
 #include <zlib.h>
 
-#include <stlplus/strings/string_utilities.hpp>
-
 #include "debug.hh"
 #include "log.hh"
 #include "mesh.hh"
@@ -27,9 +23,8 @@
 
 // TODO: this file needs to be cleaned up
 
-
-#define AC3D_FORMAT_VERSION            (0x0b)
-#define ZLIB_BUF_SIZE                  (262114)
+#define AC3D_FORMAT_VERSION    0x0b
+#define ZLIB_BUF_SIZE          262114
 
 
 namespace moof {
@@ -37,22 +32,17 @@ namespace moof {
 
 MOOF_REGISTER_RESOURCE(mesh, ac, models);
 
-
 static std::string read_string(std::istream& stream)
 {
        std::string     str;
        char            atom;
 
-       do      // skip to the next non-space character
-       {
-               stream.get(atom);
-       }
+       do stream.get(atom);
        while (stream && std::isspace(atom));
 
        if (atom == '"')
        {
-               do
-               {
+               do {
                        stream.get(atom);
                        if (atom == '"') break;
                        str += atom;
@@ -61,8 +51,7 @@ static std::string read_string(std::istream& stream)
        }
        else
        {
-               do
-               {
+               do {
                        stream.get(atom);
                        if (std::isspace(atom)) break;
                        str += atom;
@@ -73,7 +62,7 @@ static std::string read_string(std::istream& stream)
        return str;
 }
 
-inline int read_hex(std::istream& stream)
+static int read_hex(std::istream& stream)
 {
        int hex;
        std::ios::fmtflags flags = stream.flags();
@@ -83,21 +72,21 @@ inline int read_hex(std::istream& stream)
        return hex;
 }
 
-inline vector2 read_pair(std::istream& stream)
+static vector2 read_pair(std::istream& stream)
 {
        vector2 triplet;
        stream >> triplet[0] >> triplet[1];
        return triplet;
 }
 
-inline vector3 read_triplet(std::istream& stream)
+static vector3 read_triplet(std::istream& stream)
 {
        vector3 triplet;
        stream >> triplet[0] >> triplet[1] >> triplet[2];
        return triplet;
 }
 
-inline vector4 read_color(std::istream& stream)
+static vector4 read_color(std::istream& stream)
 {
        vector4 color;
        stream >> color[0] >> color[1] >> color[2];
@@ -105,12 +94,10 @@ inline vector4 read_color(std::istream& stream)
        return color;
 }
 
-
 void mesh::import(std::istream& stream)
 {
-       std::string             atom;
-
-       object_ptr              obj;
+       std::string     atom;
+       object_ptr      obj;
        std::stack<int> kids;
 
        // read and verify the AC3D header
@@ -379,12 +366,10 @@ void mesh::import(std::istream& stream)
        //face.triangles.push_back(vert);
 //}
 
-
-
 mesh::mesh(const std::string& path)
 {
        std::ifstream file(path.c_str(), std::ifstream::in |
-                                                                        std::ifstream::binary);
+                       std::ifstream::binary);
        if (!file) throw std::runtime_error("cannot find mesh file");
 
        // if we can read the header, the file isn't compressed
@@ -394,7 +379,6 @@ mesh::mesh(const std::string& path)
        {
                log_info("text mesh detected");
                file.seekg(std::ios::beg);
-
                import(file);
        }
        else
@@ -415,31 +399,30 @@ mesh::mesh(const std::string& path)
                zstream.next_in = Z_NULL;
                
                int result = inflateInit2(&zstream, 32+MAX_WBITS);
-               if (result != Z_OK) throw std::runtime_error("zlib init error");
+               if (result != Z_OK)
+                       throw std::runtime_error("zlib init error");
 
-               do
-               {
+               do {
                        file.read(in, sizeof(in));
                        zstream.next_in = (Bytef*)in;
                        zstream.avail_in = file.gcount();
 
                        if (zstream.avail_in == 0) break;
 
-                       do
-                       {
+                       do {
                                zstream.next_out = (Bytef*)out;
                                zstream.avail_out = sizeof(out);
 
                                result = inflate(&zstream, Z_NO_FLUSH);
                                switch (result)
                                {
-                                       case Z_NEED_DICT:
-                                       case Z_DATA_ERROR:
-                                       case Z_MEM_ERROR:
-                                               inflateEnd(&zstream);
-                                               throw std::runtime_error("zlib inflate error");
-                                       case Z_STREAM_ERROR:
-                                               throw std::runtime_error("zlib stream error");
+                               case Z_NEED_DICT:
+                               case Z_DATA_ERROR:
+                               case Z_MEM_ERROR:
+                                       inflateEnd(&zstream);
+                                       throw std::runtime_error("zlib inflate error");
+                               case Z_STREAM_ERROR:
+                                       throw std::runtime_error("zlib stream error");
                                }
 
                                int inflated = sizeof(out) - zstream.avail_out;
@@ -450,12 +433,10 @@ mesh::mesh(const std::string& path)
                while(result != Z_STREAM_END);
 
                inflateEnd(&zstream);
-
                import(stream);
        }
 }
 
-
 void mesh::draw(scalar alpha) const
 {
        glEnableClientState(GL_VERTEX_ARRAY);
@@ -469,7 +450,6 @@ void mesh::draw(scalar alpha) const
        // TODO: disable vertex array?
 }
 
-
 void mesh::set_material(int index) const
 {
        set_material(materials_[index]);
@@ -485,7 +465,6 @@ void mesh::set_material(const material& material) const
        glMaterial(GL_FRONT, GL_SHININESS, material.shininess);
 }
 
-
 void mesh::object::draw(scalar alpha, bool recurse) const
 {
        glVertexPointer(verts);
@@ -516,13 +495,10 @@ void mesh::object::draw(scalar alpha, bool recurse) const
        {
                std::vector<object_ptr>::const_iterator jt;
                for (jt = kids.begin(); jt != kids.end(); ++jt)
-               {
                        (*jt)->draw(alpha);
-               }
        }
 }
 
-
 //class mesh_resource_loader
 //{
 //public:
index 0fbc3cc5b303a526f6aa99f0b19ec075fadeb6e8..26accec43e1410b295797c6dbda017f7ac9b9faf 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_MESH_HH_
 #define _MOOF_MESH_HH_
@@ -34,9 +32,9 @@
 namespace moof {
 
 
+// forward declarations
 class script;
 
-
 class mesh : public boost::noncopyable, public entity
 {
 public:
@@ -45,23 +43,19 @@ public:
 
        void draw(scalar alpha = SCALAR(0.0)) const;
 
-
        struct material
        {
                material(const std::string& id) :
                        name(id) {}
 
-
+               scalar          shininess;
                std::string     name;
-
-               vector4         diffuse;
                vector4         ambient;
+               vector4         diffuse;
                vector4         emissive;
                vector4         specular;
-               scalar          shininess;
        };
 
-
        void set_material(int index) const;
        void set_material(const material& material) const;
 
@@ -71,7 +65,6 @@ public:
                std::vector<vector2>    triangles_uv;
        };
 
-
        class object;
        typedef boost::shared_ptr<object> object_ptr;
        typedef boost::weak_ptr<object>   object_weakptr;
@@ -87,33 +80,31 @@ public:
                        return object_ptr(new object(m));
                }
 
-               void draw(scalar alpha = SCALAR(0.0), bool recurse = true) const;
-
+               void
+               draw(scalar alpha = SCALAR(0.0), bool recurse = true) const;
 
-               const moof::mesh&                       mesh;
+               const moof::mesh&       mesh;
 
-               std::string                                     name;
-               std::string                                     data;
-               std::string                                     url;
+               std::string             name;
+               std::string             data;
+               std::string             url;
 
-               image_handle                            texture;
-               vector2                                         texrep;
+               image_handle            texture;
+               vector2                 texrep;
 
-               std::vector<vector3>            verts;
-               std::vector<material_group>     faces;
+               std::vector<vector3>                    verts;
+               std::vector<material_group>             faces;
 
-               std::vector<object_ptr>         kids;
-               std::map<std::string,object_ptr>                kids_byname;
-               object_weakptr                                  parent;
+               std::vector<object_ptr>                 kids;
+               std::map<std::string,object_ptr>        kids_byname;
+               object_weakptr                          parent;
        };
 
-
        object_ptr operator [] (unsigned index) const
        {
                return objects_[index];
        }
 
-
        /**
         * Import script bindings for the mesh class.
         * \param The script.
@@ -121,7 +112,6 @@ public:
         */
        static void import(script& script, const std::string& nspace = "");
 
-
 private:
 
        void import(std::istream& stream);
index 02138add2249c6c3ecae12a085ea9bf96b97f5e4..8c9f9e0c07aff424d717944ea3499b73edb19e1d 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "log.hh"
 #include "mesh.hh"
@@ -37,8 +35,10 @@ static int mesh_draw(script& script)
        script[1].require_object<mesh_handle>("mesh").get(mesh);
 
        scalar alpha;
-       if (script[2].get(alpha)) (*mesh)->draw(alpha);
-       else                      (*mesh)->draw();
+       if (script[2].get(alpha))
+               (*mesh)->draw(alpha);
+       else
+               (*mesh)->draw();
 
        return 0;
 }
@@ -70,17 +70,19 @@ static int object_draw(script& script)
        mesh::object_ptr* object;
        script[1].require_object<mesh::object_ptr>("mesh object").get(object);
 
-       scalar alpha;
-       bool recurse;
-       if (script[2].get(alpha))
-       {
-               if (script[3].get(recurse)) (*object)->draw(alpha, recurse);
-               else (*object)->draw(alpha);
+       scalar  alpha;
+       bool    recurse;
+       if (script[2].get(alpha)) {
+               if (script[3].get(recurse))
+                       (*object)->draw(alpha, recurse);
+               else
+                       (*object)->draw(alpha);
        }
-       else
-       {
-               if (script[2].get(recurse)) (*object)->draw(SCALAR(0.0), recurse);
-               else (*object)->draw();
+       else {
+               if (script[2].get(recurse))
+                       (*object)->draw(SCALAR(0.0), recurse);
+               else
+                       (*object)->draw();
        }
 
        return 0;
@@ -91,21 +93,18 @@ static int object_index(script& script)
        mesh::object_ptr* object;
        script[1].require_object<mesh::object_ptr>("mesh object").get(object);
 
-       if (script[2].is_number())
-       {
+       if (script[2].is_number()) {
                unsigned index;
                script[2].get(index);
                --index;
                script.push((*object)->kids[index]);
        }
-       else if (script[2].is_string())
-       {
+       else if (script[2].is_string()) {
                std::string name;
                script[2].get(name);
                script.push((*object)->kids_byname[name]);
        }
-       else
-       {
+       else {
                script[2].raise_type_error("index or name");
        }
        return 1;
index 4498692c9a3a79bade1539f6f778bd71fde20fc8..4afeb39b1d998a78d066470b66916c25cd364b3e 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_MODAL_DIALOG_HH_
 #define _MOOF_MODAL_DIALOG_HH_
@@ -18,7 +16,9 @@
  * supported, but only one can be used as determined at build time.
  */
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <string>
 
@@ -42,7 +42,6 @@ namespace moof {
 /**
  * Small wrapper over various user interface modal dialog windows.
  */
-
 struct modal_dialog
 {
        enum type
@@ -52,12 +51,10 @@ struct modal_dialog
                error           = 3
        };
 
-
-       std::string title;
+       std::string     title;
        type            type;
-       std::string text1;
-       std::string text2;
-
+       std::string     text1;
+       std::string     text2;
 
        /**
         * Construct a dialog box.
@@ -67,84 +64,80 @@ struct modal_dialog
         * \param text2 The second line.
         */
        modal_dialog(enum type type = information,
-                                const std::string& title = "",
-                                const std::string& text1 = "",
-                                const std::string& text2 = "") :
+                       const std::string& title = "",
+                       const std::string& text1 = "",
+                       const std::string& text2 = "") :
                title(title),
                type(type),
                text1(text1),
                text2(text2) {}
 
-
        void run() const
        {
                switch (type)
                {
-                       case warning:
-                               log_warning(text1);
-                               log_warning(text2);
-                               break;
-                       case error:
-                               log_error(text1);
-                               log_error(text2);
-                               break;
-                       default:
-                               log_info(text1);
-                               log_info(text2);
-                               break;
+               case warning:
+                       log_warning(text1);
+                       log_warning(text2);
+                       break;
+               case error:
+                       log_error(text1);
+                       log_error(text2);
+                       break;
+               default:
+                       log_info(text1);
+                       log_info(text2);
+                       break;
                }
 
 #if PLATFORM_WIN32
-
                int icon_type;
                switch (type)
                {
-                       case warning:
-                               icon_type = MB_ICONWARNING;
-                               break;
-                       case error:
-                               icon_type = MB_ICONERROR;
-                               break;
-                       default:
-                               icon_type = MB_ICONINFORMATION;
-                               break;
+               case warning:
+                       icon_type = MB_ICONWARNING;
+                       break;
+               case error:
+                       icon_type = MB_ICONERROR;
+                       break;
+               default:
+                       icon_type = MB_ICONINFORMATION;
+                       break;
                }
 
                MessageBox(0, (text1 + "\n" + text2).c_str(), title.c_str(),
                                   MB_OK | icon_type);
-
 #elif WITH_GUI_GTK
-
-               int             argc = 0;
+               int     argc = 0;
                char**  argv;
                gtk_init(&argc, &argv);
 
                GtkMessageType icon_type;
                switch (type)
                {
-                       case warning:
-                               icon_type = GTK_MESSAGE_WARNING;
-                               break;
-                       case error:
-                               icon_type = GTK_MESSAGE_ERROR;
-                               break;
-                       default:
-                               icon_type = GTK_MESSAGE_INFO;
-                               break;
+               case warning:
+                       icon_type = GTK_MESSAGE_WARNING;
+                       break;
+               case error:
+                       icon_type = GTK_MESSAGE_ERROR;
+                       break;
+               default:
+                       icon_type = GTK_MESSAGE_INFO;
+                       break;
                }
 
                GtkWidget* dialog = gtk_message_dialog_new(NULL,
                                GTK_DIALOG_DESTROY_WITH_PARENT, icon_type,
                                GTK_BUTTONS_CLOSE, "%s", text1.c_str());
                gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                                                                                                "%s", text2.c_str());
+                                       "%s", text2.c_str());
                gtk_window_set_title(GTK_WINDOW(dialog), title.c_str());
 
-               std::string icon_path = resource::find_file(PACKAGE".png");
+               std::string icon_path = resource::find_file(PACKAGE_TARNAME".png");
                if (!icon_path.empty())
                {
                        GdkPixbuf* iconPixbuf = gdk_pixbuf_new_from_file(icon_path.c_str(),
-                                                                                                                        NULL);
+                                       NULL);
                        gtk_window_set_icon(GTK_WINDOW(dialog), iconPixbuf);
                }
 
@@ -152,25 +145,23 @@ struct modal_dialog
                gtk_widget_destroy(dialog);
                // FIXME - this doesn't seem to actually remove the window from the
                // screen when it closes
-
 #elif WITH_GUI_QT4
-
-               int             argc = 0;
+               int     argc = 0;
                char**  argv;
                QApplication qt_app(argc, argv);
 
                QMessageBox::Icon icon_type;
                switch (type)
                {
-                       case warning:
-                               icon_type = QMessageBox::Warning;
-                               break;
-                       case error:
-                               icon_type = QMessageBox::Critical;
-                               break;
-                       default:
-                               icon_type = QMessageBox::Information;
-                               break;
+               case warning:
+                       icon_type = QMessageBox::Warning;
+                       break;
+               case error:
+                       icon_type = QMessageBox::Critical;
+                       break;
+               default:
+                       icon_type = QMessageBox::Information;
+                       break;
                }
 
                QMessageBox dialog;
@@ -180,7 +171,7 @@ struct modal_dialog
                dialog.setInformativeText(text2.c_str());
                dialog.setStandardButtons(QMessageBox::Close);
 
-               std::string icon_path = resource::find_file(PACKAGE".png");
+               std::string icon_path = resource::find_file(PACKAGE_TARNAME".png");
                if (!icon_path.empty())
                {
                        QIcon icon(icon_path.c_str());
@@ -188,7 +179,6 @@ struct modal_dialog
                }
 
                dialog.exec();
-
 #endif
        }
 };
index 38502d3393e0cac32c52d3e3c7c12036738874fb..998473b7f88535fb70d4324172c1f54f86e6c5e2 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_NETWORK_HH_
 #define _MOOF_NETWORK_HH_
index 3367bc8616ddcf569dfa78261bec5f90b9432462..6eeb5532f60427a07ada8bc167852c77c378be95 100644 (file)
@@ -1,24 +1,24 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_OPENGL_HH_
 #define _MOOF_OPENGL_HH_
 
 /**
  * \file opengl.hh
- * Defines macros for OpenGL functions that operate on scalars, vectors,
- * and matrices.
+ * Defines macros for OpenGL functions that operate on scalars, vectors, and
+ * matrices.
  */
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <vector>
 
 #define ARGS_V4                const moof::vector4& v
 #define PASS_V4                v[0], v[1], v[2], v[3]
 
-
 #if ENABLE_DOUBLE_PRECISION
 
-#define OPENGL_GENERIC_FUNC(R, N, L)                                                                   \
+#define OPENGL_GENERIC_FUNC(R, N, L)                                   \
        inline R gl##N(ARGS_##L) { gl##N##d(PASS_##L); }//
 
-#define OPENGL_ORDINAL_FUNC(R, N, K)                                                                   \
-       inline R gl##N(ARGS_##S##K) { gl##N##K##d(PASS_##S##K); }                       \
+#define OPENGL_ORDINAL_FUNC(R, N, K)                                   \
+       inline R gl##N(ARGS_##S##K) { gl##N##K##d(PASS_##S##K); }       \
        inline R gl##N(ARGS_##P##K) { gl##N##K##d##v(PASS_##P##K); }//
 
 #else
 
-#define OPENGL_GENERIC_FUNC(R, N, L)                                                                   \
+#define OPENGL_GENERIC_FUNC(R, N, L)                                   \
        inline R gl##N(ARGS_##L) { gl##N##f(PASS_##L); }//
 
-#define OPENGL_ORDINAL_FUNC(R, N, K)                                                                   \
-       inline R gl##N(ARGS_##S##K) { gl##N##K##f(PASS_##S##K); }                       \
+#define OPENGL_ORDINAL_FUNC(R, N, K)                                   \
+       inline R gl##N(ARGS_##S##K) { gl##N##K##f(PASS_##S##K); }       \
        inline R gl##N(ARGS_##P##K) { gl##N##K##f##v(PASS_##P##K); }//
 
 #endif
 
+OPENGL_GENERIC_FUNC(void, LoadMatrix, P);
+OPENGL_GENERIC_FUNC(void, LoadMatrix, M);
+OPENGL_GENERIC_FUNC(void, MultMatrix, P);
+OPENGL_GENERIC_FUNC(void, MultMatrix, M);
+OPENGL_GENERIC_FUNC(void, Scale,       S3);
+OPENGL_GENERIC_FUNC(void, Scale,       V3);
+OPENGL_GENERIC_FUNC(void, Rotate,      S4);
+OPENGL_GENERIC_FUNC(void, Rotate,      V4);
+OPENGL_GENERIC_FUNC(void, Translate,   S3);
+OPENGL_GENERIC_FUNC(void, Translate,   V3);
 
-OPENGL_GENERIC_FUNC(void,      LoadMatrix,     P);
-OPENGL_GENERIC_FUNC(void,      LoadMatrix,     M);
-OPENGL_GENERIC_FUNC(void,      MultMatrix, P);
-OPENGL_GENERIC_FUNC(void,      MultMatrix, M);
-
-OPENGL_GENERIC_FUNC(void,      Scale,          S3);
-OPENGL_GENERIC_FUNC(void,      Scale,          V3);
-OPENGL_GENERIC_FUNC(void,      Rotate,         S4);
-OPENGL_GENERIC_FUNC(void,      Rotate,         V4);
-OPENGL_GENERIC_FUNC(void,      Translate,      S3);
-OPENGL_GENERIC_FUNC(void,      Translate,      V3);
-
-OPENGL_ORDINAL_FUNC(void,      Color,          3);
-OPENGL_ORDINAL_FUNC(void,      Color,          4);
+OPENGL_ORDINAL_FUNC(void, Color, 3);
+OPENGL_ORDINAL_FUNC(void, Color, 4);
 
-OPENGL_ORDINAL_FUNC(void,      Vertex,         2);
-OPENGL_ORDINAL_FUNC(void,      Vertex,         3);
-OPENGL_ORDINAL_FUNC(void,      Vertex,         4);
+OPENGL_ORDINAL_FUNC(void, Vertex, 2);
+OPENGL_ORDINAL_FUNC(void, Vertex, 3);
+OPENGL_ORDINAL_FUNC(void, Vertex, 4);
 
-OPENGL_ORDINAL_FUNC(void,      TexCoord,       2);
-OPENGL_ORDINAL_FUNC(void,      TexCoord,       3);
-OPENGL_ORDINAL_FUNC(void,      TexCoord,       4);
-
-OPENGL_GENERIC_FUNC(void,      Rect,           S4);
-OPENGL_GENERIC_FUNC(void,      Rect,           V4);
+OPENGL_ORDINAL_FUNC(void, TexCoord, 2);
+OPENGL_ORDINAL_FUNC(void, TexCoord, 3);
+OPENGL_ORDINAL_FUNC(void, TexCoord, 4);
 
+OPENGL_GENERIC_FUNC(void, Rect, S4);
+OPENGL_GENERIC_FUNC(void, Rect, V4);
 
 inline void glMaterial(GLenum face, GLenum pname, moof::scalar s)
 {
@@ -136,12 +133,14 @@ inline void glDrawElements(GLenum type, const std::vector<GLuint>& v)
        glDrawElements(type, v.size(), GL_UNSIGNED_INT, &v[0]);
 }
 
-
+inline void glGetScalar(GLenum a, GLscalar* b)
+{
 #if ENABLE_DOUBLE_PRECISION
-inline void glGetScalar(GLenum a, GLscalar* b) { glGetDoublev(a, b); }
+       glGetDoublev(a, b);
 #else
-inline void glGetScalar(GLenum a, GLscalar* b) { glGetFloatv(a, b); }
+       glGetFloatv(a, b);
 #endif
+}
 
 
 #endif // _MOOF_OPENGL_HH_
index 4a175b0932cc0ded5f8039bcf3491cc6d215b3c3..dc9ce2d62a4116e8735327ea9fd9130cc4ef10da 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "aabb.hh"
 #include "plane.hh"
 namespace moof {
 
 
-plane::halfspace plane::intersects(const aabb<3>& aabb) const
+plane::halfspace plane::intersects(const aabb3& aabb) const
 {
-       vector3 corners[8];
        int nPositive = 8;
-
+       vector3 corners[8];
        aabb.get_corners(corners);
 
        for (int i = 0; i < 8; ++i)
        {
-               if (intersects(corners[i]) == negative)
-               {
-                       --nPositive;
-               }
+               if (intersects(corners[i]) == negative) --nPositive;
        }
 
-       if (nPositive == 0)      return negative;
+       if (nPositive == 0) return negative;
        else if (nPositive == 8) return positive;
-       else                     return intersecting;
+       return intersecting;
 }
 
-plane::halfspace plane::intersects(const sphere<3>& sphere) const
+plane::halfspace plane::intersects(const sphere3& sphere) const
 {
        scalar distance = distance_to_point(sphere.point);
 
-       if (distance < -sphere.radius)     return negative;
+       if (distance < -sphere.radius) return negative;
        else if (distance < sphere.radius) return intersecting;
-       else                               return positive;
+       return positive;
 }
 
 
index 5605831a3ca73ba5bbe37cc3b290b0ca3c0c66f9..83b5517385380a18f59c5cc167640d96b76e8e88 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_PLANE_HH_
 #define _MOOF_PLANE_HH_
 namespace moof {
 
 
+// forward declarations
 template <int D> class aabb;
 template <int D> class sphere;
 
-
 /**
- * A plane in 3-space defined by the equation Ax + By + Cz = D, where [A,
- * B, C] is normal to the plane.
+ * A plane in 3-space defined by the equation Ax + By + Cz = D, where [A, B,
+ * C] is normal to the plane.
  */
 struct plane : public shape<3>
 {
@@ -39,9 +37,9 @@ struct plane : public shape<3>
 
        enum halfspace
        {
-               negative                = -1,
+               negative        = -1,
                intersecting    =  0,
-               positive                =  1
+               positive        =  1
        };
 
        plane() {}
@@ -52,7 +50,6 @@ struct plane : public shape<3>
                normal(a, b, c),
                d(scalar) {}
 
-
        bool intersect_ray(const ray3& ray, ray3::contact& hit)
        {
                // solve: [(ray.point + t*ray.direction) dot normal] + d = 0
@@ -79,11 +76,10 @@ struct plane : public shape<3>
                if (hit.distance < SCALAR(0.0)) return false;
 
                if (numer >= 0.0) hit.normal = normal;
-               else              hit.normal = -normal;
+               else hit.normal = -normal;
                return true;
        }
 
-
        /* Causes the normal of the plane to become normalized.  The scalar may
         * also be changed to keep the equation true.  Word to the wise: don't
         * normalize a plane if the normal is the zero vector.
@@ -91,7 +87,6 @@ struct plane : public shape<3>
        void normalize()
        {
                scalar mag = normal.length();
-
                normal /= mag;
                d /= mag;
        }
@@ -109,8 +104,8 @@ struct plane : public shape<3>
                scalar distance = distance_to_point(point);
 
                if (is_equal(distance, 0.0)) return intersecting;
-               else if (distance < 0.0)     return negative;
-               else                         return positive;
+               else if (distance < 0.0) return negative;
+               return positive;
        }
 
        halfspace intersects(const aabb<3>& aabb) const;
index b1f7bdde88e54d937b124ee06433900df56c2de4..b992903b8bb2d892bf853af68d409d1e136363fa 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RAY_HH_
 #define _MOOF_RAY_HH_
@@ -73,9 +71,8 @@ struct ray : public drawable
        }
 };
 
-
-typedef ray<2> ray2;
-typedef ray<3> ray3;
+typedef ray<2> ray2;
+typedef ray<3> ray3;
 
 
 } // namespace moof
index 95b4c698501a05686a02d1789a3f428298939cb1..7a60d0e304e6e4c444dbeb5d920c3a5215c4e478 100644 (file)
@@ -1,15 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <queue>
 
 #include "hash.hh"
 #include "resource.hh"
 
-
 #ifndef BUF_SIZE
-#define BUF_SIZE 4096
+#define BUF_SIZE 8192
 #endif
 
 
 namespace moof {
-       
+
 
 /*] Filesystem searching
  *************************************************************************/
@@ -44,7 +43,6 @@ void resource::set_search_paths(const std::string& paths)
        boost::split(search_paths_, paths, boost::is_any_of(":"));
 }
 
-
 std::string resource::find_file(const std::string& name)
 {
        std::string ext = stlplus::extension_part(name);
@@ -76,8 +74,8 @@ std::string resource::find_file(const std::string& name)
        return std::string();
 }
 
-std::string resource::find_file(const std::string& name,
-                                                               const std::string& ext)
+std::string
+resource::find_file(const std::string& name, const std::string& ext)
 {
        std::string actual_ext = stlplus::extension_part(name);
        if (actual_ext != ext)
@@ -105,9 +103,7 @@ static struct rsrc_list
        {
                hash<std::string,resource_weakptr,hash_function>::iterator it;
                for (it = table.begin(); it != table.end(); ++it)
-               {
                        log_warning("leaked resource:", (*it).first);
-               }
        }
 #endif
 } rsrc_list;
@@ -131,7 +127,7 @@ static struct watch_list
        int add(resource_ptr rsrc)
        {
                int wd = inotify_add_watch(fd, rsrc->path().c_str(),
-                                                                  IN_DELETE_SELF | IN_MODIFY);
+                               IN_DELETE_SELF | IN_MODIFY);
                table[wd] = rsrc;
                return wd;
        }
@@ -142,22 +138,19 @@ static struct watch_list
 } watch_list;
 #endif
 
-
 resource_ptr resource::load(const std::string& name)
 {
        std::string ext = stlplus::extension_part(name);
        return load_with_path(find_file(name, ext), ext);
 }
 
-resource_ptr resource::load(const std::string& name,
-                                                       const std::string& ext)
+resource_ptr resource::load(const std::string& name, const std::string& ext)
 {
        return load_with_path(find_file(name, ext), ext);
 }
 
-
-resource_ptr resource::load_with_path(const std::string& path,
-                                                                         const std::string& ext)
+resource_ptr
+resource::load_with_path(const std::string& path, const std::string& ext)
 {
        if (path.empty()) return resource_ptr();
 
@@ -189,7 +182,6 @@ resource_ptr resource::load_with_path(const std::string& path,
        return resource_ptr();
 }
 
-
 /*] Hotloading
  *************************************************************************/
 
@@ -237,7 +229,6 @@ int resource::reload_as_needed()
                }
        }
 #endif
-
        return count;
 }
 
@@ -260,32 +251,30 @@ resource::~resource()
 #endif
 }
 
-
 /*] Resource registration
  *************************************************************************/
 
 bool resource::call_registry(const std::string& ext,
-                                                        loader_ptr& loader,
-                                                        registry_action action)
+               loader_ptr& loader, registry_action action)
 {
        static std::map<std::string,loader_ptr> table;
 
        switch (action)
        {
-               case set:
-               {
-                       if (loader) table[ext] = loader;
-                       else        table.erase(ext);
-                       break;
-               }
+       case lookup:
+       {
+               std::map<std::string,loader_ptr>::iterator it;
+               it = table.find(ext);
+               if (it != table.end()) loader = (*it).second;
+               break;
+       }
 
-               case lookup:
-               {
-                       std::map<std::string,loader_ptr>::iterator it;
-                       it = table.find(ext);
-                       if (it != table.end()) loader = (*it).second;
-                       break;
-               }
+       case set:
+               if (loader)
+                       table[ext] = loader;
+               else
+                       table.erase(ext);
+               break;
        }
 
        return loader;
index 094791c30f383b34538f6713227a190f69452ba3..41dfd61ac11d5ab3bbd94262fcf58c543183181f 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RESOURCE_HH_
 #define _MOOF_RESOURCE_HH_
@@ -34,7 +32,6 @@ namespace moof {
 class resource;
 typedef boost::shared_ptr<resource> resource_ptr;
 
-
 /**
  * Generic resource class capable of containing any type of resource,
  * providing a type-safe interface.
@@ -49,7 +46,6 @@ public:
         */
        static void set_search_paths(const std::string& paths);
 
-
        /**
         * Get the path to a resource of a given name.  This uses the search
         * path(s) and resources prefixes to locate resource files.
@@ -67,8 +63,8 @@ public:
         * extension is not already a part of name.
         * \return The full path of the resource.
         */
-       static std::string find_file(const std::string& name,
-                                                                const std::string& ext);
+       static std::string
+       find_file(const std::string& name, const std::string& ext);
 
        /**
         * Register a type with the extension of files which this type can
@@ -78,7 +74,7 @@ public:
         */
        template <class T>
        static void register_type(const std::string& extension,
-                                                         const std::string& prefix = "")
+                       const std::string& prefix = "")
        {
                loader_ptr loader(new specific_loader<T>(prefix));
                call_registry(extension, loader, set);
@@ -96,7 +92,6 @@ public:
                call_registry(extension, loader, set);
        }
 
-
        /**
         * Find and load a resource by name or path.
         * \param name The name or partial path of the resource.  This should
@@ -112,9 +107,8 @@ public:
         * \param 
         * \return The resource.
         */
-       static resource_ptr load(const std::string& name,
-                                                        const std::string& ext);
-
+       static resource_ptr
+       load(const std::string& name, const std::string& ext);
 
        /**
         * Reload the resource data.  This will cause the resource file to be
@@ -138,7 +132,6 @@ public:
         */
        static int reload_as_needed();
 
-
        /**
         * Get whether or not the type of the underlying resource data matches
         * an expected type.
@@ -162,13 +155,11 @@ public:
                return 0;
        }
 
-
        /**
         * Deconstruct a resource container.
         */
        virtual ~resource();
 
-
 private:
 
        template <class T>
@@ -178,9 +169,8 @@ private:
                unloader_(new specific_unloader<T>(ptr)),
                wd_(-1) {}
 
-       static resource_ptr load_with_path(const std::string& path,
-                                                                          const std::string& extension);
-
+       static resource_ptr
+       load_with_path(const std::string& path, const std::string& extension);
 
        class loader
        {
@@ -201,7 +191,6 @@ private:
                        return prefix_;
                }
 
-
        private:
 
                std::string prefix_;
@@ -223,7 +212,6 @@ private:
                }
        };
 
-
        class unloader
        {
        public:
@@ -246,13 +234,11 @@ private:
                        delete object_;
                }
 
-
        private:
 
                T* object_;
        };
 
-
        enum registry_action
        {
                lookup,
@@ -260,16 +246,14 @@ private:
        };
 
        static bool call_registry(const std::string& extension,
-                                                         loader_ptr& loader,
-                                                         registry_action action);
+                       loader_ptr& loader, registry_action action);
 
-
-       void*                   resource_;
+       void*           resource_;
        std::type_info* typeinfo_;
        unloader_ptr    unloader_;
-       int                             wd_;
-       std::string             path_;
-       std::string             type_;
+       int             wd_;
+       std::string     path_;
+       std::string     type_;
 };
 
 
@@ -301,7 +285,6 @@ public:
        resource_handle(const std::string& name, const std::string& ext) :
                resource_(resource::load(name, ext)) {}
 
-
        /**
         * Get whether or not the handle is dereferenceable to the type of this
         * handle.  A resource handle is dereferenceable if it is not a null
@@ -315,7 +298,6 @@ public:
                return resource_->check<T>();
        }
 
-
        /**
         * Get a pointer to the underlying resource.
         * \return The pointer, or null if this handle is not dereferenceable.
@@ -337,7 +319,6 @@ public:
                return *(resource_->get<T>());
        }
 
-
        /**
         * Same as get() for getting a pointer to the underlying resources.
         * \return The pointer, or null if this handle is not dereferenceable.
@@ -357,7 +338,6 @@ public:
                return get_reference();
        }
 
-
        /**
         * Unload the resource associated with this handle.
         */
@@ -366,13 +346,11 @@ public:
                resource_ = resource_ptr();
        }
 
-
 private:
 
        resource_ptr resource_;
 };
 
-
 /**
  * This macro easily registers types to act as resources.  It should be
  * used in a module file in global scope.
index 65e502c8483ae1530c594882b1adb4e1258254f1..67e12ddce4d4b87e1a48e7b17816cf3806c63bb5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RIGID_BODY_HH_
 #define _MOOF_RIGID_BODY_HH_
@@ -34,34 +32,28 @@ struct linear_state
 {
        typedef moof::vector< scalar, fixed<D> > vector;
        typedef boost::function<const vector& (const linear_state&)>
-                                                                                                       force_function;
+               force_function;
 
        // primary
-       
        vector          position;
        vector          momentum;
 
        // secondary
-
        vector          velocity;
 
        // user
-
        vector          force;
        std::vector<force_function> forces;
 
        // constant
-       
        scalar          mass;
        scalar          inverse_mass;
 
-
        void recalculate()
        {
                velocity = momentum * inverse_mass;
        }
 
-
        struct gravity_force
        {
                explicit gravity_force(scalar a = -9.8)
@@ -76,14 +68,12 @@ struct linear_state
                        return force;
                }
 
-
        private:
 
                vector force;
                scalar acceleration;
        };
 
-
        void init()
        {
                position.zero();
@@ -98,7 +88,6 @@ struct linear_state
                inverse_mass = 1.0 / mass;
        }
 
-
        struct derivative
        {
                vector  velocity;
@@ -121,7 +110,6 @@ struct linear_state
                }
        };
 
-
        vector total_force() const
        {
                vector f(force);
@@ -148,30 +136,24 @@ struct linear_state
        }
 };
 
-
 struct rotational_state2
 {
        // primary
-
        scalar          orientation;
        scalar          angular_momentum;
 
        // secondary
-
        scalar          angularVelocity;
 
        // constant
-
        scalar          inertia;
        scalar          inverse_inertia;
 
-
        void recalculate()
        {
                angularVelocity = angular_momentum * inertia;
        }
 
-
        struct derivative
        {
                scalar  angularVelocity;
@@ -189,21 +171,17 @@ struct rotational_state2
 struct rotational_state3
 {
        // primary
-
        quaternion      orientation;
        vector3         angular_momentum;
 
        // secondary
-
        quaternion      spin;
        vector3         angularVelocity;
 
        // constant
-
        scalar          inertia;
        scalar          inverse_inertia;
 
-
        void recalculate()
        {
                angularVelocity = angular_momentum * inertia;
@@ -239,7 +217,6 @@ struct state3 : public linear_state<3>, public rotational_state3
        }
 };
 
-
 template <class T>
 inline T interpolate(const T& a, const T& b, scalar alpha)
 {
@@ -247,37 +224,34 @@ inline T interpolate(const T& a, const T& b, scalar alpha)
 }
 
 template <>
-inline state2 interpolate<state2>(const state2& a, const state2& b,
-                                                                 scalar alpha)
+inline state2
+interpolate<state2>(const state2& a, const state2& b, scalar alpha)
 {
        state2 state(b);
        state.position = interpolate(a.position, b.position, alpha);
        state.momentum = interpolate(a.momentum, b.momentum, alpha);
        state.orientation = interpolate(a.orientation, b.orientation, alpha);
        state.angular_momentum = interpolate(a.angular_momentum,
-                                                                               b.angular_momentum, alpha);
+                       b.angular_momentum, alpha);
        return state;
 }
 
 template <>
-inline state3 interpolate<state3>(const state3& a, const state3& b,
-                                                                 scalar alpha)
+inline state3
+interpolate<state3>(const state3& a, const state3& b, scalar alpha)
 {
        state3 state(b);
        state.position = interpolate(a.position, b.position, alpha);
        state.momentum = interpolate(a.momentum, b.momentum, alpha);
        state.orientation = slerp(a.orientation, b.orientation, alpha);
        state.angular_momentum = interpolate(a.angular_momentum,
-                                                                               b.angular_momentum, alpha);
+                       b.angular_momentum, alpha);
        return state;
 }
 
-
-
 /**
  * Interface for anything that can move.
  */
-
 template <class T>
 class rigid_body : public entity
 {
index 98bc3a22cad4b1b2b46b1258b9fe3d03fb999e5a..f8e4ccfd08596ed6a91e6c1c6109f26854d6ac3a 100644 (file)
@@ -1,15 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <algorithm>
 
@@ -27,27 +27,24 @@ bool comp(timer* a, timer* b)
        return a->expiration() < b->expiration();
 }
 
-void runloop::run_once()
+
+int runloop::run_once()
 {
 #if ENABLE_THREADS
        thread_id_ = thread::current_identifier();
 #endif
 
        //log_debug("------------------------------------");
-       //scalar next_event = SCALAR(0.0);
-       {
-               MOOF_MUTEX_LOCK(timers_mutex_);
+       int expired = 0;
+       MOOF_MUTEX_LOCK(timers_mutex_);
 
-               for (timers_it_ = timers_.begin();
-                        timers_it_ != timers_.end();
-                        ++timers_it_)
-               {
-                       (*timers_it_)->fire_if_expired();
-               }
-
-               std::sort(timers_.begin(), timers_.end(), comp);
-               //next_event = timers_[0]->expiration();
+       std::sort(timers_.begin(), timers_.end(), comp);
+       for (timers_it_ = timers_.begin();
+                timers_it_ != timers_.end(); ++timers_it_)
+       {
+               if ((*timers_it_)->fire_if_expired()) ++expired;
        }
+       return expired;
 }
 
 int runloop::run()
@@ -55,22 +52,21 @@ int runloop::run()
        stop_ = false;
        while (!stop_)
        {
-               run_once();
-               //timer::sleep(next_event, timer::absolute);
-               timer::sleep(SCALAR(0.0));
+               if (run_once() == 0);//timer::sleep(SCALAR(0.0));
+               // TODO: maybe sleep(0.0001) will actually return sooner than
+               // sleep(0)... if the kernel interprets sleep(0) as we don't need
+               // to process for an arbitrarily long timespan while specifying a
+               // value lets the kernel know when we need control back...
        }
-
        return code_;
 }
 
-
 void runloop::stop(int code)
 {
        code_ = code;
        stop_ = true;
 }
 
-
 void runloop::add_timer(timer& timer)
 {
 #if ENABLE_THREADS
index 29529521e8d16c96a35c4472fbe603e93396e8ce..6d56d83dcb60662a7a2fd0bb0367d5c24806ad32 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_RUNLOOP_HH_
 #define _MOOF_RUNLOOP_HH_
@@ -29,7 +27,6 @@ namespace moof {
 
 // forward declarations
 class timer;
-       
 
 /**
  * A runloop is a loop with scheduled timers.
@@ -51,9 +48,9 @@ public:
 
        /**
         * Do one iteration of the runloop.
+        * \return The number of tasks which were given time.
         */
-       void run_once();
-
+       int run_once();
 
        /**
         * Start running the runloop.
@@ -67,15 +64,18 @@ public:
         */
        void stop(int code = 0);
 
+       bool is_running() const
+       {
+               return !stop_;
+       }
 
        void add_timer(timer& timer);
        void remove_timer(timer& timer);
 
-
 private:
 
        bool            stop_;
-       int                     code_;
+       int             code_;
 
        typedef std::vector<timer*> timer_table;
        timer_table     timers_;
index 35e80d22eb6a8e57cec4d2b81fc148249888b863..79412acb3bb4b9526d782d54dca8699676621100 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SCRIPT_HH_
 #define _MOOF_SCRIPT_HH_
  * \file script.hh
  * A thin wrapper over Lua 5.1.  This is not meant as a complicated binding
  * package between C++ and Lua.  It is not meant to obscure the division
- * between C++ and Lua but rather to clarify it and make it more
- * manageable.  It does not hide the concept of the Lua stack, but rather
- * provides that mechanism with a certain level of abstraction while also
- * providing a cleaner, more consistent API.
+ * between C++ and Lua but rather to clarify it and make it more manageable.
+ * It does not hide the concept of the Lua stack, but rather provides that
+ * mechanism with a certain level of abstraction while also providing a
+ * cleaner, more consistent API.
  */
 
 #include <cstring>
@@ -43,7 +41,6 @@ namespace moof {
 class script;
 typedef boost::shared_ptr<script> script_ptr;
 
-
 class script
 {
 public:
@@ -53,13 +50,13 @@ public:
 
        enum status
        {
-               success                 = 0,
-               yielding                = LUA_YIELD,
+               success         = 0,
+               yielding        = LUA_YIELD,
                runtime_error   = LUA_ERRRUN,
                syntax_error    = LUA_ERRSYNTAX,
                memory_error    = LUA_ERRMEM,
                handler_error   = LUA_ERRERR,
-               file_error              = LUA_ERRFILE
+               file_error      = LUA_ERRFILE
        };
 
        enum pseudoindex
@@ -69,7 +66,6 @@ public:
                globals_index           = LUA_GLOBALSINDEX
        };
 
-
        template <class T>
        static int object_finalizer(script& script)
        {
@@ -77,88 +73,108 @@ public:
                return 0;
        }
 
-
        /**
         * This is the most prominent abstraction on top of the standard Lua
         * API.  A slot object represents a value on the stack.  More
         * specifically, it represents a position on the stack.  The
         * distinction is only important when objects are moved around on the
         * stack or if the slot represents a negative index on the stack (the
-        * value of which will change as things are pushed onto and popped from
-        * the stack).
+        * value of which will change as things are pushed onto and popped
+        * from the stack).
         */
        struct slot
        {
                /**
-                * You have direct access to the index of the value on the stack
-                * being represented.
+                * You have direct access to the index of the value on the
+                * stack being represented.
                 */
                int index;
 
-
                enum type
                {
-                       none                    = LUA_TNONE,
-                       nil                             = LUA_TNIL,
-                       boolean                 = LUA_TBOOLEAN,
-                       light_data              = LUA_TLIGHTUSERDATA,
-                       number                  = LUA_TNUMBER,
-                       string                  = LUA_TSTRING,
-                       table                   = LUA_TTABLE,
-                       function                = LUA_TFUNCTION,
-                       data                    = LUA_TUSERDATA,
-                       thread                  = LUA_TTHREAD
+                       none            = LUA_TNONE,
+                       nil             = LUA_TNIL,
+                       boolean         = LUA_TBOOLEAN,
+                       light_data      = LUA_TLIGHTUSERDATA,
+                       number          = LUA_TNUMBER,
+                       string          = LUA_TSTRING,
+                       table           = LUA_TTABLE,
+                       function        = LUA_TFUNCTION,
+                       data            = LUA_TUSERDATA,
+                       thread          = LUA_TTHREAD
                };
 
                static std::string type_name(type type)
                {
                        switch (type)
                        {
-                               case none:                      return "none";
-                               case nil:                       return "nil";
-                               case boolean:           return "boolean";
+                               case none:      return "none";
+                               case nil:       return "nil";
+                               case boolean:   return "boolean";
                                case light_data:
-                               case data:                      return "userdata";
-                               case number:            return "number";
-                               case string:            return "string";
-                               case table:                     return "table";
-                               case function:          return "function";
-                               case thread:            return "thread";
+                               case data:      return "userdata";
+                               case number:    return "number";
+                               case string:    return "string";
+                               case table:     return "table";
+                               case function:  return "function";
+                               case thread:    return "thread";
                        }
                        return "?";
                }
 
-
                slot(const class script& s, int i = 0) :
                        index(i),
                        script_(const_cast<class script*>(&s)) {}
 
-
                // check the type of the value
                bool is_boolean() const
-               { return (bool)lua_isboolean(script_->state_, index); }
+               {
+                       return (bool)lua_isboolean(script_->state_, index);
+               }
                bool is_imported_function() const
-               { return (bool)lua_iscfunction(script_->state_, index); }
+               {
+                       return (bool)lua_iscfunction(script_->state_, index);
+               }
                bool is_function() const
-               { return (bool)lua_isfunction(script_->state_, index); }
+               {
+                       return (bool)lua_isfunction(script_->state_, index);
+               }
                bool is_nil() const
-               { return (bool)lua_isnil(script_->state_, index); }
+               {
+                       return (bool)lua_isnil(script_->state_, index);
+               }
                bool is_none() const
-               { return (bool)lua_isnone(script_->state_, index); }
+               {
+                       return (bool)lua_isnone(script_->state_, index);
+               }
                bool is_none_or_nil() const
-               { return (bool)lua_isnoneornil(script_->state_, index); }
+               {
+                       return (bool)lua_isnoneornil(script_->state_, index);
+               }
                bool is_number() const
-               { return (bool)lua_isnumber(script_->state_, index); }
+               {
+                       return (bool)lua_isnumber(script_->state_, index);
+               }
                bool is_string() const
-               { return (bool)lua_isstring(script_->state_, index); }
+               {
+                       return (bool)lua_isstring(script_->state_, index);
+               }
                bool is_table() const
-               { return (bool)lua_istable(script_->state_, index); }
+               {
+                       return (bool)lua_istable(script_->state_, index);
+               }
                bool is_thread() const
-               { return (bool)lua_isthread(script_->state_, index); }
+               {
+                       return (bool)lua_isthread(script_->state_, index);
+               }
                bool is_data() const
-               { return (bool)lua_isuserdata(script_->state_, index); }
+               {
+                       return (bool)lua_isuserdata(script_->state_, index);
+               }
                bool is_light_data() const
-               { return (bool)lua_islightuserdata(script_->state_, index); }
+               {
+                       return (bool)lua_islightuserdata(script_->state_, index);
+               }
 
                /**
                 * Check the value and throw an error if its the wrong type.
@@ -169,49 +185,58 @@ public:
                        return *this;
                }
 
-               const slot& require_boolean(const std::string& what = "boolean") const
+               const slot&
+               require_boolean(const std::string& what = "boolean") const
                {
                        if (!is_boolean()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_number(const std::string& what = "number") const
+               const slot&
+               require_number(const std::string& what = "number") const
                {
                        if (!is_number()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_string(const std::string& what = "string") const
+               const slot&
+               require_string(const std::string& what = "string") const
                {
                        if (!is_string()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_table(const std::string& what = "table") const
+               const slot&
+               require_table(const std::string& what = "table") const
                {
                        if (!is_table()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_function(const std::string& what = "function") const
+               const slot&
+               require_function(const std::string& what = "function") const
                {
                        if (!is_function()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_data(const std::string& what = "userdata") const
+               const slot&
+               require_data(const std::string& what = "userdata") const
                {
                        if (!is_data()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_nil(const std::string& what = "nil") const
+               const slot&
+               require_nil(const std::string& what = "nil") const
                {
                        if (!is_nil()) raise_type_error(what);
                        return *this;
                }
-               const slot& require_thread(const std::string& what = "thread") const
+               const slot&
+               require_thread(const std::string& what = "thread") const
                {
                        if (!is_thread()) raise_type_error(what);
                        return *this;
                }
 
                template <class T>
-               const slot& require_object(const std::string& what = typeid(T).name()) const
+               const slot&
+               require_object(const std::string& what = typeid(T).name()) const
                {
                        if (!is_data()) raise_type_error(what);
 
@@ -235,7 +260,6 @@ public:
                        return *this;
                }
 
-
                /**
                 * Get the type of the value.
                 */
@@ -249,7 +273,10 @@ public:
                 */
                std::string type_name() const
                {
-                       if (is_none()) return "none";
+                       if (is_none())
+                       {
+                               return "none";
+                       }
                        else if (is_data() && !is_light_data())
                        {
                                slot metatable = push_metatable();
@@ -273,16 +300,14 @@ public:
                        return luaL_typename(script_->state_, index);
                }
 
-
                /**
-                * Get the length of the value according to the definition given by
-                * Lua.
+                * Get the length of the value according to the definition
+                * given by Lua.
                 */
                size_t size() const
                {
                        return lua_objlen(script_->state_, index);
                }
-
                size_t length() const
                {
                        return size();
@@ -290,11 +315,12 @@ public:
 
                int positive_index() const
                {
-                       if (index < 0) return index + lua_gettop(script_->state_) + 1;
-                       else           return index;
+                       if (index < 0)
+                               return index + lua_gettop(script_->state_) + 1;
+                       else
+                               return index;
                }
 
-
                /**
                 * Get a pointer value (for userdata, tables, threads, and
                 * functions).
@@ -314,18 +340,18 @@ public:
                        return !is_none();
                }
 
-
                bool operator == (const slot& rhs) const
                {
-                       return (bool)lua_equal(script_->state_, index, rhs.index);
+                       return (bool)lua_equal(script_->state_,
+                                       index, rhs.index);
                }
 
                bool operator < (const slot& rhs) const
                {
-                       return (bool)lua_lessthan(script_->state_, index, rhs.index);
+                       return (bool)lua_lessthan(script_->state_,
+                                       index, rhs.index);
                }
 
-
                /**
                 * Convert the underlying value to a C++ type.
                 */
@@ -414,7 +440,7 @@ public:
                        array.clear();
 
                        slot    value = (*script_)[-1];
-                       int             realIndex = positive_index();
+                       int     realIndex = positive_index();
 
                        bool done = false;
                        for (int i = 1; !done; ++i)
@@ -422,8 +448,10 @@ public:
                                lua_rawgeti(script_->state_, realIndex, i);
 
                                T v;
-                               if (value.get(v)) array.push_back(v);
-                               else              done = true;
+                               if (value.get(v))
+                                       array.push_back(v);
+                               else
+                                       done = true;
 
                                script_->pop();
                        }
@@ -440,7 +468,7 @@ public:
 
                        slot    key = (*script_)[-2];
                        slot    value = (*script_)[-1];
-                       int             realIndex = positive_index();
+                       int     realIndex = positive_index();
 
                        script_->push_nil();
                        while (lua_next(script_->state_, realIndex) != 0)
@@ -469,7 +497,6 @@ public:
                        return ret;
                }
 
-
                template <class T, class V>
                void set_field(const T& field, const V& value)
                {
@@ -483,7 +510,6 @@ public:
                        lua_settable(script_->state_, index);
                }
 
-
                void set_field(const std::string& field)
                {
                        set_field(field.c_str());
@@ -493,7 +519,6 @@ public:
                        lua_setfield(script_->state_, index, field);
                }
 
-
                template <class T>
                void set_field(const std::string& field, const T& value)
                {
@@ -539,7 +564,6 @@ public:
                        set();
                }
 
-
                void remove()
                {
                        lua_remove(script_->state_, index);
@@ -550,8 +574,11 @@ public:
                 */
                void pop()
                {
-                       if (index < 0) script_->pop(-index);
-                       else script_->pop(script_->stack_size() - index + 1);
+                       if
+                               (index < 0) script_->pop(-index);
+                       else
+                               script_->pop(script_->stack_size() -
+                                               index + 1);
                }
 
                /**
@@ -563,7 +590,6 @@ public:
                        lua_insert(script_->state_, index);
                }
 
-
                /**
                 * Copy the value and push the copy to the stack.
                 */
@@ -585,7 +611,6 @@ public:
                        return script_->top();
                }
 
-
                slot push_field() const
                {
                        lua_gettable(script_->state_, index);
@@ -609,7 +634,6 @@ public:
                        return script_->top();
                }
 
-
                class script& script()
                {
                        return *script_;
@@ -620,10 +644,9 @@ public:
                        return *script_;
                }
 
-
                /**
-                * Throw an exception with a message formatted to communicate a
-                * type mismatch with the argument represented by this slot.
+                * Throw an exception with a message formatted to communicate
+                * type mismatch with the argument represented by this slot.
                 */
                int raise_type_error(const std::string& expected) const
                {
@@ -659,13 +682,11 @@ public:
                        return 0;
                }
 
-
        private:
 
                mutable class script* script_;
        };
 
-
        script() :
                state_(0)
        {
@@ -677,7 +698,6 @@ public:
                destroy();
        }
 
-
        static script_ptr alloc()
        {
                return script_ptr(new script);
@@ -689,7 +709,6 @@ public:
                state_ = luaL_newstate();
        }
 
-
        void import_standard_libraries()
        {
                luaL_openlibs(state_);
@@ -727,49 +746,42 @@ public:
                push(LUA_COLIBNAME);
                call(1, 0);
        }
-
        void import_package_library()
        {
                push(luaopen_package);
                push(LUA_LOADLIBNAME);
                call(1, 0);
        }
-
        void import_string_library()
        {
                push(luaopen_string);
                push(LUA_STRLIBNAME);
                call(1, 0);
        }
-
        void import_table_library()
        {
                push(luaopen_table);
                push(LUA_TABLIBNAME);
                call(1, 0);
        }
-
        void import_math_library()
        {
                push(luaopen_math);
                push(LUA_MATHLIBNAME);
                call(1, 0);
        }
-
        void import_io_library()
        {
                push(luaopen_io);
                push(LUA_IOLIBNAME);
                call(1, 0);
        }
-
        void import_os_library()
        {
                push(luaopen_os);
                push(LUA_OSLIBNAME);
                call(1, 0);
        }
-
        void import_debug_library()
        {
                push(luaopen_debug);
@@ -777,8 +789,8 @@ public:
                call(1, 0);
        }
 
-
-       void import_function(const std::string& name, const function& function)
+       void
+       import_function(const std::string& name, const function& function)
        {
                push(function);
                lua_setglobal(state_, name.c_str());
@@ -794,7 +806,6 @@ public:
                return status(luaL_dofile(state_, file.c_str()));
        }
 
-
        /*
         * Thread-handling methods.
         */
@@ -832,7 +843,6 @@ public:
                return is_main;
        }
 
-
        /**
         * Throw an error with the value at the top of the stack.  If this is
         * called from an imported function, the error will be caught and
@@ -855,7 +865,6 @@ public:
                return 0;
        }
 
-
        /*
         * Get significant values.
         */
@@ -864,23 +873,19 @@ public:
        {
                return slot(*this, globals_index);
        }
-
        slot registry() const
        {
                return slot(*this, registry_index);
        }
-
        slot environment() const
        {
                return slot(*this, environment_index);
        }
-
        slot top() const
        {
                return slot(*this, stack_size());
        }
 
-
        /**
         * Set the size of the stack.
         * \param size The stack size.
@@ -908,7 +913,6 @@ public:
                stack_size(0);
        }
 
-
        /**
         * Makes sure there is at least extra more places on the stack.
         * Returns false if space couldn't be created.  Just like with the
@@ -921,7 +925,6 @@ public:
                return (bool)lua_checkstack(state_, extra);
        }
 
-
        /**
         * Concatenates the top-most n slots on the stack.
         */
@@ -930,7 +933,6 @@ public:
                lua_concat(state_, n);
        }
 
-
        /*
         * Push some values onto the stack.
         */
@@ -1090,12 +1092,10 @@ public:
        }
 
        slot push_code(const std::string& name,
-                                  const char* buffer,
-                                  size_t size,
-                                  status& result)
+                       const char* buffer, size_t size, status& result)
        {
                result = status(luaL_loadbuffer(state_,
-                                                                               buffer, size, name.c_str()));
+                                       buffer, size, name.c_str()));
                return top();
        }
 
@@ -1108,7 +1108,8 @@ public:
        template <class T>
        slot push_pointer(const T* ptr)
        {
-               lua_pushlightuserdata(state_, const_cast<void*>((const void*)ptr));
+               lua_pushlightuserdata(state_,
+                               const_cast<void*>((const void*)ptr));
                return top();
        }
        slot push_pointer(cfunction function)
@@ -1152,7 +1153,6 @@ public:
                return push_pointer(&typeid(T));
        }
 
-
        /**
         * Call a function on the stack.  The correct procedure is to push a
         * function onto the stack followed by nargs arguments.  This method
@@ -1164,7 +1164,6 @@ public:
                return status(lua_pcall(state_, nargs, nresults, 0));
        }
 
-
        /**
         * Pops n values from the top of the stack.
         */
@@ -1173,7 +1172,6 @@ public:
                lua_pop(state_, n);
        }
 
-
        /**
         * Index into the stack to get a slot.
         */
@@ -1182,7 +1180,6 @@ public:
                return slot(*this, index);
        }
 
-
        /*
         * Control over the garbage collection process.
         */
@@ -1218,7 +1215,6 @@ public:
                lua_gc(state_, LUA_GCSETSTEPMUL, step);
        }
 
-
 private:
 
        script(lua_State* state) :
@@ -1237,15 +1233,12 @@ private:
                slot metatable = push_metatable(typeid(T).name(), is_new);
                if (is_new)
                {
-                       metatable.push_copy();                          // class behavior
+                       metatable.push_copy();                  // class behavior
                        metatable.set_field("__index");
-
                        push_type<T>();
                        metatable.set_field("__cxxtype");       // type_info
-
                        push(object_finalizer_<T>);
                        metatable.set_field("__gc");            // finalizer
-
                        //push(object_tostring_<T>);
                        //metatable.set_field("__tostring");    // tostring
                }
@@ -1257,7 +1250,8 @@ private:
        {
                std::ostringstream stream;
                stream << *reinterpret_cast<T*>(lua_touserdata(state, 1));
-               lua_pushlstring(state, stream.str().c_str(), stream.str().length());
+               lua_pushlstring(state,
+                               stream.str().c_str(), stream.str().length());
                return 1;
        }
 
@@ -1303,7 +1297,6 @@ private:
                }
        }
 
-
        static int call_function(lua_State* state)
        {
                cfunction function = (cfunction)lua_touserdata(state,
@@ -1339,24 +1332,21 @@ private:
                }
        }
 
-
        void destroy()
        {
                if (is_main_thread()) lua_close(state_);
        }
 
-
        lua_State*                      state_;
 };
 
 using namespace std::rel_ops;
 
-
 /**
  * Output a script value to a stream.
  */
-inline std::ostream& operator << (std::ostream& stream,
-                                                                 const script::slot& slot)
+inline std::ostream&
+operator << (std::ostream& stream, const script::slot& slot)
 {
        std::string     str;
        bool            boolean;
@@ -1368,7 +1358,7 @@ inline std::ostream& operator << (std::ostream& stream,
        else if (slot.get(boolean))
        {
                if (boolean) stream << "true";
-               else         stream << "false";
+               else stream << "false";
        }
        else if (slot.is_nil())
        {
index 869b541344f4e9e79b6b36a3a8b1499a6a06af31..c96f81fa2e258ea7dbf552ea4e605965b51360ec 100644 (file)
@@ -1,28 +1,24 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "service.hh"
 #include "socket.hh"
 
-
-#define SOLICIT  0x1234ABCD
-#define RESPONSE 0xABCD1234
+#define SOLICIT                0x1234ABCD
+#define RESPONSE       0xABCD1234
 
 
 namespace moof {
 
 
 int service::handle_packet(socket_multiplexer& mux,
-                                                  packet& packet,
-                                                  const socket::address& address)
+               packet& packet, const socket::address& address)
 {
        try
        {
@@ -41,13 +37,14 @@ int service::handle_packet(socket_multiplexer& mux,
                        }
                }
        }
-       catch (...) {}
+       catch (...)
+       {
+       }
        return -1;
 }
 
 int service_finder::handle_packet(socket_multiplexer& mux,
-                                                                 packet& packet,
-                                                                 const socket::address& address)
+               packet& packet, const socket::address& address)
 {
        try
        {
@@ -68,7 +65,9 @@ int service_finder::handle_packet(socket_multiplexer& mux,
                        }
                }
        }
-       catch (...) {}
+       catch (...)
+       {
+       }
        return -1;
 }
 
index 6db1d964b1e47a76c0cfc2c77af0fb9962a8f374..c0ca674112b89921399e407c601a59ae9431cdfe 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SERVICE_HH_
 #define _MOOF_SERVICE_HH_
@@ -56,7 +54,6 @@ public:
                        const std::string& name,
                        const std::string& text);
 
-
        /**
         * Publish the service on the network.
         */
@@ -67,7 +64,6 @@ public:
         */
        void stop();
 
-
        /**
         * Get the host address.
         * \return The address.
@@ -104,20 +100,17 @@ public:
                return text_;
        }
 
-
        ~service();
 
-
 private:
 
        int handle_packet(socket_multiplexer& mux,
-                                        packet& packet,
-                                        const socket::address& address);
+                       packet& packet, const socket::address& address);
 
        socket::address address_;
-       std::string             type_;
-       std::string             name_;
-       std::string             text_;
+       std::string     type_;
+       std::string     name_;
+       std::string     text_;
 };
 
 
@@ -138,22 +131,19 @@ public:
         * \param sockType The type of socket.
         */
        explicit service_finder(const std::string& type,
-                                                       int sockType = SOCK_STREAM);
-
+                       int sockType = SOCK_STREAM);
 
        const std::map<std::string,service>& services() const
        {
                return services_;
        }
 
-
 private:
 
        int handle_packet(socket_multiplexer& mux,
-                                         packet& packet,
-                                         const socket::address& address);
+                       packet& packet, const socket::address& address);
 
-       std::string                                             type_;
+       std::string                     type_;
        std::map<std::string,service>   services_;
 };
 
index 11dfe31b7d9b4478af16a457cb1e42863602e0c0..78f72939d2a58faa9aada73ae7014232e7f5a9a9 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <stlplus/portability/file_system.hpp>
 
@@ -32,7 +30,6 @@ settings::~settings()
        save();
 }
 
-
 void settings::parse_args(int argc, char* argv[])
 {
        for (int i = 1; i < argc; ++i)
@@ -47,12 +44,10 @@ void settings::parse_args(int argc, char* argv[])
        }
 }
 
-
 void settings::load_files(const std::string& path)
 {
        std::vector<std::string> paths;
        boost::split(paths, path, boost::is_any_of(":"));
-
        load_files(paths);
 }
 
@@ -69,11 +64,10 @@ void settings::load_files(const std::vector<std::string>& path)
                        boost::replace_all(*it, "$HOME", home);
 
                        //logDebug("Copying global settings...");
-                       //mUserFile = *it;
+                       //userfile_ = *it;
                        //mGlobals.push_copy();
                        //script_.set("globals", script::registry_index);
                }
-
                if (script_.do_file(*it) != script::success)
                {
                        std::string str;
@@ -84,16 +78,14 @@ void settings::load_files(const std::vector<std::string>& path)
        }
 }
 
-
 void settings::clear()
 {
        script_.reset();
 }
 
-
 void settings::save_as(const std::string& path)
 {
-       mUserFile = path;
+       userfile_ = path;
        save();
 }
 
index 4807eeb16d8745ddba02c0b2762172586cc7230f..c8459cf1ee4b69f9fc2c88c00aaba6f401fb4dbc 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SETTINGS_HH_
 #define _MOOF_SETTINGS_HH_
@@ -33,7 +31,6 @@ class settings
 public:
 
        settings(int argc, char* argv[], const std::string& path);
-
        ~settings();
 
        void parse_args(int argc, char* argv[]);
@@ -41,7 +38,6 @@ public:
        void load_files(const std::string& path);
        void load_files(const std::vector<std::string>& path);
 
-
        /**
         * Remove all settings.
         */
@@ -50,7 +46,6 @@ public:
        void save_as(const std::string& path);
        void save() const;
 
-
        /**
         * Get a setting by name.
         * \param key The name of the setting.
@@ -60,15 +55,12 @@ public:
        template <class T>
        bool get(const std::string& key, T& value) const;
 
-
 private:
 
        mutable script  script_;
-
-       std::string             mUserFile;
+       std::string     userfile_;
 };
 
-
 template <class T>
 bool settings::get(const std::string& key, T& value) const
 {
index 25c8c2aa5c43c201436b9708f4042c3a6d4ad28e..9af106bf424831e4808956631b647946d4be6947 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SHAPE_HH_
 #define _MOOF_SHAPE_HH_
 #include <moof/opengl.hh>
 #include <moof/ray.hh>
 
-
 // frustum
 // plane (can construct from triangle2)
 // ray
 // shape<>
 // +- line<>
-// -   line2                   line<2>
-// -   line3                   line<3>
+// -   line2           line<2>
+// -   line3           line<3>
 // +- sphere<>
 // |   sphere2, circle sphere<2>
-// |   sphere3                 sphere<3>
+// |   sphere3         sphere<3>
 // +- aabb<>
 // |   aabb2, rectangle        aabb<2>
-// |   aabb3                   aabb<3>
+// |   aabb3           aabb<3>
 // +- polygon<>
-// |   triangle2               polygon<2,3>
-// |   triangle3               polygon<3,3>
+// |   triangle2       polygon<2,3>
+// |   triangle3       polygon<3,3>
 
 
 namespace moof {
@@ -58,15 +55,14 @@ public:
         * returned if there is no contact.
         */
        virtual bool intersect_ray(const ray<D>& ray,
-                                                          typename moof::ray<D>::contact& hit) const
+                       typename moof::ray<D>::contact& hit) const
        {
                return false;
        }
 };
 
-
-typedef shape<2>       shape2;
-typedef shape<3>       shape3;
+typedef shape<2> shape2;
+typedef shape<3> shape3;
 
 
 } // namespace moof
index 864c68abda05f3820f823e8a81922fb2a9b909ea..8b22c4798e95967b2c7ce848fd206a28641de938 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <deque>
 #include <stdexcept>
 #include "thread.hh"
 #include "timer.hh"
 
-
 #ifndef BUF_SIZE
-#define BUF_SIZE               (4096)
+#define BUF_SIZE 8192
 #endif
 
-#define NUM_SAMPLE_BITS        (16)
+#define NUM_SAMPLE_BITS        16
 
 
 namespace moof {
@@ -41,9 +38,6 @@ namespace moof {
 thread stream_thread_;
 
 
-/*] Sound backend
- *************************************************************************/
-
 class sound_backend
 {
 public:
@@ -57,27 +51,25 @@ public:
                        if (!al_device || !al_context)
                        {
                                const char* error = alcGetString(al_device,
-                                                                                                alcGetError(al_device));
+                                               alcGetError(al_device));
                                log_error("audio subsystem initialization failure", error);
                        }
                        else
                        {
                                alcMakeContextCurrent(al_context);
-                               log_info << "opened sound device `"
-                                                << alcGetString(al_device,
-                                                                                ALC_DEFAULT_DEVICE_SPECIFIER)
-                                                << "'" << std::endl;
+                               log_info << "opened sound device `" <<
+                                       alcGetString(al_device, ALC_DEFAULT_DEVICE_SPECIFIER) <<
+                                       "'" << std::endl;
                        }
                }
        }
 
-
        sound_backend(const sound_backend& backend)
        {
                ++retain_count;
        }
 
-       sound_backend& operator=(const sound_backend& backend)
+       sound_backend& operator = (const sound_backend& backend)
        {
                ++retain_count;
                return *this;
@@ -93,26 +85,21 @@ public:
                }
        }
 
-
-       static int                      retain_count;
+       static int              retain_count;
        static ALCdevice*       al_device;
        static ALCcontext*      al_context;
 };
 
-int                    sound_backend::retain_count = 0;
+int            sound_backend::retain_count = 0;
 ALCdevice*     sound_backend::al_device;
 ALCcontext*    sound_backend::al_context;
 
-
 class sound_resource;
 typedef resource_handle<sound_resource> sound_handle;
 
 MOOF_REGISTER_RESOURCE(sound_resource, ogg, sounds);
 
 
-/*] Sound resource
- *************************************************************************/
-
 class sound_resource : public boost::noncopyable
 {
 public:
@@ -122,9 +109,8 @@ public:
                sample_(0)
        {
                if (ov_fopen((char*)path.c_str(), &file_) < 0)
-               {
-                       throw std::runtime_error("problem reading audio: " + path);
-               }
+                       throw std::runtime_error("problem reading audio: " +
+                                       path);
        }
 
        ~sound_resource()
@@ -133,7 +119,6 @@ public:
                if (buffer_) alDeleteBuffers(1, &buffer_);
        }
 
-
        ALuint read_all() const
        {
                if (buffer_) return buffer_;
@@ -152,9 +137,8 @@ public:
                while (size < sizeof(data))
                {
                        int     section;
-                       int     result = ov_read(&file_,
-                                                                data + size, sizeof(data) - size,
-                                                                0, 2, 1, &section);
+                       int     result = ov_read(&file_, data + size,
+                                       sizeof(data) - size, 0, 2, 1, &section);
 
                        if (0 < result)
                        {
@@ -167,7 +151,7 @@ public:
                                ALuint buffer;
                                alGenBuffers(1, &buffer);
                                alBufferData(buffer, get_audio_format(info),
-                                                        data, size, info->rate);
+                                               data, size, info->rate);
 
                                buffer_ = buffer;
                                return buffer;
@@ -178,7 +162,6 @@ public:
                                break;
                        }
                }
-
                return AL_NONE;
        }
 
@@ -186,13 +169,12 @@ public:
        {
                if ((sample == sample_ && ov_pcm_seek_lap(&file_, sample) != 0) ||
                        (sample != sample_ && ov_pcm_seek(&file_, sample) != 0))
-               {
                        return false;
-               }
 
-               char data[BUF_SIZE];
+               char    data[BUF_SIZE];
                int     section;
-               int     result = ov_read(&file_, data, sizeof(data), 0, 2, 1, &section);
+               int     result = ov_read(&file_, data, sizeof(data),
+                               0, 2, 1, &section);
 
                if (0 < result)
                {
@@ -202,8 +184,10 @@ public:
                        sample_ = sample = ov_pcm_tell(&file_);
                        return true;
                }
-               else if (result < 0) log_warning("vorbis playback error");
-
+               else if (result < 0)
+               {
+                       log_warning("vorbis playback error");
+               }
                return false;
        }
 
@@ -211,62 +195,61 @@ public:
        {
                ov_crosslap(&other->file_, &file_);
 
-               char data[BUF_SIZE];
+               char    data[BUF_SIZE];
                int     section;
-               int     result = ov_read(&file_, data, sizeof(data), 0, 2, 1, &section);
+               int     result = ov_read(&file_, data, sizeof(data),
+                               0, 2, 1, &section);
 
                if (0 < result)
                {
                        vorbis_info* info = ov_info(&file_, section);
                        alBufferData(buffer, get_audio_format(info),
-                                                data, result, info->rate);
+                                       data, result, info->rate);
                        sample_ = sample = ov_pcm_tell(&file_);
                        return true;
                }
-               else if (result < 0) log_warning("vorbis playback error");
-
+               else if (result < 0)
+               {
+                       log_warning("vorbis playback error");
+               }
                return false;
        }
 
-
-       // determines the correct number of fixed-size buffers needed to hold a
-       // given number of seconds of PCM audio.
+       // determines the correct number of fixed-size buffers needed to hold
+       // a given number of seconds of PCM audio.
        int num_buffers(scalar seconds) const
        {
                vorbis_info* info = ov_info(&file_, -1);
                int count = scalar(info->rate) *                // sample rate
-                                       scalar(info->channels) *        // channels
-                                       scalar(NUM_SAMPLE_BITS) *       // sample size
-                                       seconds *                                       // time
-                                       SCALAR(0.125) /                         // bits to bytes
-                                       scalar(BUF_SIZE);                       // individual buffer size
+                               scalar(info->channels) *        // channels
+                               scalar(NUM_SAMPLE_BITS) *       // sample size
+                               seconds *                       // time
+                               SCALAR(0.125) /                 // bits to bytes
+                               scalar(BUF_SIZE);               // individual buffer size
                return count;
        }
 
-
        static ALenum get_audio_format(const vorbis_info* info)
        {
-               if (info->channels == 1)      return AL_FORMAT_MONO16;
-               else if (info->channels == 2) return AL_FORMAT_STEREO16;
+               if (info->channels == 1)
+                       return AL_FORMAT_MONO16;
+               else if (info->channels == 2)
+                       return AL_FORMAT_STEREO16;
 
                log_error("unsupported number of channels:", info->channels);
                return 0;
        }
 
-
 private:
 
        mutable OggVorbis_File  file_;
-       mutable ALuint                  buffer_;
-       mutable uint64_t                sample_;
+       mutable ALuint          buffer_;
+       mutable uint64_t        sample_;
 
-       sound_backend                   backend_;
+       sound_backend           backend_;
 };
 
 
-/*] Sound class
- *************************************************************************/
-
 class sound::impl
 {
 public:
@@ -318,7 +301,10 @@ public:
                        alSourceUnqueueBuffers(source_, queued, buffers);
                        alDeleteBuffers(queued, buffers);
                }
-               else alSourcei(source_, AL_BUFFER, AL_NONE);
+               else
+               {
+                       alSourcei(source_, AL_BUFFER, AL_NONE);
+               }
        }
 
        void play()
@@ -329,50 +315,51 @@ public:
                alGetSourcei(source_, AL_SOURCE_STATE, &state);
                switch (state)
                {
-                       case AL_INITIAL:
-                       case AL_STOPPED:
-
-                               if (is_streaming_)
-                               {
-                                       start_update_timer();
-                                       num_buffers_ = queue_.front()->num_buffers(buffer_size_);
-                                       fill_stream();
-                                       is_playing_ = true;
-                                       alSourcei(source_, AL_LOOPING, false);
-                               }
-                               else
-                               {
-                                       ALuint buffer = queue_.front()->read_all();
-                                       alSourcei(source_, AL_BUFFER, buffer);
-                                       alSourcei(source_, AL_LOOPING, is_looping_);
-                               }
-                               break;
+               case AL_INITIAL:
+               case AL_STOPPED:
+                       if (is_streaming_)
+                       {
+                               start_update_timer();
+                               num_buffers_ = queue_.front()->num_buffers(buffer_size_);
+                               fill_stream();
+                               is_playing_ = true;
+                               alSourcei(source_, AL_LOOPING, false);
+                       }
+                       else
+                       {
+                               ALuint buffer = queue_.front()->read_all();
+                               alSourcei(source_, AL_BUFFER, buffer);
+                               alSourcei(source_, AL_LOOPING, is_looping_);
+                       }
+                       break;
 
-                       case AL_PAUSED:
-                               
-                               if (is_streaming_)
-                               {
-                                       start_update_timer();
-                                       is_playing_ = true;
-                               }
-                               break;
+               case AL_PAUSED:
+                       if (is_streaming_)
+                       {
+                               start_update_timer();
+                               is_playing_ = true;
+                       }
+                       break;
                }
 
                alSourcePlay(source_);
        }
 
-
        void start_update_timer()
        {
-               stream_timer_.init(boost::bind(&impl::stream_update, this, _1, _2),
-                                                                          SCALAR(0.1), timer::repeat);
+               stream_timer_.init(boost::bind(&impl::stream_update,
+                                       this, _1, _2),
+                               SCALAR(0.1), timer::repeat);
+
+               thread::main_runloop().add_timer(stream_timer_);
 
                //thread thread;
                //thread.runloop().add_timer(stream_timer_);
-               if (!stream_thread_.is_valid())
-               {
-                       stream_thread_ = thread::detach(stream_timer_);
-               }
+               //if (!stream_thread_.is_valid())
+                       //stream_thread_ = thread::detach(stream_timer_);
+               // FIXME: proper locking needs to be done; this is causing crashes
+               // on shutdown when sound resources are destroyed yet the stream
+               // thread is neither shutdown or notified.
        }
 
        void fill_stream()
@@ -386,7 +373,7 @@ public:
                alGetSourcei(source_, AL_BUFFERS_QUEUED, &queued);
                alGetSourcei(source_, AL_BUFFERS_PROCESSED, &processed);
 
-               int             target_diff = num_buffers_ - queued + processed;
+               int     target_diff = num_buffers_ - queued + processed;
 
                ALuint  bufs[processed];
                alSourceUnqueueBuffers(source_, processed, bufs);
@@ -396,7 +383,10 @@ public:
 
                        if (0 < target_diff)
                        {
-                               if (queue_buffer(buf)) --target_diff;
+                               if (queue_buffer(buf))
+                               {
+                                       --target_diff;
+                               }
                                else
                                {
                                        alDeleteBuffers(processed - i - 1, &bufs[i+1]);
@@ -428,6 +418,7 @@ public:
                }
        }
 
+       // TODO: this function is ugly
        bool queue_buffer(ALuint buffer)
        {
                if (buffer == AL_NONE) alGenBuffers(1, &buffer);
@@ -471,7 +462,10 @@ public:
                                        queue_.push_back(sound);
                                        looped_once = true;
                                }
-                               else break;
+                               else
+                               {
+                                       break;
+                               }
                        }
                }
 
@@ -481,7 +475,6 @@ public:
                return false;
        }
 
-
        void stop()
        {
                alSourceStop(source_);
@@ -500,7 +493,6 @@ public:
                stream_timer_.invalidate();
        }
 
-
        void sample(const std::string& name)
        {
                stop();
@@ -518,17 +510,15 @@ public:
                is_streaming_ = true;
        }
 
-
        bool is_playing() const
        {
                ALenum state;
                alGetSourcei(source_, AL_SOURCE_STATE, &state);
 
                if (state == AL_PLAYING) return true;
-               else                     return is_playing_;
+               else return is_playing_;
        }
 
-
        void loop(bool looping)
        {
                is_looping_ = looping;
@@ -536,33 +526,29 @@ public:
                ALenum type;
                alGetSourcei(source_, AL_SOURCE_TYPE, &type);
                if (type != AL_STREAMING)
-               {
                        alSourcei(source_, AL_LOOPING, is_looping_);
-               }
        }
 
-
        void stream_update(timer& timer, scalar t)
        {
                log_debug("blaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhrrrrrg");
                fill_stream();
        }
 
+       ALuint                          source_;
 
-       ALuint                                          source_;
-
-       bool                                            is_playing_;
-       bool                                            is_looping_;
-       bool                                            is_streaming_;
+       bool                            is_playing_;
+       bool                            is_looping_;
+       bool                            is_streaming_;
 
        std::deque<sound_handle>        queue_;
-       uint64_t                                        sample_;
-       int                                                     num_buffers_;
-       scalar                                          buffer_size_;
+       uint64_t                        sample_;
+       int                             num_buffers_;
+       scalar                          buffer_size_;
 
-       timer                                           stream_timer_;
+       timer                           stream_timer_;
 
-       sound_backend                           backend_;
+       sound_backend                   backend_;
 };
 
 
@@ -574,7 +560,6 @@ sound::sound(const std::string& path) :
        // pass through
        impl_(new sound::impl(path)) {}
 
-
 void sound::sample(const std::string& path)
 {
        // pass through
@@ -587,7 +572,6 @@ void sound::queue(const std::string& path)
        impl_->queue(path);
 }
 
-
 void sound::play()
 {
        // pass through
@@ -623,7 +607,6 @@ void sound::buffer_size(scalar seconds)
        impl_->buffer_size_ = seconds;
 }
 
-
 void sound::position(const vector3& position)
 {
        float vec[3] = {position[0], position[1], position[2]};
@@ -652,7 +635,6 @@ void sound::loop(bool looping)
        impl_->loop(looping);
 }
 
-
 void sound::listener_position(const vector3& position)
 {
        float vec[] = {position[0], position[1], position[2]};
@@ -666,7 +648,7 @@ void sound::listener_velocity(const vector3& velocity)
 }
 
 void sound::listener_orientation(const vector3& forward,
-                                                                const vector3& up)
+               const vector3& up)
 {
        float vec[6];
        vec[0] = float(forward[0]);
index d4c1bcdc9db5253ec849fec3fc2e58a1cd39a4fb..1f7fcfe788c1e33d5fd44975f4d26e8d98cf8400 100644 (file)
@@ -1,20 +1,18 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SOUND_HH_
 #define _MOOF_SOUND_HH_
 
 /**
  * \file sound.hh
- * Load and play sounds, current supports ogg vorbis.
+ * Load and play sounds, currently supports ogg vorbis.
  */
 
 #include <string>
@@ -27,9 +25,9 @@
 namespace moof {
 
 
+// forward declarations
 class script;
 
-
 class sound
 {
 public:
@@ -55,11 +53,9 @@ public:
        void pitch(scalar pitch);
        void loop(bool looping);
        
-
        static void listener_position(const vector3& position);
        static void listener_velocity(const vector3& velocity);
-       static void listener_orientation(const vector3& forward,
-                                                                        const vector3& up);
+       static void listener_orientation(const vector3& forward, const vector3& up);
 
        static void import(script& script, const std::string& nspace = "");
 
index 6849d91696e66f3fd2a625a968e6f165d43dc481..65bcd0160aee8660da003e7090996aa9c561ec3c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "script.hh"
 #include "sound.hh"
@@ -103,7 +101,6 @@ static int sound_is_playing(script& script)
        return 1;
 }
 
-
 void sound::import(script& script, const std::string& nspace)
 {
        script.check_stack(4);
@@ -111,13 +108,13 @@ void sound::import(script& script, const std::string& nspace)
        script::slot parent = script.push_table(nspace);
        script::slot meta = script.push_class<sound>(sound_new);
 
-       meta.set_field("sample", sound_sample);
-       meta.set_field("queue", sound_queue);
+       meta.set_field("is_playing", sound_is_playing);
+       meta.set_field("pause", sound_pause);
        meta.set_field("play", sound_play);
+       meta.set_field("queue", sound_queue);
+       meta.set_field("sample", sound_sample);
        meta.set_field("stop", sound_stop);
-       meta.set_field("pause", sound_pause);
        meta.set_field("toggle", sound_toggle);
-       meta.set_field("is_playing", sound_is_playing);
 
        parent.set_field("sound");
        parent.pop();
index cf1bba772316057ca7e625ab0f1b99ed976151f1..75c5808a476cfe5d4e4256f52f76bbd4d691c149 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SPHERE_HH_
 #define _MOOF_SPHERE_HH_
@@ -41,14 +39,12 @@ struct sphere : public cullable, public drawable, public shape<D>
        vector  point;
        scalar  radius;
 
-
        sphere() {}
 
        sphere(const vector& p, scalar r) :
                point(p),
                radius(r) {}
 
-
        void init(const vector& p, scalar r)
        {
                point = p;
@@ -78,7 +74,6 @@ struct sphere : public cullable, public drawable, public shape<D>
                return true;
        }
 
-
        bool intersect(const sphere<D>& sphere, contact<D>& hit) const
        {
                vector n = sphere.point - point;
@@ -110,7 +105,7 @@ struct sphere : public cullable, public drawable, public shape<D>
 
        // a ray inside the sphere will not intersect on its way out
        bool intersect(const ray<D>& ray,
-                                  typename moof::ray<D>::contact& hit) const
+                       typename moof::ray<D>::contact& hit) const
        {
                vector b = point - ray.point;
                scalar z = dot(b, ray.direction);
@@ -134,15 +129,19 @@ struct sphere : public cullable, public drawable, public shape<D>
        }
 };
 
+typedef sphere<2> circle;
+typedef sphere<2> sphere2;
+typedef sphere<3> sphere3;
+
 
 template <>
-inline bool sphere<3>::is_visible(const frustum& frustum) const
+inline bool sphere3::is_visible(const frustum& frustum) const
 {
        return frustum.contains(*this);
 }
 
 template <>
-inline void sphere<2>::draw(scalar alpha) const
+inline void sphere2::draw(scalar alpha) const
 {
        GLUquadricObj* sphereObj = gluNewQuadric();
        gluQuadricDrawStyle(sphereObj, GLU_LINE);
@@ -158,7 +157,7 @@ inline void sphere<2>::draw(scalar alpha) const
 }
 
 template <>
-inline void sphere<3>::draw(scalar alpha) const
+inline void sphere3::draw(scalar alpha) const
 {
        GLUquadricObj* sphereObj = gluNewQuadric();
        gluQuadricDrawStyle(sphereObj, GLU_LINE);
@@ -181,11 +180,6 @@ inline bool checkCollision(const sphere<D>& a, const sphere<D>& b)
 }
 
 
-typedef sphere<2>      sphere2;
-typedef sphere2        circle;
-typedef sphere<3>      sphere3;
-
-
 } // namespace moof
 
 #endif // _MOOF_SPHERE_HH_
index ee5db1dd302023072a93b7d0b534be37dd3da4e7..b71a4b99ee8a860393047a4bc15eb0a27dd49251 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <cstdio>              // FILE
 #include <cstring>             // strncmp
@@ -44,7 +42,6 @@ sprite::sprite(const sprite& sprite, int tile)
        image_ = sprite.image_;
 }
 
-
 void sprite::image(const std::string& name)
 {
        image_ = resource::load(name, "png");
@@ -55,7 +52,6 @@ void sprite::tile(int tile)
        if (image_) image_->tile_coordinates(tile, tile_);
 }
 
-
 void sprite::bind() const
 {
        if (image_) image_->bind();
@@ -66,7 +62,6 @@ void sprite::reset_binding()
        image::reset_binding();
 }
 
-
 void sprite::draw(const vector3 vertices[4]) const
 {
        bind();
@@ -77,7 +72,6 @@ void sprite::draw(const vector3 vertices[4]) const
        glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
 }
 
-
 /*
        void min_filter(GLuint filter)
        {
@@ -107,7 +101,6 @@ void sprite::draw(const vector3 vertices[4]) const
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mWrapT);
        }
 
-
 bool sprite::tile_coordinates(int index, scalar coords[8],
                orientation orientation) const
 {
index 3e3d17934ce04e6f32d537f41d0d96067eb71935..88029e52bbf0e442a90932e47a52a8a4ed90916e 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SPRITE_HH_
 #define _MOOF_SPRITE_HH_
@@ -43,11 +41,10 @@ public:
 
        void draw(const vector3 vertices[4]) const;
 
-
 private:
 
        image_handle    image_;
-       scalar                  tile_[8];
+       scalar          tile_[8];
 };
 
 
index 61bbf8fa6e77982a92b2c4fdf1542a24ab96a42b..a73bcd0723d0e9fd8f454fcc7c485513d0443686 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include <stdexcept>
 
@@ -27,18 +25,17 @@ wstring multi_to_wide(const string& multi)
 
        if (sizeof(wchar_t) == 2)
        {
-               size_t                  length = multi.length();
-               buffer                  wide(new wchar_t[length + 1]);
-               const UTF8*             src1 = (const UTF8*)multi.c_str();
-               const UTF8*             src2 = src1 + length;
-               UTF16*                  dst1 = (UTF16*)wide.get();
-               UTF16*                  dst2 = dst1 + length+1;
+               size_t          length = multi.length();
+               buffer          wide(new wchar_t[length + 1]);
+               const UTF8*     src1 = (const UTF8*)multi.c_str();
+               const UTF8*     src2 = src1 + length;
+               UTF16*          dst1 = (UTF16*)wide.get();
+               UTF16*          dst2 = dst1 + length + 1;
 
                if (ConvertUTF8toUTF16(&src1, src2,
-                               &dst1, dst2, lenientConversion) != conversionOK)
-               {
+                                       &dst1, dst2,
+                                       lenientConversion) != conversionOK)
                        throw std::runtime_error("bad string conversion");
-               }
 
                *dst1 = 0;
                wstring str(wide.get());
@@ -46,18 +43,17 @@ wstring multi_to_wide(const string& multi)
        }
        else if (sizeof(wchar_t) == 4)
        {
-               size_t                  length = multi.length();
-               buffer                  wide(new wchar_t[length + 1]);
-               const UTF8*             src1 = (const UTF8*)multi.c_str();
-               const UTF8*             src2 = src1 + length;
-               UTF32*                  dst1 = (UTF32*)wide.get();
-               UTF32*                  dst2 = dst1 + length+1;
+               size_t          length = multi.length();
+               buffer          wide(new wchar_t[length + 1]);
+               const UTF8*     src1 = (const UTF8*)multi.c_str();
+               const UTF8*     src2 = src1 + length;
+               UTF32*          dst1 = (UTF32*)wide.get();
+               UTF32*          dst2 = dst1 + length + 1;
 
                if (ConvertUTF8toUTF32(&src1, src2,
-                               &dst1, dst2, lenientConversion) != conversionOK)
-               {
+                                       &dst1, dst2,
+                                       lenientConversion) != conversionOK)
                        throw std::runtime_error("bad string conversion");
-               }
 
                *dst1 = 0;
                wstring str(wide.get());
@@ -75,19 +71,18 @@ string wide_to_multi(const wstring& wide)
 
        if (sizeof(wchar_t) == 2)
        {
-               size_t                  length = wide.length();
-               size_t                  multi_length = 3 * length + 1;
-               buffer                  multi(new char[multi_length]);
+               size_t          length = wide.length();
+               size_t          multi_length = 3 * length + 1;
+               buffer          multi(new char[multi_length]);
                const UTF16*    src1 = (const UTF16*)wide.c_str();
                const UTF16*    src2 = src1 + length;
-               UTF8*                   dst1 = (UTF8*)multi.get();
-               UTF8*                   dst2 = dst1 + multi_length;
+               UTF8*           dst1 = (UTF8*)multi.get();
+               UTF8*           dst2 = dst1 + multi_length;
 
                if (ConvertUTF16toUTF8(&src1, src2,
-                               &dst1, dst2, lenientConversion) != conversionOK)
-               {
+                                       &dst1, dst2,
+                                       lenientConversion) != conversionOK)
                        throw std::runtime_error("bad string conversion");
-               }
 
                *dst1 = 0;
                string str(multi.get());
@@ -95,19 +90,18 @@ string wide_to_multi(const wstring& wide)
        }
        else if (sizeof(wchar_t) == 4)
        {
-               size_t                  length = wide.length();
-               size_t                  multi_length = 4 * length + 1;
-               buffer                  multi(new char[multi_length]);
+               size_t          length = wide.length();
+               size_t          multi_length = 4 * length + 1;
+               buffer          multi(new char[multi_length]);
                const UTF32*    src1 = (const UTF32*)wide.c_str();
                const UTF32*    src2 = src1 + length;
-               UTF8*                   dst1 = (UTF8*)multi.get();
-               UTF8*                   dst2 = dst1 + multi_length;
+               UTF8*           dst1 = (UTF8*)multi.get();
+               UTF8*           dst2 = dst1 + multi_length;
 
                if (ConvertUTF32toUTF8(&src1, src2,
-                               &dst1, dst2, lenientConversion) != conversionOK)
-               {
+                                       &dst1, dst2,
+                                       lenientConversion) != conversionOK)
                        throw std::runtime_error("bad string conversion");
-               }
 
                *dst1 = 0;
                string str(multi.get());
@@ -120,10 +114,10 @@ string wide_to_multi(const wstring& wide)
 }
 
 
-static script& regex_script()
+static script& pattern_script()
 {
        static script   script;
-       static bool             init = true;
+       static bool     init = true;
        if (init)
        {
                script.import_string_library();
@@ -141,22 +135,20 @@ static script& regex_script()
        return script;
 }
 
-
-regex::regex(const string& pattern)
+pattern::pattern(const std::string& pattern)
 {
-       regex::pattern(pattern);
+       pattern::string(pattern);
 }
 
-regex::regex(const string& pattern, const string& source)
+pattern::pattern(const std::string& pattern, const std::string& source)
 {
-       regex::pattern(pattern);
+       pattern::string(pattern);
        match(source);
 }
 
-regex::~regex()
+pattern::~pattern()
 {
-       script& script = regex_script();
-       
+       script& script = pattern_script();
        script.push_pointer(this);
        script.push_nil();
        script.globals().set_field();
@@ -165,32 +157,30 @@ regex::~regex()
        script.registry().set_field();
 }
 
-
-string regex::pattern() const
+std::string pattern::string() const
 {
-       script& script = regex_script();
+       script& script = pattern_script();
        script.push_pointer(this);
        script::slot saved = script.registry().push_field();
 
-       string pattern;
+       std::string pattern;
        saved.get(pattern);
 
        saved.pop();
        return pattern;
 }
 
-void regex::pattern(const string& pattern)
+void pattern::string(const std::string& pattern)
 {
-       script& script = regex_script();
+       script& script = pattern_script();
        script.push_pointer(this);
        script.push(pattern);
        script.registry().set_field();
 }
 
-
-void regex::match(const string& source)
+void pattern::match(const std::string& source)
 {
-       script& script = regex_script();
+       script& script = pattern_script();
        script.push_pointer(this);
 
        script.globals().push_field("gmatch");
@@ -202,9 +192,9 @@ void regex::match(const string& source)
        script.globals().set_field();
 }
 
-bool regex::get(string& match)
+bool pattern::get(std::string& match)
 {
-       script& script = regex_script();
+       script& script = pattern_script();
        script.push_pointer(this);
        script::slot value = script.globals().push_field();
        if (!value.is_function())
@@ -219,9 +209,9 @@ bool regex::get(string& match)
        return result;
 }
 
-bool regex::get(std::vector<string>& captures)
+bool pattern::get(std::vector<std::string>& captures)
 {
-       script& script = regex_script();
+       script& script = pattern_script();
        script.push_pointer(this);
        script::slot value = script.globals().push_field();
        if (!value.is_function())
@@ -244,18 +234,14 @@ bool regex::get(std::vector<string>& captures)
        return 0 < captures.size();
 }
 
-
-bool regex::match(string& match,
-                                 const string& pattern,
-                                 const string& source,
-                                 int position)
+bool pattern::match(std::string& match,
+               const std::string& pattern, const std::string& source, int position)
 {
-       script& script = regex_script();
-
+       script& script = pattern_script();
        script::slot value = script.globals().push_field("match");
        script.push(source);
        script.push(pattern);
-       ++position;     // Lua indices count from one.
+       ++position;     // lua indices count from one
        script.push(position);
        script.call(3, 1);
 
@@ -264,17 +250,14 @@ bool regex::match(string& match,
        return result;
 }
 
-bool regex::match(std::vector<string>& captures,
-                                 const string& pattern,
-                                 const string& source,
-                                 int position)
+bool pattern::match(std::vector<std::string>& captures,
+               const std::string& pattern, const std::string& source, int position)
 {
-       script& script = regex_script();
-
+       script& script = pattern_script();
        script::slot value = script.globals().push_field("match");
        script.push(source);
        script.push(pattern);
-       ++position;     // Lua indices count from one.
+       ++position;     // lua indices count from one
        script.push(position);
        script.call(3);
 
@@ -291,14 +274,11 @@ bool regex::match(std::vector<string>& captures,
        return 0 < captures.size();
 }
 
-
-int regex::sub(string& substitution,
-                          const string& pattern,
-                          const string& source,
-                          const string& replacement)
+int pattern::sub(std::string& substitution,
+               const std::string& pattern,
+               const std::string& source, const std::string& replacement)
 {
-       script& script = regex_script();
-
+       script& script = pattern_script();
        script::slot value = script.globals().push_field("gsub");
        script.push(source);
        script.push(pattern);
index dd9d7918deb13ef9e27feab36423a66154db410d..4194abb08e1679d959b1a5cf58292df366ac241c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_STRING_HH_
 #define _MOOF_STRING_HH_
@@ -28,7 +26,6 @@ namespace moof {
 using std::string;
 using std::wstring;
 
-
 /**
  * Convert a multi-byte (UTF-8) string to a wide string.
  * \param multi The multi-byte string to convert.
@@ -48,50 +45,48 @@ string wide_to_multi(const wstring& wide);
  * Class exposing the pattern-matching and substitution methods used in
  * Lua.
  */
-class regex : public boost::noncopyable
+class pattern : public boost::noncopyable
 {
 public:
 
        /**
-        * Construct a regex object.
+        * Construct a pattern object.
         */
-       regex() {}
+       pattern() {}
 
        /**
-        * Construct a regex object with a pattern.
+        * Construct a pattern object with a pattern.
         * \param pattern The pattern.
         */
-       regex(const string& pattern);
+       pattern(const std::string& pattern);
 
        /**
-        * Construct a regex object with a pattern and source to match.
+        * Construct a pattern object with a pattern and source to match.
         * \param pattern The pattern.
         * \param source The source string.
         */
-       regex(const string& pattern, const string& source);
+       pattern(const std::string& pattern, const std::string& source);
 
        /**
-        * Deconstruct the regex.
+        * Deconstruct the pattern.
         */
-       ~regex();
-
+       ~pattern();
 
        /**
-        * Get the regex pattern.
+        * Get the pattern pattern.
         */
-       string pattern() const;
+       std::string string() const;
 
        /**
-        * Set the regex pattern.
+        * Set the pattern string.
         */
-       void pattern(const string& pattern);
-
+       void string(const std::string& pattern);
 
        /**
         * Match a string against the pattern iteratively.
         * \param source The source string.
         */
-       void match(const string& source);
+       void match(const std::string& source);
 
        /**
         * Get the next match.  If the pattern contains captures, this version
@@ -99,7 +94,7 @@ public:
         * \param match Reference to a string to be assigned the match.
         * \return True if there was a match to get, false otherwise.
         */
-       bool get(string& match);
+       bool get(std::string& match);
 
        /**
         * Get the next match.  Use this version if the pattern contains more
@@ -107,8 +102,7 @@ public:
         * \param captures Reference to a vector of strings to hold the result.
         * \return True if there was a match to get, false otherwise.
         */
-       bool get(std::vector<string>& captures);
-
+       bool get(std::vector<std::string>& captures);
 
        /**
         * Match a string against a pattern all at one time.
@@ -117,12 +111,12 @@ public:
         * \param position The index of the first character of source to match.
         * \return The match.
         */
-       static string match(const string& pattern,
-                                               const string& source,
-                                               int position = 0)
+       static std::string
+       match(const std::string& pattern, const std::string& source,
+                       int position = 0)
        {
-               string match;
-               regex::match(match, pattern, source, position);
+               std::string match;
+               pattern::match(match, pattern, source, position);
                return match;
        }
 
@@ -134,10 +128,8 @@ public:
         * \param position The index of the first character of source to match.
         * \return True if a match was made, false otherwise.
         */
-       static bool match(string& match,
-                                         const string& pattern,
-                                         const string& source,
-                                         int position = 0);
+       static bool match(std::string& match, const std::string& pattern,
+                       const std::string& source, int position = 0);
 
        /**
         * Match a string against a pattern all at one time.  If the pattern
@@ -150,11 +142,8 @@ public:
         * \param position The index of the first character of source to match.
         * \return True if a match was made, false otherwise.
         */
-       static bool match(std::vector<string>& captures,
-                                         const string& pattern,
-                                         const string& source,
-                                         int position = 0);
-
+       static bool match(std::vector<std::string>& captures, const std::string& pattern,
+                       const std::string& source, int position = 0);
 
        /**
         * Substitute a string using a pattern and replacement string.
@@ -164,12 +153,11 @@ public:
         * references to captures.
         * \return The string with any substitutions made.
         */
-       static string sub(const string& pattern,
-                                         const string& source,
-                                         const string& replacement)
+       static std::string sub(const std::string& pattern,
+                       const std::string& source, const std::string& replacement)
        {
-               string substitution;
-               regex::sub(substitution, pattern, source, replacement);
+               std::string substitution;
+               pattern::sub(substitution, pattern, source, replacement);
                return substitution;
        }
 
@@ -182,14 +170,12 @@ public:
         * references to captures.
         * \return The number of substitutions made.
         */
-       static int sub(string& substitution,
-                                  const string& pattern,
-                                  const string& source,
-                                  const string& replacement);
+       static int sub(std::string& substitution, const std::string& pattern,
+                       const std::string& source, const std::string& replacement);
 };
 
 
 } // namespace moof
 
-#endif // _MOOF_STRINGTOOLS_HH_
+#endif // _MOOF_STRING_HH_
 
index c1e501c6a378ea22774283c341c2ee43269b9bd9..03c04f7b8ab70c53dd074065fd6a1a483970068a 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #include "runloop.hh"
 #include "thread.hh"
@@ -20,7 +18,6 @@ thread::thread() :
        thread_(0),
        runloop_(new moof::runloop) {}
 
-
 thread thread::detach(const function& function)
 {
        thread* thread = new moof::thread;
@@ -38,7 +35,6 @@ thread thread::detach(timer& timer)
        return *thread;
 }
 
-
 void thread::spawn(thread* thread)
 {
        thread->thread_ = SDL_CreateThread(&thread::run, (void*)thread);
@@ -52,7 +48,6 @@ int thread::run(void* arg)
        return code;
 }
 
-
 void thread::kill()
 {
        if (thread_)
@@ -62,7 +57,6 @@ void thread::kill()
        }
 }
 
-
 moof::runloop& thread::runloop() const
 {
        return *runloop_;
index 8151c3297d3d4dc181f1b8e700181ad0461a77d2..17d3170beaf4ce1304feb2da5584332a19d2250c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_THREAD_HH_
 #define _MOOF_THREAD_HH_
 namespace moof {
 
 
+// forward declarations
 class runloop;
 typedef boost::shared_ptr<runloop> runloop_ptr;
 
-
 /**
  * Represents a thread which may be running.  You cannot instantiate a
  * thread object directly; new threads are created by detaching functions
@@ -46,14 +44,12 @@ public:
 
        typedef boost::function<int(thread&)> function;
 
-
        /**
         * Construct an invalid thread object which has no association with any
         * real thread.
         */
        thread();
 
-
        /**
         * Execute a function in a new thread.
         * \param function The function to execute.
@@ -68,7 +64,6 @@ public:
         */
        static thread detach(timer& timer);
 
-
        /**
         * Wait for the thread to terminate, getting its return value.  The
         * thread will be invalidated.
@@ -102,7 +97,6 @@ public:
                return thread_ != 0;
        }
 
-
        /**
         * Get a unique identifier for this thread, if it is valid.
         * \return The identifier.
@@ -121,7 +115,6 @@ public:
                return SDL_ThreadID();
        }
 
-
        /**
         * Get the thread's runloop.
         * \return The thread's runloop.
@@ -134,16 +127,14 @@ public:
         */
        static moof::runloop& main_runloop();
 
-
 private:
 
        static void spawn(thread* thread);
        static int run(void* arg);
 
-
-       function                function_;
-       SDL_Thread*             thread_;
-       runloop_ptr             runloop_;
+       function        function_;
+       SDL_Thread*     thread_;
+       runloop_ptr     runloop_;
 };
 
 
@@ -178,6 +169,7 @@ public:
        virtual int wait() = 0;
 };
 
+
 /**
  * An asynchronous task that is run to be executed in a separated thread.
  */
@@ -189,7 +181,10 @@ public:
         * Get the thread object the task is executing in.
         * \return The thread.
         */
-       const class thread& thread() const { return thread_; }
+       const class thread& thread() const
+       {
+               return thread_;
+       }
 
        /**
         * Block the current thread until the task thread is finished.
@@ -200,7 +195,6 @@ public:
                return thread_.wait();
        }
 
-
 protected:
 
        class thread thread_;
@@ -218,27 +212,26 @@ public:
        /**
         * Construct a mutex.
         */
-    mutex() :
+       mutex() :
                mutex_(SDL_CreateMutex()) {}
 
        /**
         * Deconstruct a mutex.
         */
-    ~mutex()
+       ~mutex()
        {
                SDL_DestroyMutex(mutex_);
        }
 
-
        /**
         * Block until the calling thread can secure exclusive access to the
         * code protected by the mutex.
         * \return True if the lock was acquired, false otherwise.
         * \see lock
         */
-    bool acquire_lock()
+       bool acquire_lock()
        {
-               return (SDL_LockMutex(mutex_) == 0);
+               return SDL_LockMutex(mutex_) == 0;
        }
 
        /**
@@ -247,48 +240,46 @@ public:
         * \return True if the mutex was unlocked, false otherwise.
         * \see lock
         */
-    bool release_lock()
+       bool release_lock()
        {
-               return (SDL_UnlockMutex(mutex_) == 0);
+               return SDL_UnlockMutex(mutex_) == 0;
        }
 
-
        /**
         * As an alternative method for locking, objects of this class will
         * automagically release the lock if it is still locked at
         * deconstruction.  Therefore, it's generally safer to use this method
         * since it makes it much more difficult to forget to unlock a mutex.
         */
-    class lock
-    {
-    public:
+       class lock
+       {
+       public:
 
                /**
                 * Construct a lock.
                 * \param mutex The mutex.
                 */
-        explicit lock(mutex& mutex, bool lock = true) :
+               explicit lock(mutex& mutex, bool lock = true) :
                        mutex_(mutex),
                        is_locked_(false)
                {
-                       if (lock) if (!acquire()) throw "mutex lock not acquired";
+                       if (lock && !acquire()) throw "mutex lock not acquired";
                }
 
                /**
                 * Deconstruct a lock.  The lock is automagically released if it is
                 * still locked.
                 */
-        ~lock()
+               ~lock()
                {
                        if (is_locked_) release();
                }
 
-
                /**
                 * Try to acquire a lock on the mutex.
                 * \return True if the mutex was locked, false otherwise.
                 */
-        bool acquire()
+               bool acquire()
                {
                        return (is_locked_ = mutex_.acquire_lock());
                }
@@ -297,32 +288,29 @@ public:
                 * Release the lock.
                 * \return True if the mutex was unlocked, false otherwise.
                 */
-        bool release()
+               bool release()
                {
                        bool result = mutex_.release_lock();
                        is_locked_ = false;
                        return result;
                }
 
-
                /**
                 * Get whether or not the mutex is locked.
                 * \return True if the mutex is locked, false otherwise.
                 */
-        bool is_locked() const
+               bool is_locked() const
                {
                        return is_locked_;
                }
 
+       protected:
 
-    protected:
-
-        mutex& mutex_;
-        bool   is_locked_;
-
-        friend class condition;
-    };
+               mutex&  mutex_;
+               bool    is_locked_;
 
+               friend class condition;
+       };
 
 private:
 
@@ -342,7 +330,7 @@ public:
        /**
         * Construct a condition.
         */
-    condition()
+       condition()
        {
                condition_ = SDL_CreateCond();
        }
@@ -350,12 +338,11 @@ public:
        /**
         * Deconstruct a condition.
         */
-    ~condition()
+       ~condition()
        {
                SDL_DestroyCond(condition_);
        }
 
-
        /**
         * Unlock the mutex and wait for another thread to notify the thread,
         * at which point the mutex will be re-locked and the method will
@@ -365,7 +352,7 @@ public:
         */
        bool wait(mutex& mutex)
        {
-        return (SDL_CondWait(condition_, mutex.mutex_) == 0);
+               return SDL_CondWait(condition_, mutex.mutex_) == 0;
        }
 
        /**
@@ -375,10 +362,10 @@ public:
         * \param lock The lock.
         * \return True if the thread was notified, false otherwise.
         */
-    bool wait(mutex::lock& lock)
+       bool wait(mutex::lock& lock)
        {
-        return (SDL_CondWait(condition_, lock.mutex_.mutex_) == 0);
-    }
+               return SDL_CondWait(condition_, lock.mutex_.mutex_) == 0;
+       }
 
        /**
         * Unlock the mutex and wait for another thread to notify the thread,
@@ -389,10 +376,10 @@ public:
         * \param timeout Number of seconds to wait.
         * \return True if the thread was notified, false otherwise.
         */
-    bool wait(mutex& mutex, scalar timeout)
+       bool wait(mutex& mutex, scalar timeout)
        {
                Uint32 ms = timeout * SCALAR(1000.0);
-        return (SDL_CondWaitTimeout(condition_, mutex.mutex_, ms) == 0);
+               return SDL_CondWaitTimeout(condition_, mutex.mutex_, ms) == 0;
        }
 
        /**
@@ -404,33 +391,31 @@ public:
         * \param timeout Number of seconds to wait.
         * \return True if the thread was notified, false otherwise.
         */
-    bool wait(mutex::lock& lock, scalar timeout)
+       bool wait(mutex::lock& lock, scalar timeout)
        {
                Uint32 ms = timeout * SCALAR(1000.0);
-        return (SDL_CondWaitTimeout(condition_,
-                                                                       lock.mutex_.mutex_, ms) == 0);
+               return SDL_CondWaitTimeout(condition_,
+                                       lock.mutex_.mutex_, ms) == 0;
        }
 
-
        /**
         * Notify one other thread that is waiting on the condition.
         * \return True on success, false otherwise.
         */
-    bool notify()
+       bool notify()
        {
-               return (SDL_CondSignal(condition_) == 0);
+               return SDL_CondSignal(condition_) == 0;
        }
 
        /**
         * Notify all other threads that are waiting on the condition.
         * \return True on success, false otherwise.
         */
-    bool notify_all()
+       bool notify_all()
        {
-               return (SDL_CondBroadcast(condition_) == 0);
+               return SDL_CondBroadcast(condition_) == 0;
        }
 
-
 private:
 
     SDL_cond* condition_;
@@ -448,7 +433,7 @@ public:
         * Construct a semaphore.
         * \param value The initial value of the semaphore.
         */
-    explicit semaphore(uint32_t value)
+       explicit semaphore(uint32_t value)
        {
                semaphore_ = SDL_CreateSemaphore(value);
        }
@@ -456,21 +441,20 @@ public:
        /**
         * Deconstruct a semaphore.
         */
-    ~semaphore()
+       ~semaphore()
        {
                SDL_DestroySemaphore(semaphore_);
        }
 
-
        /**
         * Block until the calling thread can secure exclusive access to the
         * code protected by the semaphore.
         * \return True if the lock was acquired, false otherwise.
         * \see lock
         */
-    bool acquire_lock()
+       bool acquire_lock()
        {
-               return (SDL_SemWait(semaphore_) == 0);
+               return SDL_SemWait(semaphore_) == 0;
        }
 
        /**
@@ -482,7 +466,7 @@ public:
        bool acquire_lock(scalar timeout)
        {
                Uint32 ms = timeout * SCALAR(1000.0);
-               return (SDL_SemWaitTimeout(semaphore_, ms) == 0);
+               return SDL_SemWaitTimeout(semaphore_, ms) == 0;
        }
 
        /**
@@ -491,9 +475,9 @@ public:
         * \return True if the semaphore was unlocked, false otherwise.
         * \see lock
         */
-    bool release_lock()
+       bool release_lock()
        {
-               return (SDL_SemPost(semaphore_) == 0);
+               return SDL_SemPost(semaphore_) == 0;
        }
 
        /**
@@ -501,9 +485,9 @@ public:
         * immediately available.
         * \return True if the semaphore was locked, false otherwise.
         */
-    bool try_lock()
+       bool try_lock()
        {
-               return (SDL_SemTryWait(semaphore_) == 0);
+               return SDL_SemTryWait(semaphore_) == 0;
        }
 
        /**
@@ -513,36 +497,35 @@ public:
         * since it makes it much more difficult to forget to unlock a
         * semaphore.
         */
-    class lock
-    {
-    public:
+       class lock
+       {
+       public:
 
                /**
                 * Construct a lock.
                 * \param semaphore The semaphore.
                 */
-        explicit lock(semaphore& semaphore, bool lock = true) :
+               explicit lock(semaphore& semaphore, bool lock = true) :
                        semaphore_(semaphore),
                        is_locked_(false)
                {
-                       if (lock) if (!acquire()) throw "semaphore lock not acquired";
+                       if (lock && !acquire()) throw "semaphore lock not acquired";
                }
 
                /**
                 * Deconstruct a lock.  The lock is automagically released if it is
                 * still locked.
                 */
-        ~lock()
+               ~lock()
                {
                        if (is_locked_) release();
                }
-        
 
                /**
                 * Try to acquire a lock on the semaphore.
                 * \return True if the semaphore was locked, false otherwise.
                 */
-        bool acquire()
+               bool acquire()
                {
                        return (is_locked_ = semaphore_.acquire_lock());
                }
@@ -551,7 +534,7 @@ public:
                 * Release the lock.
                 * \return True if the semaphore was unlocked, false otherwise.
                 */
-        bool release()
+               bool release()
                {
                        bool result = semaphore_.release_lock();
                        is_locked_ = false;
@@ -562,18 +545,16 @@ public:
                 * Get whether or not the semaphore is locked.
                 * \return True if the semaphore is locked, false otherwise.
                 */
-        bool is_locked() const
+               bool is_locked() const
                {
                        return is_locked_;
                }
-        
-
-    protected:
 
-        semaphore&     semaphore_;
-        bool           is_locked_;
-    };
+       protected:
 
+               semaphore&      semaphore_;
+               bool            is_locked_;
+       };
 
 private:
 
@@ -582,9 +563,9 @@ private:
 
 
 #if ENABLE_THREADS
-#define MOOF_DECLARE_MUTEX(M)                  moof::mutex M
+#define MOOF_DECLARE_MUTEX(M)          moof::mutex M
 #define MOOF_DECLARE_STATIC_MUTEX(M)   static moof::mutex M
-#define MOOF_MUTEX_LOCK(M)                             moof::mutex::lock lock_##M(M)
+#define MOOF_MUTEX_LOCK(M)             moof::mutex::lock lock_##M(M)
 #else
 #define MOOF_DECLARE_MUTEX(M)
 #define MOOF_DECLARE_STATIC_MUTEX(M)
index cd898ddd1c62b6b437f889e80741991b7142ff2e..82f8cfa3ec4dbf13a5a1962936b35f9d4295c226 100644 (file)
@@ -1,15 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <cerrno>
 #include <ctime>
@@ -26,9 +26,7 @@ namespace moof {
 
 
 void timer::init(const function& function,
-                                scalar seconds,
-                                enum mode mode,
-                                timer_source& source)
+               scalar seconds, enum mode mode, timer_source& source)
 {
        source_ = &source;
 
@@ -60,7 +58,6 @@ void timer::invalidate()
        absolute_ = SCALAR(0.0);
 }
 
-
 void timer::added_to_runloop(runloop& runloop)
 {
        detach_from_runloop();
@@ -76,29 +73,30 @@ void timer::detach_from_runloop()
        }
 }
 
-
 void timer::fire(scalar t)
 {
        if (function_) function_(*this, t);
 
        if (mode_ == repeat)
        {
-               if (is_equal(absolute_, t, 1.0)) absolute_ += interval_;
-               else absolute_ = interval_ + t;
+               if (is_equal(absolute_, t, 1.0))
+                       absolute_ += interval_;
+               else
+                       absolute_ = interval_ + t;
+               // TODO error accumulates in absolute var
+       }
+       else
+       {
+               invalidate();
        }
-       else invalidate();
 }
 
-
 scalar timer::ticks()
 {
        return default_source().ticks();
 }
 
-
-
 #if ENABLE_CLOCK_GETTIME
-
 class real_time : public timer_source
 {
 public:
@@ -109,7 +107,6 @@ public:
                reset();
        }
 
-
        scalar ticks() const
        {
                struct timespec ts;
@@ -117,9 +114,9 @@ public:
                ASSERT(result == 0 && "monotonic clock not available");
 
                return reference_ +
-                          (scalar(ts.tv_sec - start_.tv_sec) +
-                               scalar(ts.tv_nsec - start_.tv_nsec) *
-                               SCALAR(0.000000001)) * scale_;
+                       (scalar(ts.tv_sec - start_.tv_sec) +
+                        scalar(ts.tv_nsec - start_.tv_nsec) *
+                        SCALAR(0.000000001)) * scale_;
        }
 
        void reset()
@@ -135,15 +132,13 @@ public:
                scale_ = factor;
        }
 
-
 private:
 
-       scalar                  reference_;
+       scalar          reference_;
        struct timespec start_;
-       scalar                  scale_;
+       scalar          scale_;
 };
 
-
 void timer::sleep(scalar seconds, enum mode mode)
 {
        if (mode == absolute) seconds -= ticks();
@@ -154,24 +149,21 @@ void timer::sleep(scalar seconds, enum mode mode)
        ts.tv_nsec = (seconds - scalar(ts.tv_sec)) * SCALAR(1000000000.0);
 
        int ret;
-       do ret = nanosleep(&ts, &ts); while (ret == -1 && errno == EINTR);
+       do ret = nanosleep(&ts, &ts);
+       while (ret == -1 && errno == EINTR);
 }
 
-
 #else // ! ENABLE_CLOCK_GETTIME
-
-
 class real_time : public timer_source
 {
 public:
 
        real_time() :
-               scale_(SCALAR(1.0))
+               scale_(SCALAR(0.001))
        {
                reset();
        }
 
-
        scalar ticks() const
        {
                return reference_ + scalar(SDL_GetTicks() - start_) * scale_;
@@ -190,7 +182,6 @@ public:
                scale_ = factor * SCALAR(0.001);
        }
 
-
 private:
 
        scalar  reference_;
@@ -198,17 +189,14 @@ private:
        scalar  scale_;
 };
 
-
 void timer::sleep(scalar seconds, enum mode mode)
 {
        if (mode == absolute) seconds -= ticks();
        if (seconds < SCALAR(0.0)) return;
        SDL_Delay(seconds * SCALAR(1000.0));
 }
-
 #endif // ENABLE_CLOCK_GETTIME
 
-
 timer_source& timer::default_source()
 {
        static real_time t;
index f9545eb4f4149810cbf78bc7b605f3948c24c17f..edd1de2deaf2cab1a98eff1502dffb0802efed86 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_TIMER_HH_
 #define _MOOF_TIMER_HH_
@@ -28,6 +26,9 @@
 namespace moof {
 
 
+// forward declarations
+class runloop;
+
 /**
  * A timer source is an object that keeps track of increasing time in units
  * of seconds.  A timer source does not necessarily have to increment at
@@ -62,9 +63,6 @@ public:
 };
 
 
-class runloop;
-
-
 /**
  * A class to represent a timer for scheduled events.  The timer events
  * will be executed on or sometime after their schedculed time.  The
@@ -83,18 +81,17 @@ public:
                invalid         = 0,    /// Timer is not scheduled.
                relative        = 1,    /// Timer is scheduled by a relative time.
                absolute        = 2,    /// Timer is scheduled by an absolute time.
-               repeat          = 3             /// Timer is scheduled by a periodic time.
+               repeat          = 3     /// Timer is scheduled by a periodic time.
        };
 
        /**
         * Function protocol for a timer event handler.  A function matching
         * this protocol will be called when the timer expires.  The function
         * takes two parameters: the timer object that just expired, and the
-        * absolute time.
+        * absolute time of the time source which caused the timer to expire.
         */
        typedef boost::function<void(timer&,scalar)> function;
 
-
        /**
         * Construct an invalid (uninitialized) timer.
         */
@@ -127,14 +124,12 @@ public:
                init(function, seconds, mode, source);
        }
 
-
        /**
         * Deconstruct a timer.  This will automagically invalidate the timer,
         * so it will not expire or fire an event.
         */
        ~timer();
 
-
        /**
         * Initialize a timer with a scheduled time.  If the timer is already
         * scheduled, its prior schedule will be invalidated and replaced by
@@ -157,20 +152,17 @@ public:
                          enum mode mode = relative,
                          timer_source& source = default_source());
 
-       
        /**
         * Manually invalidated the timer, removing any schedule such that the
         * timer will not expired and no event will be fired.
         */
        void invalidate();
 
-
        enum mode mode() const
        {
                return mode_;
        }
 
-
        /**
         * Manually fire the timer event.  Usually, the timer event will be
         * fired when the timer expires, but this can be used to fire it
@@ -185,7 +177,6 @@ public:
                fire(source_->ticks());
        }
 
-
        /**
         * Fire the timer event if it is expired.
         * \param t The absolute time used as a reference to determine if the
@@ -193,17 +184,20 @@ public:
         * \return The absolute time of the next expiration (if repeating), or
         * 0.0 otherwise.
         */
-       scalar fire_if_expired(scalar t)
+       bool fire_if_expired(scalar t)
        {
-               if (is_expired(t)) fire(t);
-               return absolute_;
+               if (is_expired(t))
+               {
+                       fire(t);
+                       return true;
+               }
+               return false;
        }
-       scalar fire_if_expired()
+       bool fire_if_expired()
        {
                return fire_if_expired(source_->ticks());
        }
 
-
        /**
         * Get the absolute time of the next expiration of this timer.
         * \return Seconds.
@@ -230,7 +224,6 @@ public:
                return remaining(source_->ticks());
        }
 
-
        /**
         * Get whether or not the timer is expired.  A timer on a repeating
         * schedule will never be expired since it will always have a scheduled
@@ -250,7 +243,6 @@ public:
                return is_expired(source_->ticks());
        }
 
-
        static timer_source& default_source();
 
        /**
@@ -260,7 +252,6 @@ public:
         */
        static scalar ticks();
 
-
        /**
         * Put the thread to sleep for a certain period of time.  If absolute
         * is true, then it will sleep until the default timer reaches the
@@ -274,30 +265,27 @@ public:
         */
        static void sleep(scalar seconds, enum mode mode = relative);
 
-
 private:
 
        void added_to_runloop(runloop& runloop);
        void detach_from_runloop();
 
-
-       function                function_;
-       enum mode               mode_;
-       scalar                  absolute_;
-       scalar                  interval_;
+       function        function_;
+       enum mode       mode_;
+       scalar          absolute_;
+       scalar          interval_;
        timer_source*   source_;
-       runloop*                runloop_;
+       runloop*        runloop_;
 };
 
 
-
-
 class game_time : public timer_source
 {
 public:
 
        game_time(scalar timestep = SCALAR(1.0)) :
-               scale_(timestep)
+               scale_(timestep),
+               scalefactor_(SCALAR(1.0))
        {
                reset(timestep);
        }
@@ -316,29 +304,30 @@ public:
        {
                reset();
                timestep_ = timestep;
+               scale_ = timestep_ * scalefactor_;
        }
 
        void scale(scalar factor)
        {
                reference_ = ticks();
-               ticks_ = 1;
+               ticks_ = 0;
                scale_ = timestep_ * factor;
+               scalefactor_ = factor;
        }
 
-
-       unsigned step(unsigned step = 1)
+       scalar step(unsigned step = 1)
        {
                ticks_ += step;
-               return ticks_;
+               return scale_;
        }
 
-
 private:
 
        scalar          reference_;
        unsigned        ticks_;
        scalar          timestep_;
        scalar          scale_;
+       scalar          scalefactor_;
 };
 
 
index 263ea882bcfce6751078674436ffe155aa555aab..30de984d8a9ecc84644ae273db9cfba132c5ec9e 100644 (file)
@@ -1,13 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <sstream>
 #include <stdexcept>
@@ -69,56 +71,52 @@ void video::recreate_context()
 void video::set_opengl_attributes()
 {
        SDL_GL_SetAttribute(SDL_GL_RED_SIZE,
-                                               attributes_.color_buffer[0]);
+                       attributes_.color_buffer[0]);
        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,
-                                               attributes_.color_buffer[1]);
+                       attributes_.color_buffer[1]);
        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,
-                                               attributes_.color_buffer[2]);
+                       attributes_.color_buffer[2]);
        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,
-                                               attributes_.color_buffer[3]);
+                       attributes_.color_buffer[3]);
        SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,
-                                               attributes_.frame_buffer);
+                       attributes_.frame_buffer);
        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,
-                                               attributes_.is_double_buffer);
+                       attributes_.is_double_buffer);
        SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,
-                                               attributes_.depth_buffer);
+                       attributes_.depth_buffer);
        SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,
-                                               attributes_.stencil_buffer);
+                       attributes_.stencil_buffer);
        SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,
-                                               attributes_.accumulator_buffer[0]);
+                       attributes_.accumulator_buffer[0]);
        SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,
-                                               attributes_.accumulator_buffer[1]);
+                       attributes_.accumulator_buffer[1]);
        SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,
-                                               attributes_.accumulator_buffer[2]);
+                       attributes_.accumulator_buffer[2]);
        SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,
-                                               attributes_.accumulator_buffer[3]);
+                       attributes_.accumulator_buffer[3]);
        SDL_GL_SetAttribute(SDL_GL_STEREO,
-                                               attributes_.is_stereo);
+                       attributes_.is_stereo);
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,
-                                               attributes_.multisample_buffers);
+                       attributes_.multisample_buffers);
        SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,
-                                               attributes_.multisample_samples);
+                       attributes_.multisample_samples);
        SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,
-                                               attributes_.is_swap_control);
+                       attributes_.is_swap_control);
        SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,
-                                               attributes_.is_hardware_only);
+                       attributes_.is_hardware_only);
 }
 
-
 video::~video()
 {
        SDL_FreeSurface(context_);
-
        if (current_ == this) current_ = 0;
 }
 
-
 class video::attributes video::attributes() const
 {
        return attributes_;
 }
 
-
 void video::mode(const int mode[3])
 {
        if (mode != attributes_.mode || !context_)
@@ -126,7 +124,7 @@ void video::mode(const int mode[3])
                if (context_) SDL_FreeSurface(context_);
 
                context_ = SDL_SetVideoMode(mode[0], mode[1], mode[2],
-                               SDL_OPENGL | flags_);
+                               flags_);
 
                if (context_)
                {
@@ -134,7 +132,7 @@ void video::mode(const int mode[3])
                        attributes_.mode[1] = mode[1];
                        attributes_.mode[2] = mode[2];
 
-#if !defined(linux) && !defined(__linux) && !defined(__linux__)
+#if PLATFORM_WIN32
                        log_info("video context recreated");
                        dispatcher::global().dispatch("video.newcontext");
 #endif
@@ -146,7 +144,6 @@ void video::mode(const int mode[3])
        }
 }
 
-
 void video::resize(int width, int height)
 {
        int mode[] = {width, height, attributes_.mode[2]};
@@ -158,7 +155,6 @@ bool video::iconify()
        return SDL_WM_IconifyWindow();
 }
 
-
 void video::caption(const std::string& caption)
 {
        caption_ = caption;
@@ -168,12 +164,8 @@ void video::caption(const std::string& caption)
 const std::string& video::caption() const
 {
        return caption_;
-       //char* caption;
-       //SDL_WM_GetCaption(&caption, 0);
-       //return std::string(caption);
 }
 
-
 void video::fullscreen(bool full)
 {
        if (full != fullscreen() || !context_)
@@ -182,7 +174,7 @@ void video::fullscreen(bool full)
                {
                        flags_ ^= SDL_FULLSCREEN;
 
-#if defined(linux) || defined(__linux) || defined(__linux__)
+#if PLATFORM_POSIX
                        if (SDL_WM_ToggleFullScreen(context_) == 0)
 #endif
                        recreate_context();
@@ -205,7 +197,6 @@ void video::toggle_fullscreen()
        fullscreen(!fullscreen());
 }
 
-
 void video::resizable(bool is_resizable)
 {
        if (is_resizable != resizable() || !context_)
@@ -233,7 +224,6 @@ void video::toggle_resizable()
        resizable(!resizable());
 }
 
-
 void video::cursor_visible(bool is_cursor_visible)
 {
        SDL_ShowCursor(is_cursor_visible? SDL_ENABLE : SDL_DISABLE);
@@ -249,7 +239,6 @@ void video::toggle_cursor_visible()
        cursor_visible(!cursor_visible());
 }
 
-
 bool video::cursor_captured() const
 {
        return (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON);
@@ -265,7 +254,6 @@ void video::toggle_cursor_captured()
        cursor_captured(!cursor_captured());
 }
 
-
 void video::swap(scalar t)
 {
        if (show_fps_)
@@ -286,11 +274,9 @@ void video::swap(scalar t)
 
                ++fps_counter_;
        }
-
        SDL_GL_SwapBuffers();
 }
 
-
 int video::width() const
 {
        return context_->w;
@@ -301,7 +287,6 @@ int video::height() const
        return context_->h;
 }
 
-
 void video::make_current() const
 {
        current_ = const_cast<video*>(this);
@@ -356,8 +341,7 @@ video::attributes::attributes(const settings& settings)
        }
        else if (is_fullscreen && backend::is_initialized())
        {
-               SDL_Rect** modes = SDL_ListModes(NULL,
-                                                                                SDL_FULLSCREEN | SDL_HWSURFACE);
+               SDL_Rect** modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
 
                if (modes == (SDL_Rect**)0)
                {
index 0b5cb99a7afff09adb7802547eeff0e9ac93c70d..6b4980e519fb48391f5249bb109cf3d979f8f1a5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_VIDEO_HH_
 #define _MOOF_VIDEO_HH_
 namespace moof {
 
 
+// forward declarations
 class settings;
 
 class video;
 typedef boost::shared_ptr<video> video_ptr;
 
-
 class video
 {
 public:
 
        struct attributes
        {
-               int                     color_buffer[4];                // rgba
-               int                     frame_buffer;
-               bool            is_double_buffer;
-               int                     depth_buffer;
-               int                     stencil_buffer;
-               int                     accumulator_buffer[4];  // rgba
-               bool            is_stereo;
-               int                     multisample_buffers;
-               int                     multisample_samples;
-               bool            is_swap_control;
-               bool            is_hardware_only;
-               int                     mode[3];                                // width, height, bpp
-               bool            is_fullscreen;
-               bool            is_resizable;
-               bool            is_cursor_visible;
-               bool            is_cursor_captured;
+               int     color_buffer[4];        // rgba
+               int     frame_buffer;
+               bool    is_double_buffer;
+               int     depth_buffer;
+               int     stencil_buffer;
+               int     accumulator_buffer[4];  // rgba
+               bool    is_stereo;
+               int     multisample_buffers;
+               int     multisample_samples;
+               bool    is_swap_control;
+               bool    is_hardware_only;
+               int     mode[3];                // width, height, bpp
+               bool    is_fullscreen;
+               bool    is_resizable;
+               bool    is_cursor_visible;
+               bool    is_cursor_captured;
 
                attributes();
                attributes(const settings& settings);
@@ -66,10 +64,9 @@ public:
 
                void init();
 
-               backend         mBackend;
+               backend backend_;
        };
 
-
        static video_ptr alloc(const attributes& attribs)
        {
                return video_ptr(new video(attribs));
@@ -77,8 +74,8 @@ public:
 
        explicit video(const std::string& caption = "Moof!!");
        explicit video(const class attributes& attribs);
-       video(const std::string& caption,
-                                  const class attributes& attribs);
+       explicit video(const std::string& caption,
+                       const class attributes& attribs);
        ~video();
 
        class attributes attributes() const;
@@ -107,13 +104,11 @@ public:
        bool cursor_captured() const;
        void toggle_cursor_captured();
 
-
        /**
         * Swap the video buffers if double-buffered.
         */
        void swap(scalar t = timer::ticks());
 
-
        /**
         * Make this video context the current context which will be effected
         * by future draw commands.
@@ -128,7 +123,6 @@ public:
                return current_;
        }
 
-
        /**
         * Get the width of the video display.
         * \return The pixel width.
@@ -141,7 +135,6 @@ public:
         */
        int height() const;
 
-
        void show_fps(bool show)
        {
                show_fps_ = show;
@@ -155,7 +148,6 @@ public:
                return show_fps_;
        }
 
-
 private:
 
        void init();
@@ -166,13 +158,13 @@ private:
        // TODO: this implementation is not well hidden
 
        SDL_Surface*            context_;
-       int                                     flags_;
+       int                     flags_;
        class attributes        attributes_;
-       bool                            show_fps_;
-       std::string                     caption_;
-       scalar                          fps_accumulator_;
-       int                                     fps_counter_;
-       scalar                          last_swap_;
+       bool                    show_fps_;
+       std::string             caption_;
+       scalar                  fps_accumulator_;
+       int                     fps_counter_;
+       scalar                  last_swap_;
 
        static video*           current_;
 };
index f6bd89b6c47fb2a953c2ea07da09254b7f48b689..16ebea65b22660307107188bfc07b07751d77eae 100644 (file)
@@ -3,31 +3,30 @@
 # Define rules and targets for Yoink.
 #
 
-$(call include,moof stlplus)           # Recurse into subdirectories.
+$(call include,moof stlplus)   # Recurse into subdirectories.
 
-objects                = $(patsubst %.c,$(builddir)/%.o,$(patsubst %.cc,$(builddir)/%.o,$(wildcard $d/*.c $d/*.cc)))
+objects        = $(patsubst %.c,$(builddir)/%.o,$(patsubst %.cc,$(builddir)/%.o,$(wildcard $d/*.c $d/*.cc)))
 
 ifeq (win32,$(platform))
-objects                += $b/win32.o                   # Also compile win32 resource file.
+objects        += $b/win32.o           # Also compile win32 resource file.
 endif
 
 ifeq (true,$(includeConfig))
-objects                += $b/config.o                  # Also compile in the configuration.
-exec           += $b/config.c                  # Make config.c a build target.
+objects        += $b/config.o          # Also compile in the configuration.
+exec   += $b/config.c          # Make config.c a build target.
 $b/config.c: config.mk
        $(Q)$(xxd)
 endif
 
 $(objects): TGT_CFLAGS := -I$d
 $(objects): config.h $(this) | $b
-# Make all objects depend on config.h; it's excessive, but config.h won't
-# be remade otherwise if dependencies are not being generated.  The
-# alternative is to maintain an accurate list of objects with a dependency
-# on config.h.
+# Make all objects depend on config.h; it's excessive, but config.h won't be
+# remade otherwise if dependencies are not being generated.  The alternative
+# is to maintain an accurate list of objects with a dependency on config.h.
 
-exec           += $(objects)                   # Make the objects build targets.
+exec   += $(objects)           # Make the objects build targets.
 
-bindir_$b := $b/$(projectName)$(EXEEXT)                # Install executable to bindir.
+bindir_$b := $b/$(projectName)$(EXEEXT)        # Install executable to bindir.
 $(bindir_$b): $(objects) $b/moof/libmoof.a $b/stlplus/libstlplus.a
        $(Q)$(link_cc)
 
index e6d807b76451637f54ca97c531caa80c7f8826f1..b15fa5201bbadc71c0a60bde340cb6fde50afe2c 100644 (file)
@@ -5,7 +5,7 @@
 
 objects        = $(patsubst %.cpp,$(builddir)/%.o,$(shell find $d -name "*.cpp"))
 $(objects): TGT_CFLAGS := -I$d -I$d/containers -I$d/portability
-$(objects): config.mk $(this) | $b/containers $b/portability $b/strings
+$(objects): config.mk $(this) | $b/containers $b/portability
 
 library        = $b/libstlplus.a
 $(library): $(objects)
diff --git a/src/stlplus/strings/format_types.hpp b/src/stlplus/strings/format_types.hpp
deleted file mode 100644 (file)
index c9711c3..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#ifndef STLPLUS_FORMAT_TYPES
-#define STLPLUS_FORMAT_TYPES
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   A Set of enumerations controlling the string formatting of numbers.
-
-////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////
-// Integer radix display representations:
-//   There are three ways in which the radix is represented:
-//     - none - the number is just printed as a number (e.g. 12345). Can be confusing for non-decimal radix
-//     - C style - for binary, octal and hex, the C-style prefices 0b, 0 and 0x are used
-//       note that this is an unsigned representation
-//     - Hash style - in the form radix#value - the value may be signed, e.g. 10#-9
-
-enum radix_display_t 
-{
-  radix_none,               // just print the number with no radix indicated
-  radix_hash_style,         // none for decimal, hash style for all others
-  radix_hash_style_all,     // hash style for all radices including decimal
-  radix_c_style,            // C style for hex and octal, none for others
-  radix_c_style_or_hash     // C style for hex and octal, none for decimal, hash style for others
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Floating-point display representations:
-// There are three formats for the printout:
-//   - fixed - formatted as a fixed-point number, so no mantissa is printed (equivalent to %f in printf)
-//   - floating - formatted as a normalised floating-point number (equivalent to %e in printf)
-//   - mixed - formatted as fixed-point if appropriate, otherwise the floating format (equivalent to %g in printf)
-
-enum real_display_t
-{
-  display_fixed,    // %f
-  display_floating, // %e
-  display_mixed     // %g
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// Alignment:
-//   There are three field alignments:
-//     - left aligned - the value is to the left of the field which is padded to the right with spaces
-//     - right aligned - the value is to the right of the field which is padded to the left with spaces
-//     - centred - the value is in the centre of the field and spaces added to both left and right
-
-enum alignment_t
-{
-  align_left,
-  align_right,
-  align_centre
-};
-
-////////////////////////////////////////////////////////////////////////////////
-#endif
diff --git a/src/stlplus/strings/print_address.cpp b/src/stlplus/strings/print_address.cpp
deleted file mode 100644 (file)
index 74e416f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   use the unsigned long representation for pointers
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_address.hpp"
-#include "print_int.hpp"
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_address(std::ostream& device, const void* i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    print_unsigned_long(device, (unsigned long)i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_address.hpp b/src/stlplus/strings/print_address.hpp
deleted file mode 100644 (file)
index 6ba90bc..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_PRINT_ADDRESS
-#define STLPLUS_PRINT_ADDRESS
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_address(std::ostream& device, 
-                     const void*,
-                     unsigned radix = 16,
-                     radix_display_t display = radix_c_style_or_hash,
-                     unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/print_basic.hpp b/src/stlplus/strings/print_basic.hpp
deleted file mode 100644 (file)
index f85b00e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef STLPLUS_PRINT_BASIC
-#define STLPLUS_PRINT_BASIC
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Utilities for converting printing basic C types
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "print_address.hpp"
-#include "print_bool.hpp"
-#include "print_cstring.hpp"
-#include "print_float.hpp"
-#include "print_int.hpp"
-#include "print_pointer.hpp"
-
-#endif
diff --git a/src/stlplus/strings/print_bitset.hpp b/src/stlplus/strings/print_bitset.hpp
deleted file mode 100644 (file)
index d87ee20..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef STLPLUS_PRINT_BITSET
-#define STLPLUS_PRINT_BITSET
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a bitset
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <bitset>
-#include <string>
-#include <iostream>
-
-namespace stlplus
-{
-
-  template<size_t N>
-  void print_bitset(std::ostream& device, const std::bitset<N>& data);
-
-} // end namespace stlplus
-
-#include "print_bitset.tpp"
-#endif
diff --git a/src/stlplus/strings/print_bitset.tpp b/src/stlplus/strings/print_bitset.tpp
deleted file mode 100644 (file)
index 5514bea..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_bitset.hpp"
-
-namespace stlplus
-{
-
-  template<size_t N>
-  void print_bitset(std::ostream& device, const std::bitset<N>& data)
-  {
-    device << bitset_to_string(data);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_bool.cpp b/src/stlplus/strings/print_bool.cpp
deleted file mode 100644 (file)
index 0d63deb..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   use the unsigned short representation for bool
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_bool.hpp"
-#include "print_int.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_bool(std::ostream& device, bool i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    print_unsigned_short(device, (unsigned short)i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_bool.hpp b/src/stlplus/strings/print_bool.hpp
deleted file mode 100644 (file)
index f22a1c0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef STLPLUS_PRINT_BOOL
-#define STLPLUS_PRINT_BOOL
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Conversion of string to/from bool
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_bool(std::ostream& device, bool i,
-                  unsigned radix = 10,
-                  radix_display_t display = radix_c_style_or_hash,
-                  unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/print_cstring.cpp b/src/stlplus/strings/print_cstring.cpp
deleted file mode 100644 (file)
index 50c733d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_cstring.hpp"
-
-namespace stlplus
-{
-
-  void print_cstring(std::ostream& device, const char* value)
-  {
-    device << value;
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_cstring.hpp b/src/stlplus/strings/print_cstring.hpp
deleted file mode 100644 (file)
index d705015..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef STLPLUS_PRINT_CSTRING
-#define STLPLUS_PRINT_CSTRING
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Functions for converting C/STL strings to string
-
-//   This is necessary for completeness
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  void print_cstring(std::ostream& device, const char* value);
-
-}
-
-#endif
diff --git a/src/stlplus/strings/print_digraph.hpp b/src/stlplus/strings/print_digraph.hpp
deleted file mode 100644 (file)
index 126b8a3..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_PRINT_DIGRAPH
-#define STLPLUS_PRINT_DIGRAPH
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a digraph
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "digraph.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename NT, typename AT, typename NS, typename AS>
-  void print_digraph(std::ostream& device,
-                     const digraph<NT,AT>& values,
-                     NS node_print_fn,
-                     AS arc_print_fn,
-                     const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "print_digraph.tpp"
-#endif
diff --git a/src/stlplus/strings/print_digraph.tpp b/src/stlplus/strings/print_digraph.tpp
deleted file mode 100644 (file)
index af2818f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  template<typename NT, typename AT, typename NS, typename AS>
-  void print_digraph(std::ostream& device, const digraph<NT,AT>& values,
-                     NS node_print_fn,
-                     AS arc_print_fn,
-                     const std::string& separator)
-  {
-    device << "nodes:";
-    device << separator;
-    print_sequence(device, values.begin(), values.end(), node_print_fn, separator);
-    device << "arcs:";
-    device << separator;
-    print_sequence(device, values.arc_begin(), values.arc_end(), arc_print_fn, separator);
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_float.cpp b/src/stlplus/strings/print_float.cpp
deleted file mode 100644 (file)
index dc10b20..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_float.hpp"
-#include "string_float.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // floating-point types
-
-  void print_float(std::ostream& device, float f, real_display_t display, unsigned width, unsigned precision)
-    throw(std::invalid_argument)
-  {
-    device << float_to_string(f, display, width, precision);
-  }
-
-  void print_double(std::ostream& device, double f, real_display_t display, unsigned width, unsigned precision)
-    throw(std::invalid_argument)
-  {
-    device << double_to_string(f, display, width, precision);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_float.hpp b/src/stlplus/strings/print_float.hpp
deleted file mode 100644 (file)
index 9ee54ee..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef STLPLUS_PRINT_FLOAT
-#define STLPLUS_PRINT_FLOAT
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Convert a float/double to/from string
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // convert a real type to string
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // Only decimal radix is supported
-
-  // The way in which the number is displayed is defined in radix_types.hpp
-  // Using any other value for the display type causes std::invalid_argument to be thrown
-
-  void print_float(std::ostream& device, float f,
-                   real_display_t display = display_mixed,
-                   unsigned width = 0,
-                   unsigned precision = 6)
-    throw(std::invalid_argument);
-
-  void print_double(std::ostream& device, double f,
-                    real_display_t display = display_mixed,
-                    unsigned width = 0,
-                    unsigned precision = 6)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/print_foursome.hpp b/src/stlplus/strings/print_foursome.hpp
deleted file mode 100644 (file)
index 899915f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef STLPLUS_PRINT_FOURSOME
-#define STLPLUS_PRINT_FOURSOME
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a foursome
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "foursome.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename T4, typename S1, typename S2, typename S3, typename S4>
-  void print_foursome(std::ostream& device,
-                      const foursome<T1,T2,T3,T4>& values,
-                      S1 print_fn1,
-                      S2 print_fn2,
-                      S3 print_fn3,
-                      S4 print_fn4,
-                      const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "print_foursome.tpp"
-#endif
diff --git a/src/stlplus/strings/print_foursome.tpp b/src/stlplus/strings/print_foursome.tpp
deleted file mode 100644 (file)
index adec37d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename T4, typename S1, typename S2, typename S3, typename S4>
-  void print_foursome(std::ostream& device,
-                      const foursome<T1,T2,T3,T4>& values,
-                      S1 print_fn1,
-                      S2 print_fn2,
-                      S3 print_fn3,
-                      S4 print_fn4,
-                      const std::string& separator)
-  {
-    print_fn1(device, values.first);
-    device << separator;
-    print_fn2(device, values.second);
-    device << separator;
-    print_fn3(device, values.third);
-    device << separator;
-    print_fn4(device, values.fourth);
-  }
-
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_hash.hpp b/src/stlplus/strings/print_hash.hpp
deleted file mode 100644 (file)
index 36915b5..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef STLPLUS_PRINT_HASH
-#define STLPLUS_PRINT_HASH
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a hash
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "hash.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename H, typename E, typename KS, typename TS>
-  void print_hash(std::ostream& device,
-                  const hash<K,T,H,E>& values,
-                  KS key_print_fn,
-                  TS value_print_fn,
-                  const std::string& pair_separator = ":",
-                  const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "print_hash.tpp"
-#endif
diff --git a/src/stlplus/strings/print_hash.tpp b/src/stlplus/strings/print_hash.tpp
deleted file mode 100644 (file)
index 84d2fe4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename H, typename E, typename KS, typename TS>
-  void print_hash(std::ostream& device,
-                  const hash<K,T,H,E>& values,
-                  KS key_print_fn,
-                  TS value_print_fn,
-                  const std::string& pair_separator,
-                  const std::string& separator)
-  {
-    print_pair_sequence(device, 
-                        values.begin(), values.end(),
-                        key_print_fn, value_print_fn,
-                        pair_separator, separator);
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_inf.cpp b/src/stlplus/strings/print_inf.cpp
deleted file mode 100644 (file)
index fb55917..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   String conversion functions for the infinite precision integer type inf
-
-////////////////////////////////////////////////////////////////////////////////
-
-// can be excluded from the build to break the dependency on the portability library
-#ifndef NO_STLPLUS_INF
-
-#include "print_inf.hpp"
-#include "string_inf.hpp"
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  void print_inf(std::ostream& device,
-                 const stlplus::inf& data,
-                 unsigned radix,
-                 radix_display_t display,
-                 unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << inf_to_string(data, radix, display, width);
-  }
-
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/print_inf.hpp b/src/stlplus/strings/print_inf.hpp
deleted file mode 100644 (file)
index b3bfc27..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef STLPLUS_PRINT_INF
-#define STLPLUS_PRINT_INF
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   String conversion functions for the infinite precision integer type inf
-
-//   The conversion supports all the formatting modes defined on format_types
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "strings_fixes.hpp"
-#include "inf.hpp"
-#include "format_types.hpp"
-#include <stdexcept>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_inf(std::ostream& device,
-                 const inf&,
-                 unsigned radix = 10,
-                 radix_display_t display = radix_c_style_or_hash,
-                 unsigned width = 0)
-    throw(std::invalid_argument);
-
-////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
-
-
-#endif
diff --git a/src/stlplus/strings/print_int.cpp b/src/stlplus/strings/print_int.cpp
deleted file mode 100644 (file)
index cde00ee..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_int.hpp"
-#include "string_int.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void print_short(std::ostream& device, short i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << short_to_string(i, radix, display, width);
-  }
-
-  void print_unsigned_short(std::ostream& device, unsigned short i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << unsigned_short_to_string(i, radix, display, width);
-  }
-
-  void print_int(std::ostream& device, int i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << int_to_string(i, radix, display, width);
-  }
-
-  void print_unsigned(std::ostream& device, unsigned i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << unsigned_to_string(i, radix, display, width);
-  }
-
-  void print_long(std::ostream& device, long i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << long_to_string(i, radix, display, width);
-  }
-
-  void print_unsigned_long(std::ostream& device, unsigned long i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    device << unsigned_long_to_string(i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_int.hpp b/src/stlplus/strings/print_int.hpp
deleted file mode 100644 (file)
index d09ef70..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef STLPLUS_PRINT_INT
-#define STLPLUS_PRINT_INT
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Print integer types
-
-//   This extends the formatting available from iostream
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Conversions of Integer types to string
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // The radix (i.e. base) for these conversions can be any value from base 2 to base 36
-  // specifying any other radix causes std::invalid_argument to be thrown
-
-  // The way in which the radix is displayed is defined in radix_types.hpp
-  // If any other value is used, std::invalid_argument is thrown
-
-  // The width argument specifies the number of numerical digits to use in the result
-  // This is a minimum - if the value requires more digits then it will be wider than the width argument
-  // However, if it is smaller, then it will be extended to the specified width
-  // Then, the radix display prefix is added to this width
-
-  // For example, using the hash representation of 0 in hex with width=4 gives:
-  // 16#0000 - so there's 4 digits in the number part
-
-  void print_short(std::ostream& device, short i,
-                   unsigned radix = 10,
-                   radix_display_t display = radix_c_style_or_hash,
-                   unsigned width = 0)
-    throw(std::invalid_argument);
-
-  void print_unsigned_short(std::ostream& device, unsigned short i,
-                            unsigned radix = 10,
-                            radix_display_t display = radix_c_style_or_hash,
-                            unsigned width = 0)
-    throw(std::invalid_argument);
-
-  void print_int(std::ostream& device, int i,
-                 unsigned radix = 10,
-                 radix_display_t display = radix_c_style_or_hash,
-                 unsigned width = 0)
-    throw(std::invalid_argument);
-
-  void print_unsigned(std::ostream& device, unsigned i,
-                      unsigned radix = 10,
-                      radix_display_t display = radix_c_style_or_hash,
-                      unsigned width = 0)
-    throw(std::invalid_argument);
-
-  void print_long(std::ostream& device, long i,
-                  unsigned radix = 10,
-                  radix_display_t display = radix_c_style_or_hash,
-                  unsigned width = 0)
-    throw(std::invalid_argument);
-
-  void print_unsigned_long(std::ostream& device, unsigned long i,
-                           unsigned radix = 10,
-                           radix_display_t display = radix_c_style_or_hash,
-                           unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/print_list.hpp b/src/stlplus/strings/print_list.hpp
deleted file mode 100644 (file)
index fd1027a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef STLPLUS_PRINT_LIST
-#define STLPLUS_PRINT_LIST
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a list
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <list>
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_list(std::ostream& device,
-                  const std::list<T>& values,
-                  S print_fn,
-                  const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "print_list.tpp"
-#endif
diff --git a/src/stlplus/strings/print_list.tpp b/src/stlplus/strings/print_list.tpp
deleted file mode 100644 (file)
index a573175..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   template implementations
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_list(std::ostream& device,
-                  const std::list<T>& values,
-                  S print_fn,
-                  const std::string& separator)
-  {
-    print_sequence(device, values.begin(), values.end(), print_fn, separator);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_map.hpp b/src/stlplus/strings/print_map.hpp
deleted file mode 100644 (file)
index 83c0048..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef STLPLUS_PRINT_MAP
-#define STLPLUS_PRINT_MAP
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a map/multimap
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <map>
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  void print_map(std::ostream& device, const std::map<K,T,C>& values,
-                 SK key_print_fn,
-                 ST value_print_fn,
-                 const std::string& pair_separator = ":",
-                 const std::string& separator = ",");
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  void print_multimap(std::ostream& device, const std::multimap<K,T,C>& values,
-                      SK key_print_fn,
-                      ST value_print_fn,
-                      const std::string& pair_separator = ":",
-                      const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "print_map.tpp"
-#endif
diff --git a/src/stlplus/strings/print_map.tpp b/src/stlplus/strings/print_map.tpp
deleted file mode 100644 (file)
index f499e8f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // map
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  void print_map(std::ostream& device, const std::map<K,T,C>& values,
-                 SK key_print_fn,
-                 ST value_print_fn,
-                 const std::string& pair_separator,
-                 const std::string& separator)
-  {
-    print_pair_sequence(values.begin(), values.end(),
-                        key_print_fn, value_print_fn,
-                        pair_separator, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // multimap
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  void print_multimap(std::ostream& device, const std::multimap<K,T,C>& values,
-                      SK key_print_fn,
-                      ST value_print_fn,
-                      const std::string& pair_separator,
-                      const std::string& separator)
-  {
-    print_pair_sequence(device,
-                        values.begin(), values.end(),
-                        key_print_fn, value_print_fn,
-                        pair_separator, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_matrix.hpp b/src/stlplus/strings/print_matrix.hpp
deleted file mode 100644 (file)
index b7f321a..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_PRINT_MATRIX
-#define STLPLUS_PRINT_MATRIX
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a matrix
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "matrix.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_matrix(std::ostream& device,
-                    const matrix<T>& values,
-                    S print_fn,
-                    const std::string& column_separator = "|",
-                    const std::string& row_separator = ",");
-
-} // end namespace stlplus
-
-#include "print_matrix.tpp"
-#endif
diff --git a/src/stlplus/strings/print_matrix.tpp b/src/stlplus/strings/print_matrix.tpp
deleted file mode 100644 (file)
index a31bd54..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  template<typename T, typename S>
-  void print_matrix(std::ostream& device, const matrix<T>& values,
-                    S print_fn,
-                    const std::string& column_separator,
-                    const std::string& row_separator)
-  {
-    for (unsigned r = 0; r < values.rows(); r++)
-    {
-      if (r != 0) device << row_separator;
-      for (unsigned c = 0; c < values.columns(); c++)
-      {
-        if (c != 0) device << column_separator;
-        print_fn(device, values(r,c));
-      }
-    }
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_ntree.hpp b/src/stlplus/strings/print_ntree.hpp
deleted file mode 100644 (file)
index f09ea73..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_PRINT_NTREE
-#define STLPLUS_PRINT_NTREE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of an ntree
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "ntree.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_ntree(std::ostream& device,
-                   const ntree<T>& values,
-                   S print_fn,
-                   const std::string& separator = "|",
-                   const std::string& indent_string = "  ");
-
-} // end namespace stlplus
-
-#include "print_ntree.tpp"
-#endif
diff --git a/src/stlplus/strings/print_ntree.tpp b/src/stlplus/strings/print_ntree.tpp
deleted file mode 100644 (file)
index f78895a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_ntree(std::ostream& device,
-                   const ntree<T>& values,
-                   S print_fn,
-                   const std::string& separator,
-                   const std::string& indent_string)
-  {
-    for (TYPENAME ntree<T>::const_prefix_iterator i = values.prefix_begin(); i != values.prefix_end(); i++)
-    {
-      if (i != values.prefix_begin()) device << separator;
-      for (unsigned indent = values.depth(i.simplify()); --indent; )
-        device << indent_string;
-      print_fn(device, *i);
-    }
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_pair.hpp b/src/stlplus/strings/print_pair.hpp
deleted file mode 100644 (file)
index 58dff79..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef STLPLUS_PRINT_PAIR
-#define STLPLUS_PRINT_PAIR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a pair
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <map>
-#include <string>
-#include <iostream>
-
-namespace stlplus
-{
-
-  template<typename V1, typename V2, typename S1, typename S2>
-  void print_pair(std::ostream& device,
-                  const std::pair<V1,V2>& values,
-                  S1 print_fn1,
-                  S2 print_fn2,
-                  const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "print_pair.tpp"
-#endif
diff --git a/src/stlplus/strings/print_pair.tpp b/src/stlplus/strings/print_pair.tpp
deleted file mode 100644 (file)
index 1d98050..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename V1, typename V2, typename S1, typename S2>
-  void print_pair(std::ostream& device,
-                  const std::pair<V1,V2>& values,
-                  S1 print_fn1,
-                  S2 print_fn2,
-                  const std::string& separator)
-  {
-    print_fn1(device, values.first);
-    device << separator;
-    print__fn2(device, values.second);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_pointer.hpp b/src/stlplus/strings/print_pointer.hpp
deleted file mode 100644 (file)
index 971c0ac..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef STLPLUS_PRINT_POINTER
-#define STLPLUS_PRINT_POINTER
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of an object pointed to
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-
-namespace stlplus
-{
-
-  template <typename T, typename S>
-  void print_pointer(std::ostream& device,
-                     const T* value,
-                     S print_fn,
-                     const std::string& null_string = "<null>",
-                     const std::string& prefix = "(",
-                     const std::string& suffix = ")");
-
-
-}
-
-#include "print_pointer.tpp"
-#endif
diff --git a/src/stlplus/strings/print_pointer.tpp b/src/stlplus/strings/print_pointer.tpp
deleted file mode 100644 (file)
index ade9273..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include <string>
-
-namespace stlplus
-{
-
-  template <typename T, typename S>
-  void print_pointer(std::ostream& device,
-                     const T* value,
-                     S print_fn,
-                     const std::string& null_string,
-                     const std::string& prefix,
-                     const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_sequence.hpp b/src/stlplus/strings/print_sequence.hpp
deleted file mode 100644 (file)
index 317fbf2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef STLPLUS_PRINT_SEQUENCE
-#define STLPLUS_PRINT_SEQUENCE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate string representations of sequences represented by forward iterators
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence
-
-  template <typename I, typename S>
-  void print_sequence(std::ostream& device,
-                      I begin, I end, 
-                      S print_fn,
-                      const std::string& separator);
-
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence of pairs
-
-  template <typename I, typename S1, typename S2>
-  void print_pair_sequence(std::ostream& device,
-                           I begin, I end,
-                           S1 print_fn1,
-                           S2 print_fn2,
-                           const std::string& pair_separator,
-                           const std::string& separator);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#include "print_sequence.tpp"
-#endif
diff --git a/src/stlplus/strings/print_sequence.tpp b/src/stlplus/strings/print_sequence.tpp
deleted file mode 100644 (file)
index 8600ca8..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_pair.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence
-
-  template <typename I, typename S>
-  void print_sequence(std::ostream& device,
-                      I begin, I end, 
-                      S print_fn,
-                      const std::string& separator)
-  {
-    for (I i = begin; i != end; i++)
-    {
-      if (i != begin) device << separator;
-      print_fn(device, *i);
-    }
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any sequence where the value is a pair
-
-  template <typename I, typename S1, typename S2>
-  void print_pair_sequence(std::ostream& device,
-                           I begin, I end,
-                           S1 print_fn1,
-                           S2 print_fn2,
-                           const std::string& pair_separator,
-                           const std::string& separator)
-  {
-    for (I i = begin; i != end; i++)
-    {
-      if (i != begin) device << separator;
-      print_pair(device, *i, print_fn1, print_fn2, pair_separator);
-    }
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_set.hpp b/src/stlplus/strings/print_set.hpp
deleted file mode 100644 (file)
index a032ccf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef STLPLUS_PRINT_SET
-#define STLPLUS_PRINT_SET
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a set/multiset
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <set>
-
-namespace stlplus
-{
-
-  template<typename K, typename C, typename S>
-  void print_set(std::ostream& device,
-                 const std::set<K,C>& values,
-                 S print_fn,
-                 const std::string& separator = ",");
-
-  template<typename K, typename C, typename S>
-  void print_multiset(std::ostream& device,
-                      const std::multiset<K,C>& values,
-                      S print_fn,
-                      const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "print_set.tpp"
-#endif
diff --git a/src/stlplus/strings/print_set.tpp b/src/stlplus/strings/print_set.tpp
deleted file mode 100644 (file)
index ba29fd7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   template implementations
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // set
-
-  template<typename K, typename C, typename S>
-  void print_set(std::ostream& device,
-                 const std::set<K,C>& values,
-                 S print_fn,
-                 const std::string& separator)
-  {
-    print_sequence(device, values.begin(), values.end(), print_fn, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // multiset
-
-  template<typename K, typename C, typename S>
-  void print_multiset(std::ostream& device,
-                      const std::multiset<K,C>& values,
-                      S print_fn,
-                      const std::string& separator)
-  {
-    print_sequence(device, values.begin(), values.end(), print_fn, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_simple_ptr.hpp b/src/stlplus/strings/print_simple_ptr.hpp
deleted file mode 100644 (file)
index de4c17d..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef STLPLUS_PRINT_SIMPLE_PTR
-#define STLPLUS_PRINT_SIMPLE_PTR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a smart pointer
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "simple_ptr.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_simple_ptr(std::ostream& device,
-                       const simple_ptr<T>& value,
-                       S print_fn,
-                       const std::string& null_string = "<null>",
-                       const std::string& prefix = "(",
-                       const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  void print_simple_ptr_clone(std::ostream& device,
-                             const simple_ptr_clone<T>& value,
-                             S print_fn,
-                             const std::string& null_string = "<null>",
-                             const std::string& prefix = "(",
-                             const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  void print_simple_ptr_nocopy(std::ostream& device,
-                              const simple_ptr_nocopy<T>& value,
-                              S print_fn,
-                              const std::string& null_string = "<null>",
-                              const std::string& prefix = "(",
-                              const std::string& suffix = ")");
-
-
-} // end namespace stlplus
-
-#include "print_simple_ptr.tpp"
-#endif
diff --git a/src/stlplus/strings/print_simple_ptr.tpp b/src/stlplus/strings/print_simple_ptr.tpp
deleted file mode 100644 (file)
index e4171f2..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_simple_ptr(std::ostream& device,
-                       const simple_ptr<T>& value,
-                       S print_fn,
-                       const std::string& null_string,
-                       const std::string& prefix,
-                       const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-  template<typename T, typename S>
-  void print_simple_ptr_clone(std::ostream& device,
-                             const simple_ptr_clone<T>& value,
-                             S print_fn,
-                             const std::string& null_string,
-                             const std::string& prefix,
-                             const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-  template<typename T, typename S>
-  void print_simple_ptr_nocopy(std::ostream& device,
-                              const simple_ptr_nocopy<T>& value,
-                              S print_fn,
-                              const std::string& null_string,
-                              const std::string& prefix,
-                              const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_smart_ptr.hpp b/src/stlplus/strings/print_smart_ptr.hpp
deleted file mode 100644 (file)
index da8a8b9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef STLPLUS_PRINT_SMART_PTR
-#define STLPLUS_PRINT_SMART_PTR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a smart pointer
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "smart_ptr.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_smart_ptr(std::ostream& device,
-                       const smart_ptr<T>& value,
-                       S print_fn,
-                       const std::string& null_string = "<null>",
-                       const std::string& prefix = "(",
-                       const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  void print_smart_ptr_clone(std::ostream& device,
-                             const smart_ptr_clone<T>& value,
-                             S print_fn,
-                             const std::string& null_string = "<null>",
-                             const std::string& prefix = "(",
-                             const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  void print_smart_ptr_nocopy(std::ostream& device,
-                              const smart_ptr_nocopy<T>& value,
-                              S print_fn,
-                              const std::string& null_string = "<null>",
-                              const std::string& prefix = "(",
-                              const std::string& suffix = ")");
-
-
-} // end namespace stlplus
-
-#include "print_smart_ptr.tpp"
-#endif
diff --git a/src/stlplus/strings/print_smart_ptr.tpp b/src/stlplus/strings/print_smart_ptr.tpp
deleted file mode 100644 (file)
index e57fc98..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_smart_ptr(std::ostream& device,
-                       const smart_ptr<T>& value,
-                       S print_fn,
-                       const std::string& null_string,
-                       const std::string& prefix,
-                       const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-  template<typename T, typename S>
-  void print_smart_ptr_clone(std::ostream& device,
-                             const smart_ptr_clone<T>& value,
-                             S print_fn,
-                             const std::string& null_string,
-                             const std::string& prefix,
-                             const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-  template<typename T, typename S>
-  void print_smart_ptr_nocopy(std::ostream& device,
-                              const smart_ptr_nocopy<T>& value,
-                              S print_fn,
-                              const std::string& null_string,
-                              const std::string& prefix,
-                              const std::string& suffix)
-  {
-    if (value)
-    {
-      device << prefix;
-      print_fn(device, *value);
-      device << suffix;
-    }
-    else
-    {
-      device << null_string;
-    }
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_stl.hpp b/src/stlplus/strings/print_stl.hpp
deleted file mode 100644 (file)
index 0d02839..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef STLPLUS_PRINT_STL
-#define STLPLUS_PRINT_STL
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Template string conversions for pointers and STL containers
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "print_bitset.hpp"
-#include "print_list.hpp"
-#include "print_map.hpp"
-#include "print_pair.hpp"
-#include "print_sequence.hpp"
-#include "print_set.hpp"
-#include "print_string.hpp"
-#include "print_vector.hpp"
-
-#endif
diff --git a/src/stlplus/strings/print_stlplus.hpp b/src/stlplus/strings/print_stlplus.hpp
deleted file mode 100644 (file)
index cccec48..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef STLPLUS_PRINT_STLPLUS
-#define STLPLUS_PRINT_STLPLUS
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Template string conversions for the STLplus containers
-
-////////////////////////////////////////////////////////////////////////////////
-
-#ifndef NO_STLPLUS_CONTAINERS
-#include "print_digraph.hpp"
-#include "print_foursome.hpp"
-#include "print_hash.hpp"
-#include "print_matrix.hpp"
-#include "print_ntree.hpp"
-#include "print_smart_ptr.hpp"
-#include "print_triple.hpp"
-#endif
-
-#include "print_inf.hpp"
-
-#endif
diff --git a/src/stlplus/strings/print_string.cpp b/src/stlplus/strings/print_string.cpp
deleted file mode 100644 (file)
index acd25b7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_string.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // strings
-
-  void print_string(std::ostream& device, const std::string& value)
-  {
-    device << value;
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_string.hpp b/src/stlplus/strings/print_string.hpp
deleted file mode 100644 (file)
index 42ba9ab..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef STLPLUS_PRINT_STRING
-#define STLPLUS_PRINT_STRING
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Functions for converting C/STL strings to string
-
-//   This is necessary for completeness, e.g. for use in print_vector for vector<string>
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  void print_string(std::ostream& device, const std::string& value);
-}
-
-#endif
diff --git a/src/stlplus/strings/print_triple.hpp b/src/stlplus/strings/print_triple.hpp
deleted file mode 100644 (file)
index c5867c8..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef STLPLUS_PRINT_TRIPLE
-#define STLPLUS_PRINT_TRIPLE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a triple
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "triple.hpp"
-#include <string>
-#include <iostream>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename S1, typename S2, typename S3>
-  void print_triple(std::ostream& device,
-                    const triple<T1,T2,T3>& values,
-                    S1 print_fn1,
-                    S2 print_fn2,
-                    S3 print_fn3,
-                    const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "print_triple.tpp"
-#endif
diff --git a/src/stlplus/strings/print_triple.tpp b/src/stlplus/strings/print_triple.tpp
deleted file mode 100644 (file)
index 08867bf..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename S1, typename S2, typename S3>
-  void print_triple(std::ostream& device,
-                    const triple<T1,T2,T3>& values,
-                    S1 print_fn1,
-                    S2 print_fn2,
-                    S3 print_fn3,
-                    const std::string& separator)
-  {
-    
-    print_fn1(device, values.first);
-    device << separator;
-    print_fn2(device, values.second);
-    device << separator;
-    print_fn3(device, values.third);
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/print_vector.cpp b/src/stlplus/strings/print_vector.cpp
deleted file mode 100644 (file)
index c5b662f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_vector.hpp"
-#include "string_vector.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // special case of vector<bool>
-
-  void print_bool_vector(std::ostream& device, const std::vector<bool>& values)
-  {
-    device << bool_vector_to_string(values);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/print_vector.hpp b/src/stlplus/strings/print_vector.hpp
deleted file mode 100644 (file)
index 56d5aeb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef STLPLUS_PRINT_VECTOR
-#define STLPLUS_PRINT_VECTOR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a vector
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <iostream>
-#include <vector>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // vector
-
-  template<typename T, typename S>
-  void print_vector(std::ostream& device,
-                    const std::vector<T>& values,
-                    S print_fn,
-                    const std::string& separator);
-
-  // specialisation for vector<bool> which has a different implementation
-  void print_bool_vector(std::ostream& device, const std::vector<bool>& values);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#include "print_vector.tpp"
-#endif
diff --git a/src/stlplus/strings/print_vector.tpp b/src/stlplus/strings/print_vector.tpp
deleted file mode 100644 (file)
index ef71bdc..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "print_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  void print_vector(std::ostream& device, const std::vector<T>& values,
-                               S print_fn,
-                               const std::string& separator)
-  {
-    print_sequence(device, values.begin(), values.end(), print_fn, separator);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_address.cpp b/src/stlplus/strings/string_address.cpp
deleted file mode 100644 (file)
index 1ab934b..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   use the unsigned long representation for pointers
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_address.hpp"
-#include "string_int.hpp"
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string address_to_string(const void* i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return unsigned_long_to_string((unsigned long)i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void* string_to_address(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return (void*)string_to_unsigned_long(str, radix);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_address.hpp b/src/stlplus/strings/string_address.hpp
deleted file mode 100644 (file)
index dea3a5f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef STLPLUS_STRING_ADDRESS
-#define STLPLUS_STRING_ADDRESS
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Functions for converting addresses to/from strings
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string address_to_string(const void*,
-                                unsigned radix = 16,
-                                radix_display_t display = radix_c_style_or_hash,
-                                unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  void* string_to_address(const std::string& value,
-                          unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_basic.hpp b/src/stlplus/strings/string_basic.hpp
deleted file mode 100644 (file)
index d402dfd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef STLPLUS_STRING_BASIC
-#define STLPLUS_STRING_BASIC
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Utilities for converting basic C types to/from std::strings
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "string_address.hpp"
-#include "string_bool.hpp"
-#include "string_cstring.hpp"
-#include "string_float.hpp"
-#include "string_int.hpp"
-#include "string_pointer.hpp"
-
-#endif
diff --git a/src/stlplus/strings/string_bitset.hpp b/src/stlplus/strings/string_bitset.hpp
deleted file mode 100644 (file)
index ec275cd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef STLPLUS_STRING_BITSET
-#define STLPLUS_STRING_BITSET
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a bitset
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <bitset>
-#include <string>
-
-namespace stlplus
-{
-
-  template<size_t N>
-  std::string bitset_to_string(const std::bitset<N>& data);
-
-} // end namespace stlplus
-
-#include "string_bitset.tpp"
-#endif
diff --git a/src/stlplus/strings/string_bitset.tpp b/src/stlplus/strings/string_bitset.tpp
deleted file mode 100644 (file)
index b86a612..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<size_t N>
-  std::string bitset_to_string(const std::bitset<N>& data)
-  {
-    std::string result;
-    for (unsigned i = data.size(); i--; )
-      result += data.test(i) ? '1' : '0';
-    return result;
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_bool.cpp b/src/stlplus/strings/string_bool.cpp
deleted file mode 100644 (file)
index 9c70090..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   use the unsigned short representation for bool
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_bool.hpp"
-#include "string_int.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string bool_to_string(bool i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return unsigned_short_to_string((unsigned short)i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  bool string_to_bool(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return string_to_unsigned_short(str, radix) != 0;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_bool.hpp b/src/stlplus/strings/string_bool.hpp
deleted file mode 100644 (file)
index fea8a85..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef STLPLUS_STRING_BOOL
-#define STLPLUS_STRING_BOOL
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Conversion of string to/from bool
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string bool_to_string(bool i,
-                             unsigned radix = 10,
-                             radix_display_t display = radix_c_style_or_hash,
-                             unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  bool string_to_bool(const std::string& value,
-                      unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_cstring.cpp b/src/stlplus/strings/string_cstring.cpp
deleted file mode 100644 (file)
index b1129a9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_cstring.hpp"
-
-namespace stlplus
-{
-
-  std::string cstring_to_string(const char* value)
-  {
-    return std::string(value);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_cstring.hpp b/src/stlplus/strings/string_cstring.hpp
deleted file mode 100644 (file)
index 7d04940..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef STLPLUS_STRING_CSTRING
-#define STLPLUS_STRING_CSTRING
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Functions for converting C strings to string
-
-//   This is necessary for completeness
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  std::string cstring_to_string(const char* value);
-
-}
-
-#endif
diff --git a/src/stlplus/strings/string_digraph.hpp b/src/stlplus/strings/string_digraph.hpp
deleted file mode 100644 (file)
index f499934..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef STLPLUS_STRING_DIGRAPH
-#define STLPLUS_STRING_DIGRAPH
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a digraph
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "digraph.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename NT, typename AT, typename NS, typename AS>
-  std::string digraph_to_string(const digraph<NT,AT>& values,
-                                NS node_to_string_fn,
-                                AS arc_to_string_fn,
-                                const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "string_digraph.tpp"
-#endif
diff --git a/src/stlplus/strings/string_digraph.tpp b/src/stlplus/strings/string_digraph.tpp
deleted file mode 100644 (file)
index 4b81a5c..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  template<typename NT, typename AT, typename NS, typename AS>
-  std::string digraph_to_string(const digraph<NT,AT>& values,
-                                NS node_to_string_fn,
-                                AS arc_to_string_fn,
-                                const std::string& separator)
-  {
-    std::string result;
-    result += "nodes:";
-    result += separator;
-    result += sequence_to_string(values.begin(), values.end(), node_to_string_fn, separator);
-    result += "arcs:";
-    result += separator;
-    result += sequence_to_string(values.arc_begin(), values.arc_end(), arc_to_string_fn, separator);
-    return result;
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_float.cpp b/src/stlplus/strings/string_float.cpp
deleted file mode 100644 (file)
index 8ef2a94..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_float.hpp"
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-namespace stlplus
-{
-
-  // added as a local copy to break the dependency on the portability library
-  static std::string local_dformat(const char* format, ...) throw(std::invalid_argument)
-  {
-    std::string formatted;
-    va_list args;
-    va_start(args, format);
-#ifdef MSWINDOWS
-    int length = 0;
-    char* buffer = 0;
-    for(int buffer_length = 256; ; buffer_length*=2)
-    {
-      buffer = (char*)malloc(buffer_length);
-      if (!buffer) throw std::invalid_argument("string_float");
-      length = _vsnprintf(buffer, buffer_length-1, format, args);
-      if (length >= 0)
-      {
-        buffer[length] = 0;
-        formatted += std::string(buffer);
-        free(buffer);
-        break;
-      }
-      free(buffer);
-    }
-#else
-    char* buffer = 0;
-    int length = vasprintf(&buffer, format, args);
-    if (!buffer) throw std::invalid_argument("string_float");
-    if (length >= 0)
-      formatted += std::string(buffer);
-    free(buffer);
-#endif
-    va_end(args);
-    if (length < 0) throw std::invalid_argument("string_float");
-    return formatted;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // floating-point types
-
-  std::string float_to_string(float f, real_display_t display, unsigned width, unsigned precision)
-    throw(std::invalid_argument)
-  {
-    return double_to_string((double)f, display, width, precision);
-  }
-
-  std::string double_to_string(double f, real_display_t display, unsigned width, unsigned precision)
-    throw(std::invalid_argument)
-  {
-    switch(display)
-    {
-    case display_fixed:
-      return local_dformat("%*.*f", width, precision, f);
-    case display_floating:
-      return local_dformat("%*.*e", width, precision, f);
-    case display_mixed:
-      return local_dformat("%*.*g", width, precision, f);
-    default:
-      throw std::invalid_argument("invalid radix display value");
-    }
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  float string_to_float(const std::string& value)
-    throw(std::invalid_argument)
-  {
-    return (float)string_to_double(value);
-  }
-
-  double string_to_double(const std::string& value)
-    throw(std::invalid_argument)
-  {
-    // TODO - error checking
-    return strtod(value.c_str(), 0);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_float.hpp b/src/stlplus/strings/string_float.hpp
deleted file mode 100644 (file)
index 578225f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef STLPLUS_STRING_FLOAT
-#define STLPLUS_STRING_FLOAT
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Convert a float/double to/from string
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // convert a real type to string
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // Only decimal radix is supported
-
-  // The way in which the number is displayed is defined in radix_types.hpp
-  // Using any other value for the display type causes std::invalid_argument to be thrown
-
-  std::string float_to_string(float f,
-                              real_display_t display = display_mixed,
-                              unsigned width = 0,
-                              unsigned precision = 6)
-    throw(std::invalid_argument);
-
-  std::string double_to_string(double f,
-                               real_display_t display = display_mixed,
-                               unsigned width = 0,
-                               unsigned precision = 6)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Convert a string to a floating-point type
-
-  float string_to_float(const std::string& value)
-    throw(std::invalid_argument);
-
-  double string_to_double(const std::string& value)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_foursome.hpp b/src/stlplus/strings/string_foursome.hpp
deleted file mode 100644 (file)
index 7481dc7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_STRING_FOURSOME
-#define STLPLUS_STRING_FOURSOME
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a foursome
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "foursome.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename T4, typename S1, typename S2, typename S3, typename S4>
-  std::string foursome_to_string(const foursome<T1,T2,T3,T4>& values,
-                                 S1 to_string_fn1,
-                                 S2 to_string_fn2,
-                                 S3 to_string_fn3,
-                                 S4 to_string_fn4,
-                                 const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "string_foursome.tpp"
-#endif
diff --git a/src/stlplus/strings/string_foursome.tpp b/src/stlplus/strings/string_foursome.tpp
deleted file mode 100644 (file)
index db761f4..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename T4, typename S1, typename S2, typename S3, typename S4>
-  std::string foursome_to_string(const foursome<T1,T2,T3,T4>& values,
-                                 S1 to_string_fn1,
-                                 S2 to_string_fn2,
-                                 S3 to_string_fn3,
-                                 S4 to_string_fn4,
-                                 const std::string& separator)
-  {
-    return 
-      to_string_fn1(values.first) + 
-      separator + 
-      to_string_fn2(values.second) + 
-      separator + 
-      to_string_fn3(values.third) +
-      separator + 
-      to_string_fn4(values.fourth);
-  }
-
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_hash.hpp b/src/stlplus/strings/string_hash.hpp
deleted file mode 100644 (file)
index 5a94bb2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef STLPLUS_STRING_HASH
-#define STLPLUS_STRING_HASH
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a hash
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "hash.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename H, typename E, typename KS, typename TS>
-  std::string hash_to_string(const hash<K,T,H,E>& values,
-                             KS key_to_string_fn,
-                             TS value_to_string_fn,
-                             const std::string& pair_separator = ":",
-                             const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "string_hash.tpp"
-#endif
diff --git a/src/stlplus/strings/string_hash.tpp b/src/stlplus/strings/string_hash.tpp
deleted file mode 100644 (file)
index 1d77f42..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename H, typename E, typename KS, typename TS>
-  std::string hash_to_string(const hash<K,T,H,E>& values,
-                             KS key_to_string_fn,
-                             TS value_to_string_fn,
-                             const std::string& pair_separator,
-                             const std::string& separator)
-  {
-    return pair_sequence_to_string(values.begin(), values.end(),
-                                   key_to_string_fn, value_to_string_fn,
-                                   pair_separator, separator);
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_inf.cpp b/src/stlplus/strings/string_inf.cpp
deleted file mode 100644 (file)
index e1eb545..0000000
+++ /dev/null
@@ -1,536 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   String conversion functions for the infinite precision integer type inf
-
-////////////////////////////////////////////////////////////////////////////////
-
-// can be excluded from the build to break the dependency on the portability library
-#ifndef NO_STLPLUS_INF
-
-#include "string_inf.hpp"
-#include "string_basic.hpp"
-#include <ctype.h>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  static char to_char [] = "0123456789abcdefghijklmnopqrstuvwxyz";
-  static int from_char [] = 
-  {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
-    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
-    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-  };
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string inf_to_string(const stlplus::inf& data, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    std::string result;
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value");
-    inf local_i = data;
-    // untangle all the options
-    bool hashed = false;
-    bool binary = false;
-    bool octal = false;
-    bool hex = false;
-    switch(display)
-    {
-    case radix_none:
-      break;
-    case radix_hash_style:
-      hashed = radix != 10;
-      break;
-    case radix_hash_style_all:
-      hashed = true;
-      break;
-    case radix_c_style:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      break;
-    case radix_c_style_or_hash:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      else if (radix != 10)
-        hashed = true;
-      break;
-    default:
-      throw std::invalid_argument("invalid radix display value");
-    }
-    // create constants of the same type as the template parameter to avoid type mismatches
-    const inf t_zero(0);
-    const inf t_radix(radix);
-    // the C representations for binary, octal and hex use 2's-complement representation
-    // all other represenations use sign-magnitude
-    if (hex || octal || binary)
-    {
-      // bit-pattern representation
-      // this is the binary representation optionally shown in octal or hex
-      // first generate the binary by masking the bits
-      for (unsigned j = local_i.bits(); j--; )
-        result += (local_i.bit(j) ? '1' : '0');
-      // the result is now the full width of the type - e.g. int will give a 32-bit result
-      // now interpret this as either binary, octal or hex and add the prefix
-      if (binary)
-      {
-        // the result is already binary - but the width may be wrong
-        // if this is still smaller than the width field, sign extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        while (result.size() < width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > width)
-        {
-          // do not trim to less than 1 bit (sign only)
-          if (result.size() <= 1) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        // add the prefix
-        result.insert((std::string::size_type)0, "0b");
-      }
-      else if (octal)
-      {
-        // the result is currently binary - but before converting get the width right
-        // the width is expressed in octal digits so make the binary 3 times this
-        // if this is still smaller than the width field, sign extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        // also ensure that the binary is a multiple of 3 bits to make the conversion to octal easier
-        while (result.size() < 3*width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > 3*width)
-        {
-          // do not trim to less than 2 bits (sign plus 1-bit magnitude)
-          if (result.size() <= 2) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        while (result.size() % 3 != 0)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        // now convert to octal
-        std::string octal_result;
-        for (unsigned i = 0; i < result.size()/3; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*3] == '0')
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '0';
-              else
-                octal_result += '1';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '2';
-              else
-                octal_result += '3';
-            }
-          }
-          else
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '4';
-              else
-                octal_result += '5';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '6';
-              else
-                octal_result += '7';
-            }
-          }
-        }
-        result = octal_result;
-        // add the prefix
-        result.insert((std::string::size_type)0, "0");
-      }
-      else
-      {
-        // similar to octal
-        while (result.size() < 4*width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > 4*width)
-        {
-          // do not trim to less than 2 bits (sign plus 1-bit magnitude)
-          if (result.size() <= 2) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        while (result.size() % 4 != 0)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        // now convert to hex
-        std::string hex_result;
-        for (unsigned i = 0; i < result.size()/4; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*4] == '0')
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '0';
-                else
-                  hex_result += '1';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '2';
-                else
-                  hex_result += '3';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '4';
-                else
-                  hex_result += '5';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '6';
-                else
-                  hex_result += '7';
-              }
-            }
-          }
-          else
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '8';
-                else
-                  hex_result += '9';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'a';
-                else
-                  hex_result += 'b';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'c';
-                else
-                  hex_result += 'd';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'e';
-                else
-                  hex_result += 'f';
-              }
-            }
-          }
-        }
-        result = hex_result;
-        // add the prefix
-        result.insert((std::string::size_type)0, "0x");
-      }
-    }
-    else
-    {
-      // convert to sign-magnitude
-      // the representation is:
-      // [radix#][sign]magnitude
-      bool negative = local_i.negative();
-      local_i.abs();
-      // create a representation of the magnitude by successive division
-      do
-      {
-        std::pair<inf,inf> divided = local_i.divide(t_radix);
-        unsigned remainder = divided.second.to_unsigned();
-        char digit = to_char[remainder];
-        result.insert((std::string::size_type)0, 1, digit);
-        local_i = divided.first;
-      }
-      while(!local_i.zero() || result.size() < width);
-      // add the prefixes
-      // add a sign only for negative values
-      if (negative)
-        result.insert((std::string::size_type)0, 1, '-');
-      // then prefix everything with the radix if the hashed representation was requested
-      if (hashed)
-        result.insert((std::string::size_type)0, unsigned_to_string(radix) + "#");
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Conversions FROM string
-
-  inf string_to_inf(const std::string& str, unsigned radix) throw(std::invalid_argument)
-  {
-    inf result;
-    if (radix != 0 && (radix < 2 || radix > 36))
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    unsigned i = 0;
-    // the radix passed as a parameter is just the default - it can be
-    // overridden by either the C prefix or the hash prefix
-    // Note: a leading zero is the C-style prefix for octal - I only make this
-    // override the default when the default radix is not specified
-    // first check for a C-style prefix
-    bool c_style = false;
-    if (i < str.size() && str[i] == '0')
-    {
-      // binary or hex
-      if (i+1 < str.size() && tolower(str[i+1]) == 'x')
-      {
-        c_style = true;
-        radix = 16;
-        i += 2;
-      }
-      else if (i+1 < str.size() && tolower(str[i+1]) == 'b')
-      {
-        c_style = true;
-        radix = 2;
-        i += 2;
-      }
-      else if (radix == 0)
-      {
-        c_style = true;
-        radix = 8;
-        i += 1;
-      }
-    }
-    // now check for a hash-style prefix if a C-style prefix was not found
-    if (i == 0)
-    {
-      // scan for the sequence {digits}#
-      bool hash_found = false;
-      unsigned j = i;
-      for (; j < str.size(); j++)
-      {
-        if (!isdigit(str[j]))
-        {
-          if (str[j] == '#')
-            hash_found = true;
-          break;
-        }
-      }
-      if (hash_found)
-      {
-        // use the hash prefix to define the radix
-        // i points to the start of the radix and j points to the # character
-        std::string slice = str.substr(i, j-i);
-        radix = string_to_unsigned(slice);
-        i = j+1;
-      }
-    }
-    if (radix == 0)
-      radix = 10;
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value");
-    if (c_style)
-    {
-      // the C style formats are bit patterns not integer values - these need
-      // to be sign-extended to get the right value
-      std::string binary;
-      if (radix == 2)
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += '0';
-            break;
-          case '1':
-            binary += '1';
-            break;
-          default:
-            throw std::invalid_argument("invalid binary character in string " + str);
-          }
-        }
-      }
-      else if (radix == 8)
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += "000";
-            break;
-          case '1':
-            binary += "001";
-            break;
-          case '2':
-            binary += "010";
-            break;
-          case '3':
-            binary += "011";
-            break;
-          case '4':
-            binary += "100";
-            break;
-          case '5':
-            binary += "101";
-            break;
-          case '6':
-            binary += "110";
-            break;
-          case '7':
-            binary += "111";
-            break;
-          default:
-            throw std::invalid_argument("invalid octal character in string " + str);
-          }
-        }
-      }
-      else
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(tolower(str[j]))
-          {
-          case '0':
-            binary += "0000";
-            break;
-          case '1':
-            binary += "0001";
-            break;
-          case '2':
-            binary += "0010";
-            break;
-          case '3':
-            binary += "0011";
-            break;
-          case '4':
-            binary += "0100";
-            break;
-          case '5':
-            binary += "0101";
-            break;
-          case '6':
-            binary += "0110";
-            break;
-          case '7':
-            binary += "0111";
-            break;
-          case '8':
-            binary += "1000";
-            break;
-          case '9':
-            binary += "1001";
-            break;
-          case 'a':
-            binary += "1010";
-            break;
-          case 'b':
-            binary += "1011";
-            break;
-          case 'c':
-            binary += "1100";
-            break;
-          case 'd':
-            binary += "1101";
-            break;
-          case 'e':
-            binary += "1110";
-            break;
-          case 'f':
-            binary += "1111";
-            break;
-          default:
-            throw std::invalid_argument("invalid hex character in string " + str);
-          }
-        }
-      }
-      // now convert the value
-      result.resize(binary.size());
-      for (unsigned j = 0; j < binary.size(); j++)
-        result.preset(binary.size() - j - 1, binary[j] == '1');
-    }
-    else
-    {
-      // now scan for a sign and find whether this is a negative number
-      bool negative = false;
-      if (i < str.size())
-      {
-        switch (str[i])
-        {
-        case '-':
-          negative = true;
-          i++;
-          break;
-        case '+':
-          i++;
-          break;
-        }
-      }
-      for (; i < str.size(); i++)
-      {
-        result *= inf(radix);
-        int ch = from_char[(unsigned char)str[i]] ;
-        if (ch == -1)
-          throw std::invalid_argument("invalid character in string " + str + " for radix " + unsigned_to_string(radix));
-        result += inf(ch);
-      }
-      if (negative)
-        result.negate();
-    }
-    return result;
-  }
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_inf.hpp b/src/stlplus/strings/string_inf.hpp
deleted file mode 100644 (file)
index b651d72..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef STLPLUS_STRING_INF
-#define STLPLUS_STRING_INF
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   String conversion functions for the infinite precision integer type inf
-
-//   The conversion supports all the formatting modes defined on format_types
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "inf.hpp"
-#include "format_types.hpp"
-#include <string>
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // conversion TO string
-  std::string inf_to_string(const inf&,
-                            unsigned radix = 10,
-                            radix_display_t display = radix_c_style_or_hash,
-                            unsigned width = 0)
-    throw(std::invalid_argument);
-
-  // conversion FROM string
-  inf string_to_inf(const std::string&,
-                    unsigned radix = 0)
-    throw(std::invalid_argument);
-
-////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
-#endif
diff --git a/src/stlplus/strings/string_int.cpp b/src/stlplus/strings/string_int.cpp
deleted file mode 100644 (file)
index ec5e10c..0000000
+++ /dev/null
@@ -1,1111 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_int.hpp"
-#include <ctype.h>
-#include <stdlib.h>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // character mappings
-
-  static char to_char [] = "0123456789abcdefghijklmnopqrstuvwxyz";
-  static int from_char [] = 
-  {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
-    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
-    25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
-  };
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Conversions to string
-  // Local generic routines
-
-  // signed version of the generic image generation function for all integer types
-  template<typename T>
-  static std::string simage (T i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    // untangle all the options
-    bool hashed = false;
-    bool binary = false;
-    bool octal = false;
-    bool hex = false;
-    switch(display)
-    {
-    case radix_none:
-      break;
-    case radix_hash_style:
-      hashed = radix != 10;
-      break;
-    case radix_hash_style_all:
-      hashed = true;
-      break;
-    case radix_c_style:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      break;
-    case radix_c_style_or_hash:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      else if (radix != 10)
-        hashed = true;
-      break;
-    default:
-      throw std::invalid_argument("invalid radix display value");
-    }
-    // create constants of the same type as the template parameter to avoid type mismatches
-    const T t_zero(0);
-    const T t_radix(radix);
-    // the C representations for binary, octal and hex use 2's-complement representation
-    // all other represenations use sign-magnitude
-    std::string result;
-    if (hex || octal || binary)
-    {
-      // bit-pattern representation
-      // this is the binary representation optionally shown in octal or hex
-      // first generate the binary by masking the bits
-      // ensure that it has at least one bit!
-      for (T mask(1); ; mask <<= 1)
-      {
-        result.insert((std::string::size_type)0, 1, i & mask ? '1' : '0');
-        if (mask == t_zero) break;
-      }
-      // the result is now the full width of the type - e.g. int will give a 32-bit result
-      // now interpret this as either binary, octal or hex and add the prefix
-      if (binary)
-      {
-        // the result is already binary - but the width may be wrong
-        // if this is still smaller than the width field, sign extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        while (result.size() < width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > width)
-        {
-          // do not trim to less than 2 bits (sign plus 1-bit magnitude)
-          if (result.size() <= 2) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        // add the prefix
-        result.insert((std::string::size_type)0, "0b");
-      }
-      else if (octal)
-      {
-        // the result is currently binary - but before converting get the width right
-        // the width is expressed in octal digits so make the binary 3 times this
-        // if this is still smaller than the width field, sign extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        // also ensure that the binary is a multiple of 3 bits to make the conversion to octal easier
-        while (result.size() < 3*width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > 3*width)
-        {
-          // do not trim to less than 2 bits (sign plus 1-bit magnitude)
-          if (result.size() <= 2) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        while (result.size() % 3 != 0)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        // now convert to octal
-        std::string octal_result;
-        for (unsigned i = 0; i < result.size()/3; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*3] == '0')
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '0';
-              else
-                octal_result += '1';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '2';
-              else
-                octal_result += '3';
-            }
-          }
-          else
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '4';
-              else
-                octal_result += '5';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '6';
-              else
-                octal_result += '7';
-            }
-          }
-        }
-        result = octal_result;
-        // add the prefix
-        result.insert((std::string::size_type)0, "0");
-      }
-      else
-      {
-        // hex - similar to octal
-        while (result.size() < 4*width)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        while (result.size() > 4*width)
-        {
-          // do not trim to less than 2 bits (sign plus 1-bit magnitude)
-          if (result.size() <= 2) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != result[1]) break;
-          result.erase(0,1);
-        }
-        while (result.size() % 4 != 0)
-          result.insert((std::string::size_type)0, 1, result[0]);
-        // now convert to hex
-        std::string hex_result;
-        for (unsigned i = 0; i < result.size()/4; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*4] == '0')
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '0';
-                else
-                  hex_result += '1';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '2';
-                else
-                  hex_result += '3';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '4';
-                else
-                  hex_result += '5';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '6';
-                else
-                  hex_result += '7';
-              }
-            }
-          }
-          else
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '8';
-                else
-                  hex_result += '9';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'a';
-                else
-                  hex_result += 'b';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'c';
-                else
-                  hex_result += 'd';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'e';
-                else
-                  hex_result += 'f';
-              }
-            }
-          }
-        }
-        result = hex_result;
-        // add the prefix
-        result.insert((std::string::size_type)0, "0x");
-      }
-    }
-    else
-    {
-      // convert to sign-magnitude
-      // the representation is:
-      // [radix#][sign]magnitude
-      bool negative = i < t_zero;
-      // create a representation of the magnitude by successive division
-      do
-      {
-        T ch = abs(i % t_radix);
-        i /= t_radix;
-        result.insert((std::string::size_type)0, 1, to_char[ch]);
-      }
-      while(i != t_zero || result.size() < width);
-      // add the prefixes
-      // add a sign only for negative values
-      if (negative)
-        result.insert((std::string::size_type)0, 1, '-');
-      // then prefix everything with the radix if the hashed representation was requested
-      if (hashed)
-        result.insert((std::string::size_type)0, unsigned_to_string(radix) + "#");
-    }
-    return result;
-  }
-
-  // unsigned version
-  template<typename T>
-  static std::string uimage (T i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    // untangle all the options
-    bool hashed = false;
-    bool binary = false;
-    bool octal = false;
-    bool hex = false;
-    switch(display)
-    {
-    case radix_none:
-      break;
-    case radix_hash_style:
-      hashed = radix != 10;
-      break;
-    case radix_hash_style_all:
-      hashed = true;
-      break;
-    case radix_c_style:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      break;
-    case radix_c_style_or_hash:
-      if (radix == 16)
-        hex = true;
-      else if (radix == 8)
-        octal = true;
-      else if (radix == 2)
-        binary = true;
-      else if (radix != 10)
-        hashed = true;
-      break;
-    default:
-      throw std::invalid_argument("invalid radix display value");
-    }
-    // create constants of the same type as the template parameter to avoid type mismatches
-    const T t_zero(0);
-    const T t_radix(radix);
-    // the C representations for binary, octal and hex use 2's-complement representation
-    // all other represenations use sign-magnitude
-    std::string result;
-    if (hex || octal || binary)
-    {
-      // bit-pattern representation
-      // this is the binary representation optionally shown in octal or hex
-      // first generate the binary by masking the bits
-      // ensure at least one bit
-      for (T mask(1); ; mask <<= 1)
-      {
-        result.insert((std::string::size_type)0, 1, i & mask ? '1' : '0');
-        if (mask == t_zero) break;
-      }
-      // the result is now the full width of the type - e.g. int will give a 32-bit result
-      // now interpret this as either binary, octal or hex and add the prefix
-      if (binary)
-      {
-        // the result is already binary - but the width may be wrong
-        // if this is still smaller than the width field, zero extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        while (result.size() < width)
-          result.insert((std::string::size_type)0, 1, '0');
-        while (result.size() > width)
-        {
-          // do not trim to less than 1 bit (1-bit magnitude)
-          if (result.size() <= 1) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != '0') break;
-          result.erase(0,1);
-        }
-        // add the prefix
-        result.insert((std::string::size_type)0, "0b");
-      }
-      else if (octal)
-      {
-        // the result is currently binary - but before converting get the width right
-        // the width is expressed in octal digits so make the binary 3 times this
-        // if this is still smaller than the width field, sign extend
-        // otherwise trim down to either the width or the smallest string that preserves the value
-        // also ensure that the binary is a multiple of 3 bits to make the conversion to octal easier
-        while (result.size() < 3*width)
-          result.insert((std::string::size_type)0, 1, '0');
-        while (result.size() > 3*width)
-        {
-          // do not trim to less than 1 bit (1-bit magnitude)
-          if (result.size() <= 1) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != '0') break;
-          result.erase(0,1);
-        }
-        while (result.size() % 3 != 0)
-          result.insert((std::string::size_type)0, 1, '0');
-        // now convert to octal
-        std::string octal_result;
-        for (unsigned i = 0; i < result.size()/3; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*3] == '0')
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '0';
-              else
-                octal_result += '1';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '2';
-              else
-                octal_result += '3';
-            }
-          }
-          else
-          {
-            if (result[i*3+1] == '0')
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '4';
-              else
-                octal_result += '5';
-            }
-            else
-            {
-              if (result[i*3+2] == '0')
-                octal_result += '6';
-              else
-                octal_result += '7';
-            }
-          }
-        }
-        result = octal_result;
-        // add the prefix if the leading digit is not already 0
-        if (result.empty() || result[0] != '0') result.insert((std::string::size_type)0, "0");
-      }
-      else
-      {
-        // similar to octal
-        while (result.size() < 4*width)
-          result.insert((std::string::size_type)0, 1, '0');
-        while (result.size() > 4*width)
-        {
-          // do not trim to less than 1 bit (1-bit magnitude)
-          if (result.size() <= 1) break;
-          // only trim if it doesn't change the sign and therefore the value
-          if (result[0] != '0') break;
-          result.erase(0,1);
-        }
-        while (result.size() % 4 != 0)
-          result.insert((std::string::size_type)0, 1, '0');
-        // now convert to hex
-        std::string hex_result;
-        for (unsigned i = 0; i < result.size()/4; i++)
-        {
-          // yuck - ugly or what?
-          if (result[i*4] == '0')
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '0';
-                else
-                  hex_result += '1';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '2';
-                else
-                  hex_result += '3';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '4';
-                else
-                  hex_result += '5';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '6';
-                else
-                  hex_result += '7';
-              }
-            }
-          }
-          else
-          {
-            if (result[i*4+1] == '0')
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += '8';
-                else
-                  hex_result += '9';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'a';
-                else
-                  hex_result += 'b';
-              }
-            }
-            else
-            {
-              if (result[i*4+2] == '0')
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'c';
-                else
-                  hex_result += 'd';
-              }
-              else
-              {
-                if (result[i*4+3] == '0')
-                  hex_result += 'e';
-                else
-                  hex_result += 'f';
-              }
-            }
-          }
-        }
-        result = hex_result;
-        // add the prefix
-        result.insert((std::string::size_type)0, "0x");
-      }
-    }
-    else
-    {
-      // convert to sign-magnitude
-      // the representation is:
-      // [radix#]magnitude
-      // create a representation of the magnitude by successive division
-      do
-      {
-        T ch = i % t_radix;
-        i /= t_radix;
-        result.insert((std::string::size_type)0, 1, to_char[(int)ch]);
-      }
-      while(i != t_zero || result.size() < width);
-      // prefix everything with the radix if the hashed representation was requested
-      if (hashed)
-        result.insert((std::string::size_type)0, unsigned_to_string(radix) + "#");
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // exported conversions to string
-
-  std::string short_to_string(short i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return simage(i, radix, display, width);
-  }
-
-  std::string unsigned_short_to_string(unsigned short i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return uimage(i, radix, display, width);
-  }
-
-  std::string int_to_string(int i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return simage(i, radix, display, width);
-  }
-
-  std::string unsigned_to_string(unsigned i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return uimage(i, radix, display, width);
-  }
-
-  std::string long_to_string(long i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return simage(i, radix, display, width);
-  }
-
-  std::string unsigned_long_to_string(unsigned long i, unsigned radix, radix_display_t display, unsigned width)
-    throw(std::invalid_argument)
-  {
-    return uimage(i, radix, display, width);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Conversions FROM string
-  // local template function
-  // Note: this has been copied and modified for the inf class - so any changes here must be made there too
-
-  // signed version
-  template<typename T>
-  static T svalue(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    if (radix != 0 && (radix < 2 || radix > 36))
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    std::string::size_type i = 0;
-    // the radix passed as a parameter is just the default - it can be
-    // overridden by either the C prefix or the hash prefix. Note: a leading zero
-    // is the C-style prefix for octal - I only make this override the default
-    // when the default prefix is not specified
-    // First check for a C-style prefix
-    bool c_style = false;
-    if (i < str.size() && str[i] == '0')
-    {
-      // octal, binary or hex
-      if (i+1 < str.size() && tolower(str[i+1]) == 'x')
-      {
-        radix = 16;
-        i += 2;
-        c_style = true;
-      }
-      else if (i+1 < str.size() && tolower(str[i+1]) == 'b')
-      {
-        radix = 2;
-        i += 2;
-        c_style = true;
-      }
-      else if (radix == 0)
-      {
-        radix = 8;
-        i += 1;
-        c_style = true;
-      }
-    }
-    // now check for a hash-style prefix if a C-style prefix was not found
-    if (i == 0)
-    {
-      // scan for the sequence {digits}#
-      bool hash_found = false;
-      std::string::size_type j = i;
-      for (; j < str.size(); j++)
-      {
-        if (!isdigit(str[j]))
-        {
-          if (str[j] == '#')
-            hash_found = true;
-          break;
-        }
-      }
-      if (hash_found)
-      {
-        // use the hash prefix to define the radix
-        // i points to the start of the radix and j points to the # character
-        std::string slice = str.substr(i, j-i);
-        radix = string_to_unsigned(slice);
-        i = j+1;
-      }
-    }
-    if (radix == 0)
-      radix = 10;
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    T val(0);
-    if (c_style)
-    {
-      // the C style formats are bit patterns not integer values - these need
-      // to be sign-extended to get the right value
-      std::string binary;
-      if (radix == 2)
-      {
-        for (std::string::size_type j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += '0';
-            break;
-          case '1':
-            binary += '1';
-            break;
-          default:
-            throw std::invalid_argument("invalid binary character in string " + str);
-            break;
-          }
-        }
-      }
-      else if (radix == 8)
-      {
-        for (std::string::size_type j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += "000";
-            break;
-          case '1':
-            binary += "001";
-            break;
-          case '2':
-            binary += "010";
-            break;
-          case '3':
-            binary += "011";
-            break;
-          case '4':
-            binary += "100";
-            break;
-          case '5':
-            binary += "101";
-            break;
-          case '6':
-            binary += "110";
-            break;
-          case '7':
-            binary += "111";
-            break;
-          default:
-            throw std::invalid_argument("invalid octal character in string " + str);
-            break;
-          }
-        }
-      }
-      else
-      {
-        for (std::string::size_type j = i; j < str.size(); j++)
-        {
-          switch(tolower(str[j]))
-          {
-          case '0':
-            binary += "0000";
-            break;
-          case '1':
-            binary += "0001";
-            break;
-          case '2':
-            binary += "0010";
-            break;
-          case '3':
-            binary += "0011";
-            break;
-          case '4':
-            binary += "0100";
-            break;
-          case '5':
-            binary += "0101";
-            break;
-          case '6':
-            binary += "0110";
-            break;
-          case '7':
-            binary += "0111";
-            break;
-          case '8':
-            binary += "1000";
-            break;
-          case '9':
-            binary += "1001";
-            break;
-          case 'a':
-            binary += "1010";
-            break;
-          case 'b':
-            binary += "1011";
-            break;
-          case 'c':
-            binary += "1100";
-            break;
-          case 'd':
-            binary += "1101";
-            break;
-          case 'e':
-            binary += "1110";
-            break;
-          case 'f':
-            binary += "1111";
-            break;
-          default:
-            throw std::invalid_argument("invalid hex character in string " + str);
-            break;
-          }
-        }
-      }
-      // now sign-extend to the right number of bits for the type
-      while (binary.size() < sizeof(T)*8)
-        binary.insert((std::string::size_type)0, 1, binary.empty() ? '0' : binary[0]);
-      // now convert the value
-      for (std::string::size_type j = 0; j < binary.size(); j++)
-      {
-        val *= 2;
-        int ch = from_char[(unsigned char)binary[j]] ;
-        val += T(ch);
-      }
-    }
-    else
-    {
-      // now scan for a sign and find whether this is a negative number
-      bool negative = false;
-      if (i < str.size())
-      {
-        switch (str[i])
-        {
-        case '-':
-          negative = true;
-          i++;
-          break;
-        case '+':
-          i++;
-          break;
-        }
-      }
-      for (; i < str.size(); i++)
-      {
-        val *= T(radix);
-        int ch = from_char[(unsigned char)str[i]] ;
-        if (ch == -1 || (unsigned)ch >= radix)
-          throw std::invalid_argument("invalid character in string " + str);
-        val += T(ch);
-      }
-      if (negative)
-        val = -val;
-    }
-    return val;
-  }
-
-  // unsigned version
-  template<typename T>
-  static T uvalue(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    if (radix != 0 && (radix < 2 || radix > 36))
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    unsigned i = 0;
-    // the radix passed as a parameter is just the default - it can be
-    // overridden by either the C prefix or the hash prefix. Note: a leading
-    // zero is the C-style prefix for octal - I only make this override the
-    // default when the default prefix is not specified
-    // First check for a C-style prefix
-    bool c_style = false;
-    if (i < str.size() && str[i] == '0')
-    {
-      // binary or hex
-      if (i+1 < str.size() && tolower(str[i+1]) == 'x')
-      {
-        radix = 16;
-        i += 2;
-        c_style = true;
-      }
-      else if (i+1 < str.size() && tolower(str[i+1]) == 'b')
-      {
-        radix = 2;
-        i += 2;
-        c_style = true;
-      }
-      else if (radix == 0)
-      {
-        radix = 8;
-        i += 1;
-        c_style = true;
-      }
-    }
-    // now check for a hash-style prefix if a C-style prefix was not found
-    if (i == 0)
-    {
-      // scan for the sequence {digits}#
-      bool hash_found = false;
-      unsigned j = i;
-      for (; j < str.size(); j++)
-      {
-        if (!isdigit(str[j]))
-        {
-          if (str[j] == '#')
-            hash_found = true;
-          break;
-        }
-      }
-      if (hash_found)
-      {
-        // use the hash prefix to define the radix
-        // i points to the start of the radix and j points to the # character
-        std::string slice = str.substr(i, j-i);
-        radix = string_to_unsigned(slice);
-        i = j+1;
-      }
-    }
-    if (radix == 0)
-      radix = 10;
-    if (radix < 2 || radix > 36)
-      throw std::invalid_argument("invalid radix value " + unsigned_to_string(radix));
-    T val(0);
-    if (c_style)
-    {
-      // the C style formats are bit patterns not integer values - these need
-      // to be sign-extended to get the right value
-      std::string binary;
-      if (radix == 2)
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += '0';
-            break;
-          case '1':
-            binary += '1';
-            break;
-          default:
-            throw std::invalid_argument("invalid hex character in string " + str);
-            break;
-          }
-        }
-      }
-      else if (radix == 8)
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(str[j])
-          {
-          case '0':
-            binary += "000";
-            break;
-          case '1':
-            binary += "001";
-            break;
-          case '2':
-            binary += "010";
-            break;
-          case '3':
-            binary += "011";
-            break;
-          case '4':
-            binary += "100";
-            break;
-          case '5':
-            binary += "101";
-            break;
-          case '6':
-            binary += "110";
-            break;
-          case '7':
-            binary += "111";
-            break;
-          default:
-            throw std::invalid_argument("invalid octal character in string " + str);
-            break;
-          }
-        }
-      }
-      else
-      {
-        for (unsigned j = i; j < str.size(); j++)
-        {
-          switch(tolower(str[j]))
-          {
-          case '0':
-            binary += "0000";
-            break;
-          case '1':
-            binary += "0001";
-            break;
-          case '2':
-            binary += "0010";
-            break;
-          case '3':
-            binary += "0011";
-            break;
-          case '4':
-            binary += "0100";
-            break;
-          case '5':
-            binary += "0101";
-            break;
-          case '6':
-            binary += "0110";
-            break;
-          case '7':
-            binary += "0111";
-            break;
-          case '8':
-            binary += "1000";
-            break;
-          case '9':
-            binary += "1001";
-            break;
-          case 'a':
-            binary += "1010";
-            break;
-          case 'b':
-            binary += "1011";
-            break;
-          case 'c':
-            binary += "1100";
-            break;
-          case 'd':
-            binary += "1101";
-            break;
-          case 'e':
-            binary += "1110";
-            break;
-          case 'f':
-            binary += "1111";
-            break;
-          default:
-            throw std::invalid_argument("invalid hex character in string " + str);
-            break;
-          }
-        }
-      }
-      // now zero-extend to the right number of bits for the type
-      while (binary.size() < sizeof(T)*8)
-        binary.insert((std::string::size_type)0, 1, '0');
-      // now convert the value
-      for (unsigned j = 0; j < binary.size(); j++)
-      {
-        val *= 2;
-        int ch = from_char[(unsigned char)binary[j]] ;
-        val += T(ch);
-      }
-    }
-    else
-    {
-      // now scan for a sign and find whether this is a negative number
-      if (i < str.size())
-      {
-        switch (str[i])
-        {
-        case '-':
-          throw std::invalid_argument("invalid sign character in string " + str + " for unsigned value");
-          i++;
-          break;
-        case '+':
-          i++;
-          break;
-        }
-      }
-      for (; i < str.size(); i++)
-      {
-        val *= T(radix);
-        int ch = from_char[(unsigned char)str[i]] ;
-        if (ch == -1 || (unsigned)ch >= radix)
-        {
-          throw std::invalid_argument("invalid character in string " + str);
-        }
-        val += T(ch);
-      }
-    }
-    return val;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // exported functions
-
-  short string_to_short(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return svalue<short>(str, radix);
-  }
-
-  unsigned short string_to_unsigned_short(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return uvalue<unsigned short>(str, radix);
-  }
-
-  int string_to_int(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return svalue<int>(str, radix);
-  }
-
-  unsigned string_to_unsigned(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return uvalue<unsigned>(str, radix);
-  }
-
-  long string_to_long(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return svalue<long>(str, radix);
-  }
-
-  unsigned long string_to_unsigned_long(const std::string& str, unsigned radix)
-    throw(std::invalid_argument)
-  {
-    return uvalue<unsigned long>(str, radix);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_int.hpp b/src/stlplus/strings/string_int.hpp
deleted file mode 100644 (file)
index af79098..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef STLPLUS_STRING_INT
-#define STLPLUS_STRING_INT
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Convert integer types to/from string
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Conversions of Integer types to string
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // The radix (i.e. base) for these conversions can be any value from base 2 to base 36
-  // specifying any other radix causes std::invalid_argument to be thrown
-
-  // The way in which the radix is displayed is defined in radix_types.hpp
-  // If any other value is used, std::invalid_argument is thrown
-
-  // The width argument specifies the number of numerical digits to use in the result
-  // This is a minimum - if the value requires more digits then it will be wider than the width argument
-  // However, if it is smaller, then it will be extended to the specified width
-  // Then, the radix display prefix is added to this width
-
-  // For example, using the hash representation of 0 in hex with width=4 gives:
-  // 16#0000 - so there's 4 digits in the number part
-
-  std::string short_to_string(short i,
-                              unsigned radix = 10,
-                              radix_display_t display = radix_c_style_or_hash,
-                              unsigned width = 0)
-    throw(std::invalid_argument);
-
-  std::string unsigned_short_to_string(unsigned short i,
-                                       unsigned radix = 10,
-                                       radix_display_t display = radix_c_style_or_hash,
-                                       unsigned width = 0)
-    throw(std::invalid_argument);
-
-  std::string int_to_string(int i,
-                            unsigned radix = 10,
-                            radix_display_t display = radix_c_style_or_hash,
-                            unsigned width = 0)
-    throw(std::invalid_argument);
-
-  std::string unsigned_to_string(unsigned i,
-                                 unsigned radix = 10,
-                                 radix_display_t display = radix_c_style_or_hash,
-                                 unsigned width = 0)
-    throw(std::invalid_argument);
-
-  std::string long_to_string(long i,
-                             unsigned radix = 10,
-                             radix_display_t display = radix_c_style_or_hash,
-                             unsigned width = 0)
-    throw(std::invalid_argument);
-
-  std::string unsigned_long_to_string(unsigned long i,
-                                      unsigned radix = 10,
-                                      radix_display_t display = radix_c_style_or_hash,
-                                      unsigned width = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Convert a string to an integer type
-  ////////////////////////////////////////////////////////////////////////////////
-  // supports all the formats described above for the reverse conversion
-  // If the radix is set to zero, the conversions deduce the radix from the string representation
-  // So,
-  //   0b prefix is binary,
-  //   0 prefix is octal,
-  //   0x is hex
-  //   <base># prefix is my hash format
-  // The radix must be either zero as explained above, or in the range 2 to 16
-  // A non-zero radix should be used when the string value has no radix information and is non-decimal
-  // e.g. the hex value FEDCBA has no indication that it is hex, so specify radix 16
-  // Any other value of radix will cause std::invalid_argument to be thrown
-
-  short string_to_short(const std::string& value,
-                        unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  unsigned short string_to_unsigned_short(const std::string& value,
-                                          unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  int string_to_int(const std::string& value,
-                    unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  unsigned string_to_unsigned(const std::string& value,
-                              unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  long string_to_long(const std::string& value,
-                      unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  unsigned long string_to_unsigned_long(const std::string& value,
-                                        unsigned radix = 0)
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_list.hpp b/src/stlplus/strings/string_list.hpp
deleted file mode 100644 (file)
index beaef76..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef STLPLUS_STRING_LIST
-#define STLPLUS_STRING_LIST
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a list
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <list>
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string list_to_string(const std::list<T>& values,
-                             S to_string_fn,
-                             const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "string_list.tpp"
-#endif
diff --git a/src/stlplus/strings/string_list.tpp b/src/stlplus/strings/string_list.tpp
deleted file mode 100644 (file)
index eebba42..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   template implementations
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string list_to_string(const std::list<T>& values,
-                             S to_string_fn,
-                             const std::string& separator)
-  {
-    return sequence_to_string(values.begin(), values.end(), to_string_fn, separator);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_map.hpp b/src/stlplus/strings/string_map.hpp
deleted file mode 100644 (file)
index 64a6b22..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef STLPLUS_STRING_MAP
-#define STLPLUS_STRING_MAP
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a map/multimap
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <map>
-
-namespace stlplus
-{
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  std::string map_to_string(const std::map<K,T,C>& values,
-                            SK key_to_string_fn,
-                            ST value_to_string_fn,
-                            const std::string& pair_separator = ":",
-                            const std::string& separator = ",");
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  std::string multimap_to_string(const std::multimap<K,T,C>& values,
-                                 SK key_to_string_fn,
-                                 ST value_to_string_fn,
-                                 const std::string& pair_separator = ":",
-                                 const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "string_map.tpp"
-#endif
diff --git a/src/stlplus/strings/string_map.tpp b/src/stlplus/strings/string_map.tpp
deleted file mode 100644 (file)
index ce7d2f0..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // map
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  std::string map_to_string(const std::map<K,T,C>& values,
-                            SK key_to_string_fn,
-                            ST value_to_string_fn,
-                            const std::string& pair_separator,
-                            const std::string& separator)
-  {
-    return pair_sequence_to_string(values.begin(), values.end(),
-                                   key_to_string_fn, value_to_string_fn,
-                                   pair_separator, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // multimap
-
-  template<typename K, typename T, typename C, typename SK, typename ST>
-  std::string multimap_to_string(const std::multimap<K,T,C>& values,
-                                 SK key_to_string_fn,
-                                 ST value_to_string_fn,
-                                 const std::string& pair_separator,
-                                 const std::string& separator)
-  {
-    return pair_sequence_to_string(values.begin(), values.end(),
-                                   key_to_string_fn, value_to_string_fn,
-                                   pair_separator, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_matrix.hpp b/src/stlplus/strings/string_matrix.hpp
deleted file mode 100644 (file)
index 1ab0e82..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef STLPLUS_STRING_MATRIX
-#define STLPLUS_STRING_MATRIX
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a matrix
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "matrix.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string matrix_to_string(const matrix<T>& values,
-                               S to_string_fn,
-                               const std::string& column_separator = "|",
-                               const std::string& row_separator = ",");
-
-} // end namespace stlplus
-
-#include "string_matrix.tpp"
-#endif
diff --git a/src/stlplus/strings/string_matrix.tpp b/src/stlplus/strings/string_matrix.tpp
deleted file mode 100644 (file)
index 4185999..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  template<typename T, typename S>
-  std::string matrix_to_string(const matrix<T>& values,
-                               S to_string_fn,
-                               const std::string& column_separator,
-                               const std::string& row_separator)
-  {
-    std::string result;
-    for (unsigned r = 0; r < values.rows(); r++)
-    {
-      if (r != 0) result += row_separator;
-      for (unsigned c = 0; c < values.columns(); c++)
-      {
-        if (c != 0) result += column_separator;
-        result += to_string_fn(values(r,c));
-      }
-    }
-    return result;
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_ntree.hpp b/src/stlplus/strings/string_ntree.hpp
deleted file mode 100644 (file)
index e7b092d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef STLPLUS_STRING_NTREE
-#define STLPLUS_STRING_NTREE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of an ntree
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "ntree.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string ntree_to_string(const ntree<T>& values,
-                              S to_string_fn,
-                              const std::string& separator = "|",
-                              const std::string& indent_string = "  ");
-
-} // end namespace stlplus
-
-#include "string_ntree.tpp"
-#endif
diff --git a/src/stlplus/strings/string_ntree.tpp b/src/stlplus/strings/string_ntree.tpp
deleted file mode 100644 (file)
index 1c62a4c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string ntree_to_string(const ntree<T>& values,
-                              S to_string_fn,
-                              const std::string& separator,
-                              const std::string& indent_string)
-  {
-    std::string result;
-    for (TYPENAME ntree<T>::const_prefix_iterator i = values.prefix_begin(); i != values.prefix_end(); i++)
-    {
-      if (i != values.prefix_begin()) result += separator;
-      for (unsigned indent = values.depth(i.simplify()); --indent; )
-        result += indent_string;
-      result += to_string_fn(*i);
-    }
-    return result;
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_pair.hpp b/src/stlplus/strings/string_pair.hpp
deleted file mode 100644 (file)
index c55f51c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef STLPLUS_STRING_PAIR
-#define STLPLUS_STRING_PAIR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a pair
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <map>
-#include <string>
-
-namespace stlplus
-{
-
-  template<typename V1, typename V2, typename S1, typename S2>
-  std::string pair_to_string(const std::pair<V1,V2>& values,
-                             S1 to_string_fn1,
-                             S2 to_string_fn2,
-                             const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "string_pair.tpp"
-#endif
diff --git a/src/stlplus/strings/string_pair.tpp b/src/stlplus/strings/string_pair.tpp
deleted file mode 100644 (file)
index cdeda5f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename V1, typename V2, typename S1, typename S2>
-  std::string pair_to_string(const std::pair<V1,V2>& values,
-                             S1 to_string_fn1,
-                             S2 to_string_fn2,
-                             const std::string& separator)
-  {
-    return to_string_fn1(values.first) + separator + to_string_fn2(values.second);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_pointer.hpp b/src/stlplus/strings/string_pointer.hpp
deleted file mode 100644 (file)
index abdc825..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef STLPLUS_STRING_POINTER
-#define STLPLUS_STRING_POINTER
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of an object pointed to
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-
-namespace stlplus
-{
-
-  template <typename T, typename S>
-  std::string pointer_to_string(const T* value,
-                                S to_string_fn,
-                                const std::string& null_string = "<null>",
-                                const std::string& prefix = "(",
-                                const std::string& suffix = ")");
-
-
-}
-
-#include "string_pointer.tpp"
-#endif
diff --git a/src/stlplus/strings/string_pointer.tpp b/src/stlplus/strings/string_pointer.tpp
deleted file mode 100644 (file)
index cd3e5b2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include <string>
-
-namespace stlplus
-{
-
-  template <typename T, typename S>
-  std::string pointer_to_string(const T* value,
-                                S to_string_fn,
-                                const std::string& null_string,
-                                const std::string& prefix,
-                                const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_sequence.hpp b/src/stlplus/strings/string_sequence.hpp
deleted file mode 100644 (file)
index 591692e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef STLPLUS_STRING_SEQUENCE
-#define STLPLUS_STRING_SEQUENCE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate string representations of sequences represented by forward iterators
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence
-
-  template <typename I, typename S>
-  std::string sequence_to_string(I begin,
-                                 I end, 
-                                 S to_string,
-                                 const std::string& separator);
-
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence of pairs
-
-  template <typename I, typename S1, typename S2>
-  std::string pair_sequence_to_string(I begin,
-                                      I end,
-                                      S1 to_string_fn1,
-                                      S2 to_string_fn2,
-                                      const std::string& pair_separator,
-                                      const std::string& separator);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#include "string_sequence.tpp"
-#endif
diff --git a/src/stlplus/strings/string_sequence.tpp b/src/stlplus/strings/string_sequence.tpp
deleted file mode 100644 (file)
index 7c9c827..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_pair.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any forward iterator sequence
-
-  template <typename I, typename S>
-  std::string sequence_to_string(I begin,
-                                 I end, 
-                                 S to_string,
-                                 const std::string& separator)
-  {
-    std::string result;
-    for (I i = begin; i != end; i++)
-    {
-      if (i != begin) result += separator;
-      result += to_string(*i);
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // any sequence where the value is a pair
-
-  template <typename I, typename S1, typename S2>
-  std::string pair_sequence_to_string(I begin,
-                                      I end,
-                                      S1 to_string_fn1,
-                                      S2 to_string_fn2,
-                                      const std::string& pair_separator,
-                                      const std::string& separator)
-  {
-    std::string result;
-    for (I i = begin; i != end; i++)
-    {
-      if (i != begin) result += separator;
-      result += pair_to_string(*i, to_string_fn1, to_string_fn2, pair_separator);
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_set.hpp b/src/stlplus/strings/string_set.hpp
deleted file mode 100644 (file)
index 8c15543..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef STLPLUS_STRING_SET
-#define STLPLUS_STRING_SET
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a set/multiset
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <set>
-
-namespace stlplus
-{
-
-  template<typename K, typename C, typename S>
-  std::string set_to_string(const std::set<K,C>& values,
-                            S to_string_fn,
-                            const std::string& separator = ",");
-
-  template<typename K, typename C, typename S>
-  std::string multiset_to_string(const std::multiset<K,C>& values,
-                                 S to_string_fn,
-                                 const std::string& separator = ",");
-
-} // end namespace stlplus
-
-#include "string_set.tpp"
-#endif
diff --git a/src/stlplus/strings/string_set.tpp b/src/stlplus/strings/string_set.tpp
deleted file mode 100644 (file)
index 8dd065b..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   template implementations
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // set
-
-  template<typename K, typename C, typename S>
-  std::string set_to_string(const std::set<K,C>& values,
-                            S to_string_fn,
-                            const std::string& separator)
-  {
-    return sequence_to_string(values.begin(), values.end(), to_string_fn, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // multiset
-
-  template<typename K, typename C, typename S>
-  std::string multiset_to_string(const std::multiset<K,C>& values,
-                                 S to_string_fn,
-                                 const std::string& separator)
-  {
-    return sequence_to_string(values.begin(), values.end(), to_string_fn, separator);
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_simple_ptr.hpp b/src/stlplus/strings/string_simple_ptr.hpp
deleted file mode 100644 (file)
index b8d07d8..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef STLPLUS_STRING_SIMPLE_PTR
-#define STLPLUS_STRING_SIMPLE_PTR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a smart pointer
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "simple_ptr.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string simple_ptr_to_string(const simple_ptr<T>& value,
-                                  S to_string_fn,
-                                  const std::string& null_string = "<null>",
-                                  const std::string& prefix = "(",
-                                  const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  std::string simple_ptr_clone_to_string(const simple_ptr_clone<T>& value,
-                                        S to_string_fn,
-                                        const std::string& null_string = "<null>",
-                                        const std::string& prefix = "(",
-                                        const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  std::string simple_ptr__nocopy_to_string(const simple_ptr_nocopy<T>& value,
-                                          S to_string_fn,
-                                          const std::string& null_string = "<null>",
-                                          const std::string& prefix = "(",
-                                          const std::string& suffix = ")");
-
-
-} // end namespace stlplus
-
-#include "string_simple_ptr.tpp"
-#endif
diff --git a/src/stlplus/strings/string_simple_ptr.tpp b/src/stlplus/strings/string_simple_ptr.tpp
deleted file mode 100644 (file)
index 2334b7f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string simple_ptr_to_string(const simple_ptr<T>& value,
-                                  S to_string_fn,
-                                  const std::string& null_string,
-                                  const std::string& prefix,
-                                  const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-  template<typename T, typename S>
-  std::string simple_ptr_clone_to_string(const simple_ptr_clone<T>& value,
-                                        S to_string_fn,
-                                        const std::string& null_string,
-                                        const std::string& prefix,
-                                        const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-  template<typename T, typename S>
-  std::string simple_ptr_nocopy_to_string(const simple_ptr_nocopy<T>& value,
-                                         S to_string_fn,
-                                         const std::string& null_string,
-                                         const std::string& prefix,
-                                         const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_smart_ptr.hpp b/src/stlplus/strings/string_smart_ptr.hpp
deleted file mode 100644 (file)
index ea8cdd2..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef STLPLUS_STRING_SMART_PTR
-#define STLPLUS_STRING_SMART_PTR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a smart pointer
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "smart_ptr.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string smart_ptr_to_string(const smart_ptr<T>& value,
-                                  S to_string_fn,
-                                  const std::string& null_string = "<null>",
-                                  const std::string& prefix = "(",
-                                  const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  std::string smart_ptr_clone_to_string(const smart_ptr_clone<T>& value,
-                                        S to_string_fn,
-                                        const std::string& null_string = "<null>",
-                                        const std::string& prefix = "(",
-                                        const std::string& suffix = ")");
-
-  template<typename T, typename S>
-  std::string smart_ptr__nocopy_to_string(const smart_ptr_nocopy<T>& value,
-                                          S to_string_fn,
-                                          const std::string& null_string = "<null>",
-                                          const std::string& prefix = "(",
-                                          const std::string& suffix = ")");
-
-
-} // end namespace stlplus
-
-#include "string_smart_ptr.tpp"
-#endif
diff --git a/src/stlplus/strings/string_smart_ptr.tpp b/src/stlplus/strings/string_smart_ptr.tpp
deleted file mode 100644 (file)
index 994b363..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string smart_ptr_to_string(const smart_ptr<T>& value,
-                                  S to_string_fn,
-                                  const std::string& null_string,
-                                  const std::string& prefix,
-                                  const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-  template<typename T, typename S>
-  std::string smart_ptr_clone_to_string(const smart_ptr_clone<T>& value,
-                                        S to_string_fn,
-                                        const std::string& null_string,
-                                        const std::string& prefix,
-                                        const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-  template<typename T, typename S>
-  std::string smart_ptr_nocopy_to_string(const smart_ptr_nocopy<T>& value,
-                                         S to_string_fn,
-                                         const std::string& null_string,
-                                         const std::string& prefix,
-                                         const std::string& suffix)
-  {
-    return value ? (prefix + to_string_fn(*value) + suffix) : null_string;
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_stl.hpp b/src/stlplus/strings/string_stl.hpp
deleted file mode 100644 (file)
index ef93497..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef STLPLUS_STRING_STL
-#define STLPLUS_STRING_STL
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Template string conversions for pointers and STL containers
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "string_bitset.hpp"
-#include "string_list.hpp"
-#include "string_map.hpp"
-#include "string_pair.hpp"
-#include "string_sequence.hpp"
-#include "string_set.hpp"
-#include "string_string.hpp"
-#include "string_vector.hpp"
-
-#endif
diff --git a/src/stlplus/strings/string_stlplus.hpp b/src/stlplus/strings/string_stlplus.hpp
deleted file mode 100644 (file)
index 23c4bca..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef STLPLUS_STRING_STLPLUS
-#define STLPLUS_STRING_STLPLUS
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Template string conversions for the STLplus containers
-
-////////////////////////////////////////////////////////////////////////////////
-
-// can be excluded to break the dependency on the containers library
-#ifndef NO_STLPLUS_CONTAINERS
-#include "string_digraph.hpp"
-#include "string_foursome.hpp"
-#include "string_hash.hpp"
-#include "string_matrix.hpp"
-#include "string_ntree.hpp"
-#include "string_smart_ptr.hpp"
-#include "string_triple.hpp"
-#endif
-
-// can be excluded to break the dependency on the portability library
-#ifndef NO_STLPLUS_INF
-#include "string_inf.hpp"
-#endif
-
-#endif
diff --git a/src/stlplus/strings/string_string.cpp b/src/stlplus/strings/string_string.cpp
deleted file mode 100644 (file)
index 27d5f89..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_string.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // strings
-
-  std::string string_to_string(const std::string& value)
-  {
-    return value;
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_string.hpp b/src/stlplus/strings/string_string.hpp
deleted file mode 100644 (file)
index 522f698..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef STLPLUS_STRING_STRING
-#define STLPLUS_STRING_STRING
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Functions for converting C/STL strings to string
-
-//   This is necessary for completeness, e.g. for use in vector_to_string for vector<string>
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <stdexcept>
-
-namespace stlplus
-{
-
-  std::string string_to_string(const std::string& value);
-
-}
-
-#endif
diff --git a/src/stlplus/strings/string_triple.hpp b/src/stlplus/strings/string_triple.hpp
deleted file mode 100644 (file)
index 030cf0a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef STLPLUS_STRING_TRIPLE
-#define STLPLUS_STRING_TRIPLE
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a triple
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "triple.hpp"
-#include <string>
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename S1, typename S2, typename S3>
-  std::string triple_to_string(const triple<T1,T2,T3>& values,
-                               S1 to_string_fn1,
-                               S2 to_string_fn2,
-                               S3 to_string_fn3,
-                               const std::string& separator = ":");
-
-} // end namespace stlplus
-
-#include "string_triple.tpp"
-#endif
diff --git a/src/stlplus/strings/string_triple.tpp b/src/stlplus/strings/string_triple.tpp
deleted file mode 100644 (file)
index 8cd1d93..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace stlplus
-{
-
-  template<typename T1, typename T2, typename T3, typename S1, typename S2, typename S3>
-  std::string triple_to_string(const triple<T1,T2,T3>& values,
-                               S1 to_string_fn1,
-                               S2 to_string_fn2,
-                               S3 to_string_fn3,
-                               const std::string& separator)
-  {
-    return 
-      to_string_fn1(values.first) + 
-      separator + 
-      to_string_fn2(values.second) + 
-      separator + 
-      to_string_fn3(values.third);
-  }
-
-} // end namespace stlplus
-
diff --git a/src/stlplus/strings/string_utilities.cpp b/src/stlplus/strings/string_utilities.cpp
deleted file mode 100644 (file)
index 7e04824..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_utilities.hpp"
-#include "string_basic.hpp"
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-namespace stlplus
-{
-
-  // added as a local copy to break the dependency on the portability library
-  static std::string local_dformat(const char* format, ...) throw(std::invalid_argument)
-  {
-    std::string formatted;
-    va_list args;
-    va_start(args, format);
-#ifdef MSWINDOWS
-    int length = 0;
-    char* buffer = 0;
-    for(int buffer_length = 256; ; buffer_length*=2)
-    {
-      buffer = (char*)malloc(buffer_length);
-      if (!buffer) throw std::invalid_argument("string_utilities");
-      length = _vsnprintf(buffer, buffer_length-1, format, args);
-      if (length >= 0)
-      {
-        buffer[length] = 0;
-        formatted += std::string(buffer);
-        free(buffer);
-        break;
-      }
-      free(buffer);
-    }
-#else
-    char* buffer = 0;
-    int length = vasprintf(&buffer, format, args);
-    if (!buffer) throw std::invalid_argument("string_utilities");
-    if (length >= 0)
-      formatted += std::string(buffer);
-    free(buffer);
-#endif
-    va_end(args);
-    if (length < 0) throw std::invalid_argument("string_utilities");
-    return formatted;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string pad(const std::string& str, alignment_t alignment, unsigned width, char padch)
-    throw(std::invalid_argument)
-  {
-    std::string result = str;
-    switch(alignment)
-    {
-    case align_left:
-    {
-      unsigned padding = width>str.size() ? width - str.size() : 0;
-      unsigned i = 0;
-      while (i++ < padding)
-        result.insert(result.end(), padch);
-      break;
-    }
-    case align_right:
-    {
-      unsigned padding = width>str.size() ? width - str.size() : 0;
-      unsigned i = 0;
-      while (i++ < padding)
-        result.insert(result.begin(), padch);
-      break;
-    }
-    case align_centre:
-    {
-      unsigned padding = width>str.size() ? width - str.size() : 0;
-      unsigned i = 0;
-      while (i++ < padding/2)
-        result.insert(result.end(), padch);
-      i--;
-      while (i++ < padding)
-        result.insert(result.begin(), padch);
-      break;
-    }
-    default:
-      throw std::invalid_argument("invalid alignment value");
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string trim_left(const std::string& val)
-  {
-    std::string result = val;
-    while (!result.empty() && isspace(result[0]))
-      result.erase(result.begin());
-    return result;
-  }
-
-  std::string trim_right(const std::string& val)
-  {
-    std::string result = val;
-    while (!result.empty() && isspace(result[result.size()-1]))
-      result.erase(result.end()-1);
-    return result;
-  }
-
-  std::string trim(const std::string& val)
-  {
-    std::string result = val;
-    while (!result.empty() && isspace(result[0]))
-      result.erase(result.begin());
-    while (!result.empty() && isspace(result[result.size()-1]))
-      result.erase(result.end()-1);
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string lowercase(const std::string& val)
-  {
-    std::string text = val;
-    for (unsigned i = 0; i < text.size(); i++)
-      text[i] = tolower(text[i]);
-    return text;
-  }
-
-  std::string uppercase(const std::string& val)
-  {
-    std::string text = val;
-    for (unsigned i = 0; i < text.size(); i++)
-      text[i] = toupper(text[i]);
-    return text;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string translate(const std::string& input, const std::string& from_set, const std::string& to_set)
-  {
-    std::string result;
-    for (unsigned i = 0; i < input.size(); i++)
-    {
-      char ch = input[i];
-      // check to see if the character is in the from set
-      std::string::size_type found = from_set.find(ch);
-      if (found == std::string::npos)
-      {
-        // not found so just copy across
-        result += ch;
-      }
-      else if (found < to_set.size())
-      {
-        // found and in range so translate
-        result += to_set[found];
-      }
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // WARNING: wheel re-invention follows
-  // Given that all shells perform wildcard matching, why don't the library writers put it in the C run-time????????
-  // The problem:
-  //   *  matches any number of characters - this is achieved by matching 1 and seeing if the remainder matches
-  //      if not, try 2 characters and see if the remainder matches etc.
-  //      this must be recursive, not iterative, so that multiple *s can appear in the same wildcard expression
-  //   ?  matches exactly one character so doesn't need the what-if approach
-  //   \  escapes special characters such as *, ? and [
-  //   [] matches exactly one character in the set - the difficulty is the set can contain ranges, e.g [a-zA-Z0-9]
-  //      a set cannot be empty and the ] character can be included by making it the first character
-
-  // function for testing whether a character matches a set
-  // I can't remember the exact rules and I have no definitive references but:
-  // a set contains characters, escaped characters (I think) and ranges in the form a-z
-  // The character '-' can only appear at the start of the set where it is not interpreted as a range
-  // This is a horrible mess - blame the Unix folks for making a hash of wildcards
-
-  static bool match_set (const std::string& set, char match)
-  {
-    // first expand any ranges and remove escape characters to make life more palatable
-    std::string simple_set;
-    for (std::string::const_iterator i = set.begin(); i != set.end(); ++i)
-    {
-      switch(*i)
-      {
-      case '-':
-      {
-        if (i == set.begin())
-        {
-          simple_set += *i;
-        }
-        else if (i+1 == set.end())
-        {
-          return false;
-        }
-        else
-        {
-          // found a set. The first character is already in the result, so first remove it (the set might be empty)
-          simple_set.erase(simple_set.end()-1);
-          char last = *++i;
-          for (char ch = *(i-2); ch <= last; ch++)
-          {
-            simple_set += ch;
-          }
-        }
-        break;
-      }
-      case '\\':
-        if (i+1 == set.end()) {return false;}
-        simple_set += *++i;
-        break;
-      default:
-        simple_set += *i;
-        break;
-      }
-    }
-    std::string::size_type result = simple_set.find(match);
-    return result != std::string::npos;
-  }
-
-  // the recursive bit - basically whenever a * is found you recursively call this for each candidate substring match
-  // until either it succeeds or you run out of string to match
-  // for each * in the wildcard another level of recursion is created
-
-  static bool match_remainder (const std::string& wild, std::string::const_iterator wildi,
-                               const std::string& match, std::string::const_iterator matchi)
-  {
-    //cerr << "match_remainder called at " << *matchi << " with wildcard " << *wildi << endl;
-    while (wildi != wild.end() && matchi != match.end())
-    {
-      //cerr << "trying to match " << *matchi << " with wildcard " << *wildi << endl;
-      switch(*wildi)
-      {
-      case '*':
-      {
-        ++wildi;
-        ++matchi;
-        for (std::string::const_iterator i = matchi; i != match.end(); ++i)
-        {
-          // deal with * at the end of the wildcard - there is no remainder then
-          if (wildi == wild.end())
-          {
-            if (i == match.end()-1)
-              return true;
-          }
-          else if (match_remainder(wild, wildi, match, i))
-          {
-            return true;
-          }
-        }
-        return false;
-      }
-      case '[':
-      {
-        // scan for the end of the set using a similar method for avoiding escaped characters
-        bool found = false;
-        std::string::const_iterator end = wildi + 1;
-        for (; !found && end != wild.end(); ++end)
-        {
-          switch(*end)
-          {
-          case ']':
-          {
-            // found the set, now match with its contents excluding the brackets
-            if (!match_set(wild.substr(wildi - wild.begin() + 1, end - wildi - 1), *matchi))
-              return false;
-            found = true;
-            break;
-          }
-          case '\\':
-            if (end == wild.end()-1)
-              return false;
-            ++end;
-            break;
-          default:
-            break;
-          }
-        }
-        if (!found)
-          return false;
-        ++matchi;
-        wildi = end;
-        break;
-      }
-      case '?':
-        ++wildi;
-        ++matchi;
-        break;
-      case '\\':
-        if (wildi == wild.end()-1)
-          return false;
-        ++wildi;
-        if (*wildi != *matchi)
-          return false;
-        ++wildi;
-        ++matchi;
-        break;
-      default:
-        if (*wildi != *matchi)
-          return false;
-        ++wildi;
-        ++matchi;
-        break;
-      }
-    }
-    bool result = wildi == wild.end() && matchi == match.end();
-    return result;
-  }
-
-  // like all recursions the exported function has a simpler interface than the
-  // recursive function and is just a 'seed' to the recursion itself
-
-  bool match_wildcard(const std::string& wild, const std::string& match)
-  {
-    return match_remainder(wild, wild.begin(), match, match.begin());
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::vector<std::string> split(const std::string& str, const std::string& splitter)
-  {
-    std::vector<std::string> result;
-    if (!str.empty())
-    {
-      for(std::string::size_type offset = 0;;)
-      {
-        std::string::size_type found = str.find(splitter, offset);
-        if (found != std::string::npos)
-        {
-          result.push_back(str.substr(offset, found-offset));
-          offset = found + splitter.size();
-        }
-        else
-        {
-          result.push_back(str.substr(offset, str.size()-offset));
-          break;
-        }
-      }
-    }
-    return result;
-  }
-
-  std::string join (const std::vector<std::string>& str,
-                    const std::string& joiner,
-                    const std::string& prefix,
-                    const std::string& suffix)
-  {
-    std::string result = prefix;
-    for (unsigned i = 0; i < str.size(); i++)
-    {
-      if (i) result += joiner;
-      result += str[i];
-    }
-    result += suffix;
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string display_bytes(long bytes)
-  {
-    std::string result;
-    if (bytes < 0)
-    {
-      result += '-';
-      bytes = -bytes;
-    }
-    static const long kB = 1024l;
-    static const long MB = kB * kB;
-    static const long GB = MB * kB;
-    if (bytes < kB)
-      result += local_dformat("%i", bytes);
-    else if (bytes < (10l * kB))
-      result += local_dformat("%.2fk", ((float)bytes / (float)kB));
-    else if (bytes < (100l * kB))
-      result += local_dformat("%.1fk", ((float)bytes / (float)kB));
-    else if (bytes < MB)
-      result += local_dformat("%.0fk", ((float)bytes / (float)kB));
-    else if (bytes < (10l * MB))
-      result += local_dformat("%.2fM", ((float)bytes / (float)MB));
-    else if (bytes < (100l * MB))
-      result += local_dformat("%.1fM", ((float)bytes / (float)MB));
-    else if (bytes < GB)
-      result += local_dformat("%.0fM", ((float)bytes / (float)MB));
-    else
-      result += local_dformat("%.2fG", ((float)bytes / (float)GB));
-    return result;
-  }
-
-  std::string display_time(time_t seconds)
-  {
-    unsigned minutes = (unsigned)seconds / 60;
-    seconds %= 60;
-    unsigned hours = minutes / 60;
-    minutes %= 60;
-    unsigned days = hours / 24;
-    hours %= 24;
-    unsigned weeks = days / 7;
-    days %= 7;
-    std::string result;
-    if (weeks > 0)
-    {
-      result += unsigned_to_string(weeks, 10, radix_none, 1);
-      result += "w ";
-    }
-    if (!result.empty() || days > 0)
-    {
-      result += unsigned_to_string(days, 10, radix_none, 1);
-      result += "d ";
-    }
-    if (!result.empty() || hours > 0)
-    {
-      result += unsigned_to_string(hours, 10, radix_none, 1);
-      result += ":";
-    }
-    if (!result.empty() || minutes > 0)
-    {
-      if (!result.empty())
-        result += unsigned_to_string(minutes, 10, radix_none, 2);
-      else
-        result += unsigned_to_string(minutes, 10, radix_none, 1);
-      result += ":";
-    }
-    if (!result.empty())
-      result += unsigned_to_string((unsigned)seconds, 10, radix_none, 2);
-    else
-    {
-      result += unsigned_to_string((unsigned)seconds, 10, radix_none, 1);
-      result += "s";
-    }
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_utilities.hpp b/src/stlplus/strings/string_utilities.hpp
deleted file mode 100644 (file)
index 369477d..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#ifndef STLPLUS_STRING_UTILITIES
-#define STLPLUS_STRING_UTILITIES
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Utilities for manipulating std::strings
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include "format_types.hpp"
-#include <vector>
-#include <string>
-#include <stdexcept>
-#include <time.h>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Padding function allows a string to be printed in a fixed-width field
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // The definitions for the alignment are declared in format_types.hpp
-  // Any other value will cause std::invalid_argument to be thrown
-
-  std::string pad(const std::string& str,
-                  alignment_t alignment,
-                  unsigned width,
-                  char padch = ' ')
-    throw(std::invalid_argument);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // whitespace trimming
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string trim_left(const std::string& val);
-  std::string trim_right(const std::string& val);
-  std::string trim(const std::string& val);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // case conversion for std::strings
-  ////////////////////////////////////////////////////////////////////////////////
-
-  std::string lowercase(const std::string& val);
-  std::string uppercase(const std::string& val);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // character translation - inspired by Unix 'tr' command
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // convert characters represented in from_set to the characters in the same position in to_set
-  // for example:
-  //   filename = translate(filename,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-  // converts the filename to uppercase and returns the result (Note that the
-  // uppercase function does this more easily). If the from_set is longer than
-  // the to_set, then the overlap represents characters to delete (i.e. they map
-  // to nothing)
-
-  std::string translate(const std::string& input,
-                        const std::string& from_set,
-                        const std::string& to_set = std::string());
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // wildcard matching
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // this function does wildcard matching of the wildcard expression against the candidate std::string
-  // wildcards are NOT regular expressions
-  // the wildcard characters are * and ? where * matches 1 or more characters and ? matches only one
-  // there are also character sets [a-z] [qwertyuiop] etc. which match 1 character
-  // TODO: character sets like [:alpha:]
-  // TODO eventually: regular expression matching and substitution (3rd party library?)
-
-  bool match_wildcard(const std::string& wild,
-                      const std::string& match);
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // Perl-inspired split/join functions
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // splits the string at every occurance of splitter and adds it as a separate string to the return value
-  // the splitter is removed
-  // a string with no splitter in it will give a single-value vector
-  // an empty string gives an empty vector
-
-  std::vector<std::string> split (const std::string& str,
-                                  const std::string& splitter = "\n");
-
-  // the reverse of the above
-  // joins the string vector to create a single string with the joiner inserted between the joins
-  // Note: the joiner will not be added at the beginning or the end
-  // However, there are optional fields to add such prefix and suffix strings
-
-  std::string join (const std::vector<std::string>&,
-                    const std::string& joiner = "\n",
-                    const std::string& prefix = "",
-                    const std::string& suffix = "");
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // special displays
-  ////////////////////////////////////////////////////////////////////////////////
-
-  // display the parameter as a number in bytes, kbytes, Mbytes, Gbytes depending on range
-
-  std::string display_bytes(long bytes);
-
-  // display the parameter in seconds as a string representation in weeks, days, hours, minutes, seconds
-  // e.g. "1d 1:01:01" means 1 day, 1 hour, 1 minute and 1 second
-
-  std::string display_time(time_t seconds);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#endif
diff --git a/src/stlplus/strings/string_vector.cpp b/src/stlplus/strings/string_vector.cpp
deleted file mode 100644 (file)
index 66868bc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_vector.hpp"
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // special case of vector<bool>
-
-  std::string bool_vector_to_string(const std::vector<bool>& values)
-  {
-    std::string result;
-    for (size_t i = 0; i < values.size(); i++)
-      result.append(1, values[i] ? '1' : '0');
-    return result;
-  }
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/string_vector.hpp b/src/stlplus/strings/string_vector.hpp
deleted file mode 100644 (file)
index 204eea9..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef STLPLUS_STRING_VECTOR
-#define STLPLUS_STRING_VECTOR
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Generate a string representation of a vector
-
-////////////////////////////////////////////////////////////////////////////////
-#include "strings_fixes.hpp"
-#include <string>
-#include <vector>
-
-namespace stlplus
-{
-
-  ////////////////////////////////////////////////////////////////////////////////
-  // vector
-
-  template<typename T, typename S>
-  std::string vector_to_string(const std::vector<T>& values,
-                               S to_string_fn,
-                               const std::string& separator = ",");
-
-  // specialisation for vector<bool> which has a different implementation
-  std::string bool_vector_to_string(const std::vector<bool>& values);
-
-  ////////////////////////////////////////////////////////////////////////////////
-
-} // end namespace stlplus
-
-#include "string_vector.tpp"
-#endif
diff --git a/src/stlplus/strings/string_vector.tpp b/src/stlplus/strings/string_vector.tpp
deleted file mode 100644 (file)
index 9e2f385..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-////////////////////////////////////////////////////////////////////////////////
-#include "string_sequence.hpp"
-
-namespace stlplus
-{
-
-  template<typename T, typename S>
-  std::string vector_to_string(const std::vector<T>& values,
-                               S to_string_fn,
-                               const std::string& separator)
-  {
-    return sequence_to_string(values.begin(), values.end(), to_string_fn, separator);
-  }
-
-} // end namespace stlplus
diff --git a/src/stlplus/strings/strings.hpp b/src/stlplus/strings/strings.hpp
deleted file mode 100644 (file)
index dba420e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef STLPLUS_STRINGS
-#define STLPLUS_STRINGS
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Header for including the whole strings library in one go
-
-//   The strings library prints C and C++ types into a std::string
-
-//   - it extends the numeric presentation of integers to include any radix from 2 - 36
-//   - it allows the printing of data structures - useful for diagnostic dumps
-
-////////////////////////////////////////////////////////////////////////////////
-
-#include "string_utilities.hpp"
-
-#include "string_basic.hpp"
-#include "string_stl.hpp"
-#include "string_stlplus.hpp"
-
-#include "print_basic.hpp"
-#include "print_stl.hpp"
-#include "print_stlplus.hpp"
-
-////////////////////////////////////////////////////////////////////////////////
-#endif
diff --git a/src/stlplus/strings/strings_fixes.hpp b/src/stlplus/strings/strings_fixes.hpp
deleted file mode 100644 (file)
index c6368ce..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef STLPLUS_STRINGS_FIXES
-#define STLPLUS_STRINGS_FIXES
-////////////////////////////////////////////////////////////////////////////////
-
-//   Author:    Andy Rushton
-//   Copyright: (c) Southampton University 1999-2004
-//              (c) Andy Rushton           2004-2009
-//   License:   BSD License, see ../docs/license.html
-
-//   Contains work arounds for OS or Compiler specific problems
-
-////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////
-// Problem with MicroSoft defining two different macros to identify Windows
-////////////////////////////////////////////////////////////////////////////////
-
-#if defined(_WIN32) || defined(_WIN32_WCE)
-#define MSWINDOWS
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// Unnecessary compiler warnings
-////////////////////////////////////////////////////////////////////////////////
-
-#ifdef _MSC_VER
-// Microsoft Visual Studio
-// shut up the following irritating warnings
-//   4786 - VC6, identifier string exceeded maximum allowable length and was truncated (only affects debugger)
-//   4305 - VC6, identifier type was converted to a smaller type
-//   4503 - VC6, decorated name was longer than the maximum the compiler allows (only affects debugger)
-//   4309 - VC6, type conversion operation caused a constant to exceeded the space allocated for it
-//   4290 - VC6, C++ exception specification ignored
-//   4800 - VC6, forcing value to bool 'true' or 'false' (performance warning)
-//   4675 - VC7.1, "change" in function overload resolution _might_ have altered program
-//   4996 - VC8, 'xxxx' was declared deprecated
-#pragma warning(disable: 4786 4305 4503 4309 4290 4800 4675 4996)
-#endif
-
-#ifdef __BORLANDC__
-// Borland
-// Shut up the following irritating warnings
-//   8026 - Functions with exception specifications are not expanded inline
-//   8027 - Functions with xxx are not expanded inline
-//   8066 - Unreachable code.
-//          A break, continue, goto, or return statement was not followed by a
-//          label or the end of a loop or function. The compiler checks while,
-//          do, and for loops with a constant test condition, and attempts to
-//          recognize loops that can't fall through.
-#pragma warn -8026
-#pragma warn -8027
-#pragma warn -8066
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-#endif
index 25ca5d56e40b7ee3a7293367393f34a3e1d13e75..7be05bb00f78be5f33d59a93709ac395625f9856 100644 (file)
@@ -4,13 +4,13 @@
 // Compile this file with windres and link with the executable.
 //
 
-#include <winver.h>
 #include "config.h"
+#include <winver.h>
 
 1 VERSIONINFO
 FILEVERSION            VERSION_MAJOR,VERSION_MINOR,VERSION_REVISION,0
-PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_REVISION,0
-FILEFLAGSMASK  VS_FFI_FILEFLAGSMASK
+PRODUCTVERSION         VERSION_MAJOR,VERSION_MINOR,VERSION_REVISION,0
+FILEFLAGSMASK          VS_FFI_FILEFLAGSMASK
 #if NDEBUG
        FILEFLAGS       0
 #else
@@ -23,14 +23,14 @@ BEGIN
        BEGIN
                BLOCK "040904b0"
                BEGIN
-                       VALUE "CompanyName", ""
-                       VALUE "FileDescription", "Alien-smashing action game"
-                       VALUE "FileVersion", PACKAGE_VERSION
-                       VALUE "InternalName", "Yoink"
-                       VALUE "LegalCopyright", "Copyright 2010 Charles McGarvey et al."
-                       VALUE "OriginalFilename", "yoink.exe"
-                       VALUE "ProductName", "Yoink"
-                       VALUE "ProductVersion", PACKAGE_VERSION
+                       VALUE "CompanyName",            ""
+                       VALUE "FileDescription",        "Alien-smashing action game"
+                       VALUE "FileVersion",            PACKAGE_VERSION
+                       VALUE "InternalName",           PACKAGE
+                       VALUE "LegalCopyright",         "Copyright 2011 Charles McGarvey et al."
+                       VALUE "OriginalFilename",       "yoink.exe"
+                       VALUE "ProductName",            PACKAGE_NAME
+                       VALUE "ProductVersion",         PACKAGE_VERSION
                END
        END
        BLOCK "VarFileInfo"
@@ -39,5 +39,5 @@ BEGIN
        END
 END
 
-1000 ICON "../arch/win32/yoink.ico"
+1000 ICON "../build/arch/win32/yoink.ico"
 
index 72fef6d01b3f59d3a354f0998aae93f29e2a9c18..76150362ee2d41cf136470e408a4551816927cd0 100644 (file)
@@ -1,15 +1,15 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
+#if HAVE_CONFIG_H
 #include "config.h"
+#endif
 
 #include <stdexcept>
 
@@ -114,7 +114,7 @@ yoink::yoink()
 
        //bool isMute = false;
        //settings().get("nomusic", isMute);
-       //music_.play();
+       music_.play();
 
        load_scene_loader();
        advance_scene();                // load the first scene
index cc4446a387875714cb950bb3769aaa5f54e15ed1..edd38bfd5d3a97c4429e6a6b6f81be02e492c78c 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _YOINK_HH_
 #define _YOINK_HH_
@@ -54,16 +52,16 @@ private:
        void projection();
        void projection(moof::scalar width, moof::scalar height);
 
-       mutable GameState               state_;
+       mutable GameState       state_;
 
        HudP                    mHud;
 
-       moof::sound     punch_sound_;
+       moof::sound             punch_sound_;
        moof::sound             music_;
 
        moof::ray2              mRay;
        moof::line2             mLine;
-       moof::circle    mCircle;
+       moof::circle            mCircle;
 
        moof::timer             mRayTimer;
        void rayTimer();
This page took 0.53572 seconds and 4 git commands to generate.