OSDN Git Service

-- UTF8の文字および文字列を扱うためのクラスCUTF8CharとCUTF8Stringを追加。
authorderui <derui@users.sourceforge.jp>
Wed, 3 Jun 2009 14:39:33 +0000 (23:39 +0900)
committerderui <derui@users.sourceforge.jp>
Wed, 3 Jun 2009 14:39:33 +0000 (23:39 +0900)
-- CUTF8StringとCUTF8Char、及び非メンバインターフェースのための名前空間
   utakata::utf8_stringを追加。
-- UTF8のチェック、変換を行なう単純な関数を、utakata::utf8名前空間に格納。
-- 簡単なテストをシンプルに実行できるCSimpleTestSuiteおよび周辺のクラスを
   simpletest名前空間に追加。
-- function_callbackをsmart_ptr化して利用するためのsmart_function_callback
   の内部を、引数の有無で名前空間を分割した。
-- id:rubikitchさんの考案したTextArrayFormatを解析して利用することができるように
   したTextArrayFormatクラスを追加。
-- UTF8関係、およびTextArrayFormat関係のテストを追加。
-- make checkが成功するようにtestディレクトリを新設。

37 files changed:
.gitignore
GPATH
GRTAGS
GSYMS
GTAGS
Makefile
Makefile.am
Makefile.in
TextArrayFormat.cpp [new file with mode: 0644]
TextArrayFormat.h [new file with mode: 0644]
acconfig.h.in [deleted file]
acconfig.h.in~ [deleted file]
common/GRTAGS
common/GSYMS
configure
configure.in [changed mode: 0755->0644]
function_callback.h
simpletest.cpp
simpletest.h
smart_function_callback.h
test/GPATH [new file with mode: 0644]
test/GRTAGS [new file with mode: 0644]
test/GSYMS [new file with mode: 0644]
test/GTAGS [new file with mode: 0644]
test/Makefile [new file with mode: 0644]
test/Makefile.am [new file with mode: 0755]
test/Makefile.in [new file with mode: 0644]
test/textarrayformat_test [new file with mode: 0755]
test/textarrayformat_test.cpp [new file with mode: 0644]
test/utf8_string_test [new file with mode: 0755]
test/utf8_string_test.cpp [new file with mode: 0644]
test/utf8_test [new file with mode: 0755]
test/utf8_test.cpp [new file with mode: 0644]
utf8.cpp
utf8.h
utf8_string.cpp [new file with mode: 0644]
utf8_string.h [new file with mode: 0644]

index 9c9aaa6..c26af84 100644 (file)
 /utf8
 /utf8.o
 /vm.o
+/.deps/utf8_string.Po
+/TextArrayFormat.o
+/test/.deps/TextArrayFormat.Po
+/test/.deps/simpletest.Po
+/test/.deps/textarrayformat_test.Po
+/test/.deps/utf8.Po
+/test/.deps/utf8_string.Po
+/test/.deps/utf8_string_test.Po
+/test/.deps/utf8_test.Po
+/test/TextArrayFormat.o
+/test/simpletest.o
+/test/textarrayformat_test.o
+/test/utf8.o
+/test/utf8_string.o
+/test/utf8_string_test.o
+/test/utf8_test.o
+/utf8_string.o
+/.deps/TextArrayFormat.Po
diff --git a/GPATH b/GPATH
index 0b4119d..0caddac 100644 (file)
Binary files a/GPATH and b/GPATH differ
diff --git a/GRTAGS b/GRTAGS
index 3e13c7c..adcb410 100644 (file)
Binary files a/GRTAGS and b/GRTAGS differ
diff --git a/GSYMS b/GSYMS
index 726f845..05b325f 100644 (file)
Binary files a/GSYMS and b/GSYMS differ
diff --git a/GTAGS b/GTAGS
index 73499a6..2a77e9a 100644 (file)
Binary files a/GTAGS and b/GTAGS differ
index d32bf56..6566ddb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -49,7 +49,8 @@ am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 am_utakata_OBJECTS = main.$(OBJEXT) vm.$(OBJEXT) operand.$(OBJEXT) \
-       cpu.$(OBJEXT) utf8.$(OBJEXT)
+       cpu.$(OBJEXT) utf8.$(OBJEXT) TextArrayFormat.$(OBJEXT) \
+       utf8_string.$(OBJEXT)
 utakata_OBJECTS = $(am_utakata_OBJECTS)
 utakata_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I.
