[mdds] 08/62: Imported Upstream version 0.4.0
This is an automated email from the git hooks/post-receive script.
rene pushed a commit to branch master
in repository mdds.
commit 6de7d50421ede824b759610650dc2c392a75e3dc
Author: Rene Engelhard <rene@debian.org>
Date: Thu Apr 21 14:50:46 2016 +0200
Imported Upstream version 0.4.0
---
Makefile.in | 32 +-
NEWS | 4 +
bin/pack-release.sh.in | 12 +
configure | 3366 +++++++++++++++++++-
example/{Makefile => Makefile.in} | 7 +-
example/mixed_type_matrix.cpp | 103 +
include/mdds/mixed_type_matrix.hpp | 230 ++
include/mdds/mixed_type_matrix_def.inl | 302 ++
include/mdds/mixed_type_matrix_element.hpp | 166 +
include/mdds/mixed_type_matrix_flag_storage.hpp | 102 +
include/mdds/mixed_type_matrix_storage.hpp | 1304 ++++++++
include/mdds/quad_type_matrix.hpp | 1269 --------
misc/mdds.changes | 35 +
misc/mdds.spec.in | 62 +
..._matrix_test.cpp => mixed_type_matrix_test.cpp} | 295 +-
15 files changed, 5964 insertions(+), 1325 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 145afc5..6551284 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -3,14 +3,14 @@ OBJDIR=@OBJDIR@
SRCDIR=@SRCDIR@
INCDIR=@INCDIR@
-CPPFLAGS=@CPPFLAGS@
+CPPFLAGS=@CPPFLAGS@ -I$(INCDIR)
LDFLAGS=
EXECS= \
flat_segment_tree_test \
segment_tree_test \
point_quad_tree_test \
- quad_type_matrix_test \
+ mixed_type_matrix_test \
rectangle_set_test
HEADERS= \
@@ -20,7 +20,10 @@ HEADERS= \
$(INCDIR)/mdds/flat_segment_tree.hpp \
$(INCDIR)/mdds/point_quad_tree.hpp \
$(INCDIR)/mdds/segment_tree.hpp \
- $(INCDIR)/mdds/quad_type_matrix.hpp \
+ $(INCDIR)/mdds/mixed_type_matrix.hpp \
+ $(INCDIR)/mdds/mixed_type_matrix_def.inl \
+ $(INCDIR)/mdds/mixed_type_matrix_storage.hpp \
+ $(INCDIR)/mdds/mixed_type_matrix_flag_storage.hpp \
$(INCDIR)/mdds/rectangle_set.hpp
DEPENDS= \
@@ -30,13 +33,15 @@ TESTS = \
test.fst \
test.recset \
test.pqt \
- test.st
+ test.st \
+ test.mtm
TESTS_MEM = \
test.pqt.mem \
test.recset.mem \
test.fst.mem \
- test.st.mem
+ test.st.mem \
+ test.mtm.mem
# You may add $(TESTS_MEM) if valgrind is available on your platform
ALL_TESTS = $(TESTS)
@@ -61,8 +66,8 @@ $(OBJDIR)/rectangle_set_test.o: $(SRCDIR)/rectangle_set_test.cpp $(DEPENDS)
$(OBJDIR)/point_quad_tree_test.o: $(SRCDIR)/point_quad_tree_test.cpp $(DEPENDS)
$(CXX) $(CPPFLAGS) -c -o $@ $(SRCDIR)/point_quad_tree_test.cpp
-$(OBJDIR)/quad_type_matrix_test.o: $(SRCDIR)/quad_type_matrix_test.cpp $(DEPENDS)
- $(CXX) $(CPPFLAGS) -c -o $@ $(SRCDIR)/quad_type_matrix_test.cpp
+$(OBJDIR)/mixed_type_matrix_test.o: $(SRCDIR)/mixed_type_matrix_test.cpp $(DEPENDS)
+ $(CXX) $(CPPFLAGS) -c -o $@ $(SRCDIR)/mixed_type_matrix_test.cpp
flat_segment_tree_test: pre $(OBJDIR)/flat_segment_tree_test.o
$(CXX) $(LDFLAGS) $(OBJDIR)/flat_segment_tree_test.o -o $@
@@ -76,8 +81,8 @@ rectangle_set_test: pre $(OBJDIR)/rectangle_set_test.o
point_quad_tree_test: pre $(OBJDIR)/point_quad_tree_test.o
$(CXX) $(LDFLAGS) $(OBJDIR)/point_quad_tree_test.o -o $@
-quad_type_matrix_test: pre $(OBJDIR)/quad_type_matrix_test.o
- $(CXX) $(LDFLAGS) $(OBJDIR)/quad_type_matrix_test.o -o $@
+mixed_type_matrix_test: pre $(OBJDIR)/mixed_type_matrix_test.o
+ $(CXX) $(LDFLAGS) $(OBJDIR)/mixed_type_matrix_test.o -o $@
stlperf_test: pre $(SRCDIR)/stlperf_test.cpp
$(CXX) $(LDFLAGS) $(CPPFLAGS) $(SRCDIR)/stlperf_test.cpp -o $@
@@ -115,11 +120,11 @@ test.st.perf: segment_tree_test
test.st.mem: segment_tree_test
valgrind --tool=memcheck --leak-check=full ./segment_tree_test func
-test.qtm: quad_type_matrix_test
- ./quad_type_matrix_test
+test.mtm: mixed_type_matrix_test
+ ./mixed_type_matrix_test
-test.qtm.mem: quad_type_matrix_test
- valgrind --tool=memcheck --leak-check=full ./quad_type_matrix_test func
+test.mtm.mem: mixed_type_matrix_test
+ valgrind --tool=memcheck --leak-check=full ./mixed_type_matrix_test func
test.stl: stlperf_test
./stlperf_test
@@ -130,6 +135,7 @@ install: $(HEADERS)
install -d @PREFIX@/share/mdds-devel/example
install -d @PREFIX@/share/doc/packages/mdds-devel/
install -m 644 -t @PREFIX@/include/mdds $(INCDIR)/mdds/*.hpp
+ install -m 644 -t @PREFIX@/include/mdds $(INCDIR)/mdds/*.inl
install -m 644 -t @PREFIX@/include/mdds/hash_container $(INCDIR)/mdds/hash_container/*.hpp
install -m 644 -t @PREFIX@/share/mdds-devel/example/ example/*
install -m 644 -t @PREFIX@/share/doc/packages/mdds-devel/ AUTHORS NEWS README
diff --git a/NEWS b/NEWS
index 0a922a6..b5a4e33 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+mdds 0.4.0
+
+* implemented mixed_type_matrix.
+
mdds 0.3.1
* added support for boost::unordered_map (boost) and std::hash_map
diff --git a/bin/pack-release.sh.in b/bin/pack-release.sh.in
new file mode 100755
index 0000000..4744f27
--- /dev/null
+++ b/bin/pack-release.sh.in
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+VERSION=@VERSION@
+DIR=mdds_$VERSION
+hg clone https://multidimalgorithm.googlecode.com/hg/ $DIR
+pushd .
+cd $DIR
+autoconf
+rm -rf autom4te.cache .hg .hgtags bin autogen.sh configure.ac
+popd
+find $DIR -name '*.vp?' -type f | xargs rm -f
+tar jcvf $DIR.tar.bz2 $DIR
diff --git a/configure b/configure
index 3a951dc..2042821 100755
--- 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 mdds 0.3.1.
+# Generated by GNU Autoconf 2.63 for mdds 0.4.0.
#
# Report bugs to <kohei.yoshida@gmail.com>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='mdds'
PACKAGE_TARNAME='mdds'
-PACKAGE_VERSION='0.3.1'
-PACKAGE_STRING='mdds 0.3.1'
+PACKAGE_VERSION='0.4.0'
+PACKAGE_STRING='mdds 0.4.0'
PACKAGE_BUGREPORT='kohei.yoshida@gmail.com'
ac_subst_vars='LTLIBOBJS
@@ -607,6 +607,7 @@ INCDIR
SRCDIR
OBJDIR
PREFIX
+VERSION
target_alias
host_alias
build_alias
@@ -1204,7 +1205,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 mdds 0.3.1 to adapt to many kinds of systems.
+\`configure' configures mdds 0.4.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1265,7 +1266,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of mdds 0.3.1:";;
+ short | recursive ) echo "Configuration of mdds 0.4.0:";;
esac
cat <<\_ACEOF
@@ -1349,7 +1350,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-mdds configure 0.3.1
+mdds configure 0.4.0
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1363,7 +1364,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 mdds $as_me 0.3.1, which was
+It was created by mdds $as_me 0.4.0, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -1732,6 +1733,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+VERSION=0.4.0
+
+
# Check whether --with-hash-container was given.
if test "${with_hash_container+set}" = set; then
@@ -1763,7 +1767,7 @@ INCDIR=./include
-CPPFLAGS="-I$INCDIR -DDEBUG_NODE_BASE -DUNIT_TEST -Wall -Os -g -pedantic-errors"
+CPPFLAGS="-DDEBUG_NODE_BASE -DUNIT_TEST -Wall -Os -g -pedantic-errors"
if test $with_hash_container = stlport; then
CPPFLAGS="$CPPFLAGS -DMDDS_HASH_CONTAINER_STLPORT"
elif test $with_hash_container = boost; then
@@ -2232,7 +2236,3346 @@ 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 mdds $as_me 0.3.1, which was
+This file was extended by mdds $as_me 0.4.0, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+mdds config.status 0.4.0
+configured by $0, generated by GNU Autoconf 2.63,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr='
'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+ac_config_files="$ac_config_files example/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by mdds $as_me 0.4.0, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+mdds config.status 0.4.0
+configured by $0, generated by GNU Autoconf 2.63,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr='
'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+ac_config_files="$ac_config_files misc/mdds.spec"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by mdds $as_me 0.4.0, which was
+generated by GNU Autoconf 2.63. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTION]... [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+mdds config.status 0.4.0
+configured by $0, generated by GNU Autoconf 2.63,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;;
+ "misc/mdds.spec") CONFIG_FILES="$CONFIG_FILES misc/mdds.spec" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr='
'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
+$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+ac_config_files="$ac_config_files bin/pack-release.sh"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by mdds $as_me 0.4.0, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -2282,7 +5625,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-mdds config.status 0.3.1
+mdds config.status 0.4.0
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -2386,6 +5729,9 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "example/Makefile") CONFIG_FILES="$CONFIG_FILES example/Makefile" ;;
+ "misc/mdds.spec") CONFIG_FILES="$CONFIG_FILES misc/mdds.spec" ;;
+ "bin/pack-release.sh") CONFIG_FILES="$CONFIG_FILES bin/pack-release.sh" ;;
*) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
diff --git a/example/Makefile b/example/Makefile.in
similarity index 92%
rename from example/Makefile
rename to example/Makefile.in
index 9cfd314..aa8b436 100644
--- a/example/Makefile
+++ b/example/Makefile.in
@@ -25,13 +25,14 @@
#
#***********************************************************************
-CPPFLAGS=-Wall -Os -std=c++0x
+CPPFLAGS=@CPPFLAGS@ -I../include
EXEC= \
segment_tree \
flat_segment_tree \
rectangle_set \
- point_quad_tree
+ point_quad_tree \
+ mixed_type_matrix
all: $(EXEC)
@@ -43,5 +44,7 @@ rectangle_set: rectangle_set.cpp
point_quad_tree: point_quad_tree.cpp
+mixed_type_matrix: mixed_type_matrix.cpp
+
clean:
rm -f $(EXEC)
diff --git a/example/mixed_type_matrix.cpp b/example/mixed_type_matrix.cpp
new file mode 100644
index 0000000..e674178
--- /dev/null
+++ b/example/mixed_type_matrix.cpp
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+#include <mdds/mixed_type_matrix.hpp>
+
+#include <string>
+#include <iostream>
+#include <sstream>
+
+using namespace mdds;
+using namespace std;
+
+typedef ::mdds::mixed_type_matrix<string, int> mx_type;
+
+string str(const mx_type::element& e)
+{
+ ostringstream os;
+ switch (e.m_type)
+ {
+ case element_empty:
+ os << "empty";
+ break;
+ case element_numeric:
+ os << "numeric (" << e.m_numeric << ")";
+ break;
+ case element_boolean:
+ os << "boolean";
+ break;
+ case element_string:
+ os << "string";
+ break;
+ default:
+ os << "<unkwown>";
+ }
+ return os.str();
+}
+
+void print_element(const mx_type& mx, size_t row, size_t col)
+{
+ cout << "(" << row << "," << col << ") = ";
+ switch (mx.get_type(row, col))
+ {
+ case element_boolean:
+ cout << "boolean: " << (mx.get_boolean(row, col) ? "true" : "false");
+ break;
+ case element_numeric:
+ cout << "numeric: " << mx.get_numeric(row, col);
+ break;
+ case element_string:
+ cout << "string: " << *mx.get_string(row, col);
+ break;
+ case element_empty:
+ cout << "empty";
+ break;
+ default:
+ ;
+ }
+ cout << endl;
+}
+
+int main()
+{
+ // Create a matrix instance initialized with numeric zero values.
+ mx_type mx(3, 3, matrix_density_filled_zero);
+
+ // Insert values of various types.
+ mx.set(0, 0, 5.5);
+ mx.set(1, 0, true);
+ mx.set(2, 1, new string("string value"));
+ mx.set_empty(1, 2);
+
+ // sizes.first contains row size, and sizes.second contains column size.
+ mx_type::size_pair_type sizes = mx.size();
+
+ // print all elements.
+ for (size_t i = 0; i < sizes.first; ++i)
+ for (size_t j = 0; j < sizes.second; ++j)
+ print_element(mx, i, j);
+}
diff --git a/include/mdds/mixed_type_matrix.hpp b/include/mdds/mixed_type_matrix.hpp
new file mode 100644
index 0000000..758baff
--- /dev/null
+++ b/include/mdds/mixed_type_matrix.hpp
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+#ifndef __MDDS_QUAD_TYPE_MATRIX_HPP__
+#define __MDDS_QUAD_TYPE_MATRIX_HPP__
+
+#include "mdds/global.hpp"
+#include "mdds/mixed_type_matrix_element.hpp"
+#include "mdds/mixed_type_matrix_storage.hpp"
+#include "mdds/mixed_type_matrix_flag_storage.hpp"
+
+#include <iostream>
+#include <cstdlib>
+
+namespace mdds {
+
+enum matrix_density_t
+{
+ matrix_density_filled_zero,
+ matrix_density_filled_empty,
+ matrix_density_sparse_zero,
+ matrix_density_sparse_empty
+};
+
+class matrix_error : public ::mdds::general_error
+{
+public:
+ matrix_error(const ::std::string& msg) : general_error(msg) {}
+};
+
+/**
+ * This data structure represents a matrix where each individual element may
+ * be of one of four types: value, boolean, string, or empty.
+ */
+template<typename _String, typename _Flag>
+class mixed_type_matrix
+{
+public:
+ typedef _String string_type;
+ typedef _Flag flag_type;
+ typedef size_t size_type;
+ typedef ::std::pair<size_type, size_type> size_pair_type;
+ typedef ::mdds::element<string_type> element;
+
+private:
+ struct size_pair_type_hash
+ {
+ size_t operator() (const size_pair_type& val) const
+ {
+ size_t n = val.first + (val.second << 8);
+ return n;
+ }
+ };
+ typedef ::mdds::storage_base<mixed_type_matrix> storage_base;
+
+ static storage_base* create_storage(size_t rows, size_t cols, matrix_density_t density);
+
+public:
+ typedef ::mdds::flag_storage<flag_type, size_pair_type, size_pair_type_hash> flag_storage;
+ typedef ::mdds::storage_filled<mixed_type_matrix> filled_storage_type;
+ typedef ::mdds::storage_sparse<mixed_type_matrix> sparse_storage_type;
+
+ typedef typename storage_base::const_iterator const_iterator;
+
+ /**
+ * Default constructor.
+ */
+ mixed_type_matrix();
+
+ /**
+ * Construct an empty matrix with specified density type.
+ */
+ mixed_type_matrix(matrix_density_t density);
+
+ /**
+ * Construct a matrix of specified size with specified density type.
+ */
+ mixed_type_matrix(size_t rows, size_t cols, matrix_density_t density);
+
+ mixed_type_matrix(const mixed_type_matrix& r);
+ ~mixed_type_matrix();
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ mixed_type_matrix& operator= (const mixed_type_matrix& r);
+
+ /**
+ * Get the type of element specified by its position. The type can be one
+ * of empty, string, numeric, or boolean.
+ *
+ * @return element type.
+ */
+ matrix_element_t get_type(size_t row, size_t col) const;
+
+ double get_numeric(size_t row, size_t col) const;
+ bool get_boolean(size_t row, size_t col) const;
+ const string_type* get_string(size_t row, size_t col) const;
+
+ void set_numeric(size_t row, size_t col, double val);
+ void set_boolean(size_t row, size_t col, bool val);
+ void set_string(size_t row, size_t col, string_type* str);
+ void set_empty(size_t row, size_t col);
+
+ void set(size_t row, size_t col, double val);
+ void set(size_t row, size_t col, bool val);
+ void set(size_t row, size_t col, string_type* str);
+
+ /**
+ * Set flag value at specified position.
+ *
+ * @param row row position
+ * @param col column position
+ * @param flag_type flag value
+ */
+ void set_flag(size_t row, size_t col, flag_type flag);
+
+ /**
+ * Get flag value at specified position.
+ *
+ * @param row row position
+ * @param col column position
+ *
+ * @return flag value stored at specified position
+ */
+ flag_type get_flag(size_t row, size_t col) const;
+
+ void clear_flag(size_t row, size_t cols);
+
+ /**
+ * Return the size of matrix as a pair. The first value is the row size,
+ * while the second value is the column size.
+ *
+ * @return matrix size as a value pair.
+ */
+ size_pair_type size() const;
+
+ /**
+ * Transpose the stored matrix data.
+ *
+ * @return reference to this matrix instance.
+ */
+ mixed_type_matrix& transpose();
+
+ /**
+ * Assign values from the passed matrix instance. If the size of the
+ * passed matrix is smaller, then the element values are assigned by their
+ * positions, while the rest of the elements that fall outside the size of
+ * the passed matrix instance will remain unmodified. If the size of the
+ * pass matrix instance is larger, then only the elements within the size
+ * of this matrix instance will get assigned.
+ *
+ * @param r passed matrix object to assign element values from.
+ */
+ void assign(const mixed_type_matrix& r);
+
+ /**
+ * Resize the matrix to specified size. This method supports resizing to
+ * zero-sized matrix; however, either specifying the row or column size to
+ * zero will resize the matrix to 0 x 0.
+ *
+ * @param row new row size
+ * @param col new column size
+ */
+ void resize(size_t row, size_t col);
+
+ /**
+ * Empty the matrix.
+ */
+ void clear();
+
+ /**
+ * Check whether or not this matrix is numeric. A numeric matrix contains
+ * only numeric or boolean elements.
+ *
+ * @return true if the matrix contains only numeric or boolean elements,
+ * or false otherwise.
+ */
+ bool numeric() const;
+
+ /**
+ * Check whether or not this matrix is empty.
+ *
+ * @return true if this matrix is empty, or false otherwise.
+ */
+ bool empty() const;
+
+ /**
+ * Swap the content of the matrix with another instance.
+ */
+ void swap(mixed_type_matrix& r);
+
+#ifdef UNIT_TEST
+ void dump() const;
+ void dump_flags() const;
+#endif
+
+private:
+ storage_base* mp_storage;
+};
+
+}
+
+#include "mixed_type_matrix_def.inl"
+
+#endif
diff --git a/include/mdds/mixed_type_matrix_def.inl b/include/mdds/mixed_type_matrix_def.inl
new file mode 100644
index 0000000..9d9cf54
--- /dev/null
+++ b/include/mdds/mixed_type_matrix_def.inl
@@ -0,0 +1,302 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+namespace mdds {
+
+template<typename _String, typename _Flag>
+typename mixed_type_matrix<_String,_Flag>::storage_base*
+mixed_type_matrix<_String,_Flag>::create_storage(size_t rows, size_t cols, matrix_density_t density)
+{
+ switch (density)
+ {
+ case matrix_density_filled_zero:
+ return new filled_storage_type(rows, cols, matrix_init_element_zero);
+ case matrix_density_filled_empty:
+ return new filled_storage_type(rows, cols, matrix_init_element_empty);
+ case matrix_density_sparse_zero:
+ return new sparse_storage_type(rows, cols, matrix_init_element_zero);
+ case matrix_density_sparse_empty:
+ return new sparse_storage_type(rows, cols, matrix_init_element_empty);
+ default:
+ throw matrix_error("unknown density type");
+ }
+ return NULL;
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>::mixed_type_matrix() :
+ mp_storage(NULL)
+{
+ mp_storage = create_storage(0, 0, matrix_density_filled_zero);
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>::mixed_type_matrix(matrix_density_t density) :
+ mp_storage(NULL)
+{
+ mp_storage = create_storage(0, 0, density);
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>::mixed_type_matrix(size_t rows, size_t cols, matrix_density_t density) :
+ mp_storage(NULL)
+{
+ mp_storage = create_storage(rows, cols, density);
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>::mixed_type_matrix(const mixed_type_matrix& r) :
+ mp_storage(r.mp_storage->clone())
+{
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>::~mixed_type_matrix()
+{
+ delete mp_storage;
+}
+
+template<typename _String, typename _Flag>
+typename mixed_type_matrix<_String,_Flag>::const_iterator
+mixed_type_matrix<_String,_Flag>::begin() const
+{
+ return mp_storage->begin();
+}
+
+template<typename _String, typename _Flag>
+typename mixed_type_matrix<_String,_Flag>::const_iterator
+mixed_type_matrix<_String,_Flag>::end() const
+{
+ return mp_storage->end();
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>&
+mixed_type_matrix<_String,_Flag>::operator= (const mixed_type_matrix& r)
+{
+ if (this == &r)
+ // self assignment.
+ return *this;
+
+ delete mp_storage;
+ mp_storage = r.mp_storage->clone();
+ return *this;
+}
+
+template<typename _String, typename _Flag>
+matrix_element_t mixed_type_matrix<_String,_Flag>::get_type(size_t row, size_t col) const
+{
+ return mp_storage->get_type(row, col);
+}
+
+template<typename _String, typename _Flag>
+double mixed_type_matrix<_String,_Flag>::get_numeric(size_t row, size_t col) const
+{
+ return mp_storage->get_numeric(row, col);
+}
+
+template<typename _String, typename _Flag>
+bool mixed_type_matrix<_String,_Flag>::get_boolean(size_t row, size_t col) const
+{
+ return mp_storage->get_boolean(row, col);
+}
+
+template<typename _String, typename _Flag>
+const typename mixed_type_matrix<_String,_Flag>::string_type*
+mixed_type_matrix<_String,_Flag>::get_string(size_t row, size_t col) const
+{
+ return mp_storage->get_string(row, col);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set_numeric(size_t row, size_t col, double val)
+{
+ mp_storage->get_element(row, col).set_numeric(val);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set_boolean(size_t row, size_t col, bool val)
+{
+ mp_storage->get_element(row, col).set_boolean(val);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set_string(size_t row, size_t col, string_type* str)
+{
+ mp_storage->get_element(row, col).set_string(str);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set_flag(size_t row, size_t col, flag_type flag)
+{
+ mp_storage->get_flag_storage().set_flag(row, col, flag);
+}
+
+template<typename _String, typename _Flag>
+typename mixed_type_matrix<_String,_Flag>::flag_type
+mixed_type_matrix<_String,_Flag>::get_flag(size_t row, size_t col) const
+{
+ return mp_storage->get_flag_storage().get_flag(row, col);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::clear_flag(size_t row, size_t col)
+{
+ return mp_storage->get_flag_storage().clear_flag(row, col);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set_empty(size_t row, size_t col)
+{
+ mp_storage->get_element(row, col).set_empty();
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set(size_t row, size_t col, double val)
+{
+ set_numeric(row, col, val);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set(size_t row, size_t col, bool val)
+{
+ set_boolean(row, col, val);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::set(size_t row, size_t col, string_type* str)
+{
+ set_string(row, col, str);
+}
+
+template<typename _String, typename _Flag>
+typename mixed_type_matrix<_String,_Flag>::size_pair_type
+mixed_type_matrix<_String,_Flag>::size() const
+{
+ size_pair_type size_pair(mp_storage->rows(), mp_storage->cols());
+ return size_pair;
+}
+
+template<typename _String, typename _Flag>
+mixed_type_matrix<_String,_Flag>&
+mixed_type_matrix<_String,_Flag>::transpose()
+{
+ mp_storage->transpose();
+ return *this;
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::assign(const mixed_type_matrix& r)
+{
+ if (this == &r)
+ // assignment to self.
+ return;
+
+ size_t row_count = ::std::min(mp_storage->rows(), r.mp_storage->rows());
+ size_t col_count = ::std::min(mp_storage->cols(), r.mp_storage->cols());
+ for (size_t i = 0; i < row_count; ++i)
+ for (size_t j = 0; j < col_count; ++j)
+ mp_storage->get_element(i, j) = r.mp_storage->get_element(i, j);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::resize(size_t row, size_t col)
+{
+ mp_storage->resize(row, col);
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::clear()
+{
+ mp_storage->clear();
+}
+
+template<typename _String, typename _Flag>
+bool mixed_type_matrix<_String,_Flag>::numeric() const
+{
+ return mp_storage->numeric();
+}
+
+template<typename _String, typename _Flag>
+bool mixed_type_matrix<_String,_Flag>::empty() const
+{
+ return mp_storage->empty();
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::swap(mixed_type_matrix& r)
+{
+ ::std::swap(mp_storage, r.mp_storage);
+}
+
+#ifdef UNIT_TEST
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::dump() const
+{
+ using namespace std;
+ size_t rows = mp_storage->rows(), cols = mp_storage->cols();
+ cout << "rows: " << mp_storage->rows() << " cols: " << mp_storage->cols() << endl;
+ for (size_t i = 0; i < rows; ++i)
+ {
+ cout << "row " << i << ": ";
+ for (size_t j = 0; j < cols; ++j)
+ {
+ matrix_element_t etype = mp_storage->get_type(i, j);
+ if (j > 0)
+ cout << ", ";
+ cout << "(col " << j << ": ";
+ switch (etype)
+ {
+ case element_boolean:
+ cout << boolalpha << mp_storage->get_boolean(i, j) << noboolalpha;
+ break;
+ case element_empty:
+ cout << "-";
+ break;
+ case element_numeric:
+ cout << mp_storage->get_numeric(i, j);
+ break;
+ case element_string:
+ cout << "'" << mp_storage->get_string(i, j) << "'";
+ break;
+ default:
+ ;
+ }
+ cout << ")";
+ }
+ cout << endl;
+ }
+}
+
+template<typename _String, typename _Flag>
+void mixed_type_matrix<_String,_Flag>::dump_flags() const
+{
+ mp_storage->get_flag_storage().dump();
+}
+#endif
+
+}
diff --git a/include/mdds/mixed_type_matrix_element.hpp b/include/mdds/mixed_type_matrix_element.hpp
new file mode 100644
index 0000000..18eac72
--- /dev/null
+++ b/include/mdds/mixed_type_matrix_element.hpp
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+#ifndef __MDDS_MIXED_TYPE_MATRIX_ELEMENT_HPP__
+#define __MDDS_MIXED_TYPE_MATRIX_ELEMENT_HPP__
+
+namespace mdds {
+
+enum matrix_element_t
+{
+ element_empty = 0,
+ element_numeric = 1,
+ element_boolean = 2,
+ element_string = 3
+};
+
+template<typename _String>
+struct element
+{
+ typedef _String string_type;
+
+ matrix_element_t m_type:2;
+
+ union
+ {
+ double m_numeric;
+ bool m_boolean;
+ string_type* mp_string;
+ };
+
+ element() : m_type(element_empty) {}
+ element(const element& r) : m_type(r.m_type)
+ {
+ switch (m_type)
+ {
+ case element_boolean:
+ m_boolean = r.m_boolean;
+ break;
+ case element_numeric:
+ m_numeric = r.m_numeric;
+ break;
+ case element_string:
+ mp_string = new string_type(*r.mp_string);
+ break;
+ case element_empty:
+ default:
+ ;
+ }
+ }
+
+ explicit element(double v) : m_type(element_numeric), m_numeric(v) {}
+ explicit element(bool v) : m_type(element_boolean), m_boolean(v) {}
+ explicit element(string_type* p) : m_type(element_string), mp_string(p) {}
+
+ bool operator== (const element& r) const
+ {
+ if (m_type != r.m_type)
+ return false;
+
+ switch (m_type)
+ {
+ case element_boolean:
+ return m_boolean == r.m_boolean;
+ case element_numeric:
+ return m_numeric == r.m_numeric;
+ case element_string:
+ return *mp_string == *r.mp_string;
+ case element_empty:
+ default:
+ ;
+ }
+
+ return true;
+ }
+
+ element& operator= (const element& r)
+ {
+ if (m_type == element_string)
+ delete mp_string;
+
+ m_type = r.m_type;
+
+ switch (m_type)
+ {
+ case element_boolean:
+ m_boolean = r.m_boolean;
+ break;
+ case element_numeric:
+ m_numeric = r.m_numeric;
+ break;
+ case element_string:
+ mp_string = new string_type(*r.mp_string);
+ break;
+ case element_empty:
+ default:
+ ;
+ }
+ return *this;
+ }
+
+ ~element()
+ {
+ clear_string();
+ }
+
+ void clear_string()
+ {
+ if (m_type == element_string)
+ delete mp_string;
+ }
+
+ void set_empty()
+ {
+ clear_string();
+ m_type = element_empty;
+ }
+
+ void set_numeric(double val)
+ {
+ clear_string();
+ m_type = element_numeric;
+ m_numeric = val;
+ }
+
+ void set_boolean(bool val)
+ {
+ clear_string();
+ m_type = element_boolean;
+ m_boolean = val;
+ }
+
+ void set_string(string_type* str)
+ {
+ clear_string();
+ m_type = element_string;
+ mp_string = str;
+ }
+};
+
+}
+
+#endif
diff --git a/include/mdds/mixed_type_matrix_flag_storage.hpp b/include/mdds/mixed_type_matrix_flag_storage.hpp
new file mode 100644
index 0000000..51b05bc
--- /dev/null
+++ b/include/mdds/mixed_type_matrix_flag_storage.hpp
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+#if UNIT_TEST
+#include <iostream>
+#endif
+
+#include "mdds/hash_container/map.hpp"
+
+namespace mdds {
+
+template<typename _Flag, typename _Key, typename _KeyHash>
+class flag_storage
+{
+ typedef _Flag flag_type;
+ typedef _Key key_type;
+ typedef _KeyHash key_hash_type;
+
+ typedef _mdds_unordered_map_type<key_type, flag_type, key_hash_type> flag_store_type;
+
+public:
+ flag_storage() {}
+ flag_storage(const flag_storage& r) : m_flags(r.m_flags) {}
+
+ void set_flag(size_t row, size_t col, flag_type flag)
+ {
+ key_type pos = key_type(row, col);
+ typename flag_store_type::iterator itr = m_flags.find(pos);
+ if (itr == m_flags.end())
+ {
+ // flag not stored for this position.
+ ::std::pair<typename flag_store_type::iterator, bool> r =
+ m_flags.insert(typename flag_store_type::value_type(pos, flag));
+ return;
+ }
+ itr->second = flag;
+ }
+
+ flag_type get_flag(size_t row, size_t col)
+ {
+ key_type pos = key_type(row, col);
+ typename flag_store_type::iterator itr = m_flags.find(pos);
+ return itr == m_flags.end() ? static_cast<flag_type>(0) : itr->second;
+ }
+
+ void clear_flag(size_t row, size_t col)
+ {
+ key_type pos = key_type(row, col);
+ typename flag_store_type::iterator itr = m_flags.find(pos);
+ if (itr != m_flags.end())
+ // Flag is stored at this position. Remove it.
+ m_flags.erase(itr);
+ }
+#if UNIT_TEST
+ void dump() const
+ {
+ using namespace std;
+ if (m_flags.empty())
+ {
+ cout << "no flags stored" << endl;
+ return;
+ }
+
+ cout << "flags stored:" << endl;
+ typename flag_store_type::const_iterator itr = m_flags.begin(), itr_end = m_flags.end();
+ for (; itr != itr_end; ++itr)
+ {
+ const key_type& pos = itr->first;
+ flag_type val = itr->second;
+ cout << "(row=" << pos.first << ",col=" << pos.second << ") = 0x" << hex << static_cast<size_t>(val) << endl;
+ }
+ }
+#endif
+private:
+ flag_store_type m_flags;
+};
+
+}
diff --git a/include/mdds/mixed_type_matrix_storage.hpp b/include/mdds/mixed_type_matrix_storage.hpp
new file mode 100644
index 0000000..2f95bf9
--- /dev/null
+++ b/include/mdds/mixed_type_matrix_storage.hpp
@@ -0,0 +1,1304 @@
+/*************************************************************************
+ *
+ * Copyright (c) 2010 Kohei Yoshida
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ ************************************************************************/
+
+#ifndef __MDDS_MIXED_TYPE_MATRIX_STORAGE_HPP__
+#define __MDDS_MIXED_TYPE_MATRIX_STORAGE_HPP__
+
+#include <cassert>
+
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+
+namespace mdds {
+
+enum matrix_storage_t
+{
+ matrix_storage_filled,
+ matrix_storage_sparse
+};
+
+enum matrix_init_element_t
+{
+ matrix_init_element_zero,
+ matrix_init_element_empty
+};
+
+class matrix_storage_error : public ::mdds::general_error
+{
+public:
+ matrix_storage_error(const ::std::string& msg) : general_error(msg) {}
+};
+
+/**
+ * Wrapper class that provides access to the storage internals. This is
+ * used by storage_base::const_iterator to traverse data in different
+ * storage backends.
+ */
+template<typename _StoreType, typename _ElemWrap, typename _RowsWrap>
+class const_itr_access
+{
+ typedef _StoreType store_type;
+ typedef _ElemWrap element_wrap_type;
+ typedef _RowsWrap rows_wrap_type;
+public:
+ typedef typename _StoreType::element element;
+
+ const_itr_access(const store_type& db) :
+ m_db(db),
+ m_rows_itr(db.get_rows().begin()),
+ m_rows_itr_end(db.get_rows().end())
+ {
+ // create iterators for the first row.
+ if (!empty())
+ update_row_itr();
+ }
+
+ const_itr_access(const const_itr_access& r) :
+ m_db(r.m_db),
+ m_rows_itr(r.m_rows_itr),
+ m_rows_itr_end(r.m_rows_itr_end),
+ m_row_itr(r.m_row_itr),
+ m_row_itr_end(r.m_row_itr_end) {}
+
+ /**
+ * Set the current iterator position to the end position.
+ */
+ void set_to_end()
+ {
+ if (empty())
+ return;
+
+ m_rows_itr = m_rows_itr_end;
+ typename store_type::rows_type::const_iterator itr = m_rows_itr_end;
+ --itr; // Move to the last row.
+
+ // They both need to be at the end position of the last row.
+ m_row_itr = m_row_itr_end = m_rows_wrap(itr).end();
+ }
+
+ bool operator== (const const_itr_access& r) const
+ {
+ if (&m_db != &r.m_db)
+ // different storage instances.
+ return false;
+
+ if (empty())
+ return r.empty();
+
+ if (m_rows_itr != r.m_rows_itr)
+ return false;
+
+ // If the rows iterators are equal, the end positions should be equal
+ // too. No need to check it.
+ assert(m_rows_itr_end == r.m_rows_itr_end);
+
+ if (m_row_itr != r.m_row_itr)
+ return false;
+
+ // Same assumption holds here too. See above.
+ assert(m_row_itr_end == r.m_row_itr_end);
+ return true;
+ }
+
+ bool empty() const { return m_db.get_rows().begin() == m_rows_itr_end; }
+
+ void update_row_itr()
+ {
+ m_row_itr = m_rows_wrap(m_rows_itr).begin();
+ m_row_itr_end = m_rows_wrap(m_rows_itr).end();
+ }
+
+ const element& get() const { return m_wrap(m_row_itr); }
+
+ bool inc()
+ {
+ if (m_row_itr == m_row_itr_end)
+ return false;
+
+ ++m_row_itr;
+ if (m_row_itr == m_row_itr_end)
+ {
+ // Move to the next row.
+ if (m_rows_itr != m_rows_itr_end)
+ {
+ ++m_rows_itr;
+ if (m_rows_itr == m_rows_itr_end)
+ // no more rows.
+ return false;
+ update_row_itr();
+ }
+ }
+ return true;
+ }
+
+ bool dec()
+ {
+ if (m_rows_itr == m_rows_itr_end)
+ {
+ --m_rows_itr;
+ assert(m_row_itr == m_row_itr_end);
+ --m_row_itr;
+ return true;
+ }
+
+ if (m_row_itr == m_rows_wrap(m_rows_itr).begin())
+ {
+ // On the first element of a row.
+ if (m_rows_itr == m_db.get_rows().begin())
+ // already on the first row.
+ return false;
+
+ // Move up to the previous row, and select its last element.
+ --m_rows_itr;
+ assert(!m_rows_wrap(m_rows_itr).empty());
+ m_row_itr_end = m_rows_wrap(m_rows_itr).end();
+ m_row_itr = m_row_itr_end;
+ --m_row_itr;
+ return true;
+ }
+
+ // Not on the first element of a row.
+ --m_row_itr;
+ return true;
+ }
+
+private:
+ const store_type& m_db;
+ typename store_type::rows_type::const_iterator m_rows_itr;
+ typename store_type::rows_type::const_iterator m_rows_itr_end;
+ typename store_type::row_type::const_iterator m_row_itr;
+ typename store_type::row_type::const_iterator m_row_itr_end;
+ element_wrap_type m_wrap;
+ rows_wrap_type m_rows_wrap;
+};
+
+template<typename _MatrixType>
+class storage_base
+{
+public:
+ typedef _MatrixType matrix_type;
+
+ typedef typename _MatrixType::element element;
+ typedef typename _MatrixType::flag_storage flag_storage;
+ typedef typename _MatrixType::string_type string_type;
+ typedef typename _MatrixType::filled_storage_type filled_storage_type;
+ typedef typename _MatrixType::sparse_storage_type sparse_storage_type;
+
+ class const_iterator
+ {
+ typedef typename filled_storage_type::const_itr_access filled_access_type;
+ typedef typename sparse_storage_type::const_itr_access sparse_access_type;
+ public:
+ // iterator traits
+ typedef element value_type;
+ typedef element* pointer;
+ typedef element& reference;
+ typedef ptrdiff_t difference_type;
+ typedef ::std::bidirectional_iterator_tag iterator_category;
+
+ const_iterator() :
+ m_const_itr_access(NULL), m_type(matrix_storage_filled)
+ {}
+
+ const_iterator(void* p, matrix_storage_t type, bool _end = false) :
+ m_const_itr_access(p), m_type(type)
+ {
+ assert(p != NULL);
+ if (_end)
+ {
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ get_filled_itr()->set_to_end();
+ break;
+ case matrix_storage_sparse:
+ get_sparse_itr()->set_to_end();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+ }
+
+ const_iterator(const const_iterator& r) :
+ m_const_itr_access(NULL),
+ m_type(r.m_type)
+ {
+ if (!r.m_const_itr_access)
+ return;
+
+ switch (r.m_type)
+ {
+ case matrix_storage_filled:
+ m_const_itr_access = new filled_access_type(*r.get_filled_itr());
+ break;
+ case matrix_storage_sparse:
+ m_const_itr_access = new sparse_access_type(*r.get_sparse_itr());
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+
+ ~const_iterator()
+ {
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ delete get_filled_itr();
+ break;
+ case matrix_storage_sparse:
+ delete get_sparse_itr();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+
+ void swap(const_iterator& r)
+ {
+ ::std::swap(m_type, r.m_type);
+ ::std::swap(m_const_itr_access, r.m_const_itr_access);
+ }
+
+ const_iterator& operator=(const const_iterator& r)
+ {
+ if (this == &r)
+ // self assignment.
+ return *this;
+
+ const_iterator new_itr(r);
+ swap(new_itr);
+ return *this;
+ }
+
+ const element& operator*() const
+ {
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ return get_filled_itr()->get();
+ case matrix_storage_sparse:
+ return get_sparse_itr()->get();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ const element* operator->() const
+ {
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ return &get_filled_itr()->get();
+ case matrix_storage_sparse:
+ return &get_sparse_itr()->get();
+ default:
+ assert(!"unknown storage type");
+ }
+ return NULL;
+ }
+
+ const element* operator++()
+ {
+ bool has_next = false;
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ has_next = get_filled_itr()->inc();
+ break;
+ case matrix_storage_sparse:
+ has_next = get_sparse_itr()->inc();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ return has_next ? operator->() : NULL;
+ }
+
+ const element* operator--()
+ {
+ bool has_next = false;
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ has_next = get_filled_itr()->dec();
+ break;
+ case matrix_storage_sparse:
+ has_next = get_sparse_itr()->dec();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ return has_next ? operator->() : NULL;
+ }
+
+ bool operator== (const const_iterator& r) const
+ {
+ if (m_type != r.m_type)
+ // Types differ.
+ return false;
+
+ if (!m_const_itr_access)
+ // This instance has empty access. The other one must be empty too.
+ return r.m_const_itr_access == NULL;
+
+ assert(m_const_itr_access != NULL);
+ assert(r.m_const_itr_access != NULL);
+
+ switch (m_type)
+ {
+ case matrix_storage_filled:
+ return *get_filled_itr() == *r.get_filled_itr();
+ case matrix_storage_sparse:
+ return *get_sparse_itr() == *r.get_sparse_itr();
+ default:
+ assert(!"unknown storage type");
+ }
+ return false;
+ }
+
+ bool operator!= (const const_iterator& r) const
+ {
+ return !operator==(r);
+ }
+
+ private:
+ filled_access_type* get_filled_itr()
+ {
+ return static_cast<filled_access_type*>(m_const_itr_access);
+ }
+
+ const filled_access_type* get_filled_itr() const
+ {
+ return static_cast<const filled_access_type*>(m_const_itr_access);
+ }
+
+ sparse_access_type* get_sparse_itr()
+ {
+ return static_cast<sparse_access_type*>(m_const_itr_access);
+ }
+
+ const sparse_access_type* get_sparse_itr() const
+ {
+ return static_cast<const sparse_access_type*>(m_const_itr_access);
+ }
+
+ /**
+ * Stores new'ed instance of const_itr_access of the respective
+ * storage type. TODO: Find out if there is a way to store the
+ * const_itr_access instance in a type-safe way.
+ */
+ void* m_const_itr_access;
+
+ /**
+ * Matrix storage type which is either filled or sparse.
+ */
+ matrix_storage_t m_type;
+ };
+
+ storage_base(matrix_storage_t store_type, matrix_init_element_t init) :
+ m_store_type(store_type), m_init_type(init) {}
+
+ storage_base(const storage_base& r) :
+ m_store_type(r.m_store_type), m_init_type(r.m_init_type), m_flags(r.m_flags) {}
+
+ matrix_storage_t get_storage_type() const { return m_store_type; }
+
+ /**
+ * the destructor must remain virtual because the derived classes have
+ * different sizes. TODO: Figure out a way to remove the virtual-ness
+ * without leaking memory.
+ */
+ virtual ~storage_base() {}
+
+ const_iterator begin() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ {
+ void* p = static_cast<const filled_storage_type*>(this)->get_const_itr_access();
+ return const_iterator(p, m_store_type);
+ }
+ break;
+ case matrix_storage_sparse:
+ {
+ void* p = static_cast<const sparse_storage_type*>(this)->get_const_itr_access();
+ return const_iterator(p, m_store_type);
+ }
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ const_iterator end() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ {
+ void* p = static_cast<const filled_storage_type*>(this)->get_const_itr_access();
+ return const_iterator(p, m_store_type, true);
+ }
+ break;
+ case matrix_storage_sparse:
+ {
+ void* p = static_cast<const sparse_storage_type*>(this)->get_const_itr_access();
+ return const_iterator(p, m_store_type, true);
+ }
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ element& get_element(size_t row, size_t col)
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<filled_storage_type*>(this)->get_element(row, col);
+ case matrix_storage_sparse:
+ return static_cast<sparse_storage_type*>(this)->get_element(row, col);
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ matrix_element_t get_type(size_t row, size_t col) const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->get_type(row, col);
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->get_type(row, col);
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ double get_numeric(size_t row, size_t col) const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->get_numeric(row, col);
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->get_numeric(row, col);
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ const string_type* get_string(size_t row, size_t col) const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->get_string(row, col);
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->get_string(row, col);
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ bool get_boolean(size_t row, size_t col) const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->get_boolean(row, col);
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->get_boolean(row, col);
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ size_t rows() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->rows();
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->rows();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ size_t cols() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->cols();
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->cols();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ void transpose()
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ static_cast<filled_storage_type*>(this)->transpose();
+ break;
+ case matrix_storage_sparse:
+ static_cast<sparse_storage_type*>(this)->transpose();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+
+ void resize(size_t row, size_t col)
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ static_cast<filled_storage_type*>(this)->resize(row, col);
+ break;
+ case matrix_storage_sparse:
+ static_cast<sparse_storage_type*>(this)->resize(row, col);
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+
+ void clear()
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ static_cast<filled_storage_type*>(this)->clear();
+ break;
+ case matrix_storage_sparse:
+ static_cast<sparse_storage_type*>(this)->clear();
+ break;
+ default:
+ assert(!"unknown storage type");
+ }
+ }
+
+ bool numeric()
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<filled_storage_type*>(this)->numeric();
+ case matrix_storage_sparse:
+ return static_cast<sparse_storage_type*>(this)->numeric();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ bool empty() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->empty();
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->empty();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ storage_base* clone() const
+ {
+ switch (m_store_type)
+ {
+ case matrix_storage_filled:
+ return static_cast<const filled_storage_type*>(this)->clone();
+ case matrix_storage_sparse:
+ return static_cast<const sparse_storage_type*>(this)->clone();
+ default:
+ assert(!"unknown storage type");
+ }
+ throw matrix_storage_error("unknown storage type");
+ }
+
+ flag_storage& get_flag_storage() { return m_flags; }
+
+protected:
+ matrix_init_element_t get_init_type() const { return m_init_type; }
+
+private:
+ matrix_storage_t m_store_type;
+ matrix_init_element_t m_init_type;
+ flag_storage m_flags;
+};
+
+/**
+ * This storage creates instance for every single element, even for the
+ * empty elements.
+ */
+template<typename _MatrixType>
+class storage_filled : public ::mdds::storage_base<_MatrixType>
+{
+ typedef _MatrixType matrix_type;
+ typedef typename matrix_type::string_type string_type;
+
+public:
+ typedef typename matrix_type::element element;
+ typedef ::boost::ptr_vector<element> row_type;
+ typedef ::boost::ptr_vector<row_type> rows_type;
+
+ struct elem_wrap
+ {
+ const element& operator() (const typename row_type::const_iterator& itr) const
+ {
+ return *itr;
+ }
+ };
+ struct rows_wrap
+ {
+ const row_type& operator() (const typename rows_type::const_iterator& itr) const
+ {
+ return *itr;
+ }
+ };
+ typedef ::mdds::const_itr_access<storage_filled, elem_wrap, rows_wrap> const_itr_access;
+
+ storage_filled(size_t _rows, size_t _cols, matrix_init_element_t init_type) :
+ storage_base<matrix_type>(matrix_storage_filled, init_type),
+ m_numeric(false),
+ m_valid(false)
+ {
+ m_rows.reserve(_rows);
+ for (size_t i = 0; i < _rows; ++i)
+ {
+ m_rows.push_back(new row_type);
+ init_row(m_rows.back(), _cols);
+ }
+ }
+
+ storage_filled(const storage_filled& r) :
+ storage_base<matrix_type>(r),
+ m_rows(r.m_rows),
+ m_numeric(r.m_numeric),
+ m_valid(r.m_valid) {}
+
+ virtual ~storage_filled() {}
+
+ const_itr_access* get_const_itr_access() const
+ {
+ return new const_itr_access(*this);
+ }
+
+ element& get_element(size_t row, size_t col)
+ {
+ m_valid = false;
+ return m_rows.at(row).at(col);
+ }
+
+ matrix_element_t get_type(size_t row, size_t col) const
+ {
+ return m_rows.at(row).at(col).m_type;
+ }
+
+ double get_numeric(size_t row, size_t col) const
+ {
+ const element& elem = m_rows.at(row).at(col);
+ switch (elem.m_type)
+ {
+ case element_numeric:
+ return elem.m_numeric;
+ case element_boolean:
+ return static_cast<double>(elem.m_boolean);
+ case element_empty:
+ default:
+ ;
+ }
+ return 0.0;
+ }
+
+ const string_type* get_string(size_t row, size_t col) const
+ {
+ const element& elem = m_rows.at(row).at(col);
+ if (elem.m_type != element_string)
+ throw matrix_storage_error("element type is not string.");
+
+ return elem.mp_string;
+ }
+
+ bool get_boolean(size_t row, size_t col) const
+ {
+ const element& elem = m_rows.at(row).at(col);
+ if (elem.m_type != element_boolean)
+ throw matrix_storage_error("element type is not boolean.");
+
+ return elem.m_boolean;
+ }
+
+ size_t rows() const
+ {
+ return m_rows.size();
+ }
+
+ size_t cols() const
+ {
+ return m_rows.empty() ? 0 : m_rows[0].size();
+ }
+
+ void transpose()
+ {
+ rows_type trans_mx;
+ size_t row_size = rows(), col_size = cols();
+ trans_mx.reserve(col_size);
+ for (size_t col = 0; col < col_size; ++col)
+ {
+ trans_mx.push_back(new row_type);
+ row_type& trans_row = trans_mx.back();
+ trans_row.reserve(row_size);
+ for (size_t row = 0; row < row_size; ++row)
+ trans_row.push_back(new element(m_rows[row][col]));
+ }
+ m_rows.swap(trans_mx);
+ }
+
+ void resize(size_t row, size_t col)
+ {
+ m_valid = false;
+ if (!row || !col)
+ {
+ // Empty the matrix.
+ clear();
+ return;
+ }
+
+ size_t cur_rows = rows(), cur_cols = cols();
+
+ if (!cur_rows || !cur_cols)
+ {
+ // current matrix is empty.
+ rows_type new_rows;
+ new_rows.reserve(row);
+ for (size_t i = 0; i < row; ++i)
+ {
+ new_rows.push_back(new row_type);
+ init_row(new_rows.back(), col);
+ }
+ m_rows.swap(new_rows);
+ return;
+ }
+
+ if (row > cur_rows)
+ {
+ // Insert extra rows...
+ size_t new_row_count = row - cur_rows;
+ m_rows.reserve(row);
+ for (size_t i = 0; i < new_row_count; ++i)
+ {
+ m_rows.push_back(new row_type);
+ init_row(m_rows.back(), col);
+ }
+
+ resize_rows(cur_rows-1, cur_cols, col);
+ }
+ else if (cur_rows > row)
+ {
+ // Remove rows to new size.
+ m_rows.resize(row);
+ resize_rows(row-1, cur_cols, col);
+ }
+ else
+ {
+ assert(cur_rows == row);
+ resize_rows(cur_rows-1, cur_cols, col);
+ }
+ }
+
+ void clear()
+ {
+ m_rows.clear();
+ m_valid = true;
+ m_numeric = false;
+ }
+
+ bool numeric()
+ {
+ if (m_valid)
+ return m_numeric;
+
+ typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
+ for (; itr_row != itr_row_end; ++itr_row)
+ {
+ typename row_type::const_iterator itr_col = itr_row->begin(), itr_col_end = itr_row->end();
+ for (; itr_col != itr_col_end; ++itr_col)
+ {
+ matrix_element_t elem_type = itr_col->m_type;
+ if (elem_type != element_numeric && elem_type != element_boolean)
+ {
+ m_numeric = false;
+ m_valid = true;
+ return m_numeric;
+ }
+ }
+ }
+
+ m_numeric = true;
+ m_valid = true;
+ return m_numeric;
+ }
+
+ bool empty() const
+ {
+ return m_rows.empty();
+ }
+
+ ::mdds::storage_base<matrix_type>* clone() const
+ {
+ return new storage_filled(*this);
+ }
+
+ const rows_type& get_rows() const { return m_rows; }
+
+private:
+
+ /**
+ * Resize rows to a new column size, from row 0 up to specified upper
+ * row.
+ */
+ void resize_rows(size_t upper_row, size_t cur_cols, size_t new_cols)
+ {
+ for (size_t i = 0; i <= upper_row; ++i)
+ {
+ // Resize pre-existing rows to new column size.
+ if (new_cols > cur_cols)
+ {
+ size_t new_col_count = new_cols - cur_cols;
+ for (size_t j = 0; j < new_col_count; ++j)
+ insert_new_elem(m_rows[i]);
+ }
+ else if (new_cols < cur_cols)
+ m_rows[i].resize(new_cols);
+ }
+ }
+
+ void init_row(row_type& row, size_t col_size)
+ {
+ row.reserve(col_size);
+ for (size_t j = 0; j < col_size; ++j)
+ insert_new_elem(row);
+ }
+
+ void insert_new_elem(row_type& row)
+ {
+ matrix_init_element_t init_type = storage_base<matrix_type>::get_init_type();
+ switch (init_type)
+ {
+ case matrix_init_element_zero:
+ row.push_back(new element(static_cast<double>(0.0)));
+ break;
+ case matrix_init_element_empty:
+ row.push_back(new element);
+ break;
+ default:
+ throw matrix_storage_error("unknown init type.");
+ }
+ }
+
+private:
+ rows_type m_rows;
+ bool m_numeric:1;
+ bool m_valid:1;
+};
+
+/**
+ * This storage stores only non-empty elements.
+ */
+template<typename _MatrixType>
+class storage_sparse : public storage_base<_MatrixType>
+{
+ typedef _MatrixType matrix_type;
+
+ typedef typename matrix_type::string_type string_type;
+
+public:
+ typedef typename matrix_type::element element;
+ typedef ::boost::ptr_map<size_t, element> row_type;
+ typedef ::boost::ptr_map<size_t, row_type> rows_type;
+ struct elem_wrap
+ {
+ const element& operator() (const typename row_type::const_iterator& itr) const
+ {
+ return *itr->second;
+ }
+ };
+ struct rows_wrap
+ {
+ const row_type& operator() (const typename rows_type::const_iterator& itr) const
+ {
+ return *itr->second;
+ }
+ };
+ typedef ::mdds::const_itr_access<storage_sparse, elem_wrap, rows_wrap> const_itr_access;
+
+ storage_sparse(size_t _rows, size_t _cols, matrix_init_element_t init_type) :
+ storage_base<matrix_type>(matrix_storage_sparse, init_type),
+ m_row_size(_rows), m_col_size(_cols),
+ m_numeric(_rows && _cols), m_valid(true)
+ {
+ switch (storage_base<matrix_type>::get_init_type())
+ {
+ case matrix_init_element_zero:
+ m_empty_elem.m_type = element_numeric;
+ m_empty_elem.m_numeric = 0.0;
+ break;
+ default:
+ m_empty_elem.m_type = element_empty;
+ m_numeric = false;
+ }
+ }
+
+ storage_sparse(const storage_sparse& r) :
+ storage_base<matrix_type>(r),
+ m_rows(r.m_rows),
+ m_empty_elem(r.m_empty_elem),
+ m_row_size(r.m_row_size),
+ m_col_size(r.m_col_size) {}
+
+ virtual ~storage_sparse() {}
+
+ const_itr_access* get_const_itr_access() const { return new const_itr_access(*this); }
+
+ element & get_element(size_t row, size_t col)
+ {
+ if (row >= m_row_size || col >= m_col_size)
+ throw matrix_storage_error("specified element is out-of-bound.");
+
+ m_valid = false;
+
+ typename rows_type::iterator itr = m_rows.find(row);
+ if (itr == m_rows.end())
+ {
+ // Insert a brand-new row.
+ ::std::pair<typename rows_type::iterator, bool> r = m_rows.insert(row, new row_type);
+ if (!r.second)
+ throw matrix_storage_error("failed to insert a new row instance into storage_sparse.");
+ itr = r.first;
+ }
+
+ row_type& row_store = *itr->second;
+ typename row_type::iterator itr_elem = row_store.find(col);
+ if (itr_elem == row_store.end())
+ {
+ // Insert a new element at this column position.
+ ::std::pair<typename row_type::iterator, bool> r = row_store.insert(col, new element);
+ if (!r.second)
+ throw matrix_storage_error("failed to insert a new element instance.");
+ itr_elem = r.first;
+ }
+ return *itr_elem->second;
+ }
+
+ matrix_element_t get_type(size_t row, size_t col) const
+ {
+ typename rows_type::const_iterator itr = m_rows.find(row);
+ if (itr == m_rows.end())
+ return m_empty_elem.m_type;
+
+ const row_type& row_store = *itr->second;
+ typename row_type::const_iterator itr_elem = row_store.find(col);
+ if (itr_elem == row_store.end())
+ return m_empty_elem.m_type;
+
+ return itr_elem->second->m_type;
+ }
+
+ double get_numeric(size_t row, size_t col) const
+ {
+ const element& elem = get_non_empty_element(row, col);
+ switch (elem.m_type)
+ {
+ case element_numeric:
+ return elem.m_numeric;
+ case element_boolean:
+ return static_cast<double>(elem.m_boolean);
+ case element_empty:
+ default:
+ ;
+ }
+ return 0.0;
+ }
+
+ const string_type* get_string(size_t row, size_t col) const
+ {
+ matrix_element_t elem_type = get_type(row, col);
+ if (elem_type != element_string)
+ throw matrix_storage_error("element type is not string.");
+
+ return get_non_empty_element(row, col).mp_string;
+ }
+
+ bool get_boolean(size_t row, size_t col) const
+ {
+ matrix_element_t elem_type = get_type(row, col);
+ if (elem_type != element_boolean)
+ throw matrix_storage_error("element type is not string.");
+
+ return get_non_empty_element(row, col).m_boolean;
+ }
+
+ size_t rows() const
+ {
+ return m_row_size;
+ }
+
+ size_t cols() const
+ {
+ return m_col_size;
+ }
+
+ typedef ::std::pair<size_t, size_t> elem_pos_type;
+
+ struct elem_pos_sorter : public ::std::binary_function<elem_pos_type, elem_pos_type, bool>
+ {
+ bool operator() (const elem_pos_type& left, const elem_pos_type& right) const
+ {
+ if (left.first != right.first)
+ return left.first < right.first;
+ return left.second < right.second;
+ }
+ };
+
+ void transpose()
+ {
+ using namespace std;
+
+ rows_type trans;
+
+ // First, pick up the positions of all non-empty elements.
+ vector<elem_pos_type> filled_elems;
+ {
+ typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
+ for (; itr_row != itr_row_end; ++itr_row)
+ {
+ size_t row_idx = itr_row->first;
+ const row_type& row = *itr_row->second;
+ typename row_type::const_iterator itr_col = row.begin(), itr_col_end = row.end();
+ for (; itr_col != itr_col_end; ++itr_col)
+ {
+ // Be sure to swap the row and column indices.
+ filled_elems.push_back(elem_pos_type(itr_col->first, row_idx));
+ }
+ }
+ }
+ // Sort by row index first, then by column index.
+ sort(filled_elems.begin(), filled_elems.end(), elem_pos_sorter());
+
+ // Iterate through the non-empty element positions and perform
+ // transposition.
+ typename vector<elem_pos_type>::const_iterator
+ itr_pos = filled_elems.begin(), itr_pos_end = filled_elems.end();
+ while (itr_pos != itr_pos_end)
+ {
+ // First item of the new row.
+ size_t row_idx = itr_pos->first;
+ size_t col_idx = itr_pos->second;
+ pair<typename rows_type::iterator, bool> r = trans.insert(row_idx, new row_type);
+ if (!r.second)
+ throw matrix_storage_error("failed to insert a new row instance during transposition.");
+
+ typename rows_type::iterator itr_row = r.first;
+ row_type& row = *itr_row->second;
+ pair<typename row_type::iterator, bool> r2 =
+ row.insert(col_idx, new element(m_rows[col_idx][row_idx]));
+ if (!r2.second)
+ throw matrix_storage_error("afiled to insert a new element instance during transposition.");
+
+ // Keep iterating until we get a different row index.
+ for (++itr_pos; itr_pos != itr_pos_end && itr_pos->first == row_idx; ++itr_pos)
+ {
+ col_idx = itr_pos->second;
+ r2 = row.insert(col_idx, new element(m_rows[col_idx][row_idx]));
+ if (!r2.second)
+ throw matrix_storage_error("afiled to insert a new element instance during transposition.");
+ }
+ }
+
+ m_rows.swap(trans);
+ ::std::swap(m_row_size, m_col_size);
+ }
+
+ void resize(size_t row, size_t col)
+ {
+ m_valid = false;
+
+ if (!row || !col)
+ {
+ clear();
+ return;
+ }
+
+ // Resizing a sparse matrix need to modify the data only when
+ // shrinking.
+
+ if (m_row_size > row)
+ {
+ // Remove all rows where the row index is greater than or
+ // equal to 'row'.
+ typename rows_type::iterator itr = m_rows.lower_bound(row);
+ m_rows.erase(itr, m_rows.end());
+ }
+
+ if (m_col_size > col)
+ {
+ typename rows_type::iterator itr = m_rows.begin(), itr_end = m_rows.end();
+ for (; itr != itr_end; ++itr)
+ {
+ // Now, remove all columns where the column index is
+ // greater than or equal to 'col'.
+ row_type& row_container = *itr->second;
+ typename row_type::iterator itr_elem = row_container.lower_bound(col);
+ row_container.erase(itr_elem, row_container.end());
+ }
+ }
+
+ m_row_size = row;
+ m_col_size = col;
+ }
+
+ void clear()
+ {
+ m_rows.clear();
+ m_row_size = 0;
+ m_col_size = 0;
+ m_valid = true;
+ m_numeric = false;
+ }
+
+ bool numeric()
+ {
+ using namespace std;
+
+ if (m_valid)
+ return m_numeric;
+
+ size_t non_empty_count = 0;
+ typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
+ for (; itr_row != itr_row_end; ++itr_row)
+ {
+ const row_type& row = *itr_row->second;
+ non_empty_count += row.size();
+ assert(row.size() <= m_col_size);
+ typename row_type::const_iterator itr_col = row.begin(), itr_col_end = row.end();
+ for (; itr_col != itr_col_end; ++itr_col)
+ {
+ const element& elem = *itr_col->second;
+ if (elem.m_type != element_numeric && elem.m_type != element_boolean)
+ {
+ m_valid = true;
+ m_numeric = false;
+ return m_numeric;
+ }
+ }
+ }
+
+ // All non-empty elements are numeric.
+
+ matrix_init_element_t init_type = storage_base<matrix_type>::get_init_type();
+ if (init_type == matrix_init_element_zero)
+ m_numeric = true;
+ else
+ {
+ size_t total_elem_count = m_row_size * m_col_size;
+ assert(non_empty_count <= total_elem_count);
+ m_numeric = total_elem_count == non_empty_count;
+ }
+
+ m_valid = true;
+ return m_numeric;
+ }
+
+ bool empty() const
+ {
+ // If one of row and column sizes are zero, the other size must be
+ // zero, and vise versa.
+ assert((!m_row_size && !m_col_size) || (m_row_size && m_col_size));
+
+ return m_row_size == 0 || m_col_size == 0;
+ }
+
+ storage_base<matrix_type>* clone() const
+ {
+ return new storage_sparse(*this);
+ }
+
+ const rows_type& get_rows() const { return m_rows; }
+
+private:
+ const element& get_non_empty_element(size_t row, size_t col) const
+ {
+ typename rows_type::const_iterator itr = m_rows.find(row);
+ if (itr == m_rows.end())
+ return m_empty_elem;
+
+ const row_type& row_store = *itr->second;
+ typename row_type::const_iterator itr_elem = row_store.find(col);
+ if (itr_elem == row_store.end())
+ return m_empty_elem;
+ return *itr_elem->second;
+ }
+
+private:
+ rows_type m_rows;
+ element m_empty_elem;
+ size_t m_row_size;
+ size_t m_col_size;
+ bool m_numeric:1;
+ bool m_valid:1;
+};
+
+}
+
+#endif
diff --git a/include/mdds/quad_type_matrix.hpp b/include/mdds/quad_type_matrix.hpp
deleted file mode 100644
index 4093e2b..0000000
--- a/include/mdds/quad_type_matrix.hpp
+++ /dev/null
@@ -1,1269 +0,0 @@
-/*************************************************************************
- *
- * Copyright (c) 2010 Kohei Yoshida
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- ************************************************************************/
-
-#ifndef __MDDS_QUAD_TYPE_MATRIX_HPP__
-#define __MDDS_QUAD_TYPE_MATRIX_HPP__
-
-#include "mdds/global.hpp"
-#include "mdds/hash_container/map.hpp"
-
-#include <iostream>
-#include <cstdlib>
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/ptr_container/ptr_map.hpp>
-
-namespace mdds {
-
-enum matrix_density_t
-{
- matrix_density_filled_zero,
- matrix_density_filled_empty,
- matrix_density_sparse_zero,
- matrix_density_sparse_empty
-};
-
-enum matrix_element_t
-{
- element_empty = 0,
- element_numeric = 1,
- element_boolean = 2,
- element_string = 3
-};
-
-enum matrix_init_element_t
-{
- matrix_init_element_zero,
- matrix_init_element_empty
-};
-
-class matrix_error : public ::mdds::general_error
-{
-public:
- matrix_error(const ::std::string& msg) : general_error(msg) {}
-};
-
-matrix_init_element_t get_init_element_type(matrix_density_t density)
-{
- switch (density)
- {
- case matrix_density_filled_empty:
- case matrix_density_sparse_empty:
- return matrix_init_element_empty;
- case matrix_density_filled_zero:
- case matrix_density_sparse_zero:
- return matrix_init_element_zero;
- default:
- throw matrix_error("unknown matrix density type.");
- }
-}
-
-/**
- * This data structure represents a matrix where each individual element may
- * be of one of four types: value, boolean, string, or empty.
- */
-template<typename _String, typename _Flag>
-class quad_type_matrix
-{
-public:
- typedef _String string_type;
- typedef _Flag flag_type;
- typedef size_t size_type;
- typedef ::std::pair<size_type, size_type> size_pair_type;
-
- /**
- * Default constructor.
- */
- quad_type_matrix();
-
- /**
- * Construct an empty matrix with specified density type.
- */
- quad_type_matrix(matrix_density_t density);
-
- /**
- * Construct a matrix of specified size with specified density type.
- */
- quad_type_matrix(size_t rows, size_t cols, matrix_density_t density);
-
- quad_type_matrix(const quad_type_matrix& r);
- ~quad_type_matrix();
-
- quad_type_matrix& operator= (const quad_type_matrix& r);
-
- /**
- * Get the type of element specified by its position. The type can be one
- * of empty, string, numeric, or boolean.
- *
- * @return element type.
- */
- matrix_element_t get_type(size_t row, size_t col) const;
-
- double get_numeric(size_t row, size_t col) const;
- bool get_boolean(size_t row, size_t col) const;
- const string_type* get_string(size_t row, size_t col) const;
-
- void set_numeric(size_t row, size_t col, double val);
- void set_boolean(size_t row, size_t col, bool val);
- void set_string(size_t row, size_t col, string_type* str);
- void set_empty(size_t row, size_t col);
-
- void set(size_t row, size_t col, double val);
- void set(size_t row, size_t col, bool val);
- void set(size_t row, size_t col, string_type* str);
-
- /**
- * Set flag value at specified position.
- *
- * @param row row position
- * @param col column position
- * @param flag_type flag value
- */
- void set_flag(size_t row, size_t col, flag_type flag);
-
- /**
- * Get flag value at specified position.
- *
- * @param row row position
- * @param col column position
- *
- * @return flag value stored at specified position
- */
- flag_type get_flag(size_t row, size_t col) const;
-
- void clear_flag(size_t row, size_t cols);
-
- /**
- * Return the size of matrix as a pair. The first value is the row size,
- * while the second value is the column size.
- *
- * @return matrix size as a value pair.
- */
- size_pair_type size() const;
-
- /**
- * Transpose the stored matrix data.
- *
- * @return reference to this matrix instance.
- */
- quad_type_matrix& transpose();
-
- /**
- * Assign values from the passed matrix instance. If the size of the
- * passed matrix is smaller, then the element values are assigned by their
- * positions, while the rest of the elements that fall outside the size of
- * the passed matrix instance will remain unmodified. If the size of the
- * pass matrix instance is larger, then only the elements within the size
- * of this matrix instance will get assigned.
- *
- * @param r passed matrix object to assign element values from.
- */
- void assign(const quad_type_matrix& r);
-
- /**
- * Resize the matrix to specified size. This method supports resizing to
- * zero-sized matrix; however, either specifying the row or column size to
- * zero will resize the matrix to 0 x 0.
- *
- * @param row new row size
- * @param col new column size
- */
- void resize(size_t row, size_t col);
-
- /**
- * Empty the matrix.
- */
- void clear();
-
- /**
- * Check whether or not this matrix is numeric. A numeric matrix contains
- * only numeric or boolean elements.
- *
- * @return true if the matrix contains only numeric or boolean elements,
- * or false otherwise.
- */
- bool numeric() const;
-
- /**
- * Check whether or not this matrix is empty.
- *
- * @return true if this matrix is empty, or false otherwise.
- */
- bool empty() const;
-
- /**
- * Swap the content of the matrix with another instance.
- */
- void swap(quad_type_matrix& r);
-
-#ifdef UNIT_TEST
- void dump() const;
- void dump_flags() const;
-#endif
-
-private:
- struct size_pair_type_hash
- {
- size_t operator() (const size_pair_type& val) const
- {
- size_t n = val.first + (val.second << 8);
- return n;
- }
- };
- typedef _mdds_unordered_map_type<size_pair_type, flag_type, size_pair_type_hash> flag_store_type;
-
- class flag_storage
- {
- public:
- flag_storage() {}
- flag_storage(const flag_storage& r) : m_flags(r.m_flags) {}
-
- void set_flag(size_t row, size_t col, flag_type flag)
- {
- size_pair_type pos = size_pair_type(row, col);
- typename flag_store_type::iterator itr = m_flags.find(pos);
- if (itr == m_flags.end())
- {
- // flag not stored for this position.
- ::std::pair<typename flag_store_type::iterator, bool> r =
- m_flags.insert(typename flag_store_type::value_type(pos, flag));
- return;
- }
- itr->second = flag;
- }
-
- flag_type get_flag(size_t row, size_t col)
- {
- size_pair_type pos = size_pair_type(row, col);
- typename flag_store_type::iterator itr = m_flags.find(pos);
- return itr == m_flags.end() ? static_cast<flag_type>(0) : itr->second;
- }
-
- void clear_flag(size_t row, size_t col)
- {
- size_pair_type pos = size_pair_type(row, col);
- typename flag_store_type::iterator itr = m_flags.find(pos);
- if (itr != m_flags.end())
- // Flag is stored at this position. Remove it.
- m_flags.erase(itr);
- }
-#if UNIT_TEST
- void dump() const
- {
- using namespace std;
- if (m_flags.empty())
- {
- cout << "no flags stored" << endl;
- return;
- }
-
- cout << "flags stored:" << endl;
- typename flag_store_type::const_iterator itr = m_flags.begin(), itr_end = m_flags.end();
- for (; itr != itr_end; ++itr)
- {
- const size_pair_type& pos = itr->first;
- flag_type val = itr->second;
- cout << "(row=" << pos.first << ",col=" << pos.second << ") = 0x" << hex << static_cast<size_t>(val) << endl;
- }
- }
-#endif
- private:
- flag_store_type m_flags;
- };
-
- struct element
- {
- matrix_element_t m_type:2;
-
- union
- {
- double m_numeric;
- bool m_boolean;
- string_type* mp_string;
- };
-
- element() : m_type(element_empty) {}
- element(const element& r) : m_type(r.m_type)
- {
- switch (m_type)
- {
- case element_boolean:
- m_boolean = r.m_boolean;
- break;
- case element_numeric:
- m_numeric = r.m_numeric;
- break;
- case element_string:
- mp_string = new string_type(*r.mp_string);
- break;
- case element_empty:
- default:
- ;
- }
- }
-
- explicit element(double v) : m_type(element_numeric), m_numeric(v) {}
- explicit element(bool v) : m_type(element_boolean), m_boolean(v) {}
- explicit element(string_type* p) : m_type(element_string), mp_string(p) {}
-
- bool operator== (const element& r) const
- {
- if (m_type != r.m_type)
- return false;
-
- switch (m_type)
- {
- case element_boolean:
- return m_boolean == r.m_boolean;
- case element_numeric:
- return m_numeric == r.m_numeric;
- case element_string:
- return *mp_string == *r.mp_string;
- case element_empty:
- default:
- ;
- }
-
- return true;
- }
-
- element& operator= (const element& r)
- {
- if (m_type == element_string)
- delete mp_string;
-
- m_type = r.m_type;
-
- switch (m_type)
- {
- case element_boolean:
- m_boolean = r.m_boolean;
- break;
- case element_numeric:
- m_numeric = r.m_numeric;
- break;
- case element_string:
- mp_string = new string_type(*r.mp_string);
- break;
- case element_empty:
- default:
- ;
- }
- return *this;
- }
-
- ~element()
- {
- if (m_type == element_string)
- delete mp_string;
- }
-
- void set_empty()
- {
- if (m_type == element_string)
- delete mp_string;
- m_type = element_empty;
- }
-
- void set_numeric(double val)
- {
- if (m_type == element_string)
- delete mp_string;
- m_type = element_numeric;
- m_numeric = val;
- }
-
- void set_boolean(bool val)
- {
- if (m_type == element_string)
- delete mp_string;
- m_type = element_boolean;
- m_boolean = val;
- }
-
- void set_string(string_type* str)
- {
- if (m_type == element_string)
- delete mp_string;
- m_type = element_string;
- mp_string = str;
- }
- };
-
- class storage_base
- {
- public:
- storage_base(matrix_init_element_t init) : m_init_type(init) {}
- storage_base(const storage_base& r) : m_init_type(r.m_init_type), m_flags(r.m_flags) {}
-
- virtual ~storage_base() {}
-
- virtual element& get_element(size_t row, size_t col) = 0;
-
- virtual matrix_element_t get_type(size_t row, size_t col) const = 0;
-
- virtual double get_numeric(size_t row, size_t col) const = 0;
- virtual const string_type* get_string(size_t row, size_t col) const = 0;
- virtual bool get_boolean(size_t row, size_t col) const = 0;
-
- virtual size_t rows() const = 0;
- virtual size_t cols() const = 0;
-
- virtual void transpose() = 0;
- virtual void resize(size_t row, size_t col) = 0;
- virtual void clear() = 0;
- virtual bool numeric() = 0;
- virtual bool empty() const = 0;
-
- virtual storage_base* clone() const = 0;
-
- flag_storage& get_flag_storage() { return m_flags; }
-
- protected:
- matrix_init_element_t get_init_type() const { return m_init_type; }
-
- private:
- matrix_init_element_t m_init_type;
- flag_storage m_flags;
- };
-
- /**
- * This storage creates instance for every single element, even for the
- * empty elements.
- */
- class storage_filled : public storage_base
- {
- typedef ::boost::ptr_vector<element> row_type;
- typedef ::boost::ptr_vector<row_type> rows_type;
-
- public:
- storage_filled(size_t _rows, size_t _cols, matrix_init_element_t init_type) :
- storage_base(init_type),
- m_numeric(false),
- m_valid(false)
- {
- m_rows.reserve(_rows);
- for (size_t i = 0; i < _rows; ++i)
- {
- m_rows.push_back(new row_type);
- init_row(m_rows.back(), _cols);
- }
- }
-
- storage_filled(const storage_filled& r) :
- storage_base(r),
- m_rows(r.m_rows),
- m_numeric(r.m_numeric),
- m_valid(r.m_valid) {}
-
- virtual ~storage_filled() {}
-
- virtual element& get_element(size_t row, size_t col)
- {
- m_valid = false;
- return m_rows.at(row).at(col);
- }
-
- virtual matrix_element_t get_type(size_t row, size_t col) const
- {
- return m_rows.at(row).at(col).m_type;
- }
-
- virtual double get_numeric(size_t row, size_t col) const
- {
- const element& elem = m_rows.at(row).at(col);
- if (elem.m_type != element_numeric && elem.m_type != element_boolean)
- throw matrix_error("element type is not numeric.");
-
- if (elem.m_type == element_boolean)
- return static_cast<double>(elem.m_boolean);
-
- return elem.m_numeric;
- }
-
- virtual const string_type* get_string(size_t row, size_t col) const
- {
- const element& elem = m_rows.at(row).at(col);
- if (elem.m_type != element_string)
- throw matrix_error("element type is not string.");
-
- return elem.mp_string;
- }
-
- virtual bool get_boolean(size_t row, size_t col) const
- {
- const element& elem = m_rows.at(row).at(col);
- if (elem.m_type != element_boolean)
- throw matrix_error("element type is not boolean.");
-
- return elem.m_boolean;
- }
-
- virtual size_t rows() const
- {
- return m_rows.size();
- }
-
- virtual size_t cols() const
- {
- return m_rows.empty() ? 0 : m_rows[0].size();
- }
-
- virtual void transpose()
- {
- rows_type trans_mx;
- size_t row_size = rows(), col_size = cols();
- trans_mx.reserve(col_size);
- for (size_t col = 0; col < col_size; ++col)
- {
- trans_mx.push_back(new row_type);
- row_type& trans_row = trans_mx.back();
- trans_row.reserve(row_size);
- for (size_t row = 0; row < row_size; ++row)
- trans_row.push_back(new element(m_rows[row][col]));
- }
- m_rows.swap(trans_mx);
- }
-
- virtual void resize(size_t row, size_t col)
- {
- m_valid = false;
- if (!row || !col)
- {
- // Empty the matrix.
- clear();
- return;
- }
-
- size_t cur_rows = rows(), cur_cols = cols();
-
- if (row > cur_rows)
- {
- // Insert extra rows...
- size_t new_row_count = row - cur_rows;
- m_rows.reserve(row);
- for (size_t i = 0; i < new_row_count; ++i)
- {
- m_rows.push_back(new row_type);
- init_row(m_rows.back(), col);
- }
-
- resize_rows(cur_rows-1, cur_cols, col);
- }
- else if (cur_rows > row)
- {
- // Remove rows to new size.
- m_rows.resize(row);
- resize_rows(row-1, cur_cols, col);
- }
- else
- {
- assert(cur_rows == row);
- resize_rows(cur_rows-1, cur_cols, col);
- }
- }
-
- virtual void clear()
- {
- m_rows.clear();
- m_valid = true;
- m_numeric = false;
- }
-
- virtual bool numeric()
- {
- if (m_valid)
- return m_numeric;
-
- typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
- for (; itr_row != itr_row_end; ++itr_row)
- {
- typename row_type::const_iterator itr_col = itr_row->begin(), itr_col_end = itr_row->end();
- for (; itr_col != itr_col_end; ++itr_col)
- {
- matrix_element_t elem_type = itr_col->m_type;
- if (elem_type != element_numeric && elem_type != element_boolean)
- {
- m_numeric = false;
- m_valid = true;
- return m_numeric;
- }
- }
- }
-
- m_numeric = true;
- m_valid = true;
- return m_numeric;
- }
-
- virtual bool empty() const
- {
- return m_rows.empty();
- }
-
- virtual storage_base* clone() const
- {
- return new storage_filled(*this);
- }
-
- private:
-
- /**
- * Resize rows to a new column size, from row 0 up to specified upper
- * row.
- */
- void resize_rows(size_t upper_row, size_t cur_cols, size_t new_cols)
- {
- for (size_t i = 0; i <= upper_row; ++i)
- {
- // Resize pre-existing rows to new column size.
- if (new_cols > cur_cols)
- {
- size_t new_col_count = new_cols - cur_cols;
- for (size_t j = 0; j < new_col_count; ++j)
- insert_new_elem(m_rows[i]);
- }
- else if (new_cols < cur_cols)
- m_rows[i].resize(new_cols);
- }
- }
-
- void init_row(row_type& row, size_t col_size)
- {
- row.reserve(col_size);
- for (size_t j = 0; j < col_size; ++j)
- insert_new_elem(row);
- }
-
- void insert_new_elem(row_type& row)
- {
- matrix_init_element_t init_type = storage_base::get_init_type();
- switch (init_type)
- {
- case matrix_init_element_zero:
- row.push_back(new element(static_cast<double>(0.0)));
- break;
- case matrix_init_element_empty:
- row.push_back(new element);
- break;
- default:
- throw matrix_error("unknown init type.");
- }
- }
-
- private:
- rows_type m_rows;
- bool m_numeric:1;
- bool m_valid:1;
- };
-
- /**
- * This storage stores only non-empty elements.
- */
- class storage_sparse : public storage_base
- {
- typedef ::boost::ptr_map<size_t, element> row_type;
- typedef ::boost::ptr_map<size_t, row_type> rows_type;
-
- public:
- storage_sparse(size_t _rows, size_t _cols, matrix_init_element_t init_type) :
- storage_base(init_type),
- m_row_size(_rows), m_col_size(_cols),
- m_numeric(_rows && _cols), m_valid(true)
- {
- switch (storage_base::get_init_type())
- {
- case matrix_init_element_zero:
- m_empty_elem.m_type = element_numeric;
- m_empty_elem.m_numeric = 0.0;
- break;
- default:
- m_empty_elem.m_type = element_empty;
- m_numeric = false;
- }
- }
-
- storage_sparse(const storage_sparse& r) :
- storage_base(r),
- m_rows(r.m_rows),
- m_empty_elem(r.m_empty_elem),
- m_row_size(r.m_row_size),
- m_col_size(r.m_col_size) {}
-
- virtual ~storage_sparse() {}
-
- virtual element & get_element(size_t row, size_t col)
- {
- if (row >= m_row_size || col >= m_col_size)
- throw matrix_error("specified element is out-of-bound.");
-
- m_valid = false;
-
- typename rows_type::iterator itr = m_rows.find(row);
- if (itr == m_rows.end())
- {
- // Insert a brand-new row.
- ::std::pair<typename rows_type::iterator, bool> r = m_rows.insert(row, new row_type);
- if (!r.second)
- throw matrix_error("failed to insert a new row instance into storage_sparse.");
- itr = r.first;
- }
-
- row_type& row_store = *itr->second;
- typename row_type::iterator itr_elem = row_store.find(col);
- if (itr_elem == row_store.end())
- {
- // Insert a new element at this column position.
- ::std::pair<typename row_type::iterator, bool> r = row_store.insert(col, new element);
- if (!r.second)
- throw matrix_error("failed to insert a new element instance.");
- itr_elem = r.first;
- }
- return *itr_elem->second;
- }
-
- virtual matrix_element_t get_type(size_t row, size_t col) const
- {
- typename rows_type::const_iterator itr = m_rows.find(row);
- if (itr == m_rows.end())
- return m_empty_elem.m_type;
-
- const row_type& row_store = *itr->second;
- typename row_type::const_iterator itr_elem = row_store.find(col);
- if (itr_elem == row_store.end())
- return m_empty_elem.m_type;
-
- return itr_elem->second->m_type;
- }
-
- virtual double get_numeric(size_t row, size_t col) const
- {
- matrix_element_t elem_type = get_type(row, col);
- if (elem_type != element_numeric && elem_type != element_boolean)
- throw matrix_error("element type is not numeric.");
-
- const element& elem = get_non_empty_element(row, col);
-
- if (elem.m_type == element_boolean)
- return static_cast<double>(elem.m_boolean);
-
- return elem.m_numeric;
- }
-
- virtual const string_type* get_string(size_t row, size_t col) const
- {
- matrix_element_t elem_type = get_type(row, col);
- if (elem_type != element_string)
- throw matrix_error("element type is not string.");
-
- return get_non_empty_element(row, col).mp_string;
- }
-
- virtual bool get_boolean(size_t row, size_t col) const
- {
- matrix_element_t elem_type = get_type(row, col);
- if (elem_type != element_boolean)
- throw matrix_error("element type is not string.");
-
- return get_non_empty_element(row, col).m_boolean;
- }
-
- virtual size_t rows() const
- {
- return m_row_size;
- }
-
- virtual size_t cols() const
- {
- return m_col_size;
- }
-
- typedef ::std::pair<size_t, size_t> elem_pos_type;
-
- struct elem_pos_sorter : ::std::binary_function<elem_pos_type, elem_pos_type, bool>
- {
- bool operator() (const elem_pos_type& left, const elem_pos_type& right) const
- {
- if (left.first != right.first)
- return left.first < right.first;
- return left.second < right.second;
- }
- };
-
- virtual void transpose()
- {
- using namespace std;
-
- rows_type trans;
-
- // First, pick up the positions of all non-empty elements.
- vector<elem_pos_type> filled_elems;
- {
- typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
- for (; itr_row != itr_row_end; ++itr_row)
- {
- size_t row_idx = itr_row->first;
- const row_type& row = *itr_row->second;
- typename row_type::const_iterator itr_col = row.begin(), itr_col_end = row.end();
- for (; itr_col != itr_col_end; ++itr_col)
- {
- // Be sure to swap the row and column indices.
- filled_elems.push_back(elem_pos_type(itr_col->first, row_idx));
- }
- }
- }
- // Sort by row index first, then by column index.
- sort(filled_elems.begin(), filled_elems.end(), elem_pos_sorter());
-
- // Iterate through the non-empty element positions and perform
- // transposition.
- typename vector<elem_pos_type>::const_iterator
- itr_pos = filled_elems.begin(), itr_pos_end = filled_elems.end();
- while (itr_pos != itr_pos_end)
- {
- // First item of the new row.
- size_t row_idx = itr_pos->first;
- size_t col_idx = itr_pos->second;
- pair<typename rows_type::iterator, bool> r = trans.insert(row_idx, new row_type);
- if (!r.second)
- throw matrix_error("failed to insert a new row instance during transposition.");
-
- typename rows_type::iterator itr_row = r.first;
- row_type& row = *itr_row->second;
- pair<typename row_type::iterator, bool> r2 =
- row.insert(col_idx, new element(m_rows[col_idx][row_idx]));
- if (!r2.second)
- throw matrix_error("afiled to insert a new element instance during transposition.");
-
- // Keep iterating until we get a different row index.
- for (++itr_pos; itr_pos != itr_pos_end && itr_pos->first == row_idx; ++itr_pos)
- {
- col_idx = itr_pos->second;
- r2 = row.insert(col_idx, new element(m_rows[col_idx][row_idx]));
- if (!r2.second)
- throw matrix_error("afiled to insert a new element instance during transposition.");
- }
- }
-
- m_rows.swap(trans);
- ::std::swap(m_row_size, m_col_size);
- }
-
- virtual void resize(size_t row, size_t col)
- {
- m_valid = false;
-
- if (!row || !col)
- {
- clear();
- return;
- }
-
- // Resizing a sparse matrix need to modify the data only when
- // shrinking.
-
- if (m_row_size > row)
- {
- // Remove all rows where the row index is greater than or
- // equal to 'row'.
- typename rows_type::iterator itr = m_rows.lower_bound(row);
- m_rows.erase(itr, m_rows.end());
- }
-
- if (m_col_size > col)
- {
- typename rows_type::iterator itr = m_rows.begin(), itr_end = m_rows.end();
- for (; itr != itr_end; ++itr)
- {
- // Now, remove all columns where the column index is
- // greater than or equal to 'col'.
- row_type& row_container = *itr->second;
- typename row_type::iterator itr_elem = row_container.lower_bound(col);
- row_container.erase(itr_elem, row_container.end());
- }
- }
-
- m_row_size = row;
- m_col_size = col;
- }
-
- virtual void clear()
- {
- m_rows.clear();
- m_row_size = 0;
- m_col_size = 0;
- m_valid = true;
- m_numeric = false;
- }
-
- virtual bool numeric()
- {
- using namespace std;
-
- if (m_valid)
- return m_numeric;
-
- size_t non_empty_count = 0;
- typename rows_type::const_iterator itr_row = m_rows.begin(), itr_row_end = m_rows.end();
- for (; itr_row != itr_row_end; ++itr_row)
- {
- const row_type& row = *itr_row->second;
- non_empty_count += row.size();
- assert(row.size() <= m_col_size);
- typename row_type::const_iterator itr_col = row.begin(), itr_col_end = row.end();
- for (; itr_col != itr_col_end; ++itr_col)
- {
- const element& elem = *itr_col->second;
- if (elem.m_type != element_numeric && elem.m_type != element_boolean)
- {
- m_valid = true;
- m_numeric = false;
- return m_numeric;
- }
- }
- }
-
- // All non-empty elements are numeric.
-
- matrix_init_element_t init_type = storage_base::get_init_type();
- if (init_type == matrix_init_element_zero)
- m_numeric = true;
- else
- {
- size_t total_elem_count = m_row_size * m_col_size;
- assert(non_empty_count <= total_elem_count);
- m_numeric = total_elem_count == non_empty_count;
- }
-
- m_valid = true;
- return m_numeric;
- }
-
- virtual bool empty() const
- {
- // If one of row and column sizes are zero, the other size must be
- // zero, and vise versa.
- assert((!m_row_size && !m_col_size) || (m_row_size && m_col_size));
-
- return m_row_size == 0 || m_col_size == 0;
- }
-
- virtual storage_base* clone() const
- {
- return new storage_sparse(*this);
- }
-
- private:
- const element& get_non_empty_element(size_t row, size_t col) const
- {
- typename rows_type::const_iterator itr = m_rows.find(row);
- if (itr == m_rows.end())
- return m_empty_elem;
-
- const row_type& row_store = *itr->second;
- typename row_type::const_iterator itr_elem = row_store.find(col);
- if (itr_elem == row_store.end())
- return m_empty_elem;
- return *itr_elem->second;
- }
-
- private:
- rows_type m_rows;
- element m_empty_elem;
- size_t m_row_size;
- size_t m_col_size;
- bool m_numeric:1;
- bool m_valid:1;
- };
-
-private:
- static storage_base* create_storage(size_t rows, size_t cols, matrix_density_t density);
-
-private:
- storage_base* mp_storage;
-};
-
-template<typename _String, typename _Flag>
-typename quad_type_matrix<_String,_Flag>::storage_base*
-quad_type_matrix<_String,_Flag>::create_storage(size_t rows, size_t cols, matrix_density_t density)
-{
- switch (density)
- {
- case matrix_density_filled_zero:
- return new storage_filled(rows, cols, matrix_init_element_zero);
- case matrix_density_filled_empty:
- return new storage_filled(rows, cols, matrix_init_element_empty);
- case matrix_density_sparse_zero:
- return new storage_sparse(rows, cols, matrix_init_element_zero);
- case matrix_density_sparse_empty:
- return new storage_sparse(rows, cols, matrix_init_element_empty);
- default:
- throw matrix_error("unknown density type");
- }
- return NULL;
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>::quad_type_matrix() :
- mp_storage(NULL)
-{
- mp_storage = create_storage(0, 0, matrix_density_filled_zero);
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>::quad_type_matrix(matrix_density_t density) :
- mp_storage(NULL)
-{
- mp_storage = create_storage(0, 0, density);
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>::quad_type_matrix(size_t rows, size_t cols, matrix_density_t density) :
- mp_storage(NULL)
-{
- mp_storage = create_storage(rows, cols, density);
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>::quad_type_matrix(const quad_type_matrix& r) :
- mp_storage(r.mp_storage->clone())
-{
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>::~quad_type_matrix()
-{
- delete mp_storage;
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>&
-quad_type_matrix<_String,_Flag>::operator= (const quad_type_matrix& r)
-{
- if (this == &r)
- // self assignment.
- return *this;
-
- delete mp_storage;
- mp_storage = r.mp_storage->clone();
- return *this;
-}
-
-template<typename _String, typename _Flag>
-matrix_element_t quad_type_matrix<_String,_Flag>::get_type(size_t row, size_t col) const
-{
- return mp_storage->get_type(row, col);
-}
-
-template<typename _String, typename _Flag>
-double quad_type_matrix<_String,_Flag>::get_numeric(size_t row, size_t col) const
-{
- return mp_storage->get_numeric(row, col);
-}
-
-template<typename _String, typename _Flag>
-bool quad_type_matrix<_String,_Flag>::get_boolean(size_t row, size_t col) const
-{
- return mp_storage->get_boolean(row, col);
-}
-
-template<typename _String, typename _Flag>
-const typename quad_type_matrix<_String,_Flag>::string_type*
-quad_type_matrix<_String,_Flag>::get_string(size_t row, size_t col) const
-{
- return mp_storage->get_string(row, col);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set_numeric(size_t row, size_t col, double val)
-{
- mp_storage->get_element(row, col).set_numeric(val);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set_boolean(size_t row, size_t col, bool val)
-{
- mp_storage->get_element(row, col).set_boolean(val);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set_string(size_t row, size_t col, string_type* str)
-{
- mp_storage->get_element(row, col).set_string(str);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set_flag(size_t row, size_t col, flag_type flag)
-{
- mp_storage->get_flag_storage().set_flag(row, col, flag);
-}
-
-template<typename _String, typename _Flag>
-typename quad_type_matrix<_String,_Flag>::flag_type
-quad_type_matrix<_String,_Flag>::get_flag(size_t row, size_t col) const
-{
- return mp_storage->get_flag_storage().get_flag(row, col);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::clear_flag(size_t row, size_t col)
-{
- return mp_storage->get_flag_storage().clear_flag(row, col);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set_empty(size_t row, size_t col)
-{
- mp_storage->get_element(row, col).set_empty();
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set(size_t row, size_t col, double val)
-{
- set_numeric(row, col, val);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set(size_t row, size_t col, bool val)
-{
- set_boolean(row, col, val);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::set(size_t row, size_t col, string_type* str)
-{
- set_string(row, col, str);
-}
-
-template<typename _String, typename _Flag>
-typename quad_type_matrix<_String,_Flag>::size_pair_type
-quad_type_matrix<_String,_Flag>::size() const
-{
- size_pair_type size_pair(mp_storage->rows(), mp_storage->cols());
- return size_pair;
-}
-
-template<typename _String, typename _Flag>
-quad_type_matrix<_String,_Flag>&
-quad_type_matrix<_String,_Flag>::transpose()
-{
- mp_storage->transpose();
- return *this;
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::assign(const quad_type_matrix& r)
-{
- if (this == &r)
- // assignment to self.
- return;
-
- size_t row_count = ::std::min(mp_storage->rows(), r.mp_storage->rows());
- size_t col_count = ::std::min(mp_storage->cols(), r.mp_storage->cols());
- for (size_t i = 0; i < row_count; ++i)
- for (size_t j = 0; j < col_count; ++j)
- mp_storage->get_element(i, j) = r.mp_storage->get_element(i, j);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::resize(size_t row, size_t col)
-{
- mp_storage->resize(row, col);
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::clear()
-{
- mp_storage->clear();
-}
-
-template<typename _String, typename _Flag>
-bool quad_type_matrix<_String,_Flag>::numeric() const
-{
- return mp_storage->numeric();
-}
-
-template<typename _String, typename _Flag>
-bool quad_type_matrix<_String,_Flag>::empty() const
-{
- return mp_storage->empty();
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::swap(quad_type_matrix& r)
-{
- ::std::swap(mp_storage, r.mp_storage);
-}
-
-#ifdef UNIT_TEST
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::dump() const
-{
- using namespace std;
- size_t rows = mp_storage->rows(), cols = mp_storage->cols();
- cout << "rows: " << mp_storage->rows() << " cols: " << mp_storage->cols() << endl;
- for (size_t i = 0; i < rows; ++i)
- {
- cout << "row " << i << ": ";
- for (size_t j = 0; j < cols; ++j)
- {
- matrix_element_t etype = mp_storage->get_type(i, j);
- if (j > 0)
- cout << ", ";
- cout << "(col " << j << ": ";
- switch (etype)
- {
- case element_boolean:
- cout << boolalpha << mp_storage->get_boolean(i, j) << noboolalpha;
- break;
- case element_empty:
- cout << "-";
- break;
- case element_numeric:
- cout << mp_storage->get_numeric(i, j);
- break;
- case element_string:
- cout << "'" << mp_storage->get_string(i, j) << "'";
- break;
- default:
- ;
- }
- cout << ")";
- }
- cout << endl;
- }
-}
-
-template<typename _String, typename _Flag>
-void quad_type_matrix<_String,_Flag>::dump_flags() const
-{
- mp_storage->get_flag_storage().dump();
-}
-#endif
-
-}
-
-#endif
diff --git a/misc/mdds.changes b/misc/mdds.changes
new file mode 100644
index 0000000..c324d16
--- /dev/null
+++ b/misc/mdds.changes
@@ -0,0 +1,35 @@
+-------------------------------------------------------------------
+Mon Dec 20 2010 kohei.yoshida@gmail.com
+
+- Updated to version 0.4.0.
+
+-------------------------------------------------------------------
+Thu Oct 14 2010 kyoshida@novell.com
+
+- Updated to version 0.3.1.
+
+-------------------------------------------------------------------
+Mon May 31 11:08:58 UTC 2010 - pth@suse.de
+
+- Add install target to makefile.
+- Add check target to makefile.
+- Don't install code for tests.
+- Remove -I../inc from Makefile for examles.
+- Move changelog to mdds.changes.
+
+-------------------------------------------------------------------
+Fri May 5 2010 kyoshida@novell.com
+
+- Updated to version 0.3.0.
+
+-------------------------------------------------------------------
+Fri Apr 9 2010 kyoshida@novell.com
+
+- Updated to version 0.2.1.
+
+-------------------------------------------------------------------
+Fri Apr 9 2010 kyoshida@novell.com
+
+- Initial package version 0.2.0.
+
+
diff --git a/misc/mdds.spec.in b/misc/mdds.spec.in
new file mode 100644
index 0000000..449adf8
--- /dev/null
+++ b/misc/mdds.spec.in
@@ -0,0 +1,62 @@
+Name: mdds
+Version: @VERSION@
+Release: 1
+Url: http://code.google.com/p/multidimalgorithm/
+License: MIT/X11
+Source: mdds_%{version}.tar.bz2
+Group: Development/Libraries/C and C++
+Summary: A collection of multi-dimensional data structure and indexing algorithm
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: gcc-c++, libstdc++-devel, boost-devel
+Requires: boost-devel >= 1.39
+
+%description
+This library provides a collection of multi-dimensional data structure and indexing
+algorithm. All data structures are available as C++ templates, hence this is a
+header-only library, with no shared library to link against.
+
+Authors:
+--------
+ Kohei Yoshida <kyoshida@novell.com>
+
+%package devel
+Url: http://code.google.com/p/multidimalgorithm/
+License: MIT/X11
+Group: Development/Libraries/C and C++
+Summary: A collection of multi-dimensional data structure and indexing algorithm
+
+%description devel
+This library provides a collection of multi-dimensional data structure and indexing
+algorithms. All data structures are available as C++ templates, hence this is a
+header-only library, with no shared library to link against.
+
+Authors:
+--------
+ Kohei Yoshida <kyoshida@novell.com>
+
+%define _docdir %{_defaultdocdir}/mdds-devel
+
+%prep
+%setup -q -n %{name}_%{version}
+
+%build
+./configure --prefix=%buildroot/usr
+
+%check
+#make check
+
+%install
+make install
+
+%clean
+rm -rf %buildroot
+
+%files devel
+%defattr(-,root,root)
+%dir %{_docdir}
+%dir %{_datadir}/mdds-devel
+%{_includedir}/mdds
+%{_datadir}/mdds-devel/example
+%doc %{_docdir}/*
+
+%changelog
diff --git a/src/quad_type_matrix_test.cpp b/src/mixed_type_matrix_test.cpp
similarity index 68%
rename from src/quad_type_matrix_test.cpp
rename to src/mixed_type_matrix_test.cpp
index ed4648c..f3315ca 100644
--- a/src/quad_type_matrix_test.cpp
+++ b/src/mixed_type_matrix_test.cpp
@@ -25,7 +25,7 @@
*
************************************************************************/
-#include "mdds/quad_type_matrix.hpp"
+#include "mdds/mixed_type_matrix.hpp"
#include <sstream>
#include <cassert>
@@ -77,7 +77,7 @@ private:
using namespace std;
using namespace mdds;
-typedef quad_type_matrix<string, uint8_t> mx_type;
+typedef mixed_type_matrix<string, uint8_t> mx_type;
typedef void (test_func_type)(matrix_density_t);
/**
@@ -116,6 +116,30 @@ void print_mx_density_type(matrix_density_t dens)
cout << "matrix density type: " << get_mx_density_name(dens) << endl;
}
+template<typename _Elem>
+string print_element(const _Elem& e)
+{
+ ostringstream os;
+ switch (e.m_type)
+ {
+ case element_empty:
+ os << "empty";
+ break;
+ case element_numeric:
+ os << "numeric (" << e.m_numeric << ")";
+ break;
+ case element_boolean:
+ os << "boolean";
+ break;
+ case element_string:
+ os << "string";
+ break;
+ default:
+ os << "<unkwown>";
+ }
+ return os.str();
+}
+
template<typename _Mx>
bool verify_transposed_matrix(const _Mx& original, const _Mx& transposed)
{
@@ -231,11 +255,34 @@ bool verify_assignment(const _Mx& mx1, const _Mx& mx2)
return verify_assign<_Mx>(mx1, mx2);
}
-void qtm_test_resize(matrix_density_t density)
+void mtm_test_resize(matrix_density_t density)
{
- StackPrinter __stack_printer__("::qtm_test_resize");
+ StackPrinter __stack_printer__("::mtm_test_resize");
print_mx_density_type(density);
pair<size_t,size_t> mxsize;
+
+ {
+ // Start with an empty matrix, and resize into a non-empty one.
+ mx_type mx(0, 0, density);
+ mxsize = mx.size();
+ assert(mxsize.first == 0);
+ assert(mxsize.second == 0);
+ mx.resize(1, 1);
+ mxsize = mx.size();
+ assert(mxsize.first == 1);
+ assert(mxsize.second == 1);
+ // Back to an empty matrix again.
+ mx.resize(0, 0);
+ mxsize = mx.size();
+ assert(mxsize.first == 0);
+ assert(mxsize.second == 0);
+ // Resize to a non-square matrix.
+ mx.resize(5, 10);
+ mxsize = mx.size();
+ assert(mxsize.first == 5);
+ assert(mxsize.second == 10);
+ }
+
mx_type mx(3, 3, density);
mx.dump();
mxsize = mx.size();
@@ -280,9 +327,9 @@ void qtm_test_resize(matrix_density_t density)
assert(mx.empty());
}
-void qtm_test_value_store(matrix_density_t density)
+void mtm_test_value_store(matrix_density_t density)
{
- StackPrinter __stack_printer__("::qtm_test_value_store");
+ StackPrinter __stack_printer__("::mtm_test_value_store");
print_mx_density_type(density);
mx_type mx(5, 5, density);
mx.dump();
@@ -396,9 +443,9 @@ void print_transposed_mx(const _Mx& original, const _Mx& transposed)
transposed.dump();
}
-void qtm_test_transpose(matrix_density_t density)
+void mtm_test_transpose(matrix_density_t density)
{
- StackPrinter __stack_printer__("::qtm_test_transpose");
+ StackPrinter __stack_printer__("::mtm_test_transpose");
print_mx_density_type(density);
{
@@ -443,9 +490,9 @@ void qtm_test_transpose(matrix_density_t density)
}
}
-void qtm_test_initial_elements()
+void mtm_test_initial_elements()
{
- StackPrinter __stack_printer__("::qtm_test_initial_elements");
+ StackPrinter __stack_printer__("::mtm_test_initial_elements");
{
mx_type mx(3, 3, matrix_density_filled_zero);
mx.dump();
@@ -483,9 +530,9 @@ void qtm_test_initial_elements()
}
}
-void qtm_test_numeric_matrix()
+void mtm_test_numeric_matrix()
{
- StackPrinter __stack_printer__("::qtm_test_numeric_matrix");
+ StackPrinter __stack_printer__("::mtm_test_numeric_matrix");
{
print_mx_density_type(matrix_density_filled_zero);
mx_type mx(3, 3, matrix_density_filled_zero);
@@ -539,9 +586,9 @@ void qtm_test_numeric_matrix()
}
}
-void qtm_test_assign(matrix_density_t dens1, matrix_density_t dens2)
+void mtm_test_assign(matrix_density_t dens1, matrix_density_t dens2)
{
- StackPrinter __stack_printer__("::qtm_test_assign");
+ StackPrinter __stack_printer__("::mtm_test_assign");
print_mx_density_type(dens1);
print_mx_density_type(dens2);
@@ -590,9 +637,9 @@ void qtm_test_assign(matrix_density_t dens1, matrix_density_t dens2)
assert(success);
}
-void qtm_test_assignment(matrix_density_t density)
+void mtm_test_assignment(matrix_density_t density)
{
- StackPrinter __stack_printer__("::qtm_test_assignment");
+ StackPrinter __stack_printer__("::mtm_test_assignment");
print_mx_density_type(density);
mx_type mx1(0, 0, density), mx2(3, 3, density);
mx2.set(0, 0, 3.4);
@@ -628,9 +675,9 @@ void qtm_test_assignment(matrix_density_t density)
assert(mx2.empty());
}
-void qtm_test_flag_storage(matrix_density_t density)
+void mtm_test_flag_storage(matrix_density_t density)
{
- StackPrinter __stack_printer__("::qtm_test_flag_storage");
+ StackPrinter __stack_printer__("::mtm_test_flag_storage");
print_mx_density_type(density);
mx_type mx(3, 3, density);
mx.dump();
@@ -656,21 +703,207 @@ void qtm_test_flag_storage(matrix_density_t density)
assert(mx.get_flag(2, 1) == flag);
}
+template<typename _StoreType>
+void traverse_itr_access(typename _StoreType::const_itr_access& itr_access)
+{
+ typedef _StoreType store_type;
+ if (itr_access.empty())
+ {
+ cout << "no element stored." << endl;
+ return;
+ }
+
+ cout << "increment" << endl;
+ long i = 0;
+ do
+ {
+ cout << i++ << ": " << print_element(itr_access.get()) << endl;
+ }
+ while (itr_access.inc());
+
+ cout << "decrement" << endl;
+
+ while (itr_access.dec())
+ {
+ cout << --i << ": " << print_element(itr_access.get()) << endl;
+ }
+ assert(i == 0);
+}
+
+void mtm_test_iterator_access_filled(size_t rows, size_t cols)
+{
+ StackPrinter __stack_printer__("::mtm_test_iterator_access_filled");
+ typedef storage_filled<mx_type> store_type;
+
+ store_type store(rows, cols, matrix_init_element_zero);
+ {
+ cout << "rows: " << rows << " cols: " << cols << endl;
+ store_type::const_itr_access* itr_access = store.get_const_itr_access();
+ traverse_itr_access<store_type>(*itr_access);
+ delete itr_access;
+ }
+}
+
+void mtm_test_iterator_access_sparse()
+{
+ StackPrinter __stack_printer__("::mem_test_iterator_access_sparse");
+ typedef storage_sparse<mx_type> store_type;
+ store_type store(5, 5, matrix_init_element_empty);
+ {
+ store_type::const_itr_access* itr_access = store.get_const_itr_access();
+ assert(itr_access->empty());
+ delete itr_access;
+ }
+ {
+ store_type::element& elem = store.get_element(0, 0);
+ elem.m_type = element_numeric;
+ elem.m_numeric = 3.5;
+ store_type::const_itr_access* itr_access = store.get_const_itr_access();
+ assert(!itr_access->empty());
+ traverse_itr_access<store_type>(*itr_access);
+ delete itr_access;
+ }
+ {
+ store_type::element& elem = store.get_element(4, 4);
+ elem.m_type = element_numeric;
+ elem.m_numeric = 12;
+ store_type::const_itr_access* itr_access = store.get_const_itr_access();
+ assert(!itr_access->empty());
+ traverse_itr_access<store_type>(*itr_access);
+ delete itr_access;
+ }
+ {
+ store_type::element& elem = store.get_element(3, 2);
+ elem.m_type = element_numeric;
+ elem.m_numeric = 26.567;
+ store_type::const_itr_access* itr_access = store.get_const_itr_access();
+ assert(!itr_access->empty());
+ traverse_itr_access<store_type>(*itr_access);
+ delete itr_access;
+ }
+}
+
+class find_value : public unary_function<bool, mx_type::element>
+{
+public:
+ find_value(double val) : m_val(val) {}
+ bool operator() (const mx_type::element& elem) const
+ {
+ return elem.m_type == element_numeric && elem.m_numeric == m_val;
+ }
+private:
+ double m_val;
+};
+
+void mtm_test_const_iterator()
+{
+ StackPrinter __stack_printer__("::mtm_test_const_iterator");
+ // Test with an empty matrix.
+ mx_type mx(0, 0, matrix_density_filled_zero);
+ assert(mx.empty());
+ mx_type::const_iterator itr, itr_beg = mx.begin(), itr_end = mx.end();
+
+ // Test for assignment and equality.
+ assert(itr != itr_beg);
+ assert(itr != itr_end);
+ itr = itr_beg;
+ assert(itr == itr_beg);
+ itr = itr_end;
+ assert(itr == itr_end);
+
+ // For an empty matrix, the begin and end position must equal.
+ assert(itr_beg == itr_end);
+
+ // Now, test with a non-empty matrix.
+ mx.resize(2, 3);
+ double v = 0.0;
+ mx.set(0, 0, ++v);
+ mx.set(0, 1, ++v);
+ mx.set(0, 2, ++v);
+ mx.set(1, 0, ++v);
+ mx.set(1, 1, ++v);
+ mx.set(1, 2, ++v);
+ assert(!mx.empty());
+ itr = mx_type::const_iterator();
+ itr_beg = mx.begin();
+ itr_end = mx.end();
+ assert(itr_beg != itr_end);
+
+ // Test for assignment and equality again.
+ assert(itr != itr_beg);
+ assert(itr != itr_end);
+ itr = itr_beg;
+ assert(itr == itr_beg);
+ itr = itr_end;
+ assert(itr == itr_end);
+
+ // Create another matrix instance with the same dimension.
+ mx_type mx2(2, 3, matrix_density_filled_zero);
+ assert(mx.size() == mx2.size());
+ assert(mx.begin() != mx2.begin());
+ assert(mx.end() != mx2.end());
+
+ cout << "incrementing iterators." << endl;
+ for (itr = itr_beg; itr != itr_end; ++itr)
+ cout << print_element(*itr) << endl;
+ assert(itr == itr_end);
+
+ cout << "decrementing iterators." << endl;
+ while (true)
+ {
+ cout << print_element(*(--itr)) << endl;;
+ if (itr == itr_beg)
+ break;
+ }
+ assert(itr == itr_beg);
+
+ cout << "using std::advance" << endl;
+ advance(itr, 3);
+ assert(itr->m_numeric == 4.0);
+ cout << print_element(*itr) << endl;
+ advance(itr, 2);
+ assert(itr->m_numeric == 6.0);
+ cout << print_element(*itr) << endl;
+ advance(itr, 1);
+ assert(itr == itr_end);
+
+ cout << "using ::std::find_if" << endl;
+ for (double val = 1.0; val <= 6.0; ++val)
+ {
+ itr = find_if(itr_beg, itr_end, find_value(val));
+ cout << print_element(*itr) << endl;
+ assert(itr->m_type == element_numeric);
+ assert(itr->m_numeric == val);
+ }
+ itr = find_if(itr_beg, itr_end, find_value(1.5));
+ assert(itr == itr_end); // not found.
+}
+
int main()
{
- run_tests_on_all_density_types(qtm_test_resize);
- run_tests_on_all_density_types(qtm_test_value_store);
- run_tests_on_all_density_types(qtm_test_transpose);
- run_tests_on_all_density_types(qtm_test_assignment);
-
- qtm_test_initial_elements();
- qtm_test_numeric_matrix();
- qtm_test_assign(matrix_density_filled_zero, matrix_density_filled_zero);
- qtm_test_assign(matrix_density_filled_empty, matrix_density_filled_zero);
- qtm_test_assign(matrix_density_filled_zero, matrix_density_filled_empty);
- qtm_test_assign(matrix_density_filled_empty, matrix_density_filled_empty);
-
- run_tests_on_all_density_types(qtm_test_flag_storage);
+ run_tests_on_all_density_types(mtm_test_resize);
+ run_tests_on_all_density_types(mtm_test_value_store);
+ run_tests_on_all_density_types(mtm_test_transpose);
+ run_tests_on_all_density_types(mtm_test_assignment);
+
+ mtm_test_initial_elements();
+ mtm_test_numeric_matrix();
+ mtm_test_assign(matrix_density_filled_zero, matrix_density_filled_zero);
+ mtm_test_assign(matrix_density_filled_empty, matrix_density_filled_zero);
+ mtm_test_assign(matrix_density_filled_zero, matrix_density_filled_empty);
+ mtm_test_assign(matrix_density_filled_empty, matrix_density_filled_empty);
+
+ run_tests_on_all_density_types(mtm_test_flag_storage);
+
+ mtm_test_iterator_access_filled(1, 1);
+ mtm_test_iterator_access_filled(3, 1);
+ mtm_test_iterator_access_filled(1, 3);
+ mtm_test_iterator_access_filled(3, 3);
+ mtm_test_iterator_access_filled(0, 0);
+
+ mtm_test_iterator_access_sparse();
+
+ mtm_test_const_iterator();
cout << "Test finished successfully!" << endl;
return EXIT_SUCCESS;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/mdds.git
Reply to: