[libticcutils] 01/03: New upstream version 0.17
Maarten van Gompel
proycon-guest at moszumanska.debian.org
Tue Nov 7 21:01:18 UTC 2017
This is an automated email from the git hooks/post-receive script.
proycon-guest pushed a commit to branch master
in repository libticcutils.
commit 796c5c944503a8517b133a86d05dc5c4dda54638
Author: proycon <proycon at anaproy.nl>
Date: Tue Nov 7 21:58:17 2017 +0100
New upstream version 0.17
---
ChangeLog | 55 +++++++++++-
Makefile.in | 2 +
NEWS | 4 +
configure | 122 ++++++++++++++++++++++++---
configure.ac | 6 +-
docs/Makefile.in | 2 +
include/Makefile.in | 2 +
include/ticcutils/Configuration.h | 3 +-
include/ticcutils/FileUtils.h | 1 +
include/ticcutils/Makefile.am | 2 +-
include/ticcutils/Makefile.in | 4 +-
include/ticcutils/SocketBasics.h | 2 +
include/ticcutils/StringOps.h | 1 +
include/ticcutils/Timer.h | 1 +
include/ticcutils/TreeHash.h | 1 +
include/ticcutils/{Timer.h => Unicode.h} | 38 ++++-----
include/ticcutils/zipper.h | 3 +
m4/Makefile.in | 2 +
src/CommandLine.cxx | 3 +-
src/Configuration.cxx | 16 +++-
src/FdStream.cxx | 3 +-
src/FileUtils.cxx | 3 +-
src/LogStream.cxx | 3 +-
src/Makefile.am | 2 +-
src/Makefile.in | 7 +-
src/ServerBase.cxx | 3 +-
src/SocketBasics.cxx | 3 +-
src/StringOps.cxx | 21 +++--
src/Tar.cxx | 5 +-
src/Timer.cxx | 3 +-
src/TreeHash.cxx | 4 +-
include/ticcutils/Timer.h => src/Unicode.cxx | 36 +++-----
src/XMLtools.cxx | 3 +-
src/runtest.cxx | 36 ++++++++
src/zipper.cxx | 6 +-
tests/Makefile.am | 6 +-
tests/Makefile.in | 9 +-
tests/sub1/Makefile.in | 2 +
tests/utf16bom.nl | Bin 0 -> 92 bytes
39 files changed, 330 insertions(+), 95 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 7d43820..dd2f499 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,57 @@
+2017-11-07 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * NEWS: News about release
+
2017-11-06 Ko van der Sloot <K.vanderSloot at let.ru.nl>
- * NEWS, configure.ac, m4/ax_boost_base.m4, m4/ax_boost_regex.m4,
- src/Makefile.am: Create a branch to create a release that sets the
- .so name to 3.0
+ * : commit 7ed6d807f01529d522c2aab09222095684621b12 Author: Ko van
+ der Sloot <K.vanderSloot at let.ru.nl> Date: Mon Nov 6 16:36:20 2017
+ +0100
+
+2017-11-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/Unicode.h: some formatting in the code changed.
+
+2017-11-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * tests/Makefile.am: removed ols SVN style labels
+
+2017-11-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/Unicode.h, src/Unicode.cxx: we need the code!
+
+2017-11-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac, include/ticcutils/Makefile.am, src/Makefile.am,
+ src/runtest.cxx, tests/Makefile.am: added new Unicode module, with
+ some basic wrappers around ICU. Added tests too.
+
+2017-11-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/Configuration.h, src/Configuration.cxx,
+ src/runtest.cxx: added a merge() member to Configuration class.
+ Added a test too
+
+2017-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/Configuration.h, include/ticcutils/FileUtils.h,
+ include/ticcutils/SocketBasics.h, include/ticcutils/Timer.h,
+ include/ticcutils/TreeHash.h, include/ticcutils/zipper.h,
+ m4/ax_boost_base.m4, m4/ax_boost_regex.m4, src/CommandLine.cxx,
+ src/Configuration.cxx, src/FdStream.cxx, src/FileUtils.cxx,
+ src/LogStream.cxx, src/ServerBase.cxx, src/SocketBasics.cxx,
+ src/Tar.cxx, src/Timer.cxx, src/TreeHash.cxx, src/XMLtools.cxx,
+ src/zipper.cxx: shuffling includes to top
+
+2017-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/StringOps.h, src/StringOps.cxx: added a
+ realpath() wrapper for c-style realpath() (resolves relative paths
+ to absolute)
+
+2017-10-26 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: bumped version after Release
2017-10-26 Ko van der Sloot <K.vanderSloot at let.ru.nl>
diff --git a/Makefile.in b/Makefile.in
index 0f02129..6915000 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -275,6 +275,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/NEWS b/NEWS
index 4232826..3427fc4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+07 nov 2017 0.16.1
+[Ko vd Sloot]
+New release due to mixup in the previous release
+
06 nov 2017 0.16.1
[Ko vd Sloot]
* bumped the .so version to 3.0
diff --git a/configure b/configure
index 0c62c45..bc22e4a 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.69 for ticcutils 0.16.1.
+# Generated by GNU Autoconf 2.69 for ticcutils 0.17.
#
# Report bugs to <lamasoftware at science.ru.nl>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ticcutils'
PACKAGE_TARNAME='ticcutils'
-PACKAGE_VERSION='0.16.1'
-PACKAGE_STRING='ticcutils 0.16.1'
+PACKAGE_VERSION='0.17'
+PACKAGE_STRING='ticcutils 0.17'
PACKAGE_BUGREPORT='lamasoftware at science.ru.nl'
PACKAGE_URL=''
@@ -636,6 +636,8 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+ICU_LIBS
+ICU_CFLAGS
XML2_LIBS
XML2_CFLAGS
PKG_CONFIG_LIBDIR
@@ -807,7 +809,9 @@ PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
XML2_CFLAGS
-XML2_LIBS'
+XML2_LIBS
+ICU_CFLAGS
+ICU_LIBS'
# Initialize some variables set by options.
@@ -1358,7 +1362,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 ticcutils 0.16.1 to adapt to many kinds of systems.
+\`configure' configures ticcutils 0.17 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1429,7 +1433,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ticcutils 0.16.1:";;
+ short | recursive ) echo "Configuration of ticcutils 0.17:";;
esac
cat <<\_ACEOF
@@ -1499,6 +1503,8 @@ Some influential environment variables:
path overriding pkg-config's built-in search path
XML2_CFLAGS C compiler flags for XML2, overriding pkg-config
XML2_LIBS linker flags for XML2, overriding pkg-config
+ ICU_CFLAGS C compiler flags for ICU, overriding pkg-config
+ ICU_LIBS linker flags for ICU, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -1566,7 +1572,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ticcutils configure 0.16.1
+ticcutils configure 0.17
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2310,7 +2316,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 ticcutils $as_me 0.16.1, which was
+It was created by ticcutils $as_me 0.17, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3173,7 +3179,7 @@ fi
# Define the identity of the package.
PACKAGE='ticcutils'
- VERSION='0.16.1'
+ VERSION='0.17'
cat >>confdefs.h <<_ACEOF
@@ -18398,6 +18404,100 @@ fi
CXXFLAGS="$CXXFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ICU" >&5
+$as_echo_n "checking for ICU... " >&6; }
+
+if test -n "$ICU_CFLAGS"; then
+ pkg_cv_ICU_CFLAGS="$ICU_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc >= 50 icu-io \""; } >&5
+ ($PKG_CONFIG --exists --print-errors "icu-uc >= 50 icu-io ") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_ICU_CFLAGS=`$PKG_CONFIG --cflags "icu-uc >= 50 icu-io " 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$ICU_LIBS"; then
+ pkg_cv_ICU_LIBS="$ICU_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"icu-uc >= 50 icu-io \""; } >&5
+ ($PKG_CONFIG --exists --print-errors "icu-uc >= 50 icu-io ") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_ICU_LIBS=`$PKG_CONFIG --libs "icu-uc >= 50 icu-io " 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ ICU_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "icu-uc >= 50 icu-io " 2>&1`
+ else
+ ICU_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "icu-uc >= 50 icu-io " 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$ICU_PKG_ERRORS" >&5
+
+ as_fn_error $? "Package requirements (icu-uc >= 50 icu-io ) were not met:
+
+$ICU_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables ICU_CFLAGS
+and ICU_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables ICU_CFLAGS
+and ICU_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ ICU_CFLAGS=$pkg_cv_ICU_CFLAGS
+ ICU_LIBS=$pkg_cv_ICU_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+CXXFLAGS="$CXXFLAGS $ICU_CFLAGS"
+LIBS="$ICU_LIBS $LIBS"
+
ac_config_files="$ac_config_files Makefile ticcutils.pc m4/Makefile src/Makefile docs/Makefile include/Makefile include/ticcutils/Makefile tests/Makefile tests/sub1/Makefile"
cat >confcache <<\_ACEOF
@@ -18934,7 +19034,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ticcutils $as_me 0.16.1, which was
+This file was extended by ticcutils $as_me 0.17, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -19000,7 +19100,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ticcutils config.status 0.16.1
+ticcutils config.status 0.17
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index c146ba3..9b7ad30 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([ticcutils],[0.16.1],[lamasoftware at science.ru.nl])
+AC_INIT([ticcutils],[0.17],[lamasoftware at science.ru.nl])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_MACRO_DIR([m4])
@@ -107,6 +107,10 @@ PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.6.16] )
CXXFLAGS="$CXXFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
+PKG_CHECK_MODULES([ICU], [icu-uc >= 50 icu-io] )
+CXXFLAGS="$CXXFLAGS $ICU_CFLAGS"
+LIBS="$ICU_LIBS $LIBS"
+
AC_CONFIG_FILES([
Makefile
ticcutils.pc
diff --git a/docs/Makefile.in b/docs/Makefile.in
index 3e6656a..bf6f702 100644
--- a/docs/Makefile.in
+++ b/docs/Makefile.in
@@ -195,6 +195,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/include/Makefile.in b/include/Makefile.in
index 51d7709..0a91e51 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -221,6 +221,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/include/ticcutils/Configuration.h b/include/ticcutils/Configuration.h
index 5f7f3ed..775c51a 100644
--- a/include/ticcutils/Configuration.h
+++ b/include/ticcutils/Configuration.h
@@ -30,7 +30,7 @@
#include <string>
#include <map>
#include <set>
-#include <iosfwd>
+#include <iostream>
namespace TiCC {
class Configuration {
@@ -38,6 +38,7 @@ namespace TiCC {
typedef std::map<std::string, ssMap> sssMap;
public:
Configuration();
+ void merge( const Configuration& );
bool fill( const std::string& );
bool fill( const std::string&, const std::string& );
bool hasSection( const std::string& ) const;
diff --git a/include/ticcutils/FileUtils.h b/include/ticcutils/FileUtils.h
index fe617d0..77e64c4 100644
--- a/include/ticcutils/FileUtils.h
+++ b/include/ticcutils/FileUtils.h
@@ -25,6 +25,7 @@
*/
#include <vector>
+#include <string>
#ifndef TICC_FILE_UTILS_H
#define TICC_FILE_UTILS_H
diff --git a/include/ticcutils/Makefile.am b/include/ticcutils/Makefile.am
index c214a4f..abc22b3 100644
--- a/include/ticcutils/Makefile.am
+++ b/include/ticcutils/Makefile.am
@@ -1,4 +1,4 @@
pkginclude_HEADERS = LogBuffer.h LogStream.h PrettyPrint.h XMLtools.h \
StringOps.h UnitTest.h Trie.h TreeHash.h Configuration.h Timer.h \
bz2stream.h gzstream.h zipper.h Tar.h Version.h FileUtils.h \
- CommandLine.h SocketBasics.h ServerBase.h FdStream.h
+ CommandLine.h SocketBasics.h ServerBase.h FdStream.h Unicode.h
diff --git a/include/ticcutils/Makefile.in b/include/ticcutils/Makefile.in
index d890558..585e5a0 100644
--- a/include/ticcutils/Makefile.in
+++ b/include/ticcutils/Makefile.in
@@ -210,6 +210,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -314,7 +316,7 @@ top_srcdir = @top_srcdir@
pkginclude_HEADERS = LogBuffer.h LogStream.h PrettyPrint.h XMLtools.h \
StringOps.h UnitTest.h Trie.h TreeHash.h Configuration.h Timer.h \
bz2stream.h gzstream.h zipper.h Tar.h Version.h FileUtils.h \
- CommandLine.h SocketBasics.h ServerBase.h FdStream.h
+ CommandLine.h SocketBasics.h ServerBase.h FdStream.h Unicode.h
all: all-am
diff --git a/include/ticcutils/SocketBasics.h b/include/ticcutils/SocketBasics.h
index a6a303a..18210c8 100644
--- a/include/ticcutils/SocketBasics.h
+++ b/include/ticcutils/SocketBasics.h
@@ -27,6 +27,8 @@
#ifndef SOCKET_BASICS_H
#define SOCKET_BASICS_H
+#include <string>
+
#ifdef _WIN32
#include <winsock.h>
#else
diff --git a/include/ticcutils/StringOps.h b/include/ticcutils/StringOps.h
index 242ae07..2a768c6 100644
--- a/include/ticcutils/StringOps.h
+++ b/include/ticcutils/StringOps.h
@@ -128,6 +128,7 @@ namespace TiCC {
std::string basename( const std::string& );
std::string dirname( const std::string& );
+ std::string realpath( const std::string& );
}
diff --git a/include/ticcutils/Timer.h b/include/ticcutils/Timer.h
index 64b514a..97d2ff2 100644
--- a/include/ticcutils/Timer.h
+++ b/include/ticcutils/Timer.h
@@ -28,6 +28,7 @@
#include <cstdlib>
#include <sys/time.h>
+#include <iostream>
namespace TiCC {
class Timer {
diff --git a/include/ticcutils/TreeHash.h b/include/ticcutils/TreeHash.h
index 741628b..9c3eac7 100644
--- a/include/ticcutils/TreeHash.h
+++ b/include/ticcutils/TreeHash.h
@@ -28,6 +28,7 @@
#define TICC_TREE_H
#include <vector>
+#include <ostream>
#include "ticcutils/Trie.h"
namespace Hash {
diff --git a/include/ticcutils/Timer.h b/include/ticcutils/Unicode.h
similarity index 63%
copy from include/ticcutils/Timer.h
copy to include/ticcutils/Unicode.h
index 64b514a..321b380 100644
--- a/include/ticcutils/Timer.h
+++ b/include/ticcutils/Unicode.h
@@ -1,3 +1,6 @@
+#ifndef TICC_UNICODE_H
+#define TICC_UNICODE_H
+
/*
Copyright (c) 2006 - 2017
CLST - Radboud University
@@ -22,31 +25,22 @@
https://github.com/LanguageMachines/ticcutils/issues
or send mail to:
lamasoftware (at ) science.ru.nl
+
*/
-#ifndef TICC_TIMER_H
-#define TICC_TIMER_H
-#include <cstdlib>
-#include <sys/time.h>
+#include <string>
+#include "unicode/unistr.h"
namespace TiCC {
- class Timer {
- public:
- friend std::ostream& operator << ( std::ostream& os, const Timer& T );
- Timer(){ reset(); };
- void reset(){ myTime.tv_sec=0; myTime.tv_usec=0; };
- void start(){
- gettimeofday( &startTime, 0 );
- };
- void stop();
- unsigned int secs() { stop(); return myTime.tv_sec; };
- std::string toString();
- static std::string now();
- private:
- timeval startTime;
- timeval myTime;
- };
-}
+ std::string UnicodeToUTF8( const UnicodeString& );
-#endif // TICC_TIMER_H
+ UnicodeString UnicodeFromEnc( const std::string& ,
+ const std::string& = "UTF8" );
+
+ inline UnicodeString UnicodeFromUTF8( const std::string& s ){
+ return UnicodeString::fromUTF8( s );
+ }
+
+}
+#endif // TICC_UNICODE_H
diff --git a/include/ticcutils/zipper.h b/include/ticcutils/zipper.h
index 8f493e1..9985869 100644
--- a/include/ticcutils/zipper.h
+++ b/include/ticcutils/zipper.h
@@ -27,6 +27,9 @@
#ifndef TICC_ZIP_TOOLS_H
#define TICC_ZIP_TOOLS_H
+#include <string>
+#include <iostream>
+
namespace TiCC {
bool bz2Compress( const std::string&, const std::string& = "" );
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 6593e9e..7c40532 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -164,6 +164,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index 2e6297d..f556cdc 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -26,6 +26,8 @@
*/
+#include "ticcutils/CommandLine.h"
+
#include <cassert>
#include <string>
#include <vector>
@@ -34,7 +36,6 @@
#include <iostream>
#include "ticcutils/StringOps.h"
-#include "ticcutils/CommandLine.h"
#include "ticcutils/PrettyPrint.h"
using namespace std;
diff --git a/src/Configuration.cxx b/src/Configuration.cxx
index c216d45..33993a5 100644
--- a/src/Configuration.cxx
+++ b/src/Configuration.cxx
@@ -25,6 +25,8 @@
*/
+#include "ticcutils/Configuration.h"
+
#include <string>
#include <map>
#include <set>
@@ -32,7 +34,6 @@
#include <stdexcept>
#include <iostream>
#include "ticcutils/StringOps.h"
-#include "ticcutils/Configuration.h"
using namespace std;
@@ -356,4 +357,17 @@ namespace TiCC {
return false;
}
+ void Configuration::merge( const Configuration& in ) {
+ // get al sections from in;
+ set<string> sections = in.lookUpSections();
+ for ( const auto& s : sections ){
+ // for every section, get all at-val pairs
+ auto avs = in.lookUpAll( s );
+ for ( const auto av : avs ){
+ // merge every at-val in the wanted section
+ setatt( av.first, av.second, s );
+ }
+ }
+ }
+
}
diff --git a/src/FdStream.cxx b/src/FdStream.cxx
index cd75011..2d1c53f 100644
--- a/src/FdStream.cxx
+++ b/src/FdStream.cxx
@@ -24,6 +24,8 @@
lamasoftware (at ) science.ru.nl
*/
+#include "ticcutils/FdStream.h"
+
#include <cstring>
#include <cstdio>
#include <cerrno>
@@ -33,7 +35,6 @@
#include <stdexcept>
#include <unistd.h>
#include <cstdlib>
-#include "ticcutils/FdStream.h"
using namespace std;
diff --git a/src/FileUtils.cxx b/src/FileUtils.cxx
index 597fde3..eecf0b8 100644
--- a/src/FileUtils.cxx
+++ b/src/FileUtils.cxx
@@ -25,6 +25,8 @@
*/
+#include "ticcutils/FileUtils.h"
+
#include <cerrno>
#include <cstring>
#include <vector>
@@ -46,7 +48,6 @@
# include <regex>
#endif
#include "ticcutils/StringOps.h"
-#include "ticcutils/FileUtils.h"
using namespace std;
namespace TiCC {
diff --git a/src/LogStream.cxx b/src/LogStream.cxx
index 78c9276..e8b7a0b 100755
--- a/src/LogStream.cxx
+++ b/src/LogStream.cxx
@@ -25,13 +25,14 @@
*/
+#include "ticcutils/LogStream.h"
+
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <typeinfo>
-#include "ticcutils/LogStream.h"
#include <pthread.h>
#if defined __GNUC__
diff --git a/src/Makefile.am b/src/Makefile.am
index 7749cb3..14eb528 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,7 +9,7 @@ libticcutils_la_LDFLAGS = -version-info 3:0:0
libticcutils_la_SOURCES = LogStream.cxx StringOps.cxx TreeHash.cxx \
Configuration.cxx Timer.cxx XMLtools.cxx zipper.cxx Tar.cxx \
FileUtils.cxx CommandLine.cxx SocketBasics.cxx ServerBase.cxx \
- FdStream.cxx
+ FdStream.cxx Unicode.cxx
check_PROGRAMS = runtest testlogstream
diff --git a/src/Makefile.in b/src/Makefile.in
index 32dec51..6b94afe 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -141,7 +141,7 @@ libticcutils_la_LIBADD =
am_libticcutils_la_OBJECTS = LogStream.lo StringOps.lo TreeHash.lo \
Configuration.lo Timer.lo XMLtools.lo zipper.lo Tar.lo \
FileUtils.lo CommandLine.lo SocketBasics.lo ServerBase.lo \
- FdStream.lo
+ FdStream.lo Unicode.lo
libticcutils_la_OBJECTS = $(am_libticcutils_la_OBJECTS)
AM_V_lt = $(am__v_lt_ at AM_V@)
am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -434,6 +434,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -543,7 +545,7 @@ libticcutils_la_LDFLAGS = -version-info 3:0:0
libticcutils_la_SOURCES = LogStream.cxx StringOps.cxx TreeHash.cxx \
Configuration.cxx Timer.cxx XMLtools.cxx zipper.cxx Tar.cxx \
FileUtils.cxx CommandLine.cxx SocketBasics.cxx ServerBase.cxx \
- FdStream.cxx
+ FdStream.cxx Unicode.cxx
runtest_SOURCES = runtest.cxx
testlogstream_SOURCES = testlogstream.cxx
@@ -657,6 +659,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Tar.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Timer.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TreeHash.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Unicode.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/XMLtools.Plo at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/runtest.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/testlogstream.Po at am__quote@
diff --git a/src/ServerBase.cxx b/src/ServerBase.cxx
index 337dc9f..2ee7d6e 100644
--- a/src/ServerBase.cxx
+++ b/src/ServerBase.cxx
@@ -24,6 +24,8 @@
lamasoftware (at ) science.ru.nl
*/
+#include "ticcutils/ServerBase.h"
+
#ifndef HAVE_DAEMON
#include <fcntl.h> // for implementing daemon
#endif
@@ -36,7 +38,6 @@
#include "ticcutils/StringOps.h"
#include "config.h"
#include "ticcutils/FdStream.h"
-#include "ticcutils/ServerBase.h"
using namespace std;
using namespace TiCC;
diff --git a/src/SocketBasics.cxx b/src/SocketBasics.cxx
index c994932..c936455 100755
--- a/src/SocketBasics.cxx
+++ b/src/SocketBasics.cxx
@@ -24,6 +24,8 @@
lamasoftware (at ) science.ru.nl
*/
+#include "ticcutils/SocketBasics.h"
+
#include <string>
#include <stdexcept>
#include <iostream>
@@ -37,7 +39,6 @@
#include "config.h"
#include "ticcutils/StringOps.h"
-#include "ticcutils/SocketBasics.h"
using namespace std;
diff --git a/src/StringOps.cxx b/src/StringOps.cxx
index e471d71..42c2a28 100644
--- a/src/StringOps.cxx
+++ b/src/StringOps.cxx
@@ -25,15 +25,16 @@
*/
+#include "ticcutils/StringOps.h"
+
+#include <cerrno>
+#include <cfloat>
+#include <cstdlib>
#include <algorithm>
#include <string>
#include <iostream>
#include <sstream>
-
-#include <cerrno>
-#include <cfloat>
#include "ticcutils/Version.h"
-#include "ticcutils/StringOps.h"
using namespace std;
namespace TiCC {
@@ -272,7 +273,7 @@ namespace TiCC {
return os.str();
}
- std::string basename( const std::string& path ){
+ string basename( const string& path ){
string::size_type pos = path.rfind( "/" );
if ( pos != string::npos ){
return path.substr(pos+1);
@@ -282,7 +283,7 @@ namespace TiCC {
}
}
- std::string dirname( const std::string& path ){
+ string dirname( const string& path ){
string::size_type pos = path.rfind( "/" );
if ( pos != string::npos ){
return path.substr(0,pos);
@@ -292,4 +293,12 @@ namespace TiCC {
}
}
+ string realpath( const string& path ){
+ const char *in = path.c_str();
+ char *out = 0;
+ string result = ::realpath( in, out );
+ free( out );
+ return result;
+ }
+
} // namespace TiCC
diff --git a/src/Tar.cxx b/src/Tar.cxx
index 6b0bbbf..3ef5887 100644
--- a/src/Tar.cxx
+++ b/src/Tar.cxx
@@ -24,13 +24,15 @@
lamasoftware (at ) science.ru.nl
*/
+#include "config.h"
+#include "ticcutils/Tar.h"
+
#include <cstring>
#include <cerrno>
#include <string>
#include <iostream>
#include <fstream>
#include <unistd.h>
-#include "config.h"
#include <sys/fcntl.h>
#include "ticcutils/StringOps.h"
#if HAVE_WORKING_REGEX == 2
@@ -41,7 +43,6 @@
#else
# include <regex>
#endif
-#include "ticcutils/Tar.h"
using namespace std;
diff --git a/src/Timer.cxx b/src/Timer.cxx
index c9e16f9..dfc5e66 100644
--- a/src/Timer.cxx
+++ b/src/Timer.cxx
@@ -24,10 +24,11 @@
lamasoftware (at ) science.ru.nl
*/
+#include <ticcutils/Timer.h>
+
#include <iostream>
#include <sstream>
#include <string>
-#include <ticcutils/Timer.h>
using namespace std;
diff --git a/src/TreeHash.cxx b/src/TreeHash.cxx
index 8541682..4d3927d 100644
--- a/src/TreeHash.cxx
+++ b/src/TreeHash.cxx
@@ -24,12 +24,12 @@
lamasoftware (at ) science.ru.nl
*/
+#include "ticcutils/TreeHash.h"
+
#include <iostream>
#include <cstdlib>
#include <cstring>
-#include "ticcutils/TreeHash.h"
-
using namespace std;
namespace Hash {
diff --git a/include/ticcutils/Timer.h b/src/Unicode.cxx
similarity index 63%
copy from include/ticcutils/Timer.h
copy to src/Unicode.cxx
index 64b514a..ef6a862 100644
--- a/include/ticcutils/Timer.h
+++ b/src/Unicode.cxx
@@ -22,31 +22,23 @@
https://github.com/LanguageMachines/ticcutils/issues
or send mail to:
lamasoftware (at ) science.ru.nl
+
*/
-#ifndef TICC_TIMER_H
-#define TICC_TIMER_H
-#include <cstdlib>
-#include <sys/time.h>
+#include "ticcutils/Unicode.h"
+
+using namespace std;
namespace TiCC {
- class Timer {
- public:
- friend std::ostream& operator << ( std::ostream& os, const Timer& T );
- Timer(){ reset(); };
- void reset(){ myTime.tv_sec=0; myTime.tv_usec=0; };
- void start(){
- gettimeofday( &startTime, 0 );
- };
- void stop();
- unsigned int secs() { stop(); return myTime.tv_sec; };
- std::string toString();
- static std::string now();
- private:
- timeval startTime;
- timeval myTime;
- };
-}
+ UnicodeString UnicodeFromEnc( const string& s, const string& enc ){
+ return UnicodeString( s.c_str(), s.length(), enc.c_str() );
+ }
-#endif // TICC_TIMER_H
+ string UnicodeToUTF8( const UnicodeString& s ){
+ string result;
+ s.toUTF8String(result);
+ return result;
+ }
+
+}
diff --git a/src/XMLtools.cxx b/src/XMLtools.cxx
index 33dff5e..bbc711a 100644
--- a/src/XMLtools.cxx
+++ b/src/XMLtools.cxx
@@ -24,12 +24,13 @@
lamasoftware (at ) science.ru.nl
*/
+#include "ticcutils/XMLtools.h"
+
#include <iostream>
#include <string>
#include <stdexcept>
#include "libxml/xpath.h"
#include "libxml/xpathInternals.h"
-#include "ticcutils/XMLtools.h"
using namespace std;
diff --git a/src/runtest.cxx b/src/runtest.cxx
index 8ae93d5..0c2c857 100644
--- a/src/runtest.cxx
+++ b/src/runtest.cxx
@@ -41,6 +41,7 @@
#include "ticcutils/CommandLine.h"
#include "ticcutils/Configuration.h"
#include "ticcutils/LogStream.h"
+#include "ticcutils/Unicode.h"
using namespace std;
using namespace TiCC;
@@ -554,6 +555,21 @@ void test_configuration( const string& path ){
assertEqual( att, "" );
att = c.lookUp( "Truus", "test" );
assertEqual( att, "met een \n er in en een \r!" );
+ Configuration c3;
+ assertTrue( c3.fill( path + "testconfig.cfg" ) );
+ att = c3.lookUp( "jan" );
+ assertEqual( att, "gek" );
+ att = c3.lookUp( "pief", "poef" );
+ assertEqual( att, "" );
+ att = c3.lookUp( "piet", "test" );
+ assertEqual( att, "ook gek" );
+ c3.merge( c2 );
+ att = c3.lookUp( "jan" );
+ assertEqual( att, "normaal" );
+ att = c3.lookUp( "pief", "poef" );
+ assertEqual( att, "paf" );
+ att = c3.lookUp( "piet", "test" ); // empty in c2, not changed in c3
+ assertEqual( att, "ook gek" );
}
void test_logstream( const string& path ){
@@ -588,6 +604,25 @@ void test_logstream( const string& path ){
assertEqual( system( cmd.c_str() ), 0 );
}
+void test_unicode( const string& path ){
+ UnicodeString u1 = L'私';
+ UChar32 uc1 = U'\U00007981';
+ UChar32 uc2 = U'\U00007982';
+ UnicodeString u2 = uc1;
+ u2 += UnicodeString( uc2 );
+ string s1 = UnicodeToUTF8( u1 );
+ assertEqual( s1 , "私" );
+ string s2 = UnicodeToUTF8( u2 );
+ assertEqual( s2 , "禁禂" );
+ ifstream in( path + "utf16bom.nl" );
+ string line;
+ getline( in, line );
+ assertFalse( line == "Hier staat een BOM voor. æ en ™ om te testen." );
+ UnicodeString u3 = UnicodeFromEnc( line, "UTF16" );
+ string s3 = UnicodeToUTF8( u3 );
+ assertEqual( s3, "Hier staat een BOM voor. æ en ™ om te testen." );
+}
+
int main( const int argc, const char* argv[] ){
cerr << BuildInfo() << endl;
test_opts_basic();
@@ -642,5 +677,6 @@ int main( const int argc, const char* argv[] ){
test_fileutils( testdir );
test_configuration( testdir );
test_logstream( testdir );
+ test_unicode( testdir );
summarize_tests(4);
}
diff --git a/src/zipper.cxx b/src/zipper.cxx
index 136b338..b3e1dfc 100644
--- a/src/zipper.cxx
+++ b/src/zipper.cxx
@@ -23,12 +23,12 @@
or send mail to:
lamasoftware (at ) science.ru.nl
*/
+
+#include "ticcutils/zipper.h"
+
#include <stdexcept>
-#include <string>
-#include <iostream>
#include <fstream>
#include "config.h"
-#include "ticcutils/zipper.h"
#ifdef HAVE_BZLIB_H
#include "bzlib.h"
#include "ticcutils/bz2stream.h"
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ae61e94..b3a7a61 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,5 +1,3 @@
-# $Id$
-# $URL$
-
SUBDIRS = sub1
-EXTRA_DIST = small.txt test.tar testconfig.cfg nasty.bz2 nasty.gz testls.1.ok
+EXTRA_DIST = small.txt test.tar testconfig.cfg utf16bom.nl \
+ nasty.bz2 nasty.gz testls.1.ok
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 608b487..516e5ac 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -13,9 +13,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
-
-# $Id$
-# $URL$
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -224,6 +221,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -326,7 +325,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = sub1
-EXTRA_DIST = small.txt test.tar testconfig.cfg nasty.bz2 nasty.gz testls.1.ok
+EXTRA_DIST = small.txt test.tar testconfig.cfg utf16bom.nl \
+ nasty.bz2 nasty.gz testls.1.ok
+
all: all-recursive
.SUFFIXES:
diff --git a/tests/sub1/Makefile.in b/tests/sub1/Makefile.in
index f3c7d1c..2db55e6 100644
--- a/tests/sub1/Makefile.in
+++ b/tests/sub1/Makefile.in
@@ -161,6 +161,8 @@ EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
+ICU_CFLAGS = @ICU_CFLAGS@
+ICU_LIBS = @ICU_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
diff --git a/tests/utf16bom.nl b/tests/utf16bom.nl
new file mode 100644
index 0000000..1dcdb83
Binary files /dev/null and b/tests/utf16bom.nl differ
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libticcutils.git
More information about the debian-science-commits
mailing list