@@ -62,8 +63,18 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
        -o $@
 SOURCES = $(utakata_SOURCES)
 DIST_SOURCES = $(utakata_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-dvi-recursive install-exec-recursive \
+       install-html-recursive install-info-recursive \
+       install-pdf-recursive install-ps-recursive install-recursive \
+       installcheck-recursive installdirs-recursive pdf-recursive \
+       ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -82,12 +93,12 @@ AUTOHEADER = ${SHELL} /home/derui/develop/sdl/missing --run autoheader
 AUTOMAKE = ${SHELL} /home/derui/develop/sdl/missing --run automake-1.10
 AWK = gawk
 CC = gcc
-CCDEPMODE = depmode=none
+CCDEPMODE = depmode=gcc3
 CFLAGS = -g -O2
 CPP = gcc -E
-CPPFLAGS = -Wall
+CPPFLAGS = 
 CXX = g++
-CXXDEPMODE = depmode=none
+CXXDEPMODE = depmode=gcc3
 CXXFLAGS = -g -O2
 CYGPATH_W = echo
 DEFS = -DHAVE_CONFIG_H
@@ -112,9 +123,9 @@ MKDIR_P = /bin/mkdir -p
 OBJEXT = o
 PACKAGE = utakata
 PACKAGE_BUGREPORT = BUG-REPORT-ADDRESS
-PACKAGE_NAME = main.c
-PACKAGE_STRING = main.c 0.0.1
-PACKAGE_TARNAME = main-c
+PACKAGE_NAME = utakata
+PACKAGE_STRING = utakata 0.0.1
+PACKAGE_TARNAME = utakata
 PACKAGE_VERSION = 0.0.1
 PATH_SEPARATOR = :
 SET_MAKE = 
@@ -164,9 +175,11 @@ target_alias =
 top_build_prefix = 
 top_builddir = .
 top_srcdir = .
-utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp
+SUBDIRS = . test
+INCLUDES = -l$(top_srcdir)
+utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp TextArrayFormat.cpp utf8_string.cpp
 all: config.h
-       $(MAKE) $(AM_MAKEFLAGS) all-am
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
 .SUFFIXES: .cpp .o .obj
@@ -253,25 +266,97 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+include ./$(DEPDIR)/TextArrayFormat.Po
 include ./$(DEPDIR)/cpu.Po
 include ./$(DEPDIR)/main.Po
 include ./$(DEPDIR)/operand.Po
 include ./$(DEPDIR)/utf8.Po
+include ./$(DEPDIR)/utf8_string.Po
 include ./$(DEPDIR)/vm.Po
 
 .cpp.o:
-#      $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-#      mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-       source='$<' object='$@' libtool=no \
-       DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
-       $(CXXCOMPILE) -c -o $@ $<
+       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+#      source='$<' object='$@' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXXCOMPILE) -c -o $@ $<
 
 .cpp.obj:
-#      $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-#      mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-       source='$<' object='$@' libtool=no \
-       DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
-       $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+#      source='$<' object='$@' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -283,10 +368,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        mkid -fID $$unique
 tags: TAGS
 
-TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
        unique=`for i in $$list; do \
            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -299,7 +397,7 @@ TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
            $$tags $$unique; \
        fi
 ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@@ -348,6 +446,23 @@ distdir: $(DISTFILES)
            || exit 1; \
          fi; \
        done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(MKDIR_P) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
        -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
          ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
@@ -452,21 +567,22 @@ distcleancheck: distclean
               $(distcleancheck_listfiles) ; \
               exit 1; } >&2
 check-am: all-am
-check: check-am
+check: check-recursive
 all-am: Makefile $(PROGRAMS) config.h
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
        for dir in "$(DESTDIR)$(bindir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
          install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -482,70 +598,72 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
 
 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-hdr distclean-tags
 
-dvi: dvi-am
+dvi: dvi-recursive
 
 dvi-am:
 
-html: html-am
+html: html-recursive
 
-info: info-am
+info: info-recursive
 
 info-am:
 
 install-data-am:
 
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
 
 install-exec-am: install-binPROGRAMS
 
-install-html: install-html-am
+install-html: install-html-recursive
 
-install-info: install-info-am
+install-info: install-info-recursive
 
 install-man:
 
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
 
-install-ps: install-ps-am
+install-ps: install-ps-recursive
 
 installcheck-am:
 
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf $(top_srcdir)/autom4te.cache
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
 mostlyclean-am: mostlyclean-compile mostlyclean-generic
 
-pdf: pdf-am
+pdf: pdf-recursive
 
 pdf-am:
 
-ps: ps-am
+ps: ps-recursive
 
 ps-am:
 
 uninstall-am: uninstall-binPROGRAMS
 
-.MAKE: install-am install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+       install-strip
 
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
-       clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+       all all-am am--refresh check check-am clean clean-binPROGRAMS \
+       clean-generic ctags ctags-recursive dist dist-all dist-bzip2 \
        dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
        distclean distclean-compile distclean-generic distclean-hdr \
        distclean-tags distcleancheck distdir distuninstallcheck dvi \
@@ -555,9 +673,10 @@ uninstall-am: uninstall-binPROGRAMS
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
        install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am uninstall-binPROGRAMS
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+       ps ps-am tags tags-recursive uninstall uninstall-am \
+       uninstall-binPROGRAMS
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
index 8a9bb43..c712b51 100755 (executable)
@@ -1,3 +1,6 @@
+SUBDIRS = . test
+INCLUDES = -l$(top_srcdir)
+
 bin_PROGRAMS = utakata
 
-utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp
+utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp TextArrayFormat.cpp utf8_string.cpp
index b87fe04..2ef9055 100644 (file)
@@ -49,7 +49,8 @@ am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
 am_utakata_OBJECTS = main.$(OBJEXT) vm.$(OBJEXT) operand.$(OBJEXT) \
-       cpu.$(OBJEXT) utf8.$(OBJEXT)
+       cpu.$(OBJEXT) utf8.$(OBJEXT) TextArrayFormat.$(OBJEXT) \
+       utf8_string.$(OBJEXT)
 utakata_OBJECTS = $(am_utakata_OBJECTS)
 utakata_LDADD = $(LDADD)
 DEFAULT_INCLUDES = -I.@am__isrc@
@@ -62,8 +63,18 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
        -o $@
 SOURCES = $(utakata_SOURCES)
 DIST_SOURCES = $(utakata_SOURCES)
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-dvi-recursive install-exec-recursive \
+       install-html-recursive install-info-recursive \
+       install-pdf-recursive install-ps-recursive install-recursive \
+       installcheck-recursive installdirs-recursive pdf-recursive \
+       ps-recursive uninstall-recursive
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
+  distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
@@ -164,9 +175,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp
+SUBDIRS = . test
+INCLUDES = -l$(top_srcdir)
+utakata_SOURCES = main.cpp vm.cpp operand.cpp cpu.cpp utf8.cpp TextArrayFormat.cpp utf8_string.cpp
 all: config.h
-       $(MAKE) $(AM_MAKEFLAGS) all-am
+       $(MAKE) $(AM_MAKEFLAGS) all-recursive
 
 .SUFFIXES:
 .SUFFIXES: .cpp .o .obj
@@ -253,10 +266,12 @@ mostlyclean-compile:
 distclean-compile:
        -rm -f *.tab.c
 
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextArrayFormat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operand.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_string.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vm.Po@am__quote@
 
 .cpp.o:
@@ -273,6 +288,76 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
        unique=`for i in $$list; do \
@@ -283,10 +368,23 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        mkid -fID $$unique
 tags: TAGS
 
-TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
        unique=`for i in $$list; do \
            if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
@@ -299,7 +397,7 @@ TAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
            $$tags $$unique; \
        fi
 ctags: CTAGS
-CTAGS:  $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
                $(TAGS_FILES) $(LISP)
        tags=; \
        list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@@ -348,6 +446,23 @@ distdir: $(DISTFILES)
            || exit 1; \
          fi; \
        done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(MKDIR_P) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               am__remove_distdir=: \
+               am__skip_length_check=: \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
        -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
          ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
          ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
@@ -452,21 +567,22 @@ distcleancheck: distclean
               $(distcleancheck_listfiles) ; \
               exit 1; } >&2
 check-am: all-am
-check: check-am
+check: check-recursive
 all-am: Makefile $(PROGRAMS) config.h
-installdirs:
+installdirs: installdirs-recursive
+installdirs-am:
        for dir in "$(DESTDIR)$(bindir)"; do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 
-installcheck: installcheck-am
+installcheck: installcheck-recursive
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
          install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -482,70 +598,72 @@ distclean-generic:
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
        @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
+clean: clean-recursive
 
 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
 
-distclean: distclean-am
+distclean: distclean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-hdr distclean-tags
 
-dvi: dvi-am
+dvi: dvi-recursive
 
 dvi-am:
 
-html: html-am
+html: html-recursive
 
-info: info-am
+info: info-recursive
 
 info-am:
 
 install-data-am:
 
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
 
 install-exec-am: install-binPROGRAMS
 
-install-html: install-html-am
+install-html: install-html-recursive
 
-install-info: install-info-am
+install-info: install-info-recursive
 
 install-man:
 
-install-pdf: install-pdf-am
+install-pdf: install-pdf-recursive
 
-install-ps: install-ps-am
+install-ps: install-ps-recursive
 
 installcheck-am:
 
-maintainer-clean: maintainer-clean-am
+maintainer-clean: maintainer-clean-recursive
        -rm -f $(am__CONFIG_DISTCLEAN_FILES)
        -rm -rf $(top_srcdir)/autom4te.cache
        -rm -rf ./$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
-mostlyclean: mostlyclean-am
+mostlyclean: mostlyclean-recursive
 
 mostlyclean-am: mostlyclean-compile mostlyclean-generic
 
-pdf: pdf-am
+pdf: pdf-recursive
 
 pdf-am:
 
-ps: ps-am
+ps: ps-recursive
 
 ps-am:
 
 uninstall-am: uninstall-binPROGRAMS
 
-.MAKE: install-am install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
+       install-strip
 
-.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
-       clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+       all all-am am--refresh check check-am clean clean-binPROGRAMS \
+       clean-generic ctags ctags-recursive dist dist-all dist-bzip2 \
        dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
        distclean distclean-compile distclean-generic distclean-hdr \
        distclean-tags distcleancheck distdir distuninstallcheck dvi \
@@ -555,9 +673,10 @@ uninstall-am: uninstall-binPROGRAMS
        install-html-am install-info install-info-am install-man \
        install-pdf install-pdf-am install-ps install-ps-am \
        install-strip installcheck installcheck-am installdirs \
-       maintainer-clean maintainer-clean-generic mostlyclean \
-       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
-       tags uninstall uninstall-am uninstall-binPROGRAMS
+       installdirs-am maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
+       ps ps-am tags tags-recursive uninstall uninstall-am \
+       uninstall-binPROGRAMS
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/TextArrayFormat.cpp b/TextArrayFormat.cpp
new file mode 100644 (file)
index 0000000..dc5ca0e
--- /dev/null
@@ -0,0 +1,87 @@
+#include <vector>
+#include <string>
+#include <sstream>
+
+#include <iostream>
+#include <exception>
+#include <assert.h>
+
+
+#include "TextArrayFormat.h"
+
+using namespace std;
+
+textarrayformat::CTextArrayReader::CTextArrayReader(std::istream& is) :
+    splitter_(), blocks_()
+{
+    // openを利用して読出す。
+    // openは例外を返す可能性がある。
+    open(is);
+}
+
+void textarrayformat::CTextArrayReader::open(std::istream& is)
+{
+    // isより行単位での読み出しを行う。
+
+    std::string tmp;
+    if (!std::getline(is, tmp))
+    {
+        // 最初の一行が取得できない場合、これは失敗とする。
+        throw "can't get splitter line";
+    }
+
+    // スプリッタとして設定させる。
+    splitter_ = tmp;
+
+    std::string block;
+    while (getline(is, tmp)) {
+        // 取得していく。
+        if (splitter_ != tmp)
+        {
+            //スプリッタ以外の場合はまとめる。
+            block += tmp + "\n";
+        }
+        else
+        {
+            this->blocks_.push_back(block);
+            block.clear();
+        }
+    }
+
+    // 最後に殘っている場合があるのでこうしておく。
+    if (!block.empty())
+    {
+        this->blocks_.push_back(block);
+    }
+}
+
+std::string textarrayformat::CTextArrayReader::get(int num)
+{
+    // ここはassertではなく、通常の例外によるチェックを行う。
+    if (num < 0)
+    {
+        throw textarrayformat::COutOfIndexException("Argument must be greater than zero");
+    }
+
+    if (static_cast<size_t>(num) >= blocks_.size())
+    {
+        std::stringstream ss;
+        ss << "Argument must be less than blocks num : size [" << blocks_.size()
+           << "] and receive value is [" << num << "]" << endl;
+            
+        throw textarrayformat::COutOfIndexException(ss.str());
+    }
+
+    // 本当はここでatにしておけば、事前のチェックは必要無いはず。
+    return blocks_[num];
+}
+
+textarrayformat::COutOfIndexException::COutOfIndexException(const std::string& str) :
+    str_(str)
+{
+}
+
+const char* textarrayformat::COutOfIndexException::what() const throw()
+{
+    return str_.c_str();
+}
diff --git a/TextArrayFormat.h b/TextArrayFormat.h
new file mode 100644 (file)
index 0000000..5786525
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _TEXTARRAYFORMAT_H_
+#define _TEXTARRAYFORMAT_H_
+
+#include <iostream>
+#include <string>
+#include <vector>
+#include <exception>
+
+
+namespace textarrayformat {
+
+    class COutOfIndexException : public std::exception
+    {
+    public:
+        COutOfIndexException(const std::string& str);
+        virtual ~COutOfIndexException() throw() {}
+
+        virtual const char* what() const throw();
+
+    private:
+        const std::string str_;
+    };
+
+    class CTextArrayReader
+    {
+    public:
+
+        CTextArrayReader(std::istream& is);
+        virtual ~CTextArrayReader() {}
+
+        // 指定したストリームの先頭からフォーマットに従ってブロック単位
+        // への切り出しを行う。
+        // この関数が成功した場合、以前のブロックなどは保存されない。
+        void open(std::istream& is);
+
+        // 指定したブロックを取得する。
+        // 番号を指定しない場合には、最初に取得したブロックが取得される。
+        std::string get(int = 0);
+
+        // ブロックのリストを取得する。
+        const std::vector<std::string>& getBlock() const {return blocks_;}
+
+    private:
+
+        // ファイル中のスプリッタを行ごと退避する。
+        std::string splitter_;
+
+        // テキストのブロックを退避しておくリスト
+        std::vector<std::string> blocks_;
+    };
+
+};
+
+#endif /* _TEXTARRAYFORMAT_H_ */
diff --git a/acconfig.h.in b/acconfig.h.in
deleted file mode 100755 (executable)
index 74c58b4..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/* acconfig.h.in.  Generated from configure.in by autoheader.  */
-/* acconfig.h.  Generated from acconfig.h.in by configure.  */
-/* acconfig.h.in.  Generated from configure.in by autoheader.  */
-/* acconfig.h.  Generated from acconfig.h.in by configure.  */
-/* acconfig.h.in.  Generated from configure.in by autoheader.  */
-#define PACKAGE "utakata"
-#define VERSION "0.0.1"
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if the system has the type `_Bool'. */
-#define HAVE__BOOL 1
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "main.c"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "main.c VERSION"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "main-c"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "VERSION"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if the system has the type `_Bool'. */
-#define HAVE__BOOL 1
-
-/* Name of package */
-#define PACKAGE "utakata"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "main.c"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "main.c VERSION"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "main-c"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "VERSION"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Version number of package */
-#define VERSION "0.0.1"
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#undef HAVE_STDBOOL_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-#undef inline
-#endif
diff --git a/acconfig.h.in~ b/acconfig.h.in~
deleted file mode 100755 (executable)
index 36bcdaf..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/* acconfig.h.in.  Generated from configure.in by autoheader.  */
-/* acconfig.h.  Generated from acconfig.h.in by configure.  */
-/* acconfig.h.in.  Generated from configure.in by autoheader.  */
-#define PACKAGE "utakata"
-#define VERSION "0.0.1"
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#define HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#define HAVE_STDBOOL_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#define HAVE_STDINT_H 1
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
-
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if the system has the type `_Bool'. */
-#define HAVE__BOOL 1
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "BUG-REPORT-ADDRESS"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "main.c"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "main.c VERSION"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "main-c"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "VERSION"
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if stdbool.h conforms to C99. */
-#undef HAVE_STDBOOL_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-#undef inline
-#endif
index 0207c61..82f00a2 100644 (file)
Binary files a/common/GRTAGS and b/common/GRTAGS differ
index a56691a..cdd0a51 100644 (file)
Binary files a/common/GSYMS and b/common/GSYMS differ
index c609ae7..eda120b 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for main.c 0.0.1.
+# Generated by GNU Autoconf 2.63 for utakata 0.0.1.
 #
 # Report bugs to <BUG-REPORT-ADDRESS>.
 #
@@ -594,12 +594,13 @@ MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
-PACKAGE_NAME='main.c'
-PACKAGE_TARNAME='main-c'
+PACKAGE_NAME='utakata'
+PACKAGE_TARNAME='utakata'
 PACKAGE_VERSION='0.0.1'
-PACKAGE_STRING='main.c 0.0.1'
+PACKAGE_STRING='utakata 0.0.1'
 PACKAGE_BUGREPORT='BUG-REPORT-ADDRESS'
 
+ac_unique_file="."
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
@@ -1292,7 +1293,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures main.c 0.0.1 to adapt to many kinds of systems.
+\`configure' configures utakata 0.0.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1340,7 +1341,7 @@ Fine tuning of the installation directories:
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/main-c]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/utakata]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -1358,7 +1359,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of main.c 0.0.1:";;
+     short | recursive ) echo "Configuration of utakata 0.0.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1447,7 +1448,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-main.c configure 0.0.1
+utakata configure 0.0.1
 generated by GNU Autoconf 2.63
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1461,7 +1462,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by main.c $as_me 0.0.1, which was
+It was created by utakata $as_me 0.0.1, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   $ $0 $@
@@ -1829,6 +1830,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+
+ac_config_headers="$ac_config_headers config.h"
+
 am__api_version='1.10'
 
 ac_aux_dir=
@@ -3900,6 +3904,8 @@ fi
 
 # Checks for header files.
 
+# Checks for typedefs, structures, and compiler characteristics.
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4522,160 +4528,6 @@ fi
 done
 
 
-
-
-for ac_header in stdlib.h string.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## --------------------------------- ##
-## Report this to BUG-REPORT-ADDRESS ##
-## --------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-# Checks for typedefs, structures, and compiler characteristics.
 { $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
 if test "${ac_cv_header_stdbool_h+set}" = set; then
@@ -4976,11 +4828,114 @@ _ACEOF
     ;;
 esac
 
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_type_size_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (size_t))
+       return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((size_t)))
+         return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_type_size_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test "x$ac_cv_type_size_t" = x""yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
 
 # Checks for library functions.
-ac_config_headers="$ac_config_headers config.h"
 
-ac_config_files="$ac_config_files Makefile"
+ac_config_files="$ac_config_files Makefile test/Makefile"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -5422,7 +5377,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by main.c $as_me 0.0.1, which was
+This file was extended by utakata $as_me 0.0.1, which was
 generated by GNU Autoconf 2.63.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5485,7 +5440,7 @@ Report bugs to <bug-autoconf@gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-main.c config.status 0.0.1
+utakata config.status 0.0.1
 configured by $0, generated by GNU Autoconf 2.63,
   with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
@@ -5608,9 +5563,10 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 for ac_config_target in $ac_config_targets
 do
   case $ac_config_target in
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
 
   *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 $as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
old mode 100755 (executable)
new mode 100644 (file)
index 0d927e4..8793754
@@ -2,8 +2,10 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.63])
-AC_INIT(main.c, 0.0.1, [BUG-REPORT-ADDRESS])
-AM_INIT_AUTOMAKE(utakata, 0.0.1, no-define)
+AC_INIT(utakata, 0.0.1, [BUG-REPORT-ADDRESS])
+AC_CONFIG_SRCDIR(.)
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE(utakata, 0.0.1, derutakayu@gmail.com)
 
 # Checks for programs.
 AC_PROG_CXX
@@ -12,12 +14,14 @@ AC_PROG_CC
 # Checks for libraries.
 
 # Checks for header files.
-AC_CHECK_HEADERS([stdlib.h string.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
 AC_C_INLINE
+AC_TYPE_SIZE_T
 
 # Checks for library functions.
-AC_CONFIG_HEADERS(config.h)
-AC_OUTPUT(Makefile)
+
+AC_CONFIG_FILES([Makefile
+                 test/Makefile])
+AC_OUTPUT
index c158490..6a48d89 100644 (file)
@@ -2,6 +2,7 @@
 #define ___HGL___FUNCTION_CALLBACK___
 
 namespace fc {
+
     /**
        function_callback
        関数コールバック基底クラス
@@ -38,20 +39,6 @@ namespace fc {
     template<class Obj,class T1,class T2,class T3,class T4> class function_callback_vm4;
     template<class Obj,class T1,class T2,class T3,class T4,class T5> class function_callback_vm5;
 
-    template<class Result,class T> class function_callback_rg0;
-    template<class Result>class function_callback_r0;
-    template<class Result, class T> class function_callback_r1;
-    template<class Result, class T1,class T2> class function_callback_r2;
-    template<class Result, class T1,class T2,class T3> class function_callback_r3;
-    template<class Result, class T1,class T2,class T3,class T4> class function_callback_r4;
-    template<class Result, class T1,class T2,class T3,class T4,class T5> class function_callback_r5;
-    template<class Result, class OBJ> class function_callback_rm0;
-    template<class Result, class OBJ,class T> class function_callback_rm1;
-    template<class Result, class OBJ,class T1,class T2> class function_callback_rm2;
-    template<class Result, class OBJ,class T1,class T2,class T3> class function_callback_rm3;
-    template<class Result, class OBJ,class T1,class T2,class T3,class T4> class function_callback_rm4;
-    template<class Result, class OBJ,class T1,class T2,class T3,class T4,class T5> class function_callback_rm5;
-  
     /**
        function_callback_v
        返り値無しのコールバック関数クラス。
@@ -63,10 +50,99 @@ namespace fc {
 
         virtual ~function_callback_v() {}
 
+        //--------------------------------------------------------------------------------
+        // 各関数コールバッククラス生成関数群。
+        // ここでの関数群は、全て同じ名前のオーバーロードによって行われる。
+        //--------------------------------------------------------------------------------
+
+        //引数無し、返り値無しの静的関数のみのコールバック関数クラス作成
+        template<class T>
+        static function_callback_v* create(void (T::*f)()) {
+            return new function_callback_vg0<T>(f);
+        }
+
+        //引数あり、静的関数のみ
+        template<class Arg1>
+        static function_callback_v* create(void (*f)(Arg1),Arg1 a1) {
+            return new function_callback_v1<Arg1>(f,a1);
+        }
+
+        template<class Arg1,class Arg2>
+        static function_callback_v* create(void (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
+            return new function_callback_v2<Arg1,Arg2>(f,a1,a2);
+        }
+
+        template<class Arg1,class Arg2,class Arg3>
+        static function_callback_v* create(void (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
+            return new function_callback_v3<Arg1,Arg2,Arg3>(f,a1,a2,a3);
+        }
+
+        template<class Arg1,class Arg2,class Arg3,class Arg4>
+        static function_callback_v* create(void (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+            return new function_callback_v4<Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
+        }
+
+        template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
+        static function_callback_v* create(void (*f)(Arg1,Arg2,Arg3,Arg4,Arg5),
+                                    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
+            return new function_callback_v5<Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4,a5);
+        }
+
+        //引数無し、メンバ関数
+        template<class obj>
+        static function_callback_v* create(void (obj::*f)(),obj* p) {
+            return new function_callback_vm0<obj>(f,p);
+        }
+
+        template<class obj,class Arg1>
+        static function_callback_v* create(void (obj::*f)(Arg1),obj* p,Arg1 a1) {
+            return new function_callback_vm1<obj,Arg1>(f,p,a1);
+        }
+
+        template<class obj,class Arg1,class Arg2>
+        static function_callback_v* create(void (obj::*f)(Arg1,Arg2),obj* p,Arg1 a1,Arg2 a2) {
+            return new function_callback_vm2<obj,Arg1,Arg2>(f,p,a1,a2);
+        }
+
+        template<class obj,class Arg1,class Arg2,class Arg3>
+        static function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3),obj* p,Arg1 a1,Arg2 a2,Arg3 a3) {
+            return new function_callback_vm3<obj,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
+        }
+
+        template<class obj,class Arg1,class Arg2,class Arg3,class Arg4>
+        static function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4),obj* p,
+                                    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+            return new function_callback_vm4<obj,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
+        }
+
+        template<class obj,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
+        static function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),obj* p,
+                                    Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
+            return new function_callback_vm5<obj,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
+        }
+
         virtual void run() {}
 
     };
 
+    //================================================================================
+    // 返り値ありの関数コールバッククラス
+    //================================================================================
+
+    template<class Result,class T> class function_callback_rg0;
+    template<class Result>class function_callback_r0;
+    template<class Result, class T> class function_callback_r1;
+    template<class Result, class T1,class T2> class function_callback_r2;
+    template<class Result, class T1,class T2,class T3> class function_callback_r3;
+    template<class Result, class T1,class T2,class T3,class T4> class function_callback_r4;
+    template<class Result, class T1,class T2,class T3,class T4,class T5> class function_callback_r5;
+    template<class Result, class OBJ> class function_callback_rm0;
+    template<class Result, class OBJ,class T> class function_callback_rm1;
+    template<class Result, class OBJ,class T1,class T2> class function_callback_rm2;
+    template<class Result, class OBJ,class T1,class T2,class T3> class function_callback_rm3;
+    template<class Result, class OBJ,class T1,class T2,class T3,class T4> class function_callback_rm4;
+    template<class Result, class OBJ,class T1,class T2,class T3,class T4,class T5> class function_callback_rm5;
+
     /**
        function_callback_r
        返り値ありのコールバック関数クラスの元締め
@@ -76,9 +152,85 @@ namespace fc {
     class function_callback_r : public function_callback {
     public:
 
-        function_callback_r() : m_Result(NULL) {}
+        function_callback_r() : m_Result() {}
         virtual ~function_callback_r() {}
 
+        
+        //--------------------------------------------------------------------------------
+        // 返り値有りの関数コールバックの定義
+        // 返り値はそれぞれ自由に設定することができる。
+        //--------------------------------------------------------------------------------
+        inline function_callback_r<Result>* create(Result (*f)(void)) {
+            return new function_callback_r0<Result>(f);
+        }
+
+
+        template<class T>
+        static function_callback_r<Result>* create(Result (T::*f)()) {
+            return new function_callback_rg0<Result,T>(f);
+        }
+
+        //非メンバ関数
+        template<class Arg1>
+        static function_callback_r<Result>* create(Result (*f)(Arg1),Arg1 a1) {
+            return new function_callback_r1<Result,Arg1>(f,a1);
+        }
+
+        template<class Arg1,class Arg2>
+        static function_callback_r<Result>* create(Result (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
+            return new function_callback_r2<Result,Arg1,Arg2>(f,a1,a2);
+        }
+
+        template<class Arg1,class Arg2,class Arg3>
+        static function_callback_r<Result>* 
+        create(Result (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
+            return new function_callback_r3<Result,Arg1,Arg2,Arg3>(f,a1,a2,a3);
+        }
+    
+        template<class Arg1,class Arg2,class Arg3,class Arg4>
+        static function_callback_r<Result>* create(Result (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+            return new function_callback_r4<Result,Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
+        }
+
+        template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
+        static function_callback_r<Result>* create(Result (*f)(Arg1,Arg2,Arg3,Arg4),
+                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
+            return new function_callback_r5<Result,Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4,a5);
+        }
+
+        //メンバ関数
+        template<class T>
+        static function_callback_r<Result>* create(Result (T::*f)(),T* p) {
+            return new function_callback_rm0<Result,T>(f,p);
+        }
+
+        template<class T,class Arg1>
+        static function_callback_r<Result>* create(Result (T::*f)(Arg1),T* p,Arg1 a1) {
+            return new function_callback_rm1<Result,T,Arg1>(f,p,a1);
+        }
+
+        template<class T,class Arg1,class Arg2>
+        static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2),T* p,Arg1 a1,Arg2 a2) {
+            return new function_callback_rm2<Result,T,Arg1,Arg2>(f,p,a1,a2);
+        }
+
+        template<class T,class Arg1,class Arg2,class Arg3>
+        static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3),T* p,Arg1 a1,Arg2 a2,Arg3 a3) {
+            return new function_callback_rm3<Result,T,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
+        }
+
+        template<class T,class Arg1,class Arg2,class Arg3,class Arg4>
+        static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4),T* p,
+                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+            return new function_callback_rm4<Result,T,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
+        }
+
+        template<class T,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
+        static function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),T* p,
+                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
+            return new function_callback_rm5<Result,T,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
+        }
+
         Result getResult() {
             return m_Result;
         }
@@ -91,6 +243,10 @@ namespace fc {
 
     };
 
+    //================================================================================
+    // 各コールバックテンプレートの実装
+    //================================================================================ 
+
     class function_callback_v0 : public function_callback_v {
     public:
         typedef void (*CallBack)(void);
@@ -638,157 +794,14 @@ namespace fc {
 
     };
 
-    //--------------------------------------------------------------------------------
-    // 各関数コールバッククラス生成関数群。
-    // ここでの関数群は、全て同じ名前のオーバーロードによって行われる。
-    //--------------------------------------------------------------------------------
 
-    //引数無し、返り値無しの静的関数のみのコールバック関数クラス作成
-    function_callback_v* create(void (*f)(void)) {
+    // この関数のみ、実体が必要であるため、ここで定義する。
+    inline function_callback_v* create(void (*f)(void))
+    {
         return new function_callback_v0(f);
     }
 
-    template<class T>
-    function_callback_v* create(void (T::*f)()) {
-        return new function_callback_vg0<T>(f);
-    }
-
-    //引数あり、静的関数のみ
-    template<class Arg1>
-    function_callback_v* create(void (*f)(Arg1),Arg1 a1) {
-        return new function_callback_v1<Arg1>(f,a1);
-    }
-
-    template<class Arg1,class Arg2>
-    function_callback_v* create(void (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return new function_callback_v2<Arg1,Arg2>(f,a1,a2);
-    }
-
-    template<class Arg1,class Arg2,class Arg3>
-    function_callback_v* create(void (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_v3<Arg1,Arg2,Arg3>(f,a1,a2,a3);
-    }
-
-    template<class Arg1,class Arg2,class Arg3,class Arg4>
-    function_callback_v* create(void (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_v4<Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
-    }
-
-    template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    function_callback_v* create(void (*f)(Arg1,Arg2,Arg3,Arg4,Arg5),
-                                Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_v5<Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4,a5);
-    }
-
-    //引数無し、メンバ関数
-    template<class obj>
-    function_callback_v* create(void (obj::*f)(),obj* p) {
-        return new function_callback_vm0<obj>(f,p);
-    }
-
-    template<class obj,class Arg1>
-    function_callback_v* create(void (obj::*f)(Arg1),obj* p,Arg1 a1) {
-        return new function_callback_vm1<obj,Arg1>(f,p,a1);
-    }
-
-    template<class obj,class Arg1,class Arg2>
-    function_callback_v* create(void (obj::*f)(Arg1,Arg2),obj* p,Arg1 a1,Arg2 a2) {
-        return new function_callback_vm2<obj,Arg1,Arg2>(f,p,a1,a2);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3>
-    function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3),obj* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_vm3<obj,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3,class Arg4>
-    function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4),obj* p,
-                                Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_vm4<obj,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
-    }
-
-    template<class obj,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    function_callback_v* create(void (obj::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),obj* p,
-                                Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_vm5<obj,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
-    }
-
-    //--------------------------------------------------------------------------------
-    // 返り値有りの関数コールバックの定義
-    // 返り値はそれぞれ自由に設定することができる。
-    //--------------------------------------------------------------------------------
-
-    template<class Result>
-    function_callback_r<Result>* create(Result (*f)()) {
-        return new function_callback_r0<Result>(f);
-    }
-
-    template<class Result, class T>
-    function_callback_r<Result>* create(Result (T::*f)()) {
-        return new function_callback_rg0<Result,T>(f);
-    }
-
-    //非メンバ関数
-    template<class Result, class Arg1>
-    function_callback_r<Result>* create(Result (*f)(Arg1),Arg1 a1) {
-        return new function_callback_r1<Result,Arg1>(f,a1);
-    }
-
-    template<class Result, class Arg1,class Arg2>
-    function_callback_r<Result>* create(Result (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return new function_callback_r2<Result,Arg1,Arg2>(f,a1,a2);
-    }
-
-    template<class Result, class Arg1,class Arg2,class Arg3>
-    function_callback_r<Result>* 
-    create(Result (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_r3<Result,Arg1,Arg2,Arg3>(f,a1,a2,a3);
-    }
-    
-    template<class Result, class Arg1,class Arg2,class Arg3,class Arg4>
-    function_callback_r<Result>* create(Result (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_r4<Result,Arg1,Arg2,Arg3,Arg4>(f,a1,a2,a3,a4);
-    }
-
-    template<class Result, class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    function_callback_r<Result>* create(Result (*f)(Arg1,Arg2,Arg3,Arg4),
-                                        Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_r5<Result,Arg1,Arg2,Arg3,Arg4,Arg5>(f,a1,a2,a3,a4,a5);
-    }
-
-    //メンバ関数
-    template<class Result, class T>
-    function_callback_r<Result>* create(Result (T::*f)(),T* p) {
-        return new function_callback_rm0<Result,T>(f,p);
-    }
-
-    template<class Result, class T,class Arg1>
-    function_callback_r<Result>* create(Result (T::*f)(Arg1),T* p,Arg1 a1) {
-        return new function_callback_rm1<Result,T,Arg1>(f,p,a1);
-    }
-
-    template<class Result, class T,class Arg1,class Arg2>
-    function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2),T* p,Arg1 a1,Arg2 a2) {
-        return new function_callback_rm2<Result,T,Arg1,Arg2>(f,p,a1,a2);
-    }
-
-    template<class Result, class T,class Arg1,class Arg2,class Arg3>
-    function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3),T* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return new function_callback_rm3<Result,T,Arg1,Arg2,Arg3>(f,p,a1,a2,a3);
-    }
-
-    template<class Result, class T,class Arg1,class Arg2,class Arg3,class Arg4>
-    function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4),T* p,
-                                        Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return new function_callback_rm4<Result,T,Arg1,Arg2,Arg3,Arg4>(f,p,a1,a2,a3,a4);
-    }
-
-    template<class Result, class T,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    function_callback_r<Result>* create(Result (T::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),T* p,
-                                        Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return new function_callback_rm5<Result,T,Arg1,Arg2,Arg3,Arg4,Arg5>(f,p,a1,a2,a3,a4,a5);
-    }
 
-}
+};
 
 #endif
index d1a12d1..4c524ec 100644 (file)
@@ -7,11 +7,21 @@
 
 using namespace simpletest;
 
-SimpleTestSuite::SimpleTestSuite() : prefix_("- "), testers_()
+CSimpleTestSuite::CSimpleTestSuite(const std::string& name) :
+    name_("[" + name + "]"), prefix_("- "), testers_(), strm_(std::cout),
+    runner_()
 {
+    runner_.add(new CSimpleTestRunner(strm_, prefix_));
 }
 
-bool SimpleTestSuite::addTester(const fc::sfc_r<bool>::type& func)
+CSimpleTestSuite::CSimpleTestSuite(const std::string& name,
+                                   std::ostream& strm) :
+    name_("[" + name + "]"), prefix_("- "), testers_(), strm_(strm)
+{
+    runner_.add(new CSimpleTestRunner(strm_, prefix_));
+}
+
+bool CSimpleTestSuite::addTester(const sfcr::sfc_r<bool>::type& func)
 {
     // テストを追加する。中身がNULLの場合には触らない。
     if (func.isNull())
@@ -22,80 +32,141 @@ bool SimpleTestSuite::addTester(const fc::sfc_r<bool>::type& func)
     return true;
 }
 
-void SimpleTestSuite::running()
+void CSimpleTestSuite::run()
 {
     // この場合、標準出力される、std::coutが利用される。
-    running(std::cout);
-}
-
-void SimpleTestSuite::running(std::ostream& strm)
-{
     // 現在保持しているテストをまとめて実行する。
     // 実行した結果は、全て出力されるようになる。
     
-    printBeginMessage(strm, prefix_);
+    printBeginMessage();
 
-    SimpleTestRunner runner(strm, prefix_);
+    CSimpleTestRunner runner(strm_, prefix_);
     std::for_each(testers_.begin(), testers_.end(),
-                  runner);
+                  *runner_);
 
-    printEndMessage(strm, prefix_, runner);
+    printEndMessage();
 }
 
-void simpletest::printBeginMessage(std::ostream& strm, const std::string& prefix)
+void simpletest::CSimpleTestSuite::printBeginMessage()
 {
     // 開始メッセージを、指定されたストリームに出力する。
 
     const std::string separates("==================================================");
-    const std::string run("running...");
+    const std::string run(" is running...");
+    const std::string suite("Test suite is ");
 
-    strm << separates << std::endl;
-    strm << prefix << run << std::endl;
+    strm_ << separates << std::endl;
+    strm_ << prefix_ << suite << name_ << run << std::endl;
+    strm_ << separates << std::endl;
 }
 
-void simpletest::printEndMessage(std::ostream& strm, const std::string& prefix,
-                                 const SimpleTestRunner& runner)
+void simpletest::CSimpleTestSuite::printEndMessage()
 {
     // テストの終了メッセージを、指定されたストリームに出力する。
     const std::string separates("==================================================");
     const std::string message("SimpleTest Results.");
-
-    strm << separates << std::endl;
-    strm << prefix << message << std::endl;
+    
+    strm_ << separates << std::endl;
+    strm_ << prefix_ << message << std::endl;
 
     // 結果を利用して出力する。
     {
         const std::string mes("executes tests ");
-        int count = runner.getSuccess() + runner.getFail() +
-            runner.getException();
-        strm << prefix << mes << count << " --> ";
-        strm << "success [" << runner.getSuccess() << "] : ";
-        strm << "fail [" << runner.getFail() << "] : ";
-        strm << "exception [" << runner.getException() << "]" << std::endl;
+        int count = testers_.size();
+        strm_ << prefix_ << mes << count << " --> ";
+        strm_ << "success [" << runner_->getSuccess() << "] : ";
+        strm_ << "fail [" << runner_->getFail() << "] : ";
+        strm_ << "exception [" << runner_->getException() << "]" << std::endl;
+    }
+
+    strm_ << separates << std::endl;
+}
+
+smart_ptr<CSimpleTestAsserter> simpletest::CSimpleTestSuite::getAsserter()
+{
+    return smart_ptr<simpletest::CSimpleTestAsserter>(new
+                                                      simpletest::CSimpleTestAsserter(strm_, prefix_));
+}
+
+
+simpletest::CSimpleTestRunner::CSimpleTestRunner(std::ostream& strm,
+                                                 const std::string& prefix) :
+    strm_(strm), prefix_(prefix), pImpl(new simpletest::CSimpleTestRunner::PImpl)
+{}
+
+void simpletest::CSimpleTestRunner::innerCheck(bool b)
+{
+    // 関数が例外を返さなかった場合に実行されるチェック関数
+    pImpl->count++;
+    if (b)
+    {
+        pImpl->success++;
+        printSuccess();
+    } else {
+        pImpl->fail++;
+        printFail();
     }
+}
 
-    strm << separates << std::endl;
+void simpletest::CSimpleTestRunner::innerCheck(std::exception& e) {
+    // 例外が発行された場合、とりあえずはe.whatsを
+    // std::stringとして保持しておく。
+    pImpl->exception++;
+    printException(e);
 }
 
-void simpletest::SimpleTestRunner::printSuccess()
+void simpletest::CSimpleTestRunner::printSuccess()
 {
     // 成功した場合のメッセージを出力する。
+    int count = pImpl->success + pImpl->fail + pImpl->exception;
     strm_ << prefix_ << "test ";
-    strm_ << prefix_ << " is success." << std::endl;
+    strm_ << count << " is success." << std::endl;
 }
 
-void simpletest::SimpleTestRunner::printFail()
+void simpletest::CSimpleTestRunner::printFail()
 {
     // 成功した場合のメッセージを出力する。
+    int count = pImpl->success + pImpl->fail + pImpl->exception;
     strm_ << prefix_ << "test ";
-    strm_ << fail_ << " is fail." << std::endl;
+    strm_ << count << " is fail." << std::endl;
 }
 
-void simpletest::SimpleTestRunner::printException(const std::exception& e)
+void simpletest::CSimpleTestRunner::printException(const std::exception& e)
 {
     // 成功した場合のメッセージを出力する。
+    int count = pImpl->success + pImpl->fail + pImpl->exception;
     strm_ << prefix_ << "test ";
-    strm_ << exception_ << " is throw exception." << std::endl;
+    strm_ << count << " is throw exception." << std::endl;
     strm_ << e.what() << std::endl;
 }
 
+
+//================================================================================
+
+
+simpletest::CSimpleTestAsserter::CSimpleTestAsserter(std::ostream& strm,
+                                                     const std::string& prefix) :
+    strm_(strm), prefix_(prefix), count_(0)
+{
+}
+
+simpletest::CSimpleTestAsserter::CSimpleTestAsserter(const CSimpleTestAsserter& asserter) :
+    strm_(asserter.strm_), prefix_(asserter.prefix_), count_(asserter.count_)
+{
+}
+
+CSimpleTestAsserter& simpletest::CSimpleTestAsserter::operator=(const CSimpleTestAsserter& asserter)
+{
+    // 代入によってコピーを作成するための処理
+    CSimpleTestAsserter a(asserter);
+    std::swap(*this, a);
+    return *this;
+}
+
+bool simpletest::CSimpleTestAsserter::isOk() const
+{
+    // count_は、checkの比較関数が失敗する度にこれが実行されることに
+    // なっている。
+    return count_ == 0 ? true : false;
+}
index 3b1070a..2bc510a 100644 (file)
@@ -3,8 +3,9 @@
 
 #include <vector>
 #include <string>
-#include <iostream>
 #include <exception>
+#include <iostream>
+#include <functional>
 
 #include "smart_function_callback.h"
 
@@ -30,7 +31,7 @@ namespace simpletest {
 //     {
 //         simpletest::SimpleTestSuite suite;
 //         suite.addTester(fc::screate(hoge));
-//         suite.running();
+//         suite.run();
 
 //         return 0;
 //     }
@@ -49,87 +50,187 @@ namespace simpletest {
 //     一応例外が実行されたかどうかをチェックし、例外が投げられたことで関数が
 //     終了している場合、それも記述される。
 
-    class SimpleTestSuite
+    class CSimpleTestRunner;
+
+    class CSimpleTestAsserter;
+    
+    class CSimpleTestSuite
     {
         // セパレータ以外の文字列の表記時に利用されるprefix
+        const std::string name_;
         const std::string prefix_;
+
     public:
         
-        SimpleTestSuite();
-        virtual ~SimpleTestSuite(){}
+        CSimpleTestSuite(const std::string& name);
+        CSimpleTestSuite(const std::string& name, std::ostream& strm);
+        virtual ~CSimpleTestSuite(){}
 
         // 指定された形式の関数コールバックを渡す。
         // 返り値以外は指定されてりない。
-        bool addTester(const fc::sfc_r<bool>::type& func);
+        bool addTester(const sfcr::sfc_r<bool>::type& func);
 
         // ostreamが指定された場合、なんらかの媒体に出力することができ
         // る。
-        // デフォルトで指定されない場合には、iostreamが利用される。
-        void running();
-        void running(std::ostream& strm);
+        // デフォルトで指定されない場合には、std::coutが利用される。
+        void run();
+
+        // assertを行う部分を切り出したクラスを返す。
+        smart_ptr<CSimpleTestAsserter> getAsserter();
 
     private:
 
-        std::vector<fc::sfc_r<bool>::type > testers_;
+        // テストの開始と終了を表示するための関数
+        void printBeginMessage();
+        void printEndMessage();
+
+    private:
+
+        std::vector<sfcr::sfc_r<bool>::type> testers_;
+        std::ostream& strm_;
+
+        smart_ptr<CSimpleTestRunner> runner_;
+
     };
 
-    class SimpleTestRunner
+    
+    //================================================================================
+
+    class CSimpleTestRunner
     {
         /**
-           指定されたテストを順次実行し、その結果を出力する
-           簡単なTestRunner
+           テスト結果をシンプルに表示するだけの機能を持つ。
         */
     public:
-        SimpleTestRunner(std::ostream& strm,
-                         const std::string& prefix) : success_(0), fail_(0),
-                                                      exception_(0), strm_(strm),
-                                                      prefix_(prefix)
-            {}
+        CSimpleTestRunner(std::ostream& strm,
+                          const std::string& prefix);
+        
+        void printSuccess();
+        void printFail();
+        void printException(const std::exception& e);
 
+        // 自身をそのまま実行可能な状態とする。
         template<class T>
         void operator()(T& test)
             {
                 try {
                     test->run();
-                    if (test->getResult() == true)
-                    {
-                        success_ += 1;
-                        printSuccess();
-                    } else {
-                        fail_ += 1;
-                        printFail();
-                    }
+                    innerCheck(test->getResult());
                 } catch (std::exception& e) {
-                    // 例外が発行された場合、とりあえずはe.whatsを
-                    // std::stringとして保持しておく。
-                    exception_ += 1;
-                    printException(e);
+                    innerCheck(e);
                 }
             }
 
-        int getSuccess() const {return success_;}
-        int getFail() const {return fail_;}
-        int getException() const {return exception_;}
+        int getSuccess() const {return pImpl->success;}
+        int getFail() const {return pImpl->fail;}
+        int getException() const {return pImpl->exception;}
 
     private:
 
-        void printSuccess();
-        void printFail();
-        void printException(const std::exception& e);
+        void innerCheck(bool b);
+        void innerCheck(std::exception& e);
 
     private:
 
-        int success_;
-        int fail_;
-        int exception_;
         std::ostream& strm_;
         const std::string prefix_;
+
+        struct PImpl;
+        smart_ptr<PImpl> pImpl;
+
+        struct PImpl
+        {
+            PImpl() : success(0), fail(0), exception(0), count(0) {}
+            int success;
+            int fail;
+            int exception;
+            int count;
+        };
+
     };
 
-    // テストの開始と終了を行うための関数
-    void printBeginMessage(std::ostream& strm, const std::string& prefix);
-    void printEndMessage(std::ostream& strm, const std::string& prefix,
-                         const SimpleTestRunner& runner);
+    //================================================================================
+    // 単純なassertを行うためだけのクラス。
+    //================================================================================
+
+    template<class T, class S>
+    struct equal : public std::binary_function<T, S, bool>
+    {
+        // 渡された二項が等しいことを表すためのテンプレート。
+        // 基本的には==のオペレータオーバーロードが利用されるはず
+        // なので特に不要とも思われるけれど、他のオペレータを
+        // 用いることができるようにもしておきたいため。
+        bool operator()(const T& f1, const S& f2) {
+            return (f1 == f2);
+        }
+    };
+
+    template<class T, class S>
+    struct not_equal : public std::binary_function<T, S, bool>
+    {
+        // 渡された二項が等しくないことを表すテンプレート。
+        // 基本的には!=のオペレータオーバーロードが利用されるはず
+        // なので特に不要とも思われるけれど、他のオペレータを
+        // 用いることができるようにもしておきたいため。
+        bool operator()(const T& f1, const S& f2) {
+            return (f1 != f2);
+        }
+    };
+
+    class CSimpleTestAsserter
+    {
+    public:
+        CSimpleTestAsserter(std::ostream& strm,
+                            const std::string& prefix);
+        CSimpleTestAsserter(const CSimpleTestAsserter& asserter);
+        virtual ~CSimpleTestAsserter() {}
+
+        CSimpleTestAsserter& operator=(const CSimpleTestAsserter& asserter);
+
+        // 外部から利用される簡単なassert。
+        // 基本的にはstd::equal_toを利用することになっている。
+        // それ以外も同様に定義されているが、独自にbinary_functionから派生して
+        // 作成することも当然許可されている。
+        // binary_functionから派生する場合、返り値はboolにすること。
+        template<class First, class Second, class Compare>
+        void check(const First& f, const Second& s, const std::string& mes, Compare c) {
+            if (!c(f, s))
+            {
+                // 失敗したら簡単なメッセージを設定することにする。
+                if (!mes.empty())
+                {
+                    strm_ << prefix_ << "fail assert between [" << f << "] and [" << s << "] "
+                          << std::endl;
+                    strm_ << (prefix_ + prefix_) << "message is --> " << mes << std::endl;
+                }
+                else
+                {
+                    strm_ << prefix_ << "fail assert between [" << f << "] and [" << s << "]" << std::endl;
+                }
+                ++count_;
+            }
+        }
+
+        // デフォルトでstd::equal_toを比較関数として利用する。
+        // 比較関数を渡す必要のない場合にはこれが利用される。
+        template<class First, class Second>
+        void check(const First& f, const Second& s, const std::string& mes = std::string()) {
+            check(f, s, mes, std::equal_to<First>());
+        }
+
+        // assertの結果が満足いくものかどうかを返す。
+        bool isOk() const;
+
+    private:
+
+        std::ostream& strm_;
+        std::string prefix_;
+
+        int count_;
+
+    };
+    
+
 };
 
 #endif /* _SIMPLETEST_H_ */
index 0dd352a..61d6f7e 100644 (file)
@@ -4,14 +4,9 @@
 #include "smart_ptr.h"
 #include "function_callback.h"
 
-namespace fc {
+namespace sfcv {
 
-    template<class T>
-    struct sfc_r
-    {
-        typedef smart_ptr<function_callback_r<T> > type;
-    };
-    typedef smart_ptr<function_callback_v> sfc_v;
+    typedef smart_ptr<fc::function_callback_v> sfc_v;
 
     //--------------------------------------------------------------------------------
     // 各関数コールバッククラス生成関数群の返り値を、
@@ -19,152 +14,166 @@ namespace fc {
     //--------------------------------------------------------------------------------
 
     //引数無し、返り値無しの静的関数のみのコールバック関数クラス作成
-    smart_ptr<function_callback_v> screate(void (*f)(void)) {
-        return smart_ptr<function_callback_v>(fc::create(f));
+
+    inline smart_ptr<fc::function_callback_v> screate(void (*f)(void)) {
+        return smart_ptr<fc::function_callback_v>(fc::create(f));
     }
 
     template<class T>
-    smart_ptr<function_callback_v> screate(void (T::*f)()) {
-        return smart_ptr<function_callback_v>(fc::create(f));
+    smart_ptr<fc::function_callback_v> screate(void (T::*f)()) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(T::f));
     }
 
     //引数あり、静的関数のみ
     template<class Arg1>
-    smart_ptr<function_callback_v> screate(void (*f)(Arg1),Arg1 a1) {
-        return smart_ptr<function_callback_v>(fc::create(f,a1));
+    smart_ptr<fc::function_callback_v> screate(void (*f)(Arg1),Arg1 a1) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,a1));
     }
 
     template<class Arg1,class Arg2>
-    smart_ptr<function_callback_v> screate(void (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return smart_ptr<function_callback_v>(fc::create(f,a1,a2));
+    smart_ptr<fc::function_callback_v> screate(void (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,a1,a2));
     }
 
     template<class Arg1,class Arg2,class Arg3>
-    smart_ptr<function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return smart_ptr<function_callback_v>(fc::create(f,a1,a2,a3));
+    smart_ptr<fc::function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,a1,a2,a3));
     }
 
     template<class Arg1,class Arg2,class Arg3,class Arg4>
-    smart_ptr<function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return smart_ptr<function_callback_v>(fc::create(f,a1,a2,a3,a4));
+    smart_ptr<fc::function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,a1,a2,a3,a4));
     }
 
     template<class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    smart_ptr<function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3,Arg4,Arg5),
+    smart_ptr<fc::function_callback_v> screate(void (*f)(Arg1,Arg2,Arg3,Arg4,Arg5),
                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return smart_ptr<function_callback_v>(fc::create(f,a1,a2,a3,a4,a5));
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,a1,a2,a3,a4,a5));
     }
 
     //引数無し、メンバ関数
     template<class obj>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(),obj* p) {
-        return smart_ptr<function_callback_v>(fc::create(f,p));
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(),obj* p) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p));
     }
 
     template<class obj,class Arg1>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(Arg1),obj* p,Arg1 a1) {
-        return smart_ptr<function_callback_v>(fc::create(f,p,a1));
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(Arg1),obj* p,Arg1 a1) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p,a1));
     }
 
     template<class obj,class Arg1,class Arg2>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(Arg1,Arg2),obj* p,Arg1 a1,Arg2 a2) {
-        return smart_ptr<function_callback_v>(fc::create(f,p,a1,a2));
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(Arg1,Arg2),obj* p,Arg1 a1,Arg2 a2) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p,a1,a2));
     }
 
     template<class obj,class Arg1,class Arg2,class Arg3>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3),obj* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return smart_ptr<function_callback_v>(fc::create(f,p,a1,a2,a3));
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3),obj* p,Arg1 a1,Arg2 a2,Arg3 a3) {
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p,a1,a2,a3));
     }
 
     template<class obj,class Arg1,class Arg2,class Arg3,class Arg4>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3,Arg4),obj* p,
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3,Arg4),obj* p,
                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return smart_ptr<function_callback_v>(fc::create(f,p,a1,a2,a3,a4));
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p,a1,a2,a3,a4));
     }
 
     template<class obj,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    smart_ptr<function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),obj* p,
+    smart_ptr<fc::function_callback_v> screate(void (obj::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),obj* p,
                                            Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return smart_ptr<function_callback_v>(fc::create(f,p,a1,a2,a3,a4,a5));
+        return smart_ptr<fc::function_callback_v>(fc::function_callback_v::create(f,p,a1,a2,a3,a4,a5));
     }
 
+
+};
+
+
+namespace sfcr {
+
+    template<class T>
+    struct sfc_r
+    {
+        typedef smart_ptr<fc::function_callback_r<T> > type;
+    };
+
     //--------------------------------------------------------------------------------
     // 返り値有りの関数コールバックの定義
     // 返り値はそれぞれ自由に設定することができる。
     //--------------------------------------------------------------------------------
 
     template<class Result>
-    smart_ptr<function_callback_r<Result> > screate(Result (*f)()) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (*f)(void)) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::create(f));
     }
 
     template<class Result, class T>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)()) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)()) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f));
     }
 
     //非メンバ関数
     template<class Result, class Arg1>
-    smart_ptr<function_callback_r<Result> > screate(Result (*f)(Arg1),Arg1 a1) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,a1));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (*f)(Arg1), Arg1 a1) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,a1));
     }
 
     template<class Result, class Arg1,class Arg2>
-    smart_ptr<function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,a1,a2));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2),Arg1 a1,Arg2 a2) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,a1,a2));
     }
 
     template<class Result, class Arg1,class Arg2,class Arg3>
-    smart_ptr<function_callback_r<Result> > 
+    smart_ptr<fc::function_callback_r<Result> > 
     screate(Result (*f)(Arg1,Arg2,Arg3),Arg1 a1,Arg2 a2,Arg3 a3) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,a1,a2,a3));
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,a1,a2,a3));
     }
     
     template<class Result, class Arg1,class Arg2,class Arg3,class Arg4>
-    smart_ptr<function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,a1,a2,a3,a4));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2,Arg3,Arg4),Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,a1,a2,a3,a4));
     }
 
     template<class Result, class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    smart_ptr<function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2,Arg3,Arg4),
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (*f)(Arg1,Arg2,Arg3,Arg4),
                                                     Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,a1,a2,a3,a4,a5));
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,a1,a2,a3,a4,a5));
     }
 
     //メンバ関数
     template<class Result, class T>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(),T* p) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(),T* p) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p));
     }
 
     template<class Result, class T,class Arg1>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(Arg1),T* p,Arg1 a1) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p,a1));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(Arg1),T* p,Arg1 a1) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p,a1));
     }
 
     template<class Result, class T,class Arg1,class Arg2>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2),T* p,Arg1 a1,Arg2 a2) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p,a1,a2));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2),T* p,Arg1 a1,Arg2 a2) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p,a1,a2));
     }
 
     template<class Result, class T,class Arg1,class Arg2,class Arg3>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3),T* p,Arg1 a1,Arg2 a2,Arg3 a3) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p,a1,a2,a3));
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3),T* p,Arg1 a1,Arg2 a2,Arg3 a3) {
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p,a1,a2,a3));
     }
 
     template<class Result, class T,class Arg1,class Arg2,class Arg3,class Arg4>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3,Arg4),T* p,
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3,Arg4),T* p,
                                                     Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p,a1,a2,a3,a4));
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p,a1,a2,a3,a4));
     }
 
     template<class Result, class T,class Arg1,class Arg2,class Arg3,class Arg4,class Arg5>
-    smart_ptr<function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),T* p,
+    smart_ptr<fc::function_callback_r<Result> > screate(Result (T::*f)(Arg1,Arg2,Arg3,Arg4,Arg5),T* p,
                                                     Arg1 a1,Arg2 a2,Arg3 a3,Arg4 a4,Arg5 a5) {
-        return smart_ptr<function_callback_r<Result> >(fc::create(f,p,a1,a2,a3,a4,a5));
+        return smart_ptr<fc::function_callback_r<Result> >(fc::function_callback_r<Result>::create(f,p,a1,a2,a3,a4,a5));
     }
 
 
 };
 
+
 #endif /* _SMART_FUNCTION_CALLBACK_H_ */
diff --git a/test/GPATH b/test/GPATH
new file mode 100644 (file)
index 0000000..4b8dbcd
Binary files /dev/null and b/test/GPATH differ
diff --git a/test/GRTAGS b/test/GRTAGS
new file mode 100644 (file)
index 0000000..cac14c4
Binary files /dev/null and b/test/GRTAGS differ
diff --git a/test/GSYMS b/test/GSYMS
new file mode 100644 (file)
index 0000000..5c6aa5f
Binary files /dev/null and b/test/GSYMS differ
diff --git a/test/GTAGS b/test/GTAGS
new file mode 100644 (file)
index 0000000..5064b07
Binary files /dev/null and b/test/GTAGS differ
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..8619fd1
--- /dev/null
@@ -0,0 +1,584 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# test/Makefile.  Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+
+
+pkgdatadir = $(datadir)/utakata
+pkglibdir = $(libdir)/utakata
+pkgincludedir = $(includedir)/utakata
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = utf8_test$(EXEEXT) textarrayformat_test$(EXEEXT) \
+       utf8_string_test$(EXEEXT)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_textarrayformat_test_OBJECTS = textarrayformat_test.$(OBJEXT) \
+       TextArrayFormat.$(OBJEXT) simpletest.$(OBJEXT)
+textarrayformat_test_OBJECTS = $(am_textarrayformat_test_OBJECTS)
+textarrayformat_test_LDADD = $(LDADD)
+am_utf8_string_test_OBJECTS = utf8_string_test.$(OBJEXT) \
+       utf8_string.$(OBJEXT) simpletest.$(OBJEXT) utf8.$(OBJEXT)
+utf8_string_test_OBJECTS = $(am_utf8_string_test_OBJECTS)
+utf8_string_test_LDADD = $(LDADD)
+am_utf8_test_OBJECTS = utf8_test.$(OBJEXT) utf8.$(OBJEXT) \
+       simpletest.$(OBJEXT)
+utf8_test_OBJECTS = $(am_utf8_test_OBJECTS)
+utf8_test_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+       -o $@
+SOURCES = $(textarrayformat_test_SOURCES) $(utf8_string_test_SOURCES) \
+       $(utf8_test_SOURCES)
+DIST_SOURCES = $(textarrayformat_test_SOURCES) \
+       $(utf8_string_test_SOURCES) $(utf8_test_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/derui/develop/sdl/missing --run aclocal-1.10
+AMTAR = ${SHELL} /home/derui/develop/sdl/missing --run tar
+AUTOCONF = ${SHELL} /home/derui/develop/sdl/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/derui/develop/sdl/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/derui/develop/sdl/missing --run automake-1.10
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS = 
+CXX = g++
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO_C = 
+ECHO_N = -n
+ECHO_T = 
+EGREP = /bin/grep -E
+EXEEXT = 
+GREP = /bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LDFLAGS = 
+LIBOBJS = 
+LIBS = 
+LTLIBOBJS = 
+MAKEINFO = ${SHELL} /home/derui/develop/sdl/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+OBJEXT = o
+PACKAGE = utakata
+PACKAGE_BUGREPORT = BUG-REPORT-ADDRESS
+PACKAGE_NAME = utakata
+PACKAGE_STRING = utakata 0.0.1
+PACKAGE_TARNAME = utakata
+PACKAGE_VERSION = 0.0.1
+PATH_SEPARATOR = :
+SET_MAKE = 
+SHELL = /bin/sh
+STRIP = 
+VERSION = 0.0.1
+abs_builddir = /home/derui/develop/sdl/test
+abs_srcdir = /home/derui/develop/sdl/test
+abs_top_builddir = /home/derui/develop/sdl
+abs_top_srcdir = /home/derui/develop/sdl
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+am__include = include
+am__leading_dot = .
+am__quote = 
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build_alias = 
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host_alias = 
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /home/derui/develop/sdl/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /usr/local
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias = 
+top_build_prefix = ../
+top_builddir = ..
+top_srcdir = ..
+INCLUDES = -l$(top_srcdir)
+utf8_string_test_SOURCES = utf8_string_test.cpp ../utf8_string.cpp ../simpletest.cpp ../utf8.cpp
+utf8_test_SOURCES = utf8_test.cpp ../utf8.cpp ../simpletest.cpp
+textarrayformat_test_SOURCES = textarrayformat_test.cpp ../TextArrayFormat.cpp ../simpletest.cpp
+check_PROGRANS = $(bin_PROGRAMS)
+TESTS = $(bin_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  test/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+textarrayformat_test$(EXEEXT): $(textarrayformat_test_OBJECTS) $(textarrayformat_test_DEPENDENCIES) 
+       @rm -f textarrayformat_test$(EXEEXT)
+       $(CXXLINK) $(textarrayformat_test_OBJECTS) $(textarrayformat_test_LDADD) $(LIBS)
+utf8_string_test$(EXEEXT): $(utf8_string_test_OBJECTS) $(utf8_string_test_DEPENDENCIES) 
+       @rm -f utf8_string_test$(EXEEXT)
+       $(CXXLINK) $(utf8_string_test_OBJECTS) $(utf8_string_test_LDADD) $(LIBS)
+utf8_test$(EXEEXT): $(utf8_test_OBJECTS) $(utf8_test_DEPENDENCIES) 
+       @rm -f utf8_test$(EXEEXT)
+       $(CXXLINK) $(utf8_test_OBJECTS) $(utf8_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+include ./$(DEPDIR)/TextArrayFormat.Po
+include ./$(DEPDIR)/simpletest.Po
+include ./$(DEPDIR)/textarrayformat_test.Po
+include ./$(DEPDIR)/utf8.Po
+include ./$(DEPDIR)/utf8_string.Po
+include ./$(DEPDIR)/utf8_string_test.Po
+include ./$(DEPDIR)/utf8_test.Po
+
+.cpp.o:
+       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+#      source='$<' object='$@' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+       $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+       mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+#      source='$<' object='$@' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+TextArrayFormat.o: ../TextArrayFormat.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TextArrayFormat.o -MD -MP -MF $(DEPDIR)/TextArrayFormat.Tpo -c -o TextArrayFormat.o `test -f '../TextArrayFormat.cpp' || echo '$(srcdir)/'`../TextArrayFormat.cpp
+       mv -f $(DEPDIR)/TextArrayFormat.Tpo $(DEPDIR)/TextArrayFormat.Po
+#      source='../TextArrayFormat.cpp' object='TextArrayFormat.o' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TextArrayFormat.o `test -f '../TextArrayFormat.cpp' || echo '$(srcdir)/'`../TextArrayFormat.cpp
+
+TextArrayFormat.obj: ../TextArrayFormat.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TextArrayFormat.obj -MD -MP -MF $(DEPDIR)/TextArrayFormat.Tpo -c -o TextArrayFormat.obj `if test -f '../TextArrayFormat.cpp'; then $(CYGPATH_W) '../TextArrayFormat.cpp'; else $(CYGPATH_W) '$(srcdir)/../TextArrayFormat.cpp'; fi`
+       mv -f $(DEPDIR)/TextArrayFormat.Tpo $(DEPDIR)/TextArrayFormat.Po
+#      source='../TextArrayFormat.cpp' object='TextArrayFormat.obj' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TextArrayFormat.obj `if test -f '../TextArrayFormat.cpp'; then $(CYGPATH_W) '../TextArrayFormat.cpp'; else $(CYGPATH_W) '$(srcdir)/../TextArrayFormat.cpp'; fi`
+
+simpletest.o: ../simpletest.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simpletest.o -MD -MP -MF $(DEPDIR)/simpletest.Tpo -c -o simpletest.o `test -f '../simpletest.cpp' || echo '$(srcdir)/'`../simpletest.cpp
+       mv -f $(DEPDIR)/simpletest.Tpo $(DEPDIR)/simpletest.Po
+#      source='../simpletest.cpp' object='simpletest.o' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simpletest.o `test -f '../simpletest.cpp' || echo '$(srcdir)/'`../simpletest.cpp
+
+simpletest.obj: ../simpletest.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simpletest.obj -MD -MP -MF $(DEPDIR)/simpletest.Tpo -c -o simpletest.obj `if test -f '../simpletest.cpp'; then $(CYGPATH_W) '../simpletest.cpp'; else $(CYGPATH_W) '$(srcdir)/../simpletest.cpp'; fi`
+       mv -f $(DEPDIR)/simpletest.Tpo $(DEPDIR)/simpletest.Po
+#      source='../simpletest.cpp' object='simpletest.obj' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simpletest.obj `if test -f '../simpletest.cpp'; then $(CYGPATH_W) '../simpletest.cpp'; else $(CYGPATH_W) '$(srcdir)/../simpletest.cpp'; fi`
+
+utf8_string.o: ../utf8_string.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8_string.o -MD -MP -MF $(DEPDIR)/utf8_string.Tpo -c -o utf8_string.o `test -f '../utf8_string.cpp' || echo '$(srcdir)/'`../utf8_string.cpp
+       mv -f $(DEPDIR)/utf8_string.Tpo $(DEPDIR)/utf8_string.Po
+#      source='../utf8_string.cpp' object='utf8_string.o' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8_string.o `test -f '../utf8_string.cpp' || echo '$(srcdir)/'`../utf8_string.cpp
+
+utf8_string.obj: ../utf8_string.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8_string.obj -MD -MP -MF $(DEPDIR)/utf8_string.Tpo -c -o utf8_string.obj `if test -f '../utf8_string.cpp'; then $(CYGPATH_W) '../utf8_string.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8_string.cpp'; fi`
+       mv -f $(DEPDIR)/utf8_string.Tpo $(DEPDIR)/utf8_string.Po
+#      source='../utf8_string.cpp' object='utf8_string.obj' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8_string.obj `if test -f '../utf8_string.cpp'; then $(CYGPATH_W) '../utf8_string.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8_string.cpp'; fi`
+
+utf8.o: ../utf8.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8.o -MD -MP -MF $(DEPDIR)/utf8.Tpo -c -o utf8.o `test -f '../utf8.cpp' || echo '$(srcdir)/'`../utf8.cpp
+       mv -f $(DEPDIR)/utf8.Tpo $(DEPDIR)/utf8.Po
+#      source='../utf8.cpp' object='utf8.o' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8.o `test -f '../utf8.cpp' || echo '$(srcdir)/'`../utf8.cpp
+
+utf8.obj: ../utf8.cpp
+       $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8.obj -MD -MP -MF $(DEPDIR)/utf8.Tpo -c -o utf8.obj `if test -f '../utf8.cpp'; then $(CYGPATH_W) '../utf8.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8.cpp'; fi`
+       mv -f $(DEPDIR)/utf8.Tpo $(DEPDIR)/utf8.Po
+#      source='../utf8.cpp' object='utf8.obj' libtool=no \
+#      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+#      $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8.obj `if test -f '../utf8.cpp'; then $(CYGPATH_W) '../utf8.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$all" -eq 1; then \
+           tests="test"; \
+           All=""; \
+         else \
+           tests="tests"; \
+           All="All "; \
+         fi; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="$$All$$all $$tests passed"; \
+           else \
+             if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+             banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all $$tests failed"; \
+           else \
+             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+             banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           if test "$$skip" -eq 1; then \
+             skipped="($$skip test was not run)"; \
+           else \
+             skipped="($$skip tests were not run)"; \
+           fi; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+       clean-binPROGRAMS clean-generic ctags distclean \
+       distclean-compile distclean-generic distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100755 (executable)
index 0000000..9faefa4
--- /dev/null
@@ -0,0 +1,11 @@
+INCLUDES = -l$(top_srcdir)
+
+bin_PROGRAMS = utf8_test textarrayformat_test utf8_string_test
+
+utf8_string_test_SOURCES = utf8_string_test.cpp ../utf8_string.cpp ../simpletest.cpp ../utf8.cpp
+utf8_test_SOURCES = utf8_test.cpp ../utf8.cpp ../simpletest.cpp
+textarrayformat_test_SOURCES = textarrayformat_test.cpp ../TextArrayFormat.cpp ../simpletest.cpp
+
+check_PROGRANS = $(bin_PROGRAMS)
+TESTS = $(bin_PROGRAMS)
+
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644 (file)
index 0000000..59aec5e
--- /dev/null
@@ -0,0 +1,584 @@
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = utf8_test$(EXEEXT) textarrayformat_test$(EXEEXT) \
+       utf8_string_test$(EXEEXT)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_textarrayformat_test_OBJECTS = textarrayformat_test.$(OBJEXT) \
+       TextArrayFormat.$(OBJEXT) simpletest.$(OBJEXT)
+textarrayformat_test_OBJECTS = $(am_textarrayformat_test_OBJECTS)
+textarrayformat_test_LDADD = $(LDADD)
+am_utf8_string_test_OBJECTS = utf8_string_test.$(OBJEXT) \
+       utf8_string.$(OBJEXT) simpletest.$(OBJEXT) utf8.$(OBJEXT)
+utf8_string_test_OBJECTS = $(am_utf8_string_test_OBJECTS)
+utf8_string_test_LDADD = $(LDADD)
+am_utf8_test_OBJECTS = utf8_test.$(OBJEXT) utf8.$(OBJEXT) \
+       simpletest.$(OBJEXT)
+utf8_test_OBJECTS = $(am_utf8_test_OBJECTS)
+utf8_test_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+       -o $@
+SOURCES = $(textarrayformat_test_SOURCES) $(utf8_string_test_SOURCES) \
+       $(utf8_test_SOURCES)
+DIST_SOURCES = $(textarrayformat_test_SOURCES) \
+       $(utf8_string_test_SOURCES) $(utf8_test_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -l$(top_srcdir)
+utf8_string_test_SOURCES = utf8_string_test.cpp ../utf8_string.cpp ../simpletest.cpp ../utf8.cpp
+utf8_test_SOURCES = utf8_test.cpp ../utf8.cpp ../simpletest.cpp
+textarrayformat_test_SOURCES = textarrayformat_test.cpp ../TextArrayFormat.cpp ../simpletest.cpp
+check_PROGRANS = $(bin_PROGRAMS)
+TESTS = $(bin_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+               && { if test -f $@; then exit 0; else break; fi; }; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  test/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+       @$(NORMAL_INSTALL)
+       test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+         if test -f $$p \
+         ; then \
+           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+          echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+          $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+         else :; fi; \
+       done
+
+uninstall-binPROGRAMS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(bin_PROGRAMS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+         echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(bindir)/$$f"; \
+       done
+
+clean-binPROGRAMS:
+       -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+textarrayformat_test$(EXEEXT): $(textarrayformat_test_OBJECTS) $(textarrayformat_test_DEPENDENCIES) 
+       @rm -f textarrayformat_test$(EXEEXT)
+       $(CXXLINK) $(textarrayformat_test_OBJECTS) $(textarrayformat_test_LDADD) $(LIBS)
+utf8_string_test$(EXEEXT): $(utf8_string_test_OBJECTS) $(utf8_string_test_DEPENDENCIES) 
+       @rm -f utf8_string_test$(EXEEXT)
+       $(CXXLINK) $(utf8_string_test_OBJECTS) $(utf8_string_test_LDADD) $(LIBS)
+utf8_test$(EXEEXT): $(utf8_test_OBJECTS) $(utf8_test_DEPENDENCIES) 
+       @rm -f utf8_test$(EXEEXT)
+       $(CXXLINK) $(utf8_test_OBJECTS) $(utf8_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+       -rm -f *.$(OBJEXT)
+
+distclean-compile:
+       -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextArrayFormat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpletest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textarrayformat_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_string.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_string_test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8_test.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@  $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+TextArrayFormat.o: ../TextArrayFormat.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TextArrayFormat.o -MD -MP -MF $(DEPDIR)/TextArrayFormat.Tpo -c -o TextArrayFormat.o `test -f '../TextArrayFormat.cpp' || echo '$(srcdir)/'`../TextArrayFormat.cpp
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/TextArrayFormat.Tpo $(DEPDIR)/TextArrayFormat.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../TextArrayFormat.cpp' object='TextArrayFormat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TextArrayFormat.o `test -f '../TextArrayFormat.cpp' || echo '$(srcdir)/'`../TextArrayFormat.cpp
+
+TextArrayFormat.obj: ../TextArrayFormat.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT TextArrayFormat.obj -MD -MP -MF $(DEPDIR)/TextArrayFormat.Tpo -c -o TextArrayFormat.obj `if test -f '../TextArrayFormat.cpp'; then $(CYGPATH_W) '../TextArrayFormat.cpp'; else $(CYGPATH_W) '$(srcdir)/../TextArrayFormat.cpp'; fi`
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/TextArrayFormat.Tpo $(DEPDIR)/TextArrayFormat.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../TextArrayFormat.cpp' object='TextArrayFormat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o TextArrayFormat.obj `if test -f '../TextArrayFormat.cpp'; then $(CYGPATH_W) '../TextArrayFormat.cpp'; else $(CYGPATH_W) '$(srcdir)/../TextArrayFormat.cpp'; fi`
+
+simpletest.o: ../simpletest.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simpletest.o -MD -MP -MF $(DEPDIR)/simpletest.Tpo -c -o simpletest.o `test -f '../simpletest.cpp' || echo '$(srcdir)/'`../simpletest.cpp
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/simpletest.Tpo $(DEPDIR)/simpletest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../simpletest.cpp' object='simpletest.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simpletest.o `test -f '../simpletest.cpp' || echo '$(srcdir)/'`../simpletest.cpp
+
+simpletest.obj: ../simpletest.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT simpletest.obj -MD -MP -MF $(DEPDIR)/simpletest.Tpo -c -o simpletest.obj `if test -f '../simpletest.cpp'; then $(CYGPATH_W) '../simpletest.cpp'; else $(CYGPATH_W) '$(srcdir)/../simpletest.cpp'; fi`
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/simpletest.Tpo $(DEPDIR)/simpletest.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../simpletest.cpp' object='simpletest.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o simpletest.obj `if test -f '../simpletest.cpp'; then $(CYGPATH_W) '../simpletest.cpp'; else $(CYGPATH_W) '$(srcdir)/../simpletest.cpp'; fi`
+
+utf8_string.o: ../utf8_string.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8_string.o -MD -MP -MF $(DEPDIR)/utf8_string.Tpo -c -o utf8_string.o `test -f '../utf8_string.cpp' || echo '$(srcdir)/'`../utf8_string.cpp
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/utf8_string.Tpo $(DEPDIR)/utf8_string.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../utf8_string.cpp' object='utf8_string.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8_string.o `test -f '../utf8_string.cpp' || echo '$(srcdir)/'`../utf8_string.cpp
+
+utf8_string.obj: ../utf8_string.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8_string.obj -MD -MP -MF $(DEPDIR)/utf8_string.Tpo -c -o utf8_string.obj `if test -f '../utf8_string.cpp'; then $(CYGPATH_W) '../utf8_string.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8_string.cpp'; fi`
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/utf8_string.Tpo $(DEPDIR)/utf8_string.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../utf8_string.cpp' object='utf8_string.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8_string.obj `if test -f '../utf8_string.cpp'; then $(CYGPATH_W) '../utf8_string.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8_string.cpp'; fi`
+
+utf8.o: ../utf8.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8.o -MD -MP -MF $(DEPDIR)/utf8.Tpo -c -o utf8.o `test -f '../utf8.cpp' || echo '$(srcdir)/'`../utf8.cpp
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/utf8.Tpo $(DEPDIR)/utf8.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../utf8.cpp' object='utf8.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8.o `test -f '../utf8.cpp' || echo '$(srcdir)/'`../utf8.cpp
+
+utf8.obj: ../utf8.cpp
+@am__fastdepCXX_TRUE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT utf8.obj -MD -MP -MF $(DEPDIR)/utf8.Tpo -c -o utf8.obj `if test -f '../utf8.cpp'; then $(CYGPATH_W) '../utf8.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8.cpp'; fi`
+@am__fastdepCXX_TRUE@  mv -f $(DEPDIR)/utf8.Tpo $(DEPDIR)/utf8.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='../utf8.cpp' object='utf8.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o utf8.obj `if test -f '../utf8.cpp'; then $(CYGPATH_W) '../utf8.cpp'; else $(CYGPATH_W) '$(srcdir)/../utf8.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+             END { if (nonempty) { for (i in files) print i; }; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+       srcdir=$(srcdir); export srcdir; \
+       list=' $(TESTS) '; \
+       if test -n "$$list"; then \
+         for tst in $$list; do \
+           if test -f ./$$tst; then dir=./; \
+           elif test -f $$tst; then dir=; \
+           else dir="$(srcdir)/"; fi; \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xpass=`expr $$xpass + 1`; \
+               failed=`expr $$failed + 1`; \
+               echo "XPASS: $$tst"; \
+             ;; \
+             *) \
+               echo "PASS: $$tst"; \
+             ;; \
+             esac; \
+           elif test $$? -ne 77; then \
+             all=`expr $$all + 1`; \
+             case " $(XFAIL_TESTS) " in \
+             *[\ \     ]$$tst[\ \      ]*) \
+               xfail=`expr $$xfail + 1`; \
+               echo "XFAIL: $$tst"; \
+             ;; \
+             *) \
+               failed=`expr $$failed + 1`; \
+               echo "FAIL: $$tst"; \
+             ;; \
+             esac; \
+           else \
+             skip=`expr $$skip + 1`; \
+             echo "SKIP: $$tst"; \
+           fi; \
+         done; \
+         if test "$$all" -eq 1; then \
+           tests="test"; \
+           All=""; \
+         else \
+           tests="tests"; \
+           All="All "; \
+         fi; \
+         if test "$$failed" -eq 0; then \
+           if test "$$xfail" -eq 0; then \
+             banner="$$All$$all $$tests passed"; \
+           else \
+             if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+             banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+           fi; \
+         else \
+           if test "$$xpass" -eq 0; then \
+             banner="$$failed of $$all $$tests failed"; \
+           else \
+             if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+             banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+           fi; \
+         fi; \
+         dashes="$$banner"; \
+         skipped=""; \
+         if test "$$skip" -ne 0; then \
+           if test "$$skip" -eq 1; then \
+             skipped="($$skip test was not run)"; \
+           else \
+             skipped="($$skip tests were not run)"; \
+           fi; \
+           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$skipped"; \
+         fi; \
+         report=""; \
+         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+           report="Please report to $(PACKAGE_BUGREPORT)"; \
+           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+             dashes="$$report"; \
+         fi; \
+         dashes=`echo "$$dashes" | sed s/./=/g`; \
+         echo "$$dashes"; \
+         echo "$$banner"; \
+         test -z "$$skipped" || echo "$$skipped"; \
+         test -z "$$report" || echo "$$report"; \
+         echo "$$dashes"; \
+         test "$$failed" -eq 0; \
+       else :; fi
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+         dist_files=`for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+       case $$dist_files in \
+         */*) $(MKDIR_P) `echo "$$dist_files" | \
+                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+                          sort -u` ;; \
+       esac; \
+       for file in $$dist_files; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         if test -d $$d/$$file; then \
+           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+       for dir in "$(DESTDIR)$(bindir)"; do \
+         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+       distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -rf ./$(DEPDIR)
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+       clean-binPROGRAMS clean-generic ctags distclean \
+       distclean-compile distclean-generic distclean-tags distdir dvi \
+       dvi-am html html-am info info-am install install-am \
+       install-binPROGRAMS install-data install-data-am install-dvi \
+       install-dvi-am install-exec install-exec-am install-html \
+       install-html-am install-info install-info-am install-man \
+       install-pdf install-pdf-am install-ps install-ps-am \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+       tags uninstall uninstall-am uninstall-binPROGRAMS
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/test/textarrayformat_test b/test/textarrayformat_test
new file mode 100755 (executable)
index 0000000..cb2b969
Binary files /dev/null and b/test/textarrayformat_test differ
diff --git a/test/textarrayformat_test.cpp b/test/textarrayformat_test.cpp
new file mode 100644 (file)
index 0000000..8229e66
--- /dev/null
@@ -0,0 +1,38 @@
+#include <string>
+#include <iostream>
+#include <sstream>
+
+#include "../simpletest.h"
+#include "../TextArrayFormat.h"
+#include "../smart_function_callback.h"
+
+using namespace std;
+
+bool taf_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+    std::stringstream ss;
+
+    ss << "=====" << std::endl;
+    ss << "test" << std::endl << "test" << std::endl;
+    ss << "=====" << endl;
+    ss << "testhoge" << endl;
+    ss << "=====" << endl;
+    ss << "test\ntest" << endl;
+    
+    textarrayformat::CTextArrayReader reader(ss);
+    asserter->check(reader.get(), "test\ntest\n");
+    asserter->check(reader.get(1), "testhoge\n");
+    asserter->check(reader.get(0), "test\ntest\n");
+    asserter->check(reader.get(2), "test\ntest\n");
+
+    return asserter->isOk();
+}
+
+int main(int argc, char *argv[])
+{
+    simpletest::CSimpleTestSuite suite("TextArrayFormat");
+    suite.addTester(sfcr::screate(taf_test, suite.getAsserter()));
+    suite.run();
+    return 0;
+}
+
diff --git a/test/utf8_string_test b/test/utf8_string_test
new file mode 100755 (executable)
index 0000000..4e983ff
Binary files /dev/null and b/test/utf8_string_test differ
diff --git a/test/utf8_string_test.cpp b/test/utf8_string_test.cpp
new file mode 100644 (file)
index 0000000..06af97a
--- /dev/null
@@ -0,0 +1,107 @@
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <functional>
+
+
+#include "../simpletest.h"
+
+#include "../utf8.h"
+
+#include "../utf8_string.h"
+#include "../TextArrayFormat.h"
+
+bool utf8_multichar_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+
+    std::string tmp("あいuえお");
+    // マルチバイト文字列を正しく読みだせるかどうかのチェックを
+    // 含めたテスト
+    smart_ptr<std::istream> ss(new std::stringstream(tmp));
+
+    utakata::utf8::CUTF8InputStream stream(ss);
+
+    // 単独のreadを試す。
+    utakata::utf8_string::CUTF8Char ch(stream.read());
+    asserter->check(ch.toUTF16Code(), utakata::utf8::generateUTF8Code("あ"));
+    // peekが問題なく働いていることのテスト
+    utakata::utf8_string::CUTF8Char ch2(stream.peek());
+    asserter->check(ch2.toUTF16Code(), utakata::utf8::generateUTF8Code("い"));
+    utakata::utf8_string::CUTF8Char ch3(stream.read());
+    asserter->check(ch3.toUTF16Code(), utakata::utf8::generateUTF8Code("い"));
+
+    // asciiだとしても問題無く読みだせるはず。
+    utakata::utf8_string::CUTF8Char ch4(stream.peek());
+    asserter->check(ch4.toUTF16Code(), 'u');
+
+    // 同一コードなので比較して同じになるはず。
+    asserter->check(ch == ch2, false, "chとch2が異なる");
+    asserter->check(ch < ch2, true , "chよりch2が大きいはず");
+
+    // 文字として直接返せる。ただし比較はstd::stringでしか行えない。
+    asserter->check(ch2.toStr(), "い");
+
+    return asserter->isOk();
+}
+
+bool utf8_string_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+    // マルチバイトとascii文字の混在文字も正しく扱うことのできる
+    // CUTF8Stringのテスト
+    
+    std::string tmp("あいうえsssお");
+
+    smart_ptr<std::istream> ss(new std::stringstream(tmp));
+    utakata::utf8::CUTF8InputStream stream(ss);
+
+    utakata::utf8_string::CUTF8String str(stream.read(5));
+    asserter->check(str.begin()->toStr(), "あ");
+    asserter->check(str.size(), 5);
+
+    // 自分自身との加算でも問題ないことを確認する。
+    str += str;
+    asserter->check(str[5].toStr(), "あ");
+
+    // 本当に基本的なもの以外は、同一の名前空間内に関数が用意されている。
+    // utf8_stringから返されるのは、UTF8のバイト列を設定した文字列であると
+    // する。
+    asserter->check(utakata::utf8_string::substring(str,0,2), "あい");
+    asserter->check(utakata::utf8_string::substring(str,1,2), "いう");
+    asserter->check(utakata::utf8_string::substring(str, 2), "うえsあいうえs");
+
+    // 文字列とするのは自身の関数だけで可能。
+    asserter->check(str.toStr(), "あいうえsあいうえs");
+
+    return asserter->isOk();
+}
+
+bool utf8_string_util_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+    // CUTF8Stringと共に利用するためのユーティリティ関数の操作を
+    // 行う。
+    
+    std::string tmp("あいうえsssお");
+
+    smart_ptr<std::istream> ss(new std::stringstream(tmp));
+    utakata::utf8::CUTF8InputStream stream(ss);
+
+    utakata::utf8_string::CUTF8String str(stream.read(5));
+    utakata::utf8_string::CUTF8String str2(stream.read(3));
+
+    // 挿入してみる。
+    str.insert(str.begin(), str2.begin(), str2.end());
+    asserter->check(str.toStr(), "ssおあいうえs");
+
+    return asserter->isOk();
+}
+
+
+int main(int argc, char *argv[])
+{
+    simpletest::CSimpleTestSuite suite("UTF-8 文字列テスト");
+    suite.addTester(sfcr::screate(utf8_multichar_test, suite.getAsserter()));
+    suite.addTester(sfcr::screate(utf8_string_test, suite.getAsserter()));
+    suite.addTester(sfcr::screate(utf8_string_util_test, suite.getAsserter()));
+    suite.run();
+    return 0;
+}
diff --git a/test/utf8_test b/test/utf8_test
new file mode 100755 (executable)
index 0000000..a67c453
Binary files /dev/null and b/test/utf8_test differ
diff --git a/test/utf8_test.cpp b/test/utf8_test.cpp
new file mode 100644 (file)
index 0000000..c8f0247
--- /dev/null
@@ -0,0 +1,86 @@
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <functional>
+
+
+#include "../simpletest.h"
+
+#include "../utf8.h"
+#include "../TextArrayFormat.h"
+
+using namespace std;
+
+struct identity_local
+{
+    char operator()(unsigned char t) {return static_cast<char>(t);}
+};
+
+bool utf8_charcheck_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+    // UTF-8の文字を認識するテスト。
+
+    // ソースがすでにUTF8で記述されているので、そのまま簡単にだが
+    // テストが行える。
+    std::string tmp("UTF8");
+    // 1byteの文字のみの場合
+    smart_ptr<std::istream> ss(new std::stringstream(tmp));
+
+    utakata::utf8::CUTF8InputStream stream(ss);
+
+    // 単独のreadを試す。
+    asserter->check(stream.read()[0], 'U');
+    // peekが問題なく働いていることのテスト
+    asserter->check(stream.peek()[0], 'T'); 
+    asserter->check(stream.read()[0], 'T');
+
+    // 複数文字の読み出しのチェック
+    const std::vector<unsigned char> f = stream.read(2);
+    std::string t("", f.size());
+
+    std::transform(f.begin(), f.end(), t.begin(),
+                   identity_local());
+    
+    asserter->check(t, "F8");
+    
+    return asserter->isOk();
+}
+
+bool utf8_multichar_test(smart_ptr<simpletest::CSimpleTestAsserter> asserter)
+{
+
+    std::string tmp("あいうえお");
+    // 1byteの文字のみの場合
+    smart_ptr<std::istream> ss(new std::stringstream(tmp));
+
+    utakata::utf8::CUTF8InputStream stream(ss);
+
+    // 複数文字の読み出しのチェック
+    // 但し、ここでは全体が等しいかどうかを返すに留まる。
+    std::vector<unsigned char> f = stream.read(2);
+    asserter->check(true, utakata::utf8::is_utf8_all(f));
+
+    // チェック系関数のチェック
+    // わざと1byte欠落させて様子を見てみる。
+    f.pop_back();
+    asserter->check(false, utakata::utf8::is_utf8_all(f));
+
+    // 欠落させても、先頭の方が生き残っていればなんとかなる。
+    size_t size = 0;
+    asserter->check(true, utakata::utf8::is_utf8_one(f, size));
+    asserter->check(3, size);
+
+    
+    return asserter->isOk();
+}
+
+
+int main(int argc, char *argv[])
+{
+    simpletest::CSimpleTestSuite suite("UTF-8 基本テスト");
+    suite.addTester(sfcr::screate(utf8_charcheck_test, suite.getAsserter()));
+    suite.addTester(sfcr::screate(utf8_multichar_test, suite.getAsserter()));
+    suite.run();
+    return 0;
+}
+
index 98fd551..75c36b4 100755 (executable)
--- a/utf8.cpp
+++ b/utf8.cpp
@@ -57,14 +57,20 @@ std::vector<unsigned char> CUTF8InputStream::read()
             {
                 // sizeが0より大きい場合には、この時複数バイトで文字が構成
                 // されていると考えられるため、明示的に複数文字を取得する。
-                std::vector<char> tmp(0, size);
-                strm_->get(&tmp[0], size);
-                std::vector<unsigned char> rtn(c);
-                rtn.insert(rtn.begin() + 1, tmp.begin(), tmp.end());
+                std::vector<char> tmp(size, 0);
+                strm_->read(&tmp[0], size);
+                
+                if (strm_->bad())
+                {
+                    // 読み取りきれなかった場合には、ストリームに一応読出せた
+                    // 分を元に戻す。
+                    std::for_each(tmp.rbegin(), tmp.rend(), PutBack(strm_));
+                    return std::vector<unsigned char>(0);
+                }
+                std::vector<unsigned char> rtn;
+                rtn.insert(rtn.begin(), tmp.begin(), tmp.end());
+                
                 return rtn;
-            } else {
-                // 一文字だけのため、それだけを設定して返す。
-                return std::vector<unsigned char>(c);
             }
         }
     }
@@ -102,13 +108,82 @@ std::vector<unsigned char> CUTF8InputStream::peek()
     if (tmp.size() > 0)
     {
         // 複雑な繰り返しを表現する場合には、積極的にalgorithmを利用するようにする。
-        std::for_each(tmp.begin(), tmp.end(),
+        
+        std::for_each(tmp.rbegin(), tmp.rend(),
                       utakata::utf8::PutBack(strm_));
     }
-
     return tmp;
 }
 
+
+//================================================================================
+
+long utakata::utf8::generateUTF8Code(const std::vector<unsigned char>& bytes)
+{
+    // 1文字分のUTF8のバイト列を受け取って、コードに変換して返す。
+    // 先頭の値によって、次のように値を決定することができる。
+    // x = utf8の先頭バイト
+    // y1〜yN = utf8の先頭バイト以降のバイト
+    // N = utf8の先頭バイトを含むバイト数
+    // code = (y1 & ((1 << 7) - 1)) << (6 * n-1) + (y2 & ((1 << 7) -1)) << (6 * (n - 1))...+ x & ((1 << N) -1) << (6 * N-1)
+    // 先頭バイト以外は、全て先頭に10とうビットが設定されている。このビットを除いた6ビットをする。
+    // つまり、末尾のバイトから順次やっていけばよい。
+
+    std::vector<unsigned char> tmp(bytes);
+    const unsigned char max_c = (1 << (sizeof(unsigned char) * 8 - 1)) - 1;
+    long code = 0;
+
+    if (tmp.empty())
+    {
+        return 0;
+    }
+
+    if (tmp.size() == 1)
+    {
+        // asciiコードは7bitなのでそこだけ切り取って返す。
+        code = tmp[0] & max_c;
+    }
+    else
+    {
+        // 一時的に利用されるクラス。
+        struct Lambda
+        {
+            unsigned char operator()(unsigned char c, int s) {
+                return c << (6 * s);
+            }
+        };
+
+        // サイズが1以外の場合、ここからがちと違う。
+        std::vector<unsigned char>::reverse_iterator beg = tmp.rbegin(),
+            end = tmp.rend() - 1;
+        const unsigned char char_bit = (1 << 6) - 1;
+        for (int i = 0; beg != end; ++i,++beg)
+        {
+            code += Lambda()((*beg & char_bit), i);
+        }
+
+        // 最後だけ、別の計算が必要になる。
+        const unsigned char first_byte = (1 << ((sizeof(unsigned char) + 1) - tmp.size())) - 1;
+        code += Lambda()(first_byte,tmp.size() - 1);
+        
+    }
+
+    return code;
+}
+
+
+long utakata::utf8::generateUTF8Code(const std::string& bytes)
+{
+    // UTF8である一文字のstringを受け取って、先頭1文字の値を返す。
+
+    std::string str = bytes;
+    std::vector<unsigned char> tmp;
+    tmp.insert(tmp.end(), str.begin(), str.end());
+
+    // vectorにしなおしたら後は元々の関数に任せる。
+    return generateUTF8Code(tmp);
+}
+
 bool utakata::utf8::is_utf8_one(const std::vector<unsigned char>& bytes, size_t& size)
 {
     //渡したバイト列がUTF8の一文字に該当するかどうかを返す。
@@ -179,6 +254,7 @@ bool utakata::utf8::is_utf8_first_byte(unsigned char c, size_t& size)
 {
     // UTf-8の先頭バイトであるかどうかを返す。
     // 先頭バイトである場合には、その先頭バイトを含む、一文字のサイズを返す。
+    // 先頭バイトではない場合には、
     const unsigned char max_c = 1 << (sizeof(unsigned char) * 8 - 1);
 
     size_t back = size;
@@ -203,76 +279,16 @@ bool utakata::utf8::is_utf8_first_byte(unsigned char c, size_t& size)
     if (num < max_utf8_sequence) {
         size = num;
         return true;
+    }
+    else if (num == 1)
+    {
+        // numが1の場合、何らかの理由で先頭が欠落したと見られる。
+        // この場合、スキップするべきバイト数を返す。
+        size = 1;
+        return false;
+    
     } else {
         size = back;
         return false;
     }
 }
-
-utakata::utf8::CUTF8Char::CUTF8Char(const std::vector<unsigned char>& utf8) : utf8_bytes_(utf8), utf8_code_(0)
-{
-    this->utf8_code_ = generateUTF8Code(utf8_bytes_);
-}
-
-utakata::utf8::CUTF8Char::CUTF8Char(const utakata::utf8::CUTF8Char& ch)
-{
-    // 単純にそれぞれの値をコピーする。
-    this->utf8_bytes_ = ch.utf8_bytes_;
-    utf8_code_ = ch.utf8_code_;
-}
-
-CUTF8Char& utakata::utf8::CUTF8Char::operator=(const CUTF8Char& ch)
-{
-    // 安全なスワップを利用する。
-    CUTF8Char c(ch);
-    std::swap(*this, c);
-    return *this;
-}
-
-long utakata::utf8::generateUTF8Code(const std::vector<unsigned char>& bytes)
-{
-    // コードに変換して返す。
-    // 先頭の値によって、次のように値を決定することができる。
-    // x = utf8の先頭バイト
-    // y1〜yN = utf8の先頭バイト以降のバイト
-    // N = utf8の先頭バイトを含むバイト数
-    // code = (y1 & ((1 << 7) - 1)) << (6 * n-1) + (y2 & ((1 << 7) -1)) << (6 * (n - 1))...+ x & ((1 << N) -1) << (6 * N-1)
-    // 先頭バイト以外は、全て先頭に10とうビットが設定されている。このビットを除いた6ビットをする。
-    // つまり、末尾のバイトから順次やっていけばよい。
-
-    std::vector<unsigned char> tmp(bytes);
-    std::reverse(tmp.begin(), tmp.end());
-    const unsigned char max_c = (1 << (sizeof(unsigned char) * 8 - 1)) - 1;
-    long code = 0;
-
-    if (tmp.size() == 1)
-    {
-        code = tmp[0] & max_c;
-    }
-    else
-    {
-        // 一時的に利用されるクラス。
-        struct Lambda
-        {
-            unsigned char operator()(unsigned char c, int s) {
-                return c << (6 * s);
-            }
-        };
-
-        // サイズが1以外の場合、ここからがちと違う。
-        std::vector<unsigned char>::iterator beg = tmp.begin(),
-            end = tmp.end() - 1;
-        const unsigned char char_bit = (1 << 6) - 1;
-        for (int i = 0; beg != end; ++i,++beg)
-        {
-            code += Lambda()((*beg & char_bit), (6 * i));
-        }
-
-        // 最後だけ、別の計算が必要になる。
-        const unsigned char first_byte = (1 << (sizeof(unsigned char) - tmp.size())) - 1;
-        code += Lambda()(first_byte,6 * (tmp.size() - 1));
-        
-    }
-
-    return code;
-}
diff --git a/utf8.h b/utf8.h
index 5467af9..01927ec 100755 (executable)
--- a/utf8.h
+++ b/utf8.h
@@ -39,51 +39,10 @@ namespace utakata {
         };
 
 
-        class CUTF8Char
-        {
-            /**
-               UTF8と判断されたバイト列を受け取り、実際の値を返す。
-               ここで言う実際の値とは、UTF-8で定まっているバイト列の表現から、
-               固定とされる表現部分を削除し、有効とされる値を結合した値を指す。
-
-               110xxxxx 10yyyyyy --> xxxxxyyyyyy = 11bit
-               1110xxxx 10yyyyyy 10zzzzzz --> xxxxyyyyyyzzzzzz = 16bit
-               11110xxx 10yyyyyy 10zzzzzz 10vvvvvv --> xxxyyyyyyzzzzzzvvvvvv = 21bit
-               ※策定仕様では、5byte以上となるUTF-8は異常であるとされるため、21bitが表現
-               できればよい。
-               
-               21bitを十分に表現することができる整数型は、longのみであるため、必ずlongとして
-               返す。
-               intに暗黙のキャストをすることができるが、intは16bitまでしか保持義務が無いため、
-               原則としてCUTF8Charはlongで扱う。
-               
-            */
-
-        public:
-            // バイト列を必ず渡す必要がある。
-            CUTF8Char(const std::vector<unsigned char>& utf8);
-            virtual ~CUTF8Char(){}
-
-            // コピーコンストラクタを宣言したため、同時にoperator=を宣言する。
-            CUTF8Char(const CUTF8Char& ch);
-            CUTF8Char& operator=(const CUTF8Char& ch);
-
-            // 実際のコードを返す。
-            long toCode() const {return this->utf8_code_;}
-
-        private:
-
-            // UTF-8のコードを生成する。
-            void generateCode_();
-
-            // utf8を表すバイト列
-            std::vector<unsigned char> utf8_bytes_;
-            // 渡されたバイト列を実際のコードにしたもの
-            long utf8_code_;
-        };
 
         // UTF-8のコードを表すバイト列をUTF-8のコードに変換する。
         long generateUTF8Code(const std::vector<unsigned char>& code);
+        long generateUTF8Code(const std::string& ch);
         
         struct CheckUTF8Byte
         {
@@ -109,7 +68,7 @@ namespace utakata {
             PutBack(const smart_ptr<std::istream>& strm) : strm_(strm) {}
 
             template<class T>
-            void operator()(const T& t)
+            void operator()(T t)
                 {
                     strm_->putback(t);
                 }
diff --git a/utf8_string.cpp b/utf8_string.cpp
new file mode 100644 (file)
index 0000000..83d35ae
--- /dev/null
@@ -0,0 +1,188 @@
+#include <vector>
+#include <string>
+#include <functional>
+#include "utf8.h"
+#include "utf8_string.h"
+
+using namespace utakata::utf8_string;
+
+//================================================================================
+
+utakata::utf8_string::CUTF8Char::CUTF8Char(const std::vector<unsigned char>& utf8) : utf8_bytes_(utf8), utf16_code_(0)
+{
+    this->utf16_code_ = utakata::utf8::generateUTF8Code(utf8_bytes_);
+}
+
+utakata::utf8_string::CUTF8Char::CUTF8Char(const utakata::utf8_string::CUTF8Char& ch)
+{
+    // 単純にそれぞれの値をコピーする。
+    this->utf8_bytes_ = ch.utf8_bytes_;
+    utf16_code_ = ch.utf16_code_;
+}
+
+utakata::utf8_string::CUTF8Char& utakata::utf8_string::CUTF8Char::operator=(const utakata::utf8_string::CUTF8Char& ch)
+{
+    // 安全なスワップを利用する。
+    CUTF8Char c(ch);
+    swap(c);
+    return *this;
+}
+
+bool utakata::utf8_string::CUTF8Char::operator==(const utakata::utf8_string::CUTF8Char& ch) const
+{
+    // 全てのCUTF8Charが保持しているUTF16変換が施された
+    // コードで比較を行う。実際にはlongでの比較なのでかなり速い。
+
+    return ch.utf16_code_ == utf16_code_;
+}
+
+bool utakata::utf8_string::CUTF8Char::operator!=(const utakata::utf8_string::CUTF8Char& ch) const
+{
+    return !(*this == ch);
+}
+
+bool CUTF8Char::operator<(const CUTF8Char& ch) const
+{
+    return utf16_code_ < ch.utf16_code_;
+}
+
+bool CUTF8Char::operator>(const CUTF8Char& ch) const
+{
+    return utf16_code_ > ch.utf16_code_;
+}
+
+
+void utakata::utf8_string::CUTF8Char::swap(utakata::utf8_string::CUTF8Char& ch)
+{
+    // 値と標準コンテナなので、特に問題なく動作する。
+    std::swap(utf16_code_, ch.utf16_code_);
+    std::swap(utf8_bytes_, ch.utf8_bytes_);
+}
+
+std::string utakata::utf8_string::CUTF8Char::toStr() const
+{
+    // 単純に置換が行える。
+    std::string tmp;
+    tmp.insert(tmp.end(), utf8_bytes_.begin(), utf8_bytes_.end());
+    return tmp;
+}
+
+//================================================================================
+
+utakata::utf8_string::CUTF8String::CUTF8String() : chars_()
+{
+}
+
+utakata::utf8_string::CUTF8String::CUTF8String(
+    const std::vector<unsigned char>& bytes) : chars_()
+{
+    assign(bytes);
+}
+
+utakata::utf8_string::CUTF8String::CUTF8String(
+    const CUTF8String& str) : chars_(str.chars_)
+{
+}
+
+void CUTF8String::assign(const std::vector<unsigned char>& bytes)
+{
+    // 与えられたbytesを順次utf8charに変換していく。
+    // 与えられたbytesのうち、有効なデータのみを変換していく。
+    std::vector<CUTF8Char> chars;
+    std::vector<unsigned char>::const_iterator it = bytes.begin(),
+        end = bytes.end();
+
+    while (it != end) {
+        size_t i = 0;
+        if (utakata::utf8::is_utf8_one(std::vector<unsigned char>(it, end), i))
+        {
+            // 直接生成して渡す。
+            chars.push_back(std::vector<unsigned char>(it, it + i));
+        }
+        // 判別に失敗した場合でも、スキップするべきバイト数は
+        // 渡されてくるため、とりあえず追加するだけでよい。
+        it += i;
+    }
+    // 最後にswapするとよい。
+    std::swap(chars_, chars);
+}
+
+void CUTF8String::assign(const CUTF8String& str)
+{
+    //基本的に=で渡した場合と全く同じなので、そのようにする。
+    CUTF8String tmp(str);
+    swap(tmp);
+}
+
+CUTF8String& CUTF8String::operator=(const CUTF8String& str)
+{
+    assign(str);
+    return *this;
+}
+
+void CUTF8String::swap(CUTF8String& str)
+{
+    // シンプルにswapを行う。
+    std::swap(chars_, str.chars_);
+}
+
+CUTF8String& CUTF8String::operator+=(const CUTF8String& str)
+{
+    // 一度コピーと加算してから実際にswapさせる。
+    CUTF8String tmp(str);
+    chars_.insert(chars_.end(), tmp.chars_.begin(), tmp.chars_.end());
+    return *this;
+}
+
+std::string CUTF8String::toStr() const
+{
+    // 文字列に変換する。
+    std::string ret;
+    std::for_each(chars_.begin(), chars_.end(),
+                  CUTF8StringToString<CUTF8Char>(ret));
+    return ret;
+}
+
+void CUTF8String::insert(CUTF8String::utf8iterator it, CUTF8String::utf8iterator begin,
+                         CUTF8String::utf8iterator last)
+{
+    // 渡されたのは実際にはvectorのイテレータなので、
+    // そのままvectorの実装に任せることができる。
+    chars_.insert(it, begin, last);
+}
+
+void CUTF8String::insert(CUTF8String::utf8iterator it,
+                         CUTF8String::const_utf8iterator begin,
+                         CUTF8String::const_utf8iterator last)
+{
+    // 渡されたのがconstであるかどうかというだけの違いであるため、
+    // そのまま渡すことができる。
+    chars_.insert(it, begin, last);
+}
+
+//================================================================================
+
+std::string utakata::utf8_string::substring(const CUTF8String& str, size_t begin, size_t end)
+{
+    if (end == 0)
+    {
+        // 先頭から末尾までを取得する。
+        std::string ret;
+        std::for_each(str.begin() + begin, str.end(),
+                      CUTF8StringToString<CUTF8Char>(ret));
+        return ret;
+    }
+    else if (begin <= end)
+    {
+        std::string ret;
+        std::for_each(str.begin() + begin, str.begin() + (begin + end),
+                      CUTF8StringToString<CUTF8Char>(ret));
+        return ret;
+    }
+    else
+    {
+        throw range_error("out of range in utakata::utf8_string::substring");
+    }
+}
+
+
diff --git a/utf8_string.h b/utf8_string.h
new file mode 100644 (file)
index 0000000..9d56335
--- /dev/null
@@ -0,0 +1,184 @@
+#ifndef _UTF8_STRING_H_
+#define _UTF8_STRING_H_
+
+#include <vector>
+#include <functional>
+#include <string>
+#include <exception>
+
+
+// UTF8のバイト列、あるいは文字列から、UTF8の一文字単位で保持を行う
+// CUTF8Charの作成と、CUTF8CharのコンテナであるCUTF8Stringを定義する。
+
+
+namespace utakata {
+
+    namespace utf8_string {
+
+        class range_error : public std::exception
+        {
+        public:
+            range_error(const std::string& str) : str_(str) {}
+            virtual ~range_error() throw() {}
+
+            const char* what() throw() {
+                return str_.c_str();
+            }
+        private:
+
+            std::string str_;
+        };
+    
+        class CUTF8Char
+        {
+            /**
+               UTF8と判断されたバイト列を受け取り、実際の値を返す。
+               ここで言う実際の値とは、UTF-8で定まっているバイト列の表現から、
+               固定とされる表現部分を削除し、有効とされる値を結合した値を指す。
+               この値は実際のUTF16のコードと同一であり、完全なマッピングが可能
+               となる。
+
+               110xxxxx 10yyyyyy --> xxxxxyyyyyy = 11bit
+               1110xxxx 10yyyyyy 10zzzzzz --> xxxxyyyyyyzzzzzz = 16bit
+               11110xxx 10yyyyyy 10zzzzzz 10vvvvvv --> xxxyyyyyyzzzzzzvvvvvv = 21bit
+               ※策定仕様では、5byte以上となるUTF-8は異常であるとされるため、21bitが表現
+               できればよい。
+
+               21bitを十分に表現することができる整数型は、longのみであるため、必ずlongとして
+               返す。
+               intに暗黙のキャストをすることができるが、intは16bitまでしか保持義務が無いため、
+               原則としてCUTF8Charはlongで扱う。
+            */
+
+        public:
+            // バイト列を必ず渡す必要がある。
+            CUTF8Char(const std::vector<unsigned char>& utf8);
+            virtual ~CUTF8Char(){}
+
+            // コピーコンストラクタを宣言したため、同時にoperator=を宣言する。
+            CUTF8Char(const CUTF8Char& ch);
+            CUTF8Char& operator=(const CUTF8Char& ch);
+
+            // 各演算子のオーバーロード。
+            // <=と>=は、それぞれ>の結果のnot、<の結果のnotを
+            // 用いることで実装できるため、この二つだけ供えていれば問題ない。
+            // また、比較には内部で保持しているutf16_code_を用いるため、
+            // 速度面で気にする必要は無い。
+            bool operator==(const CUTF8Char& code) const;
+            bool operator<(const CUTF8Char& code) const;
+            bool operator>(const CUTF8Char& code) const;
+            bool operator!=(const CUTF8Char& code) const;
+
+            // UTF8->UTF16に変換したコードを返す。
+            long toUTF16Code() const {return this->utf16_code_;}
+
+            // 実際のバイト列を返す。
+            const std::vector<unsigned char>& getBytes() const {return utf8_bytes_;}
+
+            // 文字列として変換して返す。
+            std::string toStr() const;
+
+            // 渡されたCUTF8Charの内部と交換する。
+            void swap(CUTF8Char& ch);
+
+        private:
+
+            // utf8を表すバイト列
+            std::vector<unsigned char> utf8_bytes_;
+            // 渡されたバイト列を実際のコードにしたもの
+            long utf16_code_;
+        };
+
+
+        class CUTF8String
+        {
+            // UTF8の文字列を保持するためのコンテナ。
+            // 相互での比較などもサポートし、utakataの内部全般で
+            // 標準として使用することが可能なものとし、かつ標準コンテナと
+            // ほぼ同様の処理を行うことができるように定義されている。
+            // というか内部では単純なvectorで定義されているため、
+            // typedefされた型を指定するだけで、イテレータとして利用可能。
+
+        public:
+
+            // イテレータとして簡単に利用するためのtypedefマクロ
+            typedef std::vector<CUTF8Char>::iterator utf8iterator;
+            typedef std::vector<CUTF8Char>::const_iterator const_utf8iterator;
+
+        public:
+            
+            CUTF8String();
+
+            CUTF8String(const std::vector<unsigned char>& bytes);
+            CUTF8String(const CUTF8String& str);
+            virtual ~CUTF8String(){}
+
+            // 実体に代入する。代入が行われなかった場合、元のデータ
+            // は保存される。
+            void assign(const std::vector<unsigned char>& bytes);
+            void assign(const CUTF8String& str);
+
+            // iteratorを取得する。
+            const_utf8iterator begin() const {return chars_.begin();}
+            utf8iterator begin() {return chars_.begin();}
+
+            const_utf8iterator end() const {return chars_.end();}
+            utf8iterator end() {return chars_.end();}
+
+            // []をオーバーロードする。これは常に境界のチェックを行う。
+            const CUTF8Char& operator[](size_t t) const {return chars_.at(t);}
+            CUTF8Char& operator[](size_t t) {
+                return const_cast<CUTF8Char&>(
+                    static_cast<const CUTF8String*>(this)->chars_[t]);}
+
+            // サイズを取得する。
+            size_t size() const {return chars_.size();}
+
+            // 安全なswapと共に提供する。
+            CUTF8String& operator=(const CUTF8String& str);
+            void swap(CUTF8String& str);
+
+            // 加算のみをサポートする。
+            CUTF8String& operator+=(const CUTF8String& str);
+
+            // std::stringへ変換する。ただし、std::string上でのinsertなどは
+            // 保証できない。
+            std::string toStr() const;
+
+            // 渡したイテレータの範囲を追加する
+            // beginとlastは同一のUTF8Stringから取得されたものであること。
+            void insert(utf8iterator it, utf8iterator begin, utf8iterator last);
+            void insert(utf8iterator it, const_utf8iterator begin,
+                        const_utf8iterator last);
+
+        private:
+
+            std::vector<CUTF8Char> chars_;
+        };
+
+        // substringの実装を行う。
+        // [begin, end)までの文字を文字列として返す。
+        // endが渡されないか、0が渡された場合、beginから末尾までが返される。
+        std::string substring(const CUTF8String& str, size_t begin, size_t end = 0);
+
+        template<class T>
+        class CUTF8StringToString : public std::unary_function<T, void>
+        {
+            // イテレータを受け取り、std::stringを初期化引数で渡されたものに
+            // コピーしていく。
+        public:
+
+            CUTF8StringToString(std::string& str) : ret_(str) {}
+            void operator()(const T& it) {
+                ret_ += it.toStr();
+            }
+            
+        private:
+            
+            std::string& ret_;
+        };
+    };
+
+};
+
+#endif /* _UTF8_STRING_H_ */