[libticcutils] 01/03: New upstream version 0.16
Maarten van Gompel
proycon-guest at moszumanska.debian.org
Thu Nov 2 19:51:00 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 9023d466e48ce8ba018716b5f6fa885316bd3478
Author: proycon <proycon at anaproy.nl>
Date: Thu Nov 2 20:38:49 2017 +0100
New upstream version 0.16
---
ChangeLog | 429 ++++++++++++++++++++++-
NEWS | 16 +
config.guess | 137 ++++----
config.h.in | 10 +-
config.sub | 38 ++-
configure | 691 +++++++++++++++++++++++---------------
configure.ac | 42 ++-
include/Makefile.am | 5 +-
include/Makefile.in | 5 +-
include/ticcutils/CommandLine.h | 6 +-
include/ticcutils/Configuration.h | 3 +-
include/ticcutils/FdStream.h | 10 +-
include/ticcutils/FileUtils.h | 4 +-
include/ticcutils/LogBuffer.h | 2 +-
include/ticcutils/LogStream.h | 22 +-
include/ticcutils/Makefile.am | 3 -
include/ticcutils/Makefile.in | 3 -
include/ticcutils/PrettyPrint.h | 2 +-
include/ticcutils/ServerBase.h | 8 +-
include/ticcutils/SocketBasics.h | 2 +-
include/ticcutils/StringOps.h | 21 +-
include/ticcutils/Tar.h | 6 +-
include/ticcutils/Timer.h | 2 +-
include/ticcutils/TreeHash.h | 2 +-
include/ticcutils/Trie.h | 4 +-
include/ticcutils/UnitTest.h | 30 +-
include/ticcutils/Version.h | 2 +-
include/ticcutils/XMLtools.h | 4 +-
include/ticcutils/gzstream.h | 42 +--
include/ticcutils/zipper.h | 2 +-
ltmain.sh | 4 +-
m4/ax_boost_base.m4 | 4 +-
m4/ax_pthread.m4 | 550 +++++++++++++++++++-----------
src/CommandLine.cxx | 22 +-
src/Configuration.cxx | 73 ++--
src/FdStream.cxx | 2 +-
src/FileUtils.cxx | 88 +++--
src/LogStream.cxx | 4 +-
src/Makefile.am | 5 +-
src/Makefile.in | 20 +-
src/ServerBase.cxx | 91 ++---
src/SocketBasics.cxx | 11 +-
src/StringOps.cxx | 113 ++++++-
src/Tar.cxx | 44 ++-
src/Timer.cxx | 7 +-
src/TreeHash.cxx | 36 +-
src/XMLtools.cxx | 2 +-
src/runtest.cxx | 110 ++++--
src/testlogstream.cxx | 94 ++++++
src/tst.sh | 2 +
src/zipper.cxx | 10 +-
tests/testconfig.cfg | 3 +-
52 files changed, 1964 insertions(+), 884 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 46bf9e6..7173455 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,407 @@
+2017-10-26 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * NEWS: NEWS!
+
+2017-10-16 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: small fix
+
+2017-10-02 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/Makefile.am, include/ticcutils/Makefile.am: removed some
+ old SVN remains
+
+2017-09-22 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: attempt to fix clang build
+
+2017-09-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/Makefile.am: set automake defaults
+
+2017-09-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: added AC_FUNC_MALLOC dependency
+
+2017-09-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: updated configure script
+
+2017-09-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/StringOps.cxx, src/runtest.cxx: fixed problem in split().
+ Added test
+
+2017-09-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/StringOps.cxx: typos in comment ;{
+
+2017-09-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/ServerBase.cxx: added a newline when logging
+
+2017-09-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/TreeHash.cxx: removed omp safeguards here. Better do this at
+ the caller side
+
+2017-09-19 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/CommandLine.cxx, src/FileUtils.cxx, src/StringOps.cxx: small
+ refactoring and cleanup
+
+2017-09-19 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/Configuration.h, src/Configuration.cxx,
+ src/runtest.cxx, tests/testconfig.cfg: some refactoring,
+ improvements and added tests
+
+2017-09-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/runtest.cxx: added a few more tests
+
+2017-09-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * : commit 6797f6dcaec080ed16add00db985ccb5bb181d54 Author: Ko van
+ der Sloot <K.vanderSloot at let.ru.nl> Date: Mon Sep 18 12:14:09 2017
+ +0200
+
+2017-09-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/StringOps.h, src/StringOps.cxx, src/runtest.cxx:
+ added string splie functions that honout a max size parameter. Th
+ JAVA way, not Pythonic. So the numeric parameter gives the maximum
+ size of the resulting array
+
+2017-09-14 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/runtest.cxx: added more comandline tests
+
+2017-09-05 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/LogStream.cxx: added another mutex_lock to avoid race errors
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml, configure.ac: ok, always use boost-regex. What a mess
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: clang als needs another stdlib++
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_compiler_version.m4: added this file while trusty doesn't
+ provide it :{
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac, src/FileUtils.cxx, src/Tar.cxx, src/runtest.cxx: Ok,
+ lets try to unboost :)
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: hmm, closing in?
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: attempt to make it cleaner
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: again
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: :{
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: desparate!
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: next...
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: retry
+
+2017-07-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml, configure.ac: desperate attempt to fix clang build on
+ travis
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: AC_MALLOC is havock
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac, m4/ax_compiler_version.m4, src/FileUtils.cxx,
+ src/Tar.cxx, src/runtest.cxx: Revert "improved configuration: Don't
+ built without Regex support. Preferably native; or else Boost" This reverts commit 5e4ed53a727982fae3fe229cd53c04a4ce6ce1a7.
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml, configure.ac: Revert "attempt to fix configure for
+ clang" This reverts commit 12730f965848e906cad4a30e228f263ea2bcaa91.
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: next attempt to fix config
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: use the deafult clang not an old version
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: attempt to fix configure for clang
+
+2017-07-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac, m4/ax_compiler_version.m4, src/FileUtils.cxx,
+ src/Tar.cxx, src/runtest.cxx: improved configuration: Don't built
+ without Regex support. Preferably native; or else Boost
+
+2017-06-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_boost_base.m4: ok, Travis seems to need this (newer?)
+ version
+
+2017-06-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_pthread.m4: small fix
+
+2017-06-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: added a 'group: edge' directive as advised by
+ https://blog.travis-ci.com/2017-06-19-trusty-updates-2017-Q2
+
+2017-06-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_boost_base.m4: removed from git. bootstrap.sh should add
+ this file
+
+2017-06-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/FileUtils.h, include/ticcutils/StringOps.h: Make
+ sure that functions are defined 'inline' when the definition is in
+ .h files
+
+2017-05-15 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/runtest.cxx: changed the new test
+
+2017-05-15 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/runtest.cxx: added a test
+
+2017-05-09 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: try to optimize Travis notice
+
+2017-05-09 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: don't join when sending IRC notice
+
+2017-05-09 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: test irc notifications
+
+2017-05-08 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/Makefile.am, src/testlogstream.cxx, src/tst.sh: added a simple
+ logstream test. Not called in make-check!
+
+2017-04-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/UnitTest.h, src/runtest.cxx: assertEqual now
+ catches exceptions. Added a test to prove it :)
+
+2017-04-04 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: bumped version after release
+
+2017-04-04 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * NEWS: Updated NEWS before release
+
+2017-02-23 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_boost_base.m4: re added file
+
+2017-02-23 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_boost_regex.m4: re-added ax_boost_regexp.m4
+
+2017-02-23 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml, configure.ac, src/FileUtils.cxx, src/Tar.cxx,
+ src/runtest.cxx: reverted to using boost::regexp because gcc4.8
+ doesn't support it and is with us until 2019 :(
+
+2017-02-21 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * README.md, include/ticcutils/CommandLine.h: small update
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: ok, we know how to do it. Just skip gcc5 for know
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: ik, next attempt
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: ok. now try this
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: argl. next attempt
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: another attempt
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: !meh
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: attempt to fix travis
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: print testsuite.log after failure
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * README.md, m4/ax_boost_base.m4, m4/ax_boost_regex.m4: removed more
+ boost leftovers
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: no boost needed
+
+2017-02-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac, src/FileUtils.cxx, src/Makefile.am, src/Tar.cxx,
+ src/runtest.cxx: uses std=c++11 flag and remove boost (regex)
+ dependency.
+
+2017-01-24 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/ServerBase.cxx, src/SocketBasics.cxx: ServerBase: added
+ newline when logging. SocketBasics: make verys sure that we don't
+ use a 0 pointer
+
+2017-01-24 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * m4/ax_pthread.m4: Added own version of ax_pthread.m4 to circumvent
+ problems with cc-analyzer tool of Clang
+
+2017-01-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/LogStream.h: removed one 'explicit' for now. it
+ upsets Frog.
+
+2017-01-19 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/FdStream.h, include/ticcutils/LogStream.h,
+ include/ticcutils/ServerBase.h, include/ticcutils/Tar.h,
+ include/ticcutils/Trie.h, include/ticcutils/XMLtools.h,
+ src/ServerBase.cxx, src/TreeHash.cxx: more refactoring triggered by
+ CPPCHECK
+
+2017-01-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/UnitTest.h, src/StringOps.cxx, src/runtest.cxx:
+ added a test for TiCC::basename() and TiCC::dirname()
+
+2017-01-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/CommandLine.h, src/CommandLine.cxx,
+ src/Configuration.cxx, src/SocketBasics.cxx, src/Timer.cxx,
+ src/TreeHash.cxx: small refactoring steps, partly because of
+ CPPcheck results
+
+2017-01-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/ServerBase.cxx: avoid potential memory leak
+
+2017-01-12 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * include/ticcutils/gzstream.h, src/zipper.cxx: refactoring and
+ modernizing
+
+2017-01-12 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/Tar.cxx: refactor
+
+2017-01-12 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/FileUtils.cxx: modernizeing too
+
+2016-12-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/CommandLine.cxx: added an exception for incorrect use of the
+ API
+
+2016-12-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/StringOps.cxx: added guard against invalid uses of split_at*
+
+2016-12-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/FileUtils.cxx: small refactoring
+
+2016-12-20 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * README.md, include/ticcutils/CommandLine.h,
+ include/ticcutils/Configuration.h, include/ticcutils/FdStream.h,
+ include/ticcutils/FileUtils.h, include/ticcutils/LogBuffer.h,
+ include/ticcutils/LogStream.h, include/ticcutils/PrettyPrint.h,
+ include/ticcutils/ServerBase.h, include/ticcutils/SocketBasics.h,
+ include/ticcutils/StringOps.h, include/ticcutils/Tar.h,
+ include/ticcutils/Timer.h, include/ticcutils/TreeHash.h,
+ include/ticcutils/Trie.h, include/ticcutils/UnitTest.h,
+ include/ticcutils/Version.h, include/ticcutils/XMLtools.h,
+ include/ticcutils/zipper.h, src/CommandLine.cxx,
+ src/Configuration.cxx, src/FdStream.cxx, src/FileUtils.cxx,
+ src/LogStream.cxx, src/ServerBase.cxx, src/SocketBasics.cxx,
+ src/StringOps.cxx, src/Tar.cxx, src/Timer.cxx, src/TreeHash.cxx,
+ src/XMLtools.cxx, src/runtest.cxx, src/zipper.cxx: bumping into 2017
+
+2016-12-15 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/FileUtils.cxx, src/ServerBase.cxx, src/Tar.cxx: some code
+ cleanup and refactoring. NO API/ABI breakage :)
+
+2016-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml: attempt to force travis to Trusty
+
+2016-11-01 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .travis.yml, src/runtest.cxx: better signal waht is done in
+ runtest.
+
+2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * configure.ac: bumped version after release
+
+2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * .gitignore: ignore more
+
+2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
+
+ * src/runtest.cxx, tests/Makefile.am: make distcheck now works again
+
2016-10-18 Ko van der Sloot <K.vanderSloot at let.ru.nl>
* .gitignore, NEWS, README, README.md, bootstrap.sh, configure.ac,
@@ -151,7 +555,7 @@
2016-02-17 Maarten van Gompel <proycon at anaproy.nl>
- * README, README.md, bootstrap.sh: Converted README to markdown,
+ * README => README.md, bootstrap.sh: Converted README to markdown,
added lamabadge + travis badge, symlink in bootstrap
2016-02-17 Ko van der Sloot <K.vanderSloot at let.ru.nl>
@@ -633,8 +1037,8 @@
2014-06-11 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
- * m4/ax_boost_regex.m4, src/Makefile.am, src/runtest.cxx,
- src/test.cxx, src/tst.sh, tests/Makefile.am: Made 'make distcheck'
+ * m4/ax_boost_regex.m4, src/Makefile.am, src/{test.cxx =>
+ runtest.cxx}, src/tst.sh, tests/Makefile.am: Made 'make distcheck'
working again git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@17325
12f355fe-0486-481a-ad91-c297ab22b4e3
@@ -770,7 +1174,7 @@
2013-10-17 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
- * bootstrap, bootstrap.sh, configure.ac: modernized and updated git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@16615
+ * bootstrap => bootstrap.sh, configure.ac: modernized and updated git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@16615
12f355fe-0486-481a-ad91-c297ab22b4e3
2013-10-09 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
@@ -862,9 +1266,9 @@
2013-04-11 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
- * include/ticcutils/FileUtils.h, include/ticcutils/Makefile.am,
- include/ticcutils/globber.h, src/FileUtils.cxx, src/Makefile.am,
- src/globber.cxx: More descriptive name chosen git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15985
+ * include/ticcutils/{globber.h => FileUtils.h},
+ include/ticcutils/Makefile.am, src/{globber.cxx => FileUtils.cxx},
+ src/Makefile.am: More descriptive name chosen git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15985
12f355fe-0486-481a-ad91-c297ab22b4e3
2013-04-11 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
@@ -898,8 +1302,8 @@
* Makefile.am, configure.ac, include/ticcutils/Makefile.am,
include/ticcutils/Version.h, src/Makefile.am, src/StringOps.cxx,
- src/small.txt, src/test.cxx, tests/small.txt: added Version stuff
- make distcheck work again git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15977
+ src/test.cxx, {src => tests}/small.txt: added Version stuff make
+ distcheck work again git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15977
12f355fe-0486-481a-ad91-c297ab22b4e3
2013-04-09 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
@@ -1028,15 +1432,14 @@
2012-12-19 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
* include/ticcutils/Makefile.am, include/ticcutils/TreeHash.h,
- include/ticcutils/Trie.h, include/ticcutils/Tries.h: reverted silly
- 'fix' git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15543
+ include/ticcutils/{Tries.h => Trie.h}: reverted silly 'fix' git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15543
12f355fe-0486-481a-ad91-c297ab22b4e3
2012-12-18 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
* include/ticcutils/Makefile.am, include/ticcutils/TreeHash.h,
- include/ticcutils/Trie.h, include/ticcutils/Tries.h: renamed file to
- avoid name clashes with older timbl installations git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15542
+ include/ticcutils/{Trie.h => Tries.h}: renamed file to avoid name
+ clashes with older timbl installations git-svn-id: https://ilk.uvt.nl/svn/sources/libticcutils/trunk@15542
12f355fe-0486-481a-ad91-c297ab22b4e3
2012-12-03 sloot <sloot at 12f355fe-0486-481a-ad91-c297ab22b4e3>
diff --git a/NEWS b/NEWS
index 8941c3a..01ad2ca 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,19 @@
+26 oct 2017 0.16
+[Ko van der Sloot]
+* update autoconfig stuff
+* added more and enhanced split() functions, including JAVA like variants
+* refactoring and cleanup
+* improved assertEqual()
+
+4 april 2017 0.15
+[Ko van der Sloot]
+- small bug fixes:
+ - added newline in logging
+ - check on 0 pointer in SocketBasics
+ - added more safeguards against abuse of CommandLine and StringOps
+ - added more tests tot runtest
+
+- code refactoring based on static analysis with CPPCHECK
18 oct 2016 0.14
[Ko van der Sloot]
- fixed dependecy on zlib1g-dev in configure
diff --git a/config.guess b/config.guess
index 1659250..2e9ad7f 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2015 Free Software Foundation, Inc.
+# Copyright 1992-2016 Free Software Foundation, Inc.
-timestamp='2015-08-20'
+timestamp='2016-10-02'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ timestamp='2015-08-20'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to <config-patches at gnu.org>.
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2015 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -186,9 +186,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
+ # to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
- arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ earm*)
+ os=netbsdelf
+ ;;
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__
@@ -237,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
+ *:LibertyBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -268,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
+ UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
+ UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
+ UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
+ UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
+ UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
+ UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
+ UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
+ UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
+ UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
@@ -376,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
- SUN_ARCH="i386"
+ SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
- SUN_ARCH="x86_64"
+ SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -410,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
@@ -635,13 +642,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ 32) HP_ARCH=hppa2.0n ;;
+ 64) HP_ARCH=hppa2.0w ;;
+ '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
@@ -680,11 +687,11 @@ EOF
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
+ if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
@@ -697,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
- HP_ARCH="hppa2.0w"
+ HP_ARCH=hppa2.0w
else
- HP_ARCH="hppa64"
+ HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -807,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -896,7 +903,7 @@ EOF
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
@@ -919,7 +926,7 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
@@ -965,6 +972,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
+ k1om:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@@ -990,6 +1000,9 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
+ mips64el:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
@@ -1022,6 +1035,9 @@ EOF
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
+ riscv32:Linux:*:* | riscv64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
@@ -1120,7 +1136,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
+ # prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@@ -1269,6 +1285,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
+ SX-ACE:SUPER-UX:*:*)
+ echo sxace-nec-superux${UNAME_RELEASE}
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1282,9 +1301,9 @@ EOF
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
@@ -1306,7 +1325,7 @@ EOF
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
+ if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
@@ -1337,7 +1356,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
- if test "$cputype" = "386"; then
+ if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
@@ -1379,7 +1398,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@@ -1390,23 +1409,25 @@ EOF
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
+ amd64:Isilon\ OneFS:*:*)
+ echo x86_64-unknown-onefs
+ exit ;;
esac
cat >&2 <<EOF
$0: unable to guess system type
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches at gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches at gnu.org to
+provide the necessary information to handle your system.
config.guess timestamp = $timestamp
diff --git a/config.h.in b/config.h.in
index 63bd7a3..3bc8c6e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -51,10 +51,6 @@
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
-/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
- to 0 otherwise. */
-#undef HAVE_MALLOC
-
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
@@ -127,6 +123,9 @@
/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK
+/* Define to 2 if you have boost regular expresions */
+#undef HAVE_WORKING_REGEX
+
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
@@ -173,9 +172,6 @@
#undef inline
#endif
-/* Define to rpl_malloc if the replacement function should be used. */
-#undef malloc
-
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
diff --git a/config.sub b/config.sub
index 1acc966..dd2ca93 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2015 Free Software Foundation, Inc.
+# Copyright 1992-2016 Free Software Foundation, Inc.
-timestamp='2015-08-20'
+timestamp='2016-11-04'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ timestamp='2015-08-20'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2015-08-20'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches at gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2015 Free Software Foundation, Inc.
+Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -118,7 +117,7 @@ case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
- kopensolaris*-gnu* | \
+ kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -302,6 +301,7 @@ case $basic_machine in
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
@@ -429,6 +429,7 @@ case $basic_machine in
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pru-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
@@ -521,7 +522,7 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
- asmjs)
+ asmjs)
basic_machine=asmjs-unknown
;;
aux)
@@ -644,6 +645,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
+ e500v[12])
+ basic_machine=powerpc-unknown
+ os=$os"spe"
+ ;;
+ e500v[12]-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=$os"spe"
+ ;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@@ -1023,7 +1032,7 @@ case $basic_machine in
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
+ ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
@@ -1033,7 +1042,7 @@ case $basic_machine in
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
@@ -1383,14 +1392,14 @@ case $os in
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1399,7 +1408,8 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1531,6 +1541,8 @@ case $os in
;;
-nacl*)
;;
+ -ios)
+ ;;
-none)
;;
*)
diff --git a/configure b/configure
index f1f7ae3..98128e0 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.14.
+# Generated by GNU Autoconf 2.69 for ticcutils 0.16.
#
# 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.14'
-PACKAGE_STRING='ticcutils 0.14'
+PACKAGE_VERSION='0.16'
+PACKAGE_STRING='ticcutils 0.16'
PACKAGE_BUGREPORT='lamasoftware at science.ru.nl'
PACKAGE_URL=''
@@ -635,6 +635,7 @@ ac_includes_default="\
ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
+LIBOBJS
XML2_LIBS
XML2_CFLAGS
PKG_CONFIG_LIBDIR
@@ -647,7 +648,6 @@ PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
ax_pthread_config
-LIBOBJS
OPENMP_CXXFLAGS
CXXCPP
CPP
@@ -1358,7 +1358,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.14 to adapt to many kinds of systems.
+\`configure' configures ticcutils 0.16 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1429,7 +1429,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ticcutils 0.14:";;
+ short | recursive ) echo "Configuration of ticcutils 0.16:";;
esac
cat <<\_ACEOF
@@ -1566,7 +1566,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ticcutils configure 0.14
+ticcutils configure 0.16
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2310,7 +2310,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.14, which was
+It was created by ticcutils $as_me 0.16, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3173,7 +3173,7 @@ fi
# Define the identity of the package.
PACKAGE='ticcutils'
- VERSION='0.14'
+ VERSION='0.16'
cat >>confdefs.h <<_ACEOF
@@ -16766,73 +16766,6 @@ _ACEOF
fi
done
-for ac_header in stdlib.h
-do :
- ac_fn_cxx_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_stdlib_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_STDLIB_H 1
-_ACEOF
-
-fi
-
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
-$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
-if ${ac_cv_func_malloc_0_nonnull+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then :
- ac_cv_func_malloc_0_nonnull=no
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#if defined STDC_HEADERS || defined HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-char *malloc ();
-#endif
-
-int
-main ()
-{
-return ! malloc (0);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_run "$LINENO"; then :
- ac_cv_func_malloc_0_nonnull=yes
-else
- ac_cv_func_malloc_0_nonnull=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
-$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
-if test $ac_cv_func_malloc_0_nonnull = yes; then :
-
-$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
-
-else
- $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
-
- case " $LIBOBJS " in
- *" malloc.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
- ;;
-esac
-
-
-$as_echo "#define malloc rpl_malloc" >>confdefs.h
-
-fi
-
-
for ac_header in vfork.h
do :
ac_fn_cxx_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
@@ -17046,6 +16979,9 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
fi
+# AC_FUNC_MALLOC seems to drive clang nuts
+
+
@@ -17057,21 +16993,32 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ax_pthread_ok=no
+# hack for Clang analyzer
+SUBST="cc-analyzer"
+if test "${CC#*$SUBST}" != "${CC}"; then
+ OLDCC=${CC}
+ CC=clang
+fi
+
# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
+# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
-$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
+ ax_pthread_save_CC="$CC"
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ if test "x$PTHREAD_CC" != "x"; then :
+ CC="$PTHREAD_CC"
+fi
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS" >&5
+$as_echo_n "checking for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -17094,14 +17041,15 @@ if ac_fn_c_try_link "$LINENO"; then :
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
$as_echo "$ax_pthread_ok" >&6; }
- if test x"$ax_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
+ if test "x$ax_pthread_ok" = "xno"; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ CC="$ax_pthread_save_CC"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
@@ -17114,7 +17062,7 @@ fi
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
-ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
@@ -17123,86 +17071,259 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
+# (Note: HP C rejects this with "bad form for `-t' option")
+# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
+# doesn't hurt to check since this sometimes defines pthreads and
+# -D_REENTRANT too), HP C (must be checked before -lpthread, which
+# is present but should not be used directly; and before -mthreads,
+# because the compiler interprets this as "-mt" + "-hreads")
+# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
-case ${host_os} in
- solaris*)
+case $host_os in
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
+ freebsd*)
- ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
- ;;
+ # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+ # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
- darwin*)
- ax_pthread_flags="-pthread $ax_pthread_flags"
- ;;
+ ax_pthread_flags="-kthread lthread $ax_pthread_flags"
+ ;;
+
+ hpux*)
+
+ # From the cc(1) man page: "[-mt] Sets various -D flags to enable
+ # multi-threading and also sets -lpthread."
+
+ ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
+ ;;
+
+ openedition*)
+
+ # IBM z/OS requires a feature-test macro to be defined in order to
+ # enable POSIX threads at all, so give the user a hint if this is
+ # not set. (We don't define these ourselves, as they can affect
+ # other portions of the system API in unpredictable ways.)
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
+ AX_PTHREAD_ZOS_MISSING
+# endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "AX_PTHREAD_ZOS_MISSING" >/dev/null 2>&1; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&5
+$as_echo "$as_me: WARNING: IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support." >&2;}
+fi
+rm -f conftest*
+
+ ;;
+
+ solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (N.B.: The stubs are missing
+ # pthread_cleanup_push, or rather a function called by this macro,
+ # so we could check for that, but who knows whether they'll stub
+ # that too in a future libc.) So we'll check first for the
+ # standard Solaris way of linking pthreads (-mt -lpthread).
+
+ ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
+ ;;
esac
-# Clang doesn't consider unrecognized options an error unless we specify
-# -Werror. We throw in some extra Clang-specific options to ensure that
-# this doesn't happen for GCC, which also accepts -Werror.
+# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5
-$as_echo_n "checking if compiler needs -Werror to reject unknown flags... " >&6; }
-save_CFLAGS="$CFLAGS"
-ax_pthread_extra_flags="-Werror"
-CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if test "x$GCC" = "xyes"; then :
+ ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"
+fi
+
+# The presence of a feature test macro requesting re-entrant function
+# definitions is, on some systems, a strong hint that pthreads support is
+# correctly enabled
+
+case $host_os in
+ darwin* | hpux* | linux* | osf* | solaris*)
+ ax_pthread_check_macro="_REENTRANT"
+ ;;
+
+ aix* | freebsd*)
+ ax_pthread_check_macro="_THREAD_SAFE"
+ ;;
+
+ *)
+ ax_pthread_check_macro="--"
+ ;;
+esac
+if test "x$ax_pthread_check_macro" = "x--"; then :
+ ax_pthread_check_cond=0
+else
+ ax_pthread_check_cond="!defined($ax_pthread_check_macro)"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC is Clang" >&5
+$as_echo_n "checking whether $CC is Clang... " >&6; }
+if ${ax_cv_PTHREAD_CLANG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ax_cv_PTHREAD_CLANG=no
+ # Note that Autoconf sets GCC=yes for Clang as well as GCC
+ if test "x$GCC" = "xyes"; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-int foo(void);
-int
-main ()
-{
-foo()
- ;
- return 0;
-}
+/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
+# if defined(__clang__) && defined(__llvm__)
+ AX_PTHREAD_CC_IS_CLANG
+# endif
+
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "AX_PTHREAD_CC_IS_CLANG" >/dev/null 2>&1; then :
+ ax_cv_PTHREAD_CLANG=yes
+fi
+rm -f conftest*
+
+ fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG" >&6; }
+ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
+
+ax_pthread_clang_warning=no
+
+# Clang needs special handling, because older versions handle the -pthread
+# option in a rather... idiosyncratic way
+
+if test "x$ax_pthread_clang" = "xyes"; then
+
+ # Clang takes -pthread; it has never supported any other flag
+
+ # (Note 1: This will need to be revisited if a system that Clang
+ # supports has POSIX threads in a separate library. This tends not
+ # to be the way of modern systems, but it's conceivable.)
+
+ # (Note 2: On some systems, notably Darwin, -pthread is not needed
+ # to get POSIX threads support; the API is always present and
+ # active. We could reasonably leave PTHREAD_CFLAGS empty. But
+ # -pthread does define _REENTRANT, and while the Darwin headers
+ # ignore this macro, third-party headers might not.)
+
+ PTHREAD_CFLAGS="-pthread"
+ PTHREAD_LIBS=
+
+ ax_pthread_ok=yes
+
+ # However, older versions of Clang make a point of warning the user
+ # that, in an invocation where only linking and no compilation is
+ # taking place, the -pthread option has no effect ("argument unused
+ # during compilation"). They expect -pthread to be passed in only
+ # when source code is being compiled.
+ #
+ # Problem is, this is at odds with the way Automake and most other
+ # C build frameworks function, which is that the same flags used in
+ # compilation (CFLAGS) are also used in linking. Many systems
+ # supported by AX_PTHREAD require exactly this for POSIX threads
+ # support, and in fact it is often not straightforward to specify a
+ # flag that is used only in the compilation phase and not in
+ # linking. Such a scenario is extremely rare in practice.
+ #
+ # Even though use of the -pthread flag in linking would only print
+ # a warning, this can be a nuisance for well-run software projects
+ # that build with -Werror. So if the active version of Clang has
+ # this misfeature, we search for an option to squash it.
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread" >&5
+$as_echo_n "checking whether Clang needs flag to prevent \"argument unused\" warning when linking with -pthread... " >&6; }
+if ${ax_cv_PTHREAD_CLANG_NO_WARN_FLAG+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- ax_pthread_extra_flags=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
+ # Create an alternate version of $ac_link that compiles and
+ # links in two steps (.c -> .o, .o -> exe) instead of one
+ # (.c -> exe), because the warning occurs only in the second
+ # step
+ ax_pthread_save_ac_link="$ac_link"
+ ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
+ ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
+ ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
+ if test "x$ax_pthread_try" = "xunknown"; then :
+ break
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS="$save_CFLAGS"
+ CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
+ ac_link="$ax_pthread_save_ac_link"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_link="$ax_pthread_2step_ac_link"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int main(void){return 0;}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
-if test x"$ax_pthread_ok" = xno; then
-for flag in $ax_pthread_flags; do
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ done
+ ac_link="$ax_pthread_save_ac_link"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ if test "x$ax_pthread_try" = "x"; then :
+ ax_pthread_try=no
+fi
+ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
- case $flag in
- none)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&5
+$as_echo "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" >&6; }
+
+ case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
+ no | unknown) ;;
+ *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
+ esac
+
+fi # $ax_pthread_clang = yes
+
+if test "x$ax_pthread_ok" = "xno"; then
+for ax_pthread_try_flag in $ax_pthread_flags; do
+
+ case $ax_pthread_try_flag in
+ none)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
$as_echo_n "checking whether pthreads work without any flags... " >&6; }
- ;;
+ ;;
- -*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
-$as_echo_n "checking whether pthreads work with $flag... " >&6; }
- PTHREAD_CFLAGS="$flag"
- ;;
+ -mt,pthread)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with -mt -lpthread" >&5
+$as_echo_n "checking whether pthreads work with -mt -lpthread... " >&6; }
+ PTHREAD_CFLAGS="-mt"
+ PTHREAD_LIBS="-lpthread"
+ ;;
+
+ -*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $ax_pthread_try_flag" >&5
+$as_echo_n "checking whether pthreads work with $ax_pthread_try_flag... " >&6; }
+ PTHREAD_CFLAGS="$ax_pthread_try_flag"
+ ;;
- pthread-config)
- # Extract the first word of "pthread-config", so it can be a program name with args.
+ pthread-config)
+ # Extract the first word of "pthread-config", so it can be a program name with args.
set dummy pthread-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
@@ -17240,46 +17361,52 @@ $as_echo "no" >&6; }
fi
- if test x"$ax_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
+ if test "x$ax_pthread_config" = "xno"; then :
+ continue
+fi
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
-$as_echo_n "checking for the pthreads library -l$flag... " >&6; }
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
+ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$ax_pthread_try_flag" >&5
+$as_echo_n "checking for the pthreads library -l$ax_pthread_try_flag... " >&6; }
+ PTHREAD_LIBS="-l$ax_pthread_try_flag"
+ ;;
+ esac
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
- static void routine(void *a) { a = 0; }
- static void *start_routine(void *a) { return a; }
+# if $ax_pthread_check_cond
+# error "$ax_pthread_check_macro must be defined"
+# endif
+ static void routine(void *a) { a = 0; }
+ static void *start_routine(void *a) { return a; }
int
main ()
{
pthread_t th; pthread_attr_t attr;
- pthread_create(&th, 0, start_routine, 0);
- pthread_join(th, 0);
- pthread_attr_init(&attr);
- pthread_cleanup_push(routine, 0);
- pthread_cleanup_pop(0) /* ; */
+ pthread_create(&th, 0, start_routine, 0);
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_cleanup_pop(0) /* ; */
;
return 0;
}
@@ -17290,87 +17417,95 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5
$as_echo "$ax_pthread_ok" >&6; }
- if test "x$ax_pthread_ok" = xyes; then
- break;
- fi
+ if test "x$ax_pthread_ok" = "xyes"; then :
+ break
+fi
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
done
fi
# Various other checks:
-if test "x$ax_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
+if test "x$ax_pthread_ok" = "xyes"; then
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
$as_echo_n "checking for joinable pthread attribute... " >&6; }
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+if ${ax_cv_PTHREAD_JOINABLE_ATTR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ax_cv_PTHREAD_JOINABLE_ATTR=unknown
+ for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
int
main ()
{
-int attr = $attr; return attr /* ; */
+int attr = $ax_pthread_attr; return attr /* ; */
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
- attr_name=$attr; break
+ ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- done
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
-$as_echo "$attr_name" >&6; }
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
+ done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_JOINABLE_ATTR" >&5
+$as_echo "$ax_cv_PTHREAD_JOINABLE_ATTR" >&6; }
+ if test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
+ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
+ test "x$ax_pthread_joinable_attr_defined" != "xyes"; then :
cat >>confdefs.h <<_ACEOF
-#define PTHREAD_CREATE_JOINABLE $attr_name
+#define PTHREAD_CREATE_JOINABLE $ax_cv_PTHREAD_JOINABLE_ATTR
_ACEOF
- fi
+ ax_pthread_joinable_attr_defined=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
-$as_echo_n "checking if more special flags are required for pthreads... " >&6; }
- flag=no
- case ${host_os} in
- aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
- osf* | hpux*) flag="-D_REENTRANT";;
- solaris*)
- if test "$GCC" = "yes"; then
- flag="-D_REENTRANT"
- else
- # TODO: What about Clang on Solaris?
- flag="-mt -D_REENTRANT"
- fi
- ;;
- esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag" >&5
-$as_echo "$flag" >&6; }
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether more special flags are required for pthreads" >&5
+$as_echo_n "checking whether more special flags are required for pthreads... " >&6; }
+if ${ax_cv_PTHREAD_SPECIAL_FLAGS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ax_cv_PTHREAD_SPECIAL_FLAGS=no
+ case $host_os in
+ solaris*)
+ ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
+ ;;
+ esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_SPECIAL_FLAGS" >&5
+$as_echo "$ax_cv_PTHREAD_SPECIAL_FLAGS" >&6; }
+ if test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
+ test "x$ax_pthread_special_flags_added" != "xyes"; then :
+ PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
+ ax_pthread_special_flags_added=yes
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5
$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; }
if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then :
$as_echo_n "(cached) " >&6
else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <pthread.h>
int
@@ -17392,23 +17527,26 @@ rm -f core conftest.err conftest.$ac_objext \
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5
$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; }
- if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then :
+ if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
+ test "x$ax_pthread_prio_inherit_defined" != "xyes"; then :
$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h
+ ax_pthread_prio_inherit_defined=yes
+
fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
- # More AIX lossage: compile with *_r variant
- if test "x$GCC" != xyes; then
- case $host_os in
- aix*)
- case "x/$CC" in #(
+ # More AIX lossage: compile with *_r variant
+ if test "x$GCC" != "xyes"; then
+ case $host_os in
+ aix*)
+ case "x/$CC" in #(
x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6) :
#handle absolute path differently from PATH based program lookup
- case "x$CC" in #(
+ case "x$CC" in #(
x/*) :
if as_fn_executable_p ${CC}_r; then :
PTHREAD_CC="${CC}_r"
@@ -17461,9 +17599,9 @@ esac ;; #(
*) :
;;
esac
- ;;
- esac
- fi
+ ;;
+ esac
+ fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
@@ -17473,15 +17611,21 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$ax_pthread_ok" = xyes; then
+if test "x$ax_pthread_ok" = "xyes"; then
$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
- :
+ :
else
- ax_pthread_ok=no
- as_fn_error $? "We need pthread support!" "$LINENO" 5
+ ax_pthread_ok=no
+ as_fn_error $? "We need pthread support!" "$LINENO" 5
+fi
+
+# undo hack for Clang analyzer
+if test "${OLDCC#*$SUBST}" != "${OLDCC}"; then
+ CC=${OLDCC}
fi
+
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -17495,6 +17639,23 @@ if test x"$ax_pthread_ok" = xyes; then
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
fi
+# only require boost for OLD gcc compilers AND als stdlib++
+# for now we HAV to stick to boost regex :{
+
+# AX_COMPILER_VENDOR
+# if test x"$ax_cv_cxx_compiler_vendor" = xgnu; then
+# AX_COMPILER_VERSION
+# AX_COMPARE_VERSION( [$ax_cv_cxx_compiler_version], [lt], [4.9],
+# [AX_BOOST_BASE( [1.50],
+# [AX_BOOST_REGEX
+# LIBS="$LIBS $BOOST_REGEX_LIB"
+# AC_DEFINE(HAVE_WORKING_REGEX, 2 , Define to 2 if you have boost regular expresions )],
+# [AC_MSG_ERROR([No Regular expression support available. Please install libboost-regex-dev, or update gcc])])],
+# AC_DEFINE(HAVE_WORKING_REGEX, 1 , Define to 1 if you have working native C++ regular expresions ) )
+# else
+# AC_DEFINE(HAVE_WORKING_REGEX, 1 , Define to 1 if you have native C++ regular expresions)
+# fi
+
# Check whether --with-boost was given.
@@ -17554,7 +17715,7 @@ $as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
libsubdirs="lib64 libx32 lib lib64"
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
- libsubdirs="lib64 lib lib64 ppc64le"
+ libsubdirs="lib64 lib lib64"
;;
esac
@@ -17767,8 +17928,7 @@ $as_echo "$as_me: We could not detect the boost libraries (version $boost_lib_ve
$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
fi
# execute ACTION-IF-NOT-FOUND (if present):
- { $as_echo "$as_me:${as_lineno-$LINENO}: No Boost support" >&5
-$as_echo "$as_me: No Boost support" >&6;}
+ as_fn_error $? "No Regular expression support available. Please install libboost-regex-dev" "$LINENO" 5
else
@@ -18003,7 +18163,10 @@ fi
LDFLAGS="$LDFLAGS_SAVED"
fi
- LIBS="$LIBS $BOOST_REGEX_LIB"
+ LIBS="$LIBS $BOOST_REGEX_LIB"
+
+$as_echo "#define HAVE_WORKING_REGEX 2 " >>confdefs.h
+
fi
CPPFLAGS="$CPPFLAGS_SAVED"
@@ -18013,13 +18176,6 @@ fi
-# ugly hack when PKG_CONFIG_PATH isn't defined.
-# couldn't get it to work otherwise
-if test "x$PKG_CONFIG_PATH" = x; then
- export PKG_CONFIG_PATH=""
-fi
-
-
@@ -18140,6 +18296,13 @@ $as_echo "no" >&6; }
fi
fi
+if test "x$PKG_CONFIG_PATH" = x; then
+ export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
+else
+ export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
+fi
+
+
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML2" >&5
$as_echo_n "checking for XML2... " >&6; }
@@ -18769,7 +18932,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.14, which was
+This file was extended by ticcutils $as_me 0.16, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18835,7 +18998,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.14
+ticcutils config.status 0.16
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 5950327..2b5d4bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,8 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-# $Id$
-# $URL $
AC_PREREQ(2.61)
-AC_INIT([ticcutils],[0.14],[lamasoftware at science.ru.nl])
+AC_INIT([ticcutils],[0.16],[lamasoftware at science.ru.nl])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_SRCDIR([.])
AC_CONFIG_MACRO_DIR([m4])
@@ -35,7 +33,7 @@ if test "x$ac_cv_prog_cxx_openmp" != "xunsupported"; then
CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
AC_DEFINE(HAVE_OPENMP, 1 , Define to 1 if you have OpenMP )
else
- AC_MSG_NOTICE(We don't have OpenMP. Multithreaded operation is disabled)
+ AC_MSG_NOTICE([We don't have OpenMP. Multithreaded operation is disabled])
fi
#checks for libraries.
@@ -64,8 +62,8 @@ AX_TYPE_SOCKLEN_T
# Checks for library functions.
AC_CHECK_FUNCS([localtime_r gettimeofday mkdir getaddrinfo gethostbyaddr gethostbyname inet_ntoa memset socket strerror dup2 memmove ])
-AC_FUNC_MALLOC
AC_FUNC_FORK
+# AC_FUNC_MALLOC seems to drive clang nuts
AX_PTHREAD([],[AC_MSG_ERROR([We need pthread support!])])
@@ -74,19 +72,37 @@ if test x"$ax_pthread_ok" = xyes; then
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
fi
-AX_BOOST_BASE([1.50],
- [AX_BOOST_REGEX
- LIBS="$LIBS $BOOST_REGEX_LIB"],
- [AC_MSG_NOTICE([No Boost support]) ])
+# only require boost for OLD gcc compilers AND als stdlib++
+# for now we HAV to stick to boost regex :{
+
+# AX_COMPILER_VENDOR
+# if test x"$ax_cv_cxx_compiler_vendor" = xgnu; then
+# AX_COMPILER_VERSION
+# AX_COMPARE_VERSION( [$ax_cv_cxx_compiler_version], [lt], [4.9],
+# [AX_BOOST_BASE( [1.50],
+# [AX_BOOST_REGEX
+# LIBS="$LIBS $BOOST_REGEX_LIB"
+# AC_DEFINE(HAVE_WORKING_REGEX, 2 , Define to 2 if you have boost regular expresions )],
+# [AC_MSG_ERROR([No Regular expression support available. Please install libboost-regex-dev, or update gcc])])],
+# AC_DEFINE(HAVE_WORKING_REGEX, 1 , Define to 1 if you have working native C++ regular expresions ) )
+# else
+# AC_DEFINE(HAVE_WORKING_REGEX, 1 , Define to 1 if you have native C++ regular expresions)
+# fi
+
+AX_BOOST_BASE( [1.50],
+ [AX_BOOST_REGEX
+ LIBS="$LIBS $BOOST_REGEX_LIB"
+ AC_DEFINE(HAVE_WORKING_REGEX, 2 , Define to 2 if you have boost regular expresions )],
+ [AC_MSG_ERROR([No Regular expression support available. Please install libboost-regex-dev])])
+PKG_PROG_PKG_CONFIG
-# ugly hack when PKG_CONFIG_PATH isn't defined.
-# couldn't get it to work otherwise
if test "x$PKG_CONFIG_PATH" = x; then
- export PKG_CONFIG_PATH=""
+ export PKG_CONFIG_PATH="$prefix/lib/pkgconfig"
+else
+ export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
-PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.6.16] )
CXXFLAGS="$CXXFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
diff --git a/include/Makefile.am b/include/Makefile.am
index b70e115..1190da6 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,6 +1,3 @@
-# $Id: Makefile.am 8191 2011-02-02 14:50:37Z sloot $
-# $URL: https://ilk.uvt.nl/svn/trunk/sources/Timbl6/include/Makefile.am $
-
-AUTOMAKE_OPTIONS = foreign
+AUTOMAKE_OPTIONS = foreign
SUBDIRS = ticcutils
diff --git a/include/Makefile.in b/include/Makefile.in
index abd4603..51d7709 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -13,9 +13,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
-
-# $Id: Makefile.am 8191 2011-02-02 14:50:37Z sloot $
-# $URL: https://ilk.uvt.nl/svn/trunk/sources/Timbl6/include/Makefile.am $
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -325,7 +322,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AUTOMAKE_OPTIONS = foreign
+AUTOMAKE_OPTIONS = foreign
SUBDIRS = ticcutils
all: all-recursive
diff --git a/include/ticcutils/CommandLine.h b/include/ticcutils/CommandLine.h
index a2ed46b..f43cd55 100644
--- a/include/ticcutils/CommandLine.h
+++ b/include/ticcutils/CommandLine.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -37,7 +37,7 @@ namespace TiCC {
class OptionError: public std::runtime_error {
public:
- OptionError( const std::string& s ): std::runtime_error( "option-error: " + s ){};
+ explicit OptionError( const std::string& s ): std::runtime_error( "option-error: " + s ){};
};
class CL_item {
@@ -46,7 +46,7 @@ namespace TiCC {
CL_item( const std::string& s, const std::string& o ):
opt_word(s), option( o ), mood( false ), longOpt(true) {};
CL_item( char c, const std::string& o, bool m=false ):
- option( o ), mood( m ), longOpt(false){ opt_word = c; };
+ opt_word(1,c),option( o ), mood( m ), longOpt(false){};
CL_item( const CL_item& in ):
opt_word( in.opt_word ), option(in.option),
mood(in.mood), longOpt(in.longOpt){
diff --git a/include/ticcutils/Configuration.h b/include/ticcutils/Configuration.h
index fc73189..5f7f3ed 100644
--- a/include/ticcutils/Configuration.h
+++ b/include/ticcutils/Configuration.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -60,6 +60,7 @@ namespace TiCC {
private:
sssMap myMap;
std::string cdir; // not used. left here for binary compatibility
+ bool get_att_val( const std::string&, const std::string& );
};
inline std::ostream& operator<<( std::ostream& os, const Configuration& c ){
diff --git a/include/ticcutils/FdStream.h b/include/ticcutils/FdStream.h
index 758d411..bd7d1a4 100644
--- a/include/ticcutils/FdStream.h
+++ b/include/ticcutils/FdStream.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -32,7 +32,7 @@
class fdoutbuf: public std::streambuf {
public:
- fdoutbuf( int _fd );
+ explicit fdoutbuf( int _fd );
fdoutbuf();
bool connect( int );
protected:
@@ -45,7 +45,7 @@ class fdostream: public std::ostream {
protected:
fdoutbuf buf;
public:
- fdostream( int fd ): std::ostream(&buf), buf(fd) {};
+ explicit fdostream( int fd ): std::ostream(&buf), buf(fd) {};
fdostream(): std::ostream(&buf) {};
bool open( int fd );
};
@@ -53,7 +53,7 @@ class fdostream: public std::ostream {
class fdinbuf: public std::streambuf {
public:
fdinbuf();
- fdinbuf( int);
+ explicit fdinbuf( int);
bool connect( int );
protected:
virtual int underflow();
@@ -67,7 +67,7 @@ class fdistream: public std::istream {
protected:
fdinbuf buf;
public:
- fdistream( int fd ): std::istream(&buf), buf(fd) {};
+ explicit fdistream( int fd ): std::istream(&buf), buf(fd) {};
fdistream(): std::istream(&buf) {};
bool open( int fd );
};
diff --git a/include/ticcutils/FileUtils.h b/include/ticcutils/FileUtils.h
index e364497..fe617d0 100644
--- a/include/ticcutils/FileUtils.h
+++ b/include/ticcutils/FileUtils.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -34,7 +34,7 @@ namespace TiCC {
std::vector<std::string> searchFilesExt( const std::string&,
const std::string&,
bool = true );
- std::vector<std::string> searchFiles( const std::string& name,
+ inline std::vector<std::string> searchFiles( const std::string& name,
bool recurse = true ){
return searchFilesExt( name, "", recurse );
}
diff --git a/include/ticcutils/LogBuffer.h b/include/ticcutils/LogBuffer.h
index 515a8ca..0b75d6e 100644
--- a/include/ticcutils/LogBuffer.h
+++ b/include/ticcutils/LogBuffer.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/LogStream.h b/include/ticcutils/LogStream.h
index 9a0e226..cfbf13a 100644
--- a/include/ticcutils/LogStream.h
+++ b/include/ticcutils/LogStream.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -71,8 +71,8 @@ namespace TiCC {
friend bool IsActive( LogStream & );
friend bool IsActive( LogStream * );
public:
- LogStream();
- LogStream( int );
+ explicit LogStream();
+ explicit LogStream( int );
LogStream( const std::string&, LogFlag = StampBoth );
LogStream( std::ostream&, const std::string& = "",
LogFlag = StampBoth );
@@ -107,8 +107,8 @@ namespace TiCC {
class Log{
public:
- Log( LogStream * );
- Log( LogStream& l );
+ explicit Log( LogStream * );
+ explicit Log( LogStream& l );
~Log();
LogStream& operator *();
private:
@@ -120,8 +120,8 @@ namespace TiCC {
class Dbg{
public:
- Dbg( LogStream * );
- Dbg( LogStream& l );
+ explicit Dbg( LogStream * );
+ explicit Dbg( LogStream& l );
~Dbg();
LogStream& operator *();
private:
@@ -133,8 +133,8 @@ namespace TiCC {
class xDbg{
public:
- xDbg( LogStream * );
- xDbg( LogStream& l );
+ explicit xDbg( LogStream * );
+ explicit xDbg( LogStream& l );
~xDbg();
LogStream& operator *();
private:
@@ -146,8 +146,8 @@ namespace TiCC {
class xxDbg{
public:
- xxDbg( LogStream * );
- xxDbg( LogStream& l );
+ explicit xxDbg( LogStream * );
+ explicit xxDbg( LogStream& l );
~xxDbg();
LogStream& operator *();
private:
diff --git a/include/ticcutils/Makefile.am b/include/ticcutils/Makefile.am
index 923f771..c214a4f 100644
--- a/include/ticcutils/Makefile.am
+++ b/include/ticcutils/Makefile.am
@@ -1,6 +1,3 @@
-# $Id$
-# $URL$
-
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 \
diff --git a/include/ticcutils/Makefile.in b/include/ticcutils/Makefile.in
index 6fa020c..d890558 100644
--- a/include/ticcutils/Makefile.in
+++ b/include/ticcutils/Makefile.in
@@ -14,9 +14,6 @@
@SET_MAKE@
-# $Id$
-# $URL$
-
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
diff --git a/include/ticcutils/PrettyPrint.h b/include/ticcutils/PrettyPrint.h
index f5f33a5..a7c2b4a 100644
--- a/include/ticcutils/PrettyPrint.h
+++ b/include/ticcutils/PrettyPrint.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/ServerBase.h b/include/ticcutils/ServerBase.h
index 0d85f45..51b49f4 100644
--- a/include/ticcutils/ServerBase.h
+++ b/include/ticcutils/ServerBase.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -50,7 +50,7 @@ namespace TimblServer {
static std::string VersionInfo( bool );
static int daemonize( int , int );
int maxConn() const { return _maxConn; };
- ServerBase( const TiCC::Configuration * );
+ explicit ServerBase( const TiCC::Configuration * );
void setDebug( bool d ){ debug = d; };
Sockets::ServerSocket *TcpSocket() const { return tcp_socket; };
static void *callChild( void * );
@@ -98,14 +98,14 @@ namespace TimblServer {
class TcpServerBase : public ServerBase {
public:
- TcpServerBase( const TiCC::Configuration *c ):ServerBase( c ){};
+ explicit TcpServerBase( const TiCC::Configuration *c ):ServerBase( c ){};
};
class HttpServerBase : public ServerBase {
public:
void socketChild( childArgs * );
virtual void sendReject( std::ostream& os ) const;
- HttpServerBase( const TiCC::Configuration *c ): ServerBase( c ){};
+ explicit HttpServerBase( const TiCC::Configuration *c ): ServerBase( c ){};
};
std::string Version();
diff --git a/include/ticcutils/SocketBasics.h b/include/ticcutils/SocketBasics.h
index 070961c..a6a303a 100644
--- a/include/ticcutils/SocketBasics.h
+++ b/include/ticcutils/SocketBasics.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/StringOps.h b/include/ticcutils/StringOps.h
index 43dad65..242ae07 100644
--- a/include/ticcutils/StringOps.h
+++ b/include/ticcutils/StringOps.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -55,10 +55,21 @@ namespace TiCC {
return split_at_first_of( s, vec, " \r\t\n", exact );
}
+ std::vector<std::string> split_at( const std::string&,
+ const std::string&,
+ size_t = 0 );
+ std::vector<std::string> split_at_first_of( const std::string&,
+ const std::string&,
+ size_t = 0 );
+ inline std::vector<std::string> split( const std::string& s,
+ size_t num = 0 ){
+ return split_at_first_of( s, " \r\t\n", num );
+ }
+
std::string format_nonascii( const std::string& );
template< typename T >
- T stringTo( const std::string& str ) {
+ inline T stringTo( const std::string& str ) {
T result;
std::stringstream dummy ( str );
if ( !( dummy >> result ) ) {
@@ -81,7 +92,7 @@ namespace TiCC {
}
template< typename T >
- bool stringTo( const std::string& str, T& result ) {
+ inline bool stringTo( const std::string& str, T& result ) {
try {
result = stringTo<T>( str );
return true;
@@ -92,7 +103,7 @@ namespace TiCC {
}
template <typename T>
- bool stringTo( const std::string& s, T &answer, T low, T upp ){
+ inline bool stringTo( const std::string& s, T &answer, T low, T upp ){
try {
T tmp = stringTo<T>( s );
if ( (tmp >= low) && (tmp <= upp) ){
@@ -107,7 +118,7 @@ namespace TiCC {
}
template< typename T >
- std::string toString ( const T& obj, bool=false ) {
+ inline std::string toString ( const T& obj, bool=false ) {
std::stringstream dummy;
if ( !( dummy << obj ) ) {
throw( std::runtime_error( "conversion failed" ) );
diff --git a/include/ticcutils/Tar.h b/include/ticcutils/Tar.h
index d1c4d67..8e56c29 100644
--- a/include/ticcutils/Tar.h
+++ b/include/ticcutils/Tar.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -29,8 +29,6 @@
#ifdef HAVE_LIBTAR_H
#include "libtar.h"
-#else
-#define TAR int
#endif
#include <fstream>
#include <vector>
@@ -50,7 +48,9 @@ namespace TiCC {
bool extract_ifstream( const std::string&, std::ifstream& );
bool close();
private:
+#ifdef HAVE_LIBTAR_H
TAR *tar_file;
+#endif
std::string tarname;
tar( const tar& ); // no copies
tar& operator=( const tar& ); // no copies
diff --git a/include/ticcutils/Timer.h b/include/ticcutils/Timer.h
index 29e854b..64b514a 100644
--- a/include/ticcutils/Timer.h
+++ b/include/ticcutils/Timer.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/TreeHash.h b/include/ticcutils/TreeHash.h
index f6b4c77..741628b 100644
--- a/include/ticcutils/TreeHash.h
+++ b/include/ticcutils/TreeHash.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/Trie.h b/include/ticcutils/Trie.h
index 5d8cf48..30f2fe8 100644
--- a/include/ticcutils/Trie.h
+++ b/include/ticcutils/Trie.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -42,7 +42,7 @@ namespace Tries {
friend std::ostream& operator<< LTGT ( std::ostream&,
const TrieNode<Info> * );
public:
- TrieNode( char );
+ explicit TrieNode( char );
~TrieNode();
Info *add_to_tree( Info *, const std::string& );
Info *scan_tree( const std::string& ) const;
diff --git a/include/ticcutils/UnitTest.h b/include/ticcutils/UnitTest.h
index df878ab..08c1e66 100644
--- a/include/ticcutils/UnitTest.h
+++ b/include/ticcutils/UnitTest.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -111,7 +111,19 @@ void MyTSerie::stop( const std::string& fun, int ){
};
}
-#define assertEqual( XX , YY ) test_eq<decltype(XX), decltype(YY)>( __func__, __LINE__, (XX), (YY), currentTestContext )
+#define assertEqual( XX , YY ) \
+ try { \
+ test_eq<decltype(XX), decltype(YY)>( __func__, __LINE__, (XX), (YY), currentTestContext ); \
+ } \
+ catch ( const std::exception& e ){ \
+ ++currentTestContext._fails; \
+ if ( currentTestContext.isDefault() ) \
+ std::cout << FAIL << std::endl; \
+ else \
+ std::cerr << "\t"; \
+ std::cerr << __func__ << "(" << __LINE__ << ") : caucht exception, what='" << e.what() << "'" << std::endl; \
+ }
+
#define assertThrow( XX, EE ) \
do { \
++currentTestContext._tests; \
@@ -173,19 +185,19 @@ void MyTSerie::stop( const std::string& fun, int ){
#define assertFalse( YY ) \
try { \
- test_false( __func__, __LINE__, (YY), currentTestContext ); \
+ test_false( __func__, __LINE__, (YY), currentTestContext ); \
} \
catch( const std::exception& e ){ \
std::cerr << __func__ << "(" << __LINE__ << ") error:'" << e.what() << "'" << std::endl; \
}
#define assertMessage( MM, YY ) \
- try { \
- test_true_message( __func__, __LINE__, (MM), (YY), currentTestContext ); \
- } \
- catch( const std::exception& e ){ \
- std::cerr << __func__ << "(" << __LINE__ << ") error: '" << e.what() << "'" << std::endl; \
- }
+ try { \
+ test_true_message( __func__, __LINE__, (MM), (YY), currentTestContext ); \
+ } \
+ catch( const std::exception& e ){ \
+ std::cerr << __func__ << "(" << __LINE__ << ") error: '" << e.what() << "'" << std::endl; \
+ }
#define startTestSerie( SS ) MyTSerie currentTestContext( __func__, __LINE__, (SS) )
diff --git a/include/ticcutils/Version.h b/include/ticcutils/Version.h
index 07fcc5d..a03fa87 100644
--- a/include/ticcutils/Version.h
+++ b/include/ticcutils/Version.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/include/ticcutils/XMLtools.h b/include/ticcutils/XMLtools.h
index 318cd53..5ca7409 100644
--- a/include/ticcutils/XMLtools.h
+++ b/include/ticcutils/XMLtools.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -142,7 +142,7 @@ namespace TiCC {
class XmlDoc {
friend std::ostream& operator << ( std::ostream& , const XmlDoc& );
public:
- XmlDoc( const std::string& );
+ explicit XmlDoc( const std::string& );
~XmlDoc(){
xmlFreeDoc( the_doc );
}
diff --git a/include/ticcutils/gzstream.h b/include/ticcutils/gzstream.h
index 00d15aa..3d43a6e 100644
--- a/include/ticcutils/gzstream.h
+++ b/include/ticcutils/gzstream.h
@@ -21,7 +21,7 @@
// Revision : $Revision: 16571 $
// Revision_date : $Date: 2013-10-09 10:33:53 +0200 (Wed, 09 Oct 2013) $
// Author(s) : Deepak Bandyopadhyay, Lutz Kettner
-//
+// Modernized : Ko vd Sloot (12-01-2017)
// Standard streambuf implementation following Nicolai Josuttis, "The
// Standard C++ Library".
// ============================================================================
@@ -66,7 +66,7 @@ namespace GZSTREAM_NAMESPACE {
// ASSERT: both input & output capabilities will not be used together
}
int is_open() { return opened; }
- gzstreambuf* open( const char* name, int open_mode);
+ gzstreambuf* open( const std::string &name, int open_mode );
gzstreambuf* close();
~gzstreambuf() { close(); }
@@ -80,9 +80,9 @@ namespace GZSTREAM_NAMESPACE {
gzstreambuf buf;
public:
gzstreambase() { init(&buf); }
- gzstreambase( const char* name, int open_mode);
+ gzstreambase( const std::string&, int );
~gzstreambase();
- void open( const char* name, int open_mode);
+ void open( const std::string&, int );
void close();
gzstreambuf* rdbuf() { return &buf; }
};
@@ -96,10 +96,10 @@ namespace GZSTREAM_NAMESPACE {
class igzstream : public gzstreambase, public std::istream {
public:
igzstream() : std::istream( &buf) {}
- igzstream( const char* name, int open_mode = std::ios::in)
- : gzstreambase( name, open_mode), std::istream( &buf) {}
+ igzstream( const std::string& name, int open_mode = std::ios::in )
+ : gzstreambase( name, open_mode ), std::istream( &buf ) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
- void open( const char* name, int open_mode = std::ios::in) {
+ void open( const std::string& name, int open_mode = std::ios::in ) {
gzstreambase::open( name, open_mode);
}
};
@@ -107,15 +107,15 @@ namespace GZSTREAM_NAMESPACE {
class ogzstream : public gzstreambase, public std::ostream {
public:
ogzstream() : std::ostream( &buf) {}
- ogzstream( const char* name, int mode = std::ios::out)
- : gzstreambase( name, mode), std::ostream( &buf) {}
+ ogzstream( const std::string& name, int mode = std::ios::out )
+ : gzstreambase( name, mode ), std::ostream( &buf ) {}
gzstreambuf* rdbuf() { return gzstreambase::rdbuf(); }
- void open( const char* name, int open_mode = std::ios::out) {
- gzstreambase::open( name, open_mode);
+ void open( const std::string& name, int open_mode = std::ios::out ) {
+ gzstreambase::open( name, open_mode );
}
};
- gzstreambuf* gzstreambuf::open( const char* name, int open_mode) {
+ gzstreambuf* gzstreambuf::open( const std::string& name, int open_mode) {
if ( is_open())
return (gzstreambuf*)0;
mode = open_mode;
@@ -129,7 +129,7 @@ namespace GZSTREAM_NAMESPACE {
else if ( mode & std::ios::out)
fmode += 'w';
fmode += 'b';
- file = gzopen( name, fmode.c_str() );
+ file = gzopen( name.c_str(), fmode.c_str() );
if (file == 0){
return (gzstreambuf*)0;
}
@@ -209,23 +209,23 @@ namespace GZSTREAM_NAMESPACE {
// class gzstreambase:
// --------------------------------------
- gzstreambase::gzstreambase( const char* name, int mode) {
- init( &buf);
- open( name, mode);
+ gzstreambase::gzstreambase( const std::string& name, int mode ) {
+ init( &buf );
+ open( name, mode );
}
gzstreambase::~gzstreambase() {
buf.close();
}
- void gzstreambase::open( const char* name, int open_mode) {
- if ( ! buf.open( name, open_mode))
- clear( rdstate() | std::ios::badbit);
+ void gzstreambase::open( const std::string& name, int open_mode ) {
+ if ( ! buf.open( name, open_mode ) )
+ clear( rdstate() | std::ios::badbit );
}
void gzstreambase::close() {
- if ( buf.is_open())
- if ( ! buf.close())
+ if ( buf.is_open() )
+ if ( ! buf.close() )
clear( rdstate() | std::ios::badbit);
}
diff --git a/include/ticcutils/zipper.h b/include/ticcutils/zipper.h
index 6c1e2e6..8f493e1 100644
--- a/include/ticcutils/zipper.h
+++ b/include/ticcutils/zipper.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/ltmain.sh b/ltmain.sh
index 147d758..a736cf9 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -31,7 +31,7 @@
PROGRAM=libtool
PACKAGE=libtool
-VERSION="2.4.6 Debian-2.4.6-0.1"
+VERSION="2.4.6 Debian-2.4.6-2"
package_revision=2.4.6
@@ -2068,7 +2068,7 @@ include the following information:
compiler: $LTCC
compiler flags: $LTCFLAGS
linker: $LD (gnu? $with_gnu_ld)
- version: $progname (GNU libtool) 2.4.6
+ version: $progname $scriptversion Debian-2.4.6-2
automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
diff --git a/m4/ax_boost_base.m4 b/m4/ax_boost_base.m4
index f3279f2..ab46745 100644
--- a/m4/ax_boost_base.m4
+++ b/m4/ax_boost_base.m4
@@ -33,7 +33,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 26
+#serial 27
AC_DEFUN([AX_BOOST_BASE],
[
@@ -96,7 +96,7 @@ if test "x$want_boost" = "xyes"; then
libsubdirs="lib64 libx32 lib lib64"
;;
ppc64|s390x|sparc64|aarch64|ppc64le)
- libsubdirs="lib64 lib lib64 ppc64le"
+ libsubdirs="lib64 lib lib64"
;;
esac
diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4
index d383ad5..8071682 100644
--- a/m4/ax_pthread.m4
+++ b/m4/ax_pthread.m4
@@ -6,6 +6,8 @@
#
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
+# Ko vd Sloot: special hacked version to survive clang's cc-analyser usage
+#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads. It
@@ -19,10 +21,10 @@
# is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
-# but also link it with them as well. e.g. you should link with
+# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
-# If you are only building threads programs, you may wish to use these
+# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
@@ -30,8 +32,8 @@
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
-# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
-# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
+# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
@@ -82,35 +84,47 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 21
+#serial 222
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
+# hack for Clang analyzer
+SUBST="cc-analyzer"
+if test "${CC#*$SUBST}" != "${CC}"; then
+ OLDCC=${CC}
+ CC=clang
+fi
+
# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
+# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
- AC_MSG_RESULT([$ax_pthread_ok])
- if test x"$ax_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
+if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
+ ax_pthread_save_CC="$CC"
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+ AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
+ AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
+ AC_MSG_RESULT([$ax_pthread_ok])
+ if test "x$ax_pthread_ok" = "xno"; then
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
+ fi
+ CC="$ax_pthread_save_CC"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
@@ -123,7 +137,7 @@ fi
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
-ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
@@ -132,186 +146,332 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
+# (Note: HP C rejects this with "bad form for `-t' option")
+# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# ... -mt is also the pthreads flag for HP/aCC
+# doesn't hurt to check since this sometimes defines pthreads and
+# -D_REENTRANT too), HP C (must be checked before -lpthread, which
+# is present but should not be used directly; and before -mthreads,
+# because the compiler interprets this as "-mt" + "-hreads")
+# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
-case ${host_os} in
- solaris*)
+case $host_os in
+
+ freebsd*)
+
+ # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+ # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+
+ ax_pthread_flags="-kthread lthread $ax_pthread_flags"
+ ;;
+
+ hpux*)
+
+ # From the cc(1) man page: "[-mt] Sets various -D flags to enable
+ # multi-threading and also sets -lpthread."
+
+ ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
+ ;;
+
+ openedition*)
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthreads/-mt/
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
+ # IBM z/OS requires a feature-test macro to be defined in order to
+ # enable POSIX threads at all, so give the user a hint if this is
+ # not set. (We don't define these ourselves, as they can affect
+ # other portions of the system API in unpredictable ways.)
- ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
- ;;
+ AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
+ [
+# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
+ AX_PTHREAD_ZOS_MISSING
+# endif
+ ],
+ [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
+ ;;
- darwin*)
- ax_pthread_flags="-pthread $ax_pthread_flags"
- ;;
+ solaris*)
+
+ # On Solaris (at least, for some versions), libc contains stubbed
+ # (non-functional) versions of the pthreads routines, so link-based
+ # tests will erroneously succeed. (N.B.: The stubs are missing
+ # pthread_cleanup_push, or rather a function called by this macro,
+ # so we could check for that, but who knows whether they'll stub
+ # that too in a future libc.) So we'll check first for the
+ # standard Solaris way of linking pthreads (-mt -lpthread).
+
+ ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags"
+ ;;
esac
-# Clang doesn't consider unrecognized options an error unless we specify
-# -Werror. We throw in some extra Clang-specific options to ensure that
-# this doesn't happen for GCC, which also accepts -Werror.
-
-AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
-save_CFLAGS="$CFLAGS"
-ax_pthread_extra_flags="-Werror"
-CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
- [AC_MSG_RESULT([yes])],
- [ax_pthread_extra_flags=
- AC_MSG_RESULT([no])])
-CFLAGS="$save_CFLAGS"
-
-if test x"$ax_pthread_ok" = xno; then
-for flag in $ax_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- pthread-config)
- AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
- if test x"$ax_pthread_config" = xno; then continue; fi
- PTHREAD_CFLAGS="`pthread-config --cflags`"
- PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
- static void routine(void *a) { a = 0; }
- static void *start_routine(void *a) { return a; }],
- [pthread_t th; pthread_attr_t attr;
- pthread_create(&th, 0, start_routine, 0);
- pthread_join(th, 0);
- pthread_attr_init(&attr);
- pthread_cleanup_push(routine, 0);
- pthread_cleanup_pop(0) /* ; */])],
- [ax_pthread_ok=yes],
- [])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT([$ax_pthread_ok])
- if test "x$ax_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
+# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
+
+AS_IF([test "x$GCC" = "xyes"],
+ [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"])
+
+# The presence of a feature test macro requesting re-entrant function
+# definitions is, on some systems, a strong hint that pthreads support is
+# correctly enabled
+
+case $host_os in
+ darwin* | hpux* | linux* | osf* | solaris*)
+ ax_pthread_check_macro="_REENTRANT"
+ ;;
+
+ aix* | freebsd*)
+ ax_pthread_check_macro="_THREAD_SAFE"
+ ;;
+
+ *)
+ ax_pthread_check_macro="--"
+ ;;
+esac
+AS_IF([test "x$ax_pthread_check_macro" = "x--"],
+ [ax_pthread_check_cond=0],
+ [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
+
+AC_CACHE_CHECK([whether $CC is Clang],
+ [ax_cv_PTHREAD_CLANG],
+ [ax_cv_PTHREAD_CLANG=no
+ # Note that Autoconf sets GCC=yes for Clang as well as GCC
+ if test "x$GCC" = "xyes"; then
+ AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
+ [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
+# if defined(__clang__) && defined(__llvm__)
+ AX_PTHREAD_CC_IS_CLANG
+# endif
+ ],
+ [ax_cv_PTHREAD_CLANG=yes])
+ fi
+ ])
+ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
+
+ax_pthread_clang_warning=no
+
+# Clang needs special handling, because older versions handle the -pthread
+# option in a rather... idiosyncratic way
+
+if test "x$ax_pthread_clang" = "xyes"; then
+
+ # Clang takes -pthread; it has never supported any other flag
+
+ # (Note 1: This will need to be revisited if a system that Clang
+ # supports has POSIX threads in a separate library. This tends not
+ # to be the way of modern systems, but it's conceivable.)
+
+ # (Note 2: On some systems, notably Darwin, -pthread is not needed
+ # to get POSIX threads support; the API is always present and
+ # active. We could reasonably leave PTHREAD_CFLAGS empty. But
+ # -pthread does define _REENTRANT, and while the Darwin headers
+ # ignore this macro, third-party headers might not.)
+
+ PTHREAD_CFLAGS="-pthread"
+ PTHREAD_LIBS=
+
+ ax_pthread_ok=yes
+
+ # However, older versions of Clang make a point of warning the user
+ # that, in an invocation where only linking and no compilation is
+ # taking place, the -pthread option has no effect ("argument unused
+ # during compilation"). They expect -pthread to be passed in only
+ # when source code is being compiled.
+ #
+ # Problem is, this is at odds with the way Automake and most other
+ # C build frameworks function, which is that the same flags used in
+ # compilation (CFLAGS) are also used in linking. Many systems
+ # supported by AX_PTHREAD require exactly this for POSIX threads
+ # support, and in fact it is often not straightforward to specify a
+ # flag that is used only in the compilation phase and not in
+ # linking. Such a scenario is extremely rare in practice.
+ #
+ # Even though use of the -pthread flag in linking would only print
+ # a warning, this can be a nuisance for well-run software projects
+ # that build with -Werror. So if the active version of Clang has
+ # this misfeature, we search for an option to squash it.
+
+ AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
+ [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
+ [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
+ # Create an alternate version of $ac_link that compiles and
+ # links in two steps (.c -> .o, .o -> exe) instead of one
+ # (.c -> exe), because the warning occurs only in the second
+ # step
+ ax_pthread_save_ac_link="$ac_link"
+ ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
+ ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
+ ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
+ AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
+ CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
+ ac_link="$ax_pthread_save_ac_link"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
+ [ac_link="$ax_pthread_2step_ac_link"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
+ [break])
+ ])
+ done
+ ac_link="$ax_pthread_save_ac_link"
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
+ ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
+ ])
+
+ case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
+ no | unknown) ;;
+ *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
+ esac
+
+fi # $ax_pthread_clang = yes
+
+if test "x$ax_pthread_ok" = "xno"; then
+for ax_pthread_try_flag in $ax_pthread_flags; do
+
+ case $ax_pthread_try_flag in
+ none)
+ AC_MSG_CHECKING([whether pthreads work without any flags])
+ ;;
+
+ -mt,pthread)
+ AC_MSG_CHECKING([whether pthreads work with -mt -lpthread])
+ PTHREAD_CFLAGS="-mt"
+ PTHREAD_LIBS="-lpthread"
+ ;;
+
+ -*)
+ AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
+ PTHREAD_CFLAGS="$ax_pthread_try_flag"
+ ;;
+
+ pthread-config)
+ AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
+ AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
+ PTHREAD_CFLAGS="`pthread-config --cflags`"
+ PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+ ;;
+
+ *)
+ AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
+ PTHREAD_LIBS="-l$ax_pthread_try_flag"
+ ;;
+ esac
+
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+
+ # Check for various functions. We must include pthread.h,
+ # since some functions may be macros. (On the Sequent, we
+ # need a special flag -Kthread to make this header compile.)
+ # We check for pthread_join because it is in -lpthread on IRIX
+ # while pthread_create is in libc. We check for pthread_attr_init
+ # due to DEC craziness with -lpthreads. We check for
+ # pthread_cleanup_push because it is one of the few pthread
+ # functions on Solaris that doesn't have a non-functional libc stub.
+ # We try pthread_create on general principles.
+
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
+# if $ax_pthread_check_cond
+# error "$ax_pthread_check_macro must be defined"
+# endif
+ static void routine(void *a) { a = 0; }
+ static void *start_routine(void *a) { return a; }],
+ [pthread_t th; pthread_attr_t attr;
+ pthread_create(&th, 0, start_routine, 0);
+ pthread_join(th, 0);
+ pthread_attr_init(&attr);
+ pthread_cleanup_push(routine, 0);
+ pthread_cleanup_pop(0) /* ; */])],
+ [ax_pthread_ok=yes],
+ [])
+
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
+
+ AC_MSG_RESULT([$ax_pthread_ok])
+ AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
+
+ PTHREAD_LIBS=""
+ PTHREAD_CFLAGS=""
done
fi
# Various other checks:
-if test "x$ax_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
- AC_MSG_CHECKING([for joinable pthread attribute])
- attr_name=unknown
- for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
- AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
- [int attr = $attr; return attr /* ; */])],
- [attr_name=$attr; break],
- [])
- done
- AC_MSG_RESULT([$attr_name])
- if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
- AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
- [Define to necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case ${host_os} in
- aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
- osf* | hpux*) flag="-D_REENTRANT";;
- solaris*)
- if test "$GCC" = "yes"; then
- flag="-D_REENTRANT"
- else
- # TODO: What about Clang on Solaris?
- flag="-mt -D_REENTRANT"
- fi
- ;;
- esac
- AC_MSG_RESULT([$flag])
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
- [ax_cv_PTHREAD_PRIO_INHERIT], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
- [[int i = PTHREAD_PRIO_INHERIT;]])],
- [ax_cv_PTHREAD_PRIO_INHERIT=yes],
- [ax_cv_PTHREAD_PRIO_INHERIT=no])
- ])
- AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
- [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: compile with *_r variant
- if test "x$GCC" != xyes; then
- case $host_os in
- aix*)
- AS_CASE(["x/$CC"],
- [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
- [#handle absolute path differently from PATH based program lookup
- AS_CASE(["x$CC"],
- [x/*],
- [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
- [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
- ;;
- esac
- fi
+if test "x$ax_pthread_ok" = "xyes"; then
+ ax_pthread_save_CFLAGS="$CFLAGS"
+ ax_pthread_save_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LIBS="$PTHREAD_LIBS $LIBS"
+
+ # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
+ AC_CACHE_CHECK([for joinable pthread attribute],
+ [ax_cv_PTHREAD_JOINABLE_ATTR],
+ [ax_cv_PTHREAD_JOINABLE_ATTR=unknown
+ for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
+ [int attr = $ax_pthread_attr; return attr /* ; */])],
+ [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
+ [])
+ done
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
+ test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
+ test "x$ax_pthread_joinable_attr_defined" != "xyes"],
+ [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
+ [$ax_cv_PTHREAD_JOINABLE_ATTR],
+ [Define to necessary symbol if this constant
+ uses a non-standard name on your system.])
+ ax_pthread_joinable_attr_defined=yes
+ ])
+
+ AC_CACHE_CHECK([whether more special flags are required for pthreads],
+ [ax_cv_PTHREAD_SPECIAL_FLAGS],
+ [ax_cv_PTHREAD_SPECIAL_FLAGS=no
+ case $host_os in
+ solaris*)
+ ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
+ ;;
+ esac
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
+ test "x$ax_pthread_special_flags_added" != "xyes"],
+ [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
+ ax_pthread_special_flags_added=yes])
+
+ AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
+ [ax_cv_PTHREAD_PRIO_INHERIT],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
+ [[int i = PTHREAD_PRIO_INHERIT;]])],
+ [ax_cv_PTHREAD_PRIO_INHERIT=yes],
+ [ax_cv_PTHREAD_PRIO_INHERIT=no])
+ ])
+ AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
+ test "x$ax_pthread_prio_inherit_defined" != "xyes"],
+ [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
+ ax_pthread_prio_inherit_defined=yes
+ ])
+
+ CFLAGS="$ax_pthread_save_CFLAGS"
+ LIBS="$ax_pthread_save_LIBS"
+
+ # More AIX lossage: compile with *_r variant
+ if test "x$GCC" != "xyes"; then
+ case $host_os in
+ aix*)
+ AS_CASE(["x/$CC"],
+ [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
+ [#handle absolute path differently from PATH based program lookup
+ AS_CASE(["x$CC"],
+ [x/*],
+ [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
+ [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
+ ;;
+ esac
+ fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
@@ -321,12 +481,18 @@ AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$ax_pthread_ok" = xyes; then
- ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
- :
+if test "x$ax_pthread_ok" = "xyes"; then
+ ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
+ :
else
- ax_pthread_ok=no
- $2
+ ax_pthread_ok=no
+ $2
fi
+
+# undo hack for Clang analyzer
+if test "${OLDCC#*$SUBST}" != "${OLDCC}"; then
+ CC=${OLDCC}
+fi
+
AC_LANG_POP
])dnl AX_PTHREAD
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index 5f16cf7..2e6297d 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -41,6 +41,11 @@ using namespace std;
namespace TiCC {
+ class ImplementationError: public std::logic_error {
+ public:
+ explicit ImplementationError( const std::string& s ): std::logic_error( "CommandLine: implementation error." + s ){};
+ };
+
CL_Options::CL_Options( const string& valid_s, const string& valid_l ):
is_init(false),
debug(false){
@@ -60,7 +65,7 @@ namespace TiCC {
bool CL_Options::parse_args( const int argc, const char * const *argv ){
if ( is_init ){
- throw OptionError( "cannot parse() a commandline twice" );
+ throw ImplementationError( "cannot parse() a commandline twice" );
}
if ( Parse_Command_Line( argc, argv ) )
is_init = true;
@@ -69,7 +74,7 @@ namespace TiCC {
bool CL_Options::parse_args( const std::string& args ){
if ( is_init ){
- throw OptionError( "cannot parse() a commandline twice" );
+ throw ImplementationError( "cannot parse() a commandline twice" );
}
const char *argstr = args.c_str();
if ( Parse_Command_Line( 0, &argstr ) )
@@ -491,8 +496,6 @@ namespace TiCC {
}
throw OptionError( "missing value for long option: '"
+ it->s + "'" );
- ++it;
- continue;
}
}
}
@@ -675,8 +678,7 @@ namespace TiCC {
}
void CL_Options::set_long_options( const string& s ){
- vector<string> parts;
- TiCC::split_at( s, parts, "," );
+ vector<string> parts = TiCC::split_at( s, "," );
for ( auto value: parts ){
string::size_type pos = value.find( ':' );
if ( pos != string::npos ){
@@ -686,7 +688,7 @@ namespace TiCC {
valid_long_opt.insert( value );
}
else {
- throw OptionError( "':' may only be present at the end of a long option ("
+ throw ImplementationError( "':' may only be present at the end of a long option specification ("
+ value + ")" );
}
}
@@ -695,8 +697,8 @@ namespace TiCC {
valid_long_par.insert( value );
}
else {
- throw OptionError( "':' may only be present at the end of a long option ("
- + value + ")" );
+ throw ImplementationError( "':' may only be present at the end of a long option specification ("
+ + value + ")" );
}
}
valid_long.insert( value );
diff --git a/src/Configuration.cxx b/src/Configuration.cxx
index 169f935..c216d45 100644
--- a/src/Configuration.cxx
+++ b/src/Configuration.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -87,6 +87,22 @@ namespace TiCC {
return result;
}
+ bool Configuration::get_att_val( const string& line, const string& section ){
+ string::size_type pos = line.find("=");
+ if ( pos != string::npos ){
+ string att = line.substr(0,pos);
+ att = TiCC::trim(att);
+ string val = line.substr(pos+1);
+ val = TiCC::trim(val);
+ if ( val[0] == '"' && val[val.length()-1] == '"' )
+ val = val.substr(1, val.length()-2);
+ val = fixControls( val );
+ myMap[section][att] = val;
+ return true;
+ }
+ return false;
+ }
+
bool Configuration::fill( const string& fileName ){
ifstream is( fileName );
if ( !is ){
@@ -110,7 +126,7 @@ namespace TiCC {
continue;
if ( line[0] == '#' )
continue;
- if ( line.find( "[[") == 0 )
+ if ( line.find( "[[" ) == 0 )
if ( line[line.length()-1] == ']' &&
line[line.length()-2] == ']' ){
section = line.substr(2,line.length()-4);
@@ -121,19 +137,9 @@ namespace TiCC {
return false;
}
else {
- string::size_type pos = line.find("=");
- if ( pos != string::npos ){
- string att = line.substr(0,pos);
- att = TiCC::trim(att);
- string val = line.substr(pos+1);
- val = TiCC::trim(val);
- if ( val[0] == '"' && val[val.length()-1] == '"' )
- val = val.substr(1, val.length()-2);
- val = fixControls( val );
- myMap[section][att] = val;
- }
- else {
- cerr << "invalid attribute value pair in line '" << line << "'" << endl;
+ if ( !get_att_val ( line, section ) ){
+ cerr << "invalid attribute value pair in line '"
+ << line << "'" << endl;
return false;
}
}
@@ -158,7 +164,7 @@ namespace TiCC {
continue;
if ( line[0] == '#' )
continue;
- if ( line.find( "[[") == 0 )
+ if ( line.find( "[[" ) == 0 )
if ( line[line.length()-1] == ']' &&
line[line.length()-2] == ']' ){
localsection = line.substr(2,line.length()-4);
@@ -171,18 +177,9 @@ namespace TiCC {
}
else if ( localsection == section ){
found = true;
- string::size_type pos = line.find("=");
- if ( pos != string::npos ){
- string att = line.substr(0,pos);
- att = TiCC::trim(att);
- string val = line.substr(pos+1);
- val = TiCC::trim(val);
- if ( val[0] == '"' && val[val.length()-1] == '"' )
- val = val.substr(1, val.length()-2);
- myMap[section][att] = val;
- }
- else {
- cerr << "invalid attribute value pair in line '" << line << "'" << endl;
+ if ( !get_att_val( line, section ) ){
+ cerr << "invalid attribute value pair in line '"
+ << line << "'" << endl;
return false;
}
}
@@ -195,6 +192,23 @@ namespace TiCC {
return true;
}
+ string encode_ctrl( const string& in ){
+ string out;
+ for ( const auto& c : in ){
+ switch ( c ){
+ case '\n': out += "\\n";
+ break;
+ case '\r': out += "\\r";
+ break;
+ case '\t': out += "\\t";
+ break;
+ default:
+ out += c;
+ }
+ }
+ return out;
+ }
+
void Configuration::dump( ostream& os ) const {
auto it1 = myMap.find("global");
if ( it1 == myMap.end() ){
@@ -204,7 +218,6 @@ namespace TiCC {
os << "[[global]]" << endl;
auto it2 = it1->second.begin();
while ( it2 != it1->second.end() ){
- string out = it2->second;
os << it2->first << "=" << it2->second << endl;
++it2;
}
@@ -214,7 +227,7 @@ namespace TiCC {
os << endl << "[[" << it1->first << "]]" << endl;
it2 = it1->second.begin();
while ( it2 != it1->second.end() ){
- os << it2->first << "=" << it2->second << endl;
+ os << it2->first << "=" << encode_ctrl(it2->second) << endl;
++it2;
}
}
diff --git a/src/FdStream.cxx b/src/FdStream.cxx
index 28f6f20..cd75011 100644
--- a/src/FdStream.cxx
+++ b/src/FdStream.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/src/FileUtils.cxx b/src/FileUtils.cxx
index c2ce391..597fde3 100644
--- a/src/FileUtils.cxx
+++ b/src/FileUtils.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -37,8 +37,13 @@
#include <sys/stat.h>
#include <dirent.h>
#include "config.h"
-#ifdef HAVE_BOOST_REGEX
-#include <boost/regex.hpp>
+#if HAVE_WORKING_REGEX == 2
+# include <boost/regex.hpp>
+# define regex boost::regex
+# define regex_error boost::regex_error
+# define regex_search boost::regex_search
+#else
+# include <regex>
#endif
#include "ticcutils/StringOps.h"
#include "ticcutils/FileUtils.h"
@@ -54,10 +59,11 @@ namespace TiCC {
return result;
}
else if ( res != 0 ){
- cerr << "TiCC::glob:" << strerror( errno ) << endl;
- exit(EXIT_FAILURE);
+ string mess = "TiCC::glob: ";
+ mess += strerror( errno );
+ throw runtime_error( mess );
}
- for(unsigned int i=0;i<glob_result.gl_pathc;++i){
+ for( unsigned int i=0; i<glob_result.gl_pathc; ++i ){
result.push_back(string(glob_result.gl_pathv[i]));
}
globfree(&glob_result);
@@ -86,8 +92,8 @@ namespace TiCC {
vector<string>& result, bool recurse ){
DIR *dir = opendir( dirName.c_str() );
if ( !dir ){
- cerr << "unable to open dir" << dirName << endl;
- exit(EXIT_FAILURE);
+ string mess = "TiCC::gatherFilesExt: unable to open dir " + dirName;
+ throw runtime_error( mess );
}
struct dirent *entry = readdir( dir );
while ( entry ){
@@ -120,21 +126,20 @@ namespace TiCC {
return result;
}
else if ( !isDir( name ) ){
- cerr << "the name '" << name
- << "' doesn't match a file or directory." << endl;
- exit(EXIT_FAILURE);
+ string mess = "TiCC::searchFilesExt: the name '" + name
+ + "' doesn't match a file or directory.";
+ throw runtime_error( mess );
}
gatherFilesExt( name, ext, result, recurse );
return result;
}
-#ifdef HAVE_BOOST_REGEX
- void gatherFilesMatch( const string& dirName, const boost::regex& match,
+ void gatherFilesMatch( const string& dirName, const regex& match,
vector<string>& result, bool recurse ){
DIR *dir = opendir( dirName.c_str() );
if ( !dir ){
- cerr << "unable to open dir" << dirName << endl;
- exit(EXIT_FAILURE);
+ string mess = "TiCC::gatherFilesMatch: unable to open dir " + dirName;
+ throw runtime_error( mess );
}
struct dirent *entry = readdir( dir );
while ( entry ){
@@ -145,7 +150,7 @@ namespace TiCC {
gatherFilesMatch( fullName, match, result, recurse );
}
}
- else if ( boost::regex_search( name, match ) ){
+ else if ( regex_search( name, match ) ){
result.push_back( fullName );
}
entry = readdir( dir );
@@ -156,8 +161,8 @@ namespace TiCC {
static string wildToRegExp( const string& wild ){
// convert 'shell'-like wildcards into a regexp
string result;
- for ( size_t i=0; i < wild.length(); ++i ){
- switch( wild[i] ){
+ for ( const auto& c : wild ){
+ switch( c ){
case '*':
result += ".*";
break;
@@ -165,11 +170,10 @@ namespace TiCC {
result += ".";
break;
case '.':
- result += "\\";
- result += wild[i];
+ result += "\\.";
break;
default:
- result += wild[i];
+ result += c;
}
}
// cerr << "wild to regexp: " << wild << " ==> " << result << endl;
@@ -182,7 +186,7 @@ namespace TiCC {
vector<string> result;
string reg = wildToRegExp( wild );
try {
- boost::regex rx( reg );
+ regex rx( reg );
if ( isFile( name ) ){
// it is just 1 file
string::size_type pos = name.rfind( "/" );
@@ -193,32 +197,27 @@ namespace TiCC {
else {
fname = name;
}
- if ( boost::regex_search( fname, rx ) )
+ if ( regex_search( fname, rx ) )
result.push_back( name );
return result;
}
else if ( !isDir( name ) ){
- cerr << "the name '" << name
- << "' doesn't match a file or directory." << endl;
- exit(EXIT_FAILURE);
+ string mess = "TiCC::searchFilesMatch: the name '" + name
+ + "' doesn't match a file or directory.";
+ throw runtime_error( mess );
}
gatherFilesMatch( name, rx, result, recurse );
}
- catch( boost::regex_error& e ){
- cerr << "invalid regexp: " << e.what() << endl;
- exit(EXIT_FAILURE);
+ catch( regex_error& e ){
+ string mess = "TiCC::searchFilesMatch: invalid regexp: ";
+ mess += e.what();
+ throw runtime_error( mess );
+ }
+ catch( ... ){
+ throw;
}
return result;
}
-#else
- vector<string> searchFilesMatch( const string& name,
- const string& match,
- bool recurse ){
- cerr << "REGEXP support not available" << endl;
- cerr << " attempting lame extension matching instead" << endl;
- return searchFilesExt( name, match, recurse );
- }
-#endif
bool createTruePath( const string& path ){
// attempt to open a path /a/b/c/ from an expression like:
@@ -226,21 +225,20 @@ namespace TiCC {
// or ./a/b/c/ from expressions like
// a/b/c/
- ofstream os1( path.c_str() );
+ ofstream os1( path );
if ( !os1.good() ){
// it fails
// attempt to create the path
- vector<string> parts;
- int num = split_at( path, parts, "/" );
- if ( num > 0 ){
+ vector<string> parts = split_at( path, "/" );
+ if ( parts.size() > 0 ){
// at least one /
string newpath;
if ( path[0] == '/' )
newpath = "/";
else
newpath = "./";
- for ( size_t i=0; i < parts.size(); ++i ){
- newpath += parts[i] + "/";
+ for ( auto const& p : parts ){
+ newpath += p + "/";
// cerr << "mkdir path = " << newpath << endl;
int status = mkdir( newpath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
if ( status != 0 && errno != EEXIST ){
@@ -264,7 +262,7 @@ namespace TiCC {
if ( !createTruePath( path ) )
return false;
}
- ofstream os( name.c_str() );
+ ofstream os( name );
if ( !os.good() ){
return false;
}
diff --git a/src/LogStream.cxx b/src/LogStream.cxx
index 6e324c7..78c9276 100755
--- a/src/LogStream.cxx
+++ b/src/LogStream.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -329,7 +329,9 @@ namespace TiCC {
}
#endif
if ( locks[pos].cnt == 0 ){
+ pthread_mutex_lock( &global_lock_mutex );
locks[pos].id = 0;
+ pthread_mutex_unlock( &global_lock_mutex );
#ifdef LSDEBUG
cerr << "Thread " << pthread_self() << " unlocked [" << pos << "]" << endl;
#endif
diff --git a/src/Makefile.am b/src/Makefile.am
index b751855..7c7bd0b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
AM_CPPFLAGS = -I at top_srcdir@/include
-AM_CXXFLAGS = -std=c++0x # -Weffc++
+AM_CXXFLAGS = -g -std=c++11 -O3 -W -Wall -pedantic
LDADD = libticcutils.la
@@ -12,8 +12,9 @@ libticcutils_la_SOURCES = LogStream.cxx StringOps.cxx TreeHash.cxx \
FdStream.cxx
-check_PROGRAMS = runtest
+check_PROGRAMS = runtest testlogstream
runtest_SOURCES = runtest.cxx
+testlogstream_SOURCES =testlogstream.cxx
TESTS_ENVIRONMENT = topsrcdir=$(top_srcdir)
TESTS = tst.sh
diff --git a/src/Makefile.in b/src/Makefile.in
index 4d3d1ea..261a0bf 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -88,7 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = runtest$(EXEEXT)
+check_PROGRAMS = runtest$(EXEEXT) testlogstream$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_boost_base.m4 \
@@ -155,6 +155,10 @@ am_runtest_OBJECTS = runtest.$(OBJEXT)
runtest_OBJECTS = $(am_runtest_OBJECTS)
runtest_LDADD = $(LDADD)
runtest_DEPENDENCIES = libticcutils.la
+am_testlogstream_OBJECTS = testlogstream.$(OBJEXT)
+testlogstream_OBJECTS = $(am_testlogstream_OBJECTS)
+testlogstream_LDADD = $(LDADD)
+testlogstream_DEPENDENCIES = libticcutils.la
AM_V_P = $(am__v_P_ at AM_V@)
am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
am__v_P_0 = false
@@ -189,8 +193,10 @@ AM_V_CXXLD = $(am__v_CXXLD_ at AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_ at AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
-SOURCES = $(libticcutils_la_SOURCES) $(runtest_SOURCES)
-DIST_SOURCES = $(libticcutils_la_SOURCES) $(runtest_SOURCES)
+SOURCES = $(libticcutils_la_SOURCES) $(runtest_SOURCES) \
+ $(testlogstream_SOURCES)
+DIST_SOURCES = $(libticcutils_la_SOURCES) $(runtest_SOURCES) \
+ $(testlogstream_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -530,7 +536,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I at top_srcdir@/include
-AM_CXXFLAGS = -std=c++0x # -Weffc++
+AM_CXXFLAGS = -g -std=c++11 -O3 -W -Wall -pedantic
LDADD = libticcutils.la
lib_LTLIBRARIES = libticcutils.la
libticcutils_la_LDFLAGS = -version-info 2:0:0
@@ -540,6 +546,7 @@ libticcutils_la_SOURCES = LogStream.cxx StringOps.cxx TreeHash.cxx \
FdStream.cxx
runtest_SOURCES = runtest.cxx
+testlogstream_SOURCES = testlogstream.cxx
TESTS_ENVIRONMENT = topsrcdir=$(top_srcdir)
TESTS = tst.sh
EXTRA_DIST = tst.sh
@@ -629,6 +636,10 @@ runtest$(EXEEXT): $(runtest_OBJECTS) $(runtest_DEPENDENCIES) $(EXTRA_runtest_DEP
@rm -f runtest$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(runtest_OBJECTS) $(runtest_LDADD) $(LIBS)
+testlogstream$(EXEEXT): $(testlogstream_OBJECTS) $(testlogstream_DEPENDENCIES) $(EXTRA_testlogstream_DEPENDENCIES)
+ @rm -f testlogstream$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(testlogstream_OBJECTS) $(testlogstream_LDADD) $(LIBS)
+
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -648,6 +659,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/TreeHash.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@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/testlogstream.Po at am__quote@
@AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zipper.Plo at am__quote@
.cxx.o:
diff --git a/src/ServerBase.cxx b/src/ServerBase.cxx
index bcf8db6..337dc9f 100644
--- a/src/ServerBase.cxx
+++ b/src/ServerBase.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -41,6 +41,8 @@
using namespace std;
using namespace TiCC;
+#define LOG *Log(myLog)
+
namespace TimblServer {
const string serv_short_opts = "S:C:";
@@ -85,19 +87,19 @@ namespace TimblServer {
string value = config->lookUp( "port" );
if ( !value.empty() ){
if ( !stringTo( value, serverPort ) ){
- cerr << "config:invalid value '" << value << "' for port" << endl;
- exit(1);
+ string mess = "ServerBase: invalid value '" + value + "' for port";
+ throw runtime_error( mess );
}
}
else {
- cerr << "missing 'port' in config " << endl;
- exit(1);
+ string mess = "ServerBase:missing 'port' in config ";
+ throw runtime_error( mess );
}
value = config->lookUp( "maxconn" );
if ( !value.empty() ){
if ( !stringTo( value, _maxConn ) ){
- cerr << "config: invalid value '" << value << "' for maxconn" << endl;
- exit(1);
+ string mess = "ServerBase: invalid value '" + value + "' for maxconn";
+ throw runtime_error( mess );
}
}
value = config->lookUp( "protocol" );
@@ -114,8 +116,9 @@ namespace TimblServer {
else if ( value == "yes" )
doDaemon = true;
else {
- cerr << "config: invalid value '" << value << "' for --daemonize" << endl;
- exit(1);
+ string mess = "ServerBase: invalid value '" + value
+ + "' for --daemonize";
+ throw runtime_error( mess );
}
}
value = config->lookUp( "logfile" );
@@ -137,8 +140,8 @@ namespace TimblServer {
else if ( value == "yes" )
debug = true;
else {
- cerr << "config: invalid value '" << value << "' for --debug" << endl;
- exit(1);
+ string mess = "ServerBase: invalid value '" + value + "' for --debug";
+ throw runtime_error( mess );
}
}
tcp_socket = 0;
@@ -158,11 +161,13 @@ namespace TimblServer {
}
if ( !old ){
cerr << "missing --config option" << endl;
+ delete config;
return 0;
}
}
else if ( !config->fill( value ) ){
cerr << "unable to read a configuration from " << value << endl;
+ delete config;
return 0;
}
if ( opts.extract( "pidfile", value ) ){
@@ -227,7 +232,7 @@ namespace TimblServer {
}
void *ServerBase::callChild( void *a ) {
- childArgs* ca = (childArgs*)a;
+ childArgs* ca = reinterpret_cast<childArgs*>(a);
ca->mother()->socketChild( ca );
return 0;
}
@@ -316,8 +321,8 @@ namespace TimblServer {
// ***** This is the routine that is executed from a new TCP thread *******
void ServerBase::socketChild( childArgs *args ){
signal( SIGPIPE, BrokenPipeChildFun );
- *Log(myLog) << "Thread " << (uintptr_t)pthread_self() << " on socket "
- << args->id() << ", started at: " << Timer::now();
+ LOG << "Thread " << (uintptr_t)pthread_self() << " on socket "
+ << args->id() << ", started at: " << Timer::now() << endl;
static int service_count=0;
static pthread_mutex_t my_lock = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_lock(&my_lock);
@@ -325,8 +330,8 @@ namespace TimblServer {
if ( service_count >= maxConn() ){
sendReject( args->os() );
pthread_mutex_unlock( &my_lock );
- *Log(myLog) << "Thread " << (uintptr_t)pthread_self()
- << " refused " << endl;
+ LOG << "Thread " << (uintptr_t)pthread_self()
+ << " refused " << endl;
}
else {
++service_count;
@@ -334,12 +339,12 @@ namespace TimblServer {
callback( args );
pthread_mutex_lock(&my_lock);
// use a mutex to update and display the global service counter
- *Log(myLog) << "Socket total = " << --service_count << endl;
+ LOG << "Socket total = " << --service_count << endl;
pthread_mutex_unlock(&my_lock);
}
// close the socket and exit this thread
- *Log(myLog) << "Thread " << (uintptr_t)pthread_self()
- << ", terminated at: " << Timer::now();
+ LOG << "Thread " << (uintptr_t)pthread_self()
+ << ", terminated at: " << Timer::now() << endl;
delete args;
}
@@ -354,8 +359,8 @@ namespace TimblServer {
}
int ServerBase::Run(){
- *Log(myLog) << "Starting a " << serverProtocol
- << " server on port " << serverPort << endl;
+ LOG << "Starting a " << serverProtocol
+ << " server on port " << serverPort << endl;
if ( !pidFile.empty() ){
// check validity of pidfile
if ( doDaemon && pidFile[0] != '/' ) // make sure the path is absolute
@@ -363,8 +368,8 @@ namespace TimblServer {
unlink( pidFile.c_str() ) ;
ofstream pid_file( pidFile ) ;
if ( !pid_file ){
- *Log(myLog)<< "unable to create pidfile:"<< pidFile << endl;
- *Log(myLog)<< "not Started" << endl;
+ LOG<< "unable to create pidfile:"<< pidFile << endl;
+ LOG<< "not Started" << endl;
return EXIT_FAILURE;
}
}
@@ -374,22 +379,22 @@ namespace TimblServer {
logFile = '/' + logFile;
logS = new ofstream( logFile );
if ( logS && logS->good() ){
- *Log(myLog) << "switching logging to file " << logFile << endl;
+ LOG << "switching logging to file " << logFile << endl;
myLog.associate( *logS );
- *Log(myLog) << "Started logging " << endl;
- *Log(myLog) << "debugging is " << (doDebug()?"on":"off") << endl;
+ LOG << "Started logging " << endl;
+ LOG << "debugging is " << (doDebug()?"on":"off") << endl;
}
else {
delete logS;
- *Log(myLog) << "unable to create logfile: " << logFile << endl;
- *Log(myLog) << "not started" << endl;
+ LOG << "unable to create logfile: " << logFile << endl;
+ LOG << "not started" << endl;
return EXIT_FAILURE;
}
}
int start = 1;
if ( doDaemon ){
- *Log(myLog) << "running as a dæmon" << endl;
+ LOG << "running as a dæmon" << endl;
signal( SIGCHLD, AfterDaemonFun );
start = daemonize( 0, logFile.empty() );
}
@@ -402,37 +407,37 @@ namespace TimblServer {
// signal it to the world
ofstream pid_file( pidFile ) ;
if ( !pid_file ){
- *Log(myLog) << "unable to create pidfile:"<< pidFile << endl;
- *Log(myLog) << "server NOT Started" << endl;
+ LOG << "unable to create pidfile:"<< pidFile << endl;
+ LOG << "server NOT Started" << endl;
return EXIT_FAILURE;
}
else {
pid_t pid = getpid();
pid_file << pid << endl;
- *Log(myLog) << "wrote PID=" << pid << " to " << pidFile << endl;
+ LOG << "wrote PID=" << pid << " to " << pidFile << endl;
}
}
// set the attributes
pthread_attr_t attr;
if ( pthread_attr_init(&attr) ||
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED ) ){
- *Log(myLog) << "Threads: couldn't set attributes" << endl;
+ LOG << "Threads: couldn't set attributes" << endl;
return EXIT_FAILURE;
}
- *Log(myLog) << "Starting Server on port:" << serverPort << endl;
+ LOG << "Starting Server on port:" << serverPort << endl;
pthread_t chld_thr;
Sockets::ServerSocket server;
string portString = toString<int>(serverPort);
if ( !server.connect( portString ) ){
- *Log(myLog) << "failed to start Server: " << server.getMessage() << endl;
+ LOG << "failed to start Server: " << server.getMessage() << endl;
return EXIT_FAILURE;
}
if ( !server.listen( 5 ) ) {
// maximum of 5 pending requests
- *Log(myLog) << server.getMessage() << endl;
+ LOG << server.getMessage() << endl;
return EXIT_FAILURE;
}
@@ -448,10 +453,10 @@ namespace TimblServer {
if ( !server.accept( *newSocket ) ){
cerr << "accept failed: " + server.getMessage() << endl;
delete newSocket;
- *Log(myLog) << server.getMessage() << endl;
+ LOG << server.getMessage() << endl;
if ( ++failcount > 20 ){
- *Log(myLog) << "accept failcount > 20 " << endl;
- *Log(myLog) << "server stopped." << endl;
+ LOG << "accept failcount > 20 " << endl;
+ LOG << "server stopped." << endl;
return EXIT_FAILURE;
}
else {
@@ -461,10 +466,10 @@ namespace TimblServer {
else {
if ( !keepGoing ) break;
failcount = 0;
- *Log(myLog) << "Accepting Connection #"
- << newSocket->getSockId()
- << " from remote host: "
- << newSocket->getClientName() << endl;
+ LOG << "Accepting Connection #"
+ << newSocket->getSockId()
+ << " from remote host: "
+ << newSocket->getClientName() << endl;
// create a new thread to process the incoming request
// (The thread will terminate itself when done processing
// and release its socket handle)
diff --git a/src/SocketBasics.cxx b/src/SocketBasics.cxx
index 6c852a5..c994932 100755
--- a/src/SocketBasics.cxx
+++ b/src/SocketBasics.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -221,9 +221,10 @@ namespace Sockets {
m = "socket " + TiCC::toString(sock);
else
m = "invalid socket ";
- if ( !mess.empty() )
+ if ( !mess.empty() ){
m += ": " + mess;
- return mess;
+ }
+ return m;
}
bool Socket::setBlocking( ) {
@@ -308,14 +309,14 @@ namespace Sockets {
}
else {
aip = res;
- while( aip ){
+ while ( aip ){
sock = socket( aip->ai_family, aip->ai_socktype, aip->ai_protocol);
if ( sock > 0 )
break;
sock = -1;
aip = aip->ai_next;
}
- if ( sock < 0 ){
+ if ( sock < 0 || aip == 0 ){
mess = string( "ClientSocket: Socket could not be created: (" )
+ strerror(errno) + ")";
}
diff --git a/src/StringOps.cxx b/src/StringOps.cxx
index 9013a0c..e471d71 100644
--- a/src/StringOps.cxx
+++ b/src/StringOps.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -39,7 +39,7 @@ using namespace std;
namespace TiCC {
string BuildInfo() {
- // cannot be defined in the header becaus otherwise __DATE__ ans
+ // cannot be defined in the header because otherwise __DATE__ and
// __TIME__ would be dynamic. (changing every time it is included)
return VersionName() + "-" + Version() + ". Compiled on "
+ __DATE__ + " " + __TIME__;
@@ -127,6 +127,9 @@ namespace TiCC {
// split a string into substrings, using seps as separator
// silently skip empty entries (e.g. when two or more separators co-incide)
// unless exact=true;
+ if ( sep.empty() ){
+ throw runtime_error( "TiCC::split_at(): separator is empty!" );
+ }
results.clear();
string::size_type pos = 0;
while ( pos != string::npos ){
@@ -146,12 +149,53 @@ namespace TiCC {
return results.size();
}
+ vector<string> split_at( const string& src,
+ const string& sep,
+ size_t max ){
+ // split a string into substrings, using seps as separator
+ // silently skip empty entries (e.g. when two or more separators co-incide)
+ // if max > 0, limit the size off the result to max,
+ // leaving the remainder in the last part of the result
+ if ( sep.empty() ){
+ throw runtime_error( "TiCC::split_at(): separator is empty!" );
+ }
+ vector<string> results;
+ size_t cnt = 0;
+ string::size_type pos = 0;
+ while ( pos != string::npos ){
+ string res;
+ string::size_type p = src.find( sep, pos );
+ if ( p == string::npos ){
+ res = src.substr( pos );
+ pos = p;
+ }
+ else {
+ res = src.substr( pos, p - pos );
+ pos = p + sep.length();
+ }
+ if ( !res.empty() ){
+ ++cnt;
+ results.push_back( res );
+ }
+ if ( max != 0 && cnt >= max-1 ){
+ if ( pos != string::npos ){
+ results.push_back( src.substr( pos ) );
+ }
+ break;
+ }
+ }
+ return results;
+ }
+
size_t split_at_first_of( const string& src, vector<string>& results,
const string& seps, bool exact ){
// split a string into substrings, using the characters in seps
// as seperators
// silently skip empty entries (e.g. when two or more seperators co-incide)
// unless exact=true;
+ if ( seps.empty() ){
+ throw runtime_error( "TiCC::split_at_first_of(): separators are empty!" );
+ }
results.clear();
string::size_type s = 0;
while ( s != string::npos ){
@@ -172,35 +216,80 @@ namespace TiCC {
return results.size();
}
+ vector<string> split_at_first_of( const string& src,
+ const string& seps,
+ size_t max ){
+ // split a string into substrings, using the characters in seps
+ // as seperators
+ // silently skip empty entries (e.g. when two or more seperators co-incide)
+ // if max > 0, limit the size of the result to max,
+ // leaving the remainder in the last part of the result
+ if ( seps.empty() ){
+ throw runtime_error( "TiCC::split_at_first_of(): separators are empty!" );
+ }
+ vector<string> results;
+ size_t cnt = 0;
+ string::size_type pos = 0;
+ while ( pos != string::npos ){
+ string res;
+ string::size_type e = src.find_first_of( seps, pos );
+ if ( e == string::npos ){
+ res = src.substr( pos );
+ pos = e;
+ }
+ else {
+ res = src.substr( pos, e - pos );
+ pos = e+1;
+ }
+ if ( !res.empty() ){
+ results.push_back( res );
+ ++cnt;
+ }
+ if ( max != 0 && cnt >= max-1 ){
+ if ( pos != string::npos ){
+ results.push_back( src.substr( pos ) );
+ }
+ break;
+ }
+ }
+ return results;
+ }
+
// format weird strings (like UTF8, LATIN1) printable
// useful for debugging
string format_nonascii( const string& s ){
stringstream os;
os << showbase << hex;
- unsigned int i;
- for ( i=0; i < s.length(); ++i )
- if ( isprint(s[i]) && (int)s[i] > 31 )
- os << s[i];
- else
- os << "-" << (short int)s[i] << "-";
+ for ( const auto& c : s ){
+ if ( isprint(c) && (int)c > 31 ){
+ os << c;
+ }
+ else {
+ os << "-" << (short int)c << "-";
+ }
+ }
os << noshowbase << dec;
return os.str();
}
std::string basename( const std::string& path ){
string::size_type pos = path.rfind( "/" );
- if ( pos != string::npos )
+ if ( pos != string::npos ){
return path.substr(pos+1);
- else
+ }
+ else {
return path;
+ }
}
std::string dirname( const std::string& path ){
string::size_type pos = path.rfind( "/" );
- if ( pos != string::npos )
+ if ( pos != string::npos ){
return path.substr(0,pos);
- else
+ }
+ else {
return ".";
+ }
}
} // namespace TiCC
diff --git a/src/Tar.cxx b/src/Tar.cxx
index 73bda5a..6b0bbbf 100644
--- a/src/Tar.cxx
+++ b/src/Tar.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -33,8 +33,13 @@
#include "config.h"
#include <sys/fcntl.h>
#include "ticcutils/StringOps.h"
-#ifdef HAVE_BOOST_REGEX
-#include <boost/regex.hpp>
+#if HAVE_WORKING_REGEX == 2
+# include <boost/regex.hpp>
+# define regex boost::regex
+# define regex_error boost::regex_error
+# define regex_search boost::regex_search
+#else
+# include <regex>
#endif
#include "ticcutils/Tar.h"
@@ -139,12 +144,11 @@ namespace TiCC {
return true;
}
-#ifdef HAVE_BOOST_REGEX
static string wildToRegExp( const string& wild ){
// convert 'shell'-like wildcards into a regexp
string result;
- for ( size_t i=0; i < wild.length(); ++i ){
- switch( wild[i] ){
+ for ( auto const& c : wild ){
+ switch( c ){
case '*':
result += ".*";
break;
@@ -152,11 +156,10 @@ namespace TiCC {
result += ".";
break;
case '.':
- result += "\\";
- result += wild[i];
+ result += "\\.";
break;
default:
- result += wild[i];
+ result += c;
}
}
// cerr << "wild to regexp: " << wild << " ==> " << result << endl;
@@ -179,12 +182,12 @@ namespace TiCC {
}
string pat = wildToRegExp( wild );
try {
- boost::regex rx( pat );
+ regex rx( pat );
stat = th_read( local_tar );
while ( stat == 0 ) {
if ( TH_ISREG( local_tar ) ){
string name = local_tar->th_buf.name;
- if ( boost::regex_search( name, rx ) ){
+ if ( regex_search( name, rx ) ){
result.push_back( name );
}
tar_skip_regfile( local_tar );
@@ -193,20 +196,13 @@ namespace TiCC {
}
tar_close( local_tar );
}
- catch( boost::regex_error& e ){
- cerr << "invalid regexp: " << e.what() << endl;
- exit(EXIT_FAILURE);
+ catch( regex_error& e ){
+ string mess = "tar:extract_file_names_match() invalid regexp: ";
+ mess += e.what();
+ throw runtime_error( mess );
}
return true;
}
-#else
- bool tar::extract_file_names_match( vector<string>& result,
- const string& pat ){
- cerr << "tar::extract() REGEXP support not available" << endl;
- cerr << " attempting lame extension matching instead" << endl;
- return extract_file_names( result, pat );
- }
-#endif
bool tar::extract_ifstream( const string& name, ifstream& result ){
result.close();
@@ -232,7 +228,7 @@ namespace TiCC {
cerr << "tar_extract_regfile(): " << strerror(errno) << endl;
return false;
}
- result.open(tmpfile.c_str() );
+ result.open( tmpfile );
if ( result.good() ){
return true;
}
@@ -280,7 +276,7 @@ namespace TiCC {
cerr << "tar_extract_regfile(): " << strerror(errno) << endl;
return false;
}
- result.open(tmpfile.c_str() );
+ result.open( tmpfile );
if ( result.good() ){
name = tar_file->th_buf.name;
return true;
diff --git a/src/Timer.cxx b/src/Timer.cxx
index eb1b096..c9e16f9 100644
--- a/src/Timer.cxx
+++ b/src/Timer.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -46,7 +46,10 @@ namespace TiCC {
string Timer::now() {
time_t now;
time( &now );
- return asctime( localtime( &now ) );
+ //return asctime( localtime( &now ) );
+ char buffer[256];
+ strftime( buffer, 100, "%c", localtime( &now ) );
+ return buffer;
}
ostream& operator << ( ostream& os, const Timer& T ){
diff --git a/src/TreeHash.cxx b/src/TreeHash.cxx
index d61fe7a..8541682 100644
--- a/src/TreeHash.cxx
+++ b/src/TreeHash.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -56,19 +56,16 @@ namespace Hash {
unsigned int StringHash::Hash( const string& name ){
unsigned int idx = 0;
-#pragma omp critical(tree_mod)
- {
- HashInfo *info = StringTree.Retrieve( name );
- if ( !info ){
- info = new HashInfo( name, ++NumOfTokens );
- info = (HashInfo *)StringTree.Store( name, info );
- }
- idx = info->Index();
- if ( idx >= rev_index.size() ){
- rev_index.resize( rev_index.size() + 1000 );
- }
- rev_index[idx] = info;
+ HashInfo *info = StringTree.Retrieve( name );
+ if ( !info ){
+ info = new HashInfo( name, ++NumOfTokens );
+ info = reinterpret_cast<HashInfo *>(StringTree.Store( name, info ));
+ }
+ idx = info->Index();
+ if ( idx >= rev_index.size() ){
+ rev_index.resize( rev_index.size() + 1000 );
}
+ rev_index[idx] = info;
return idx;
}
@@ -102,18 +99,15 @@ namespace Hash {
Lexicon::~Lexicon(){}
LexInfo *Lexicon::Lookup( const string& name ) const {
- return (LexInfo *)LexTree.Retrieve( name );
+ return reinterpret_cast<LexInfo *>(LexTree.Retrieve( name ));
}
LexInfo *Lexicon::Store( const string& name, const string& translation ){
LexInfo *info = 0;
-#pragma omp critical(tree_mod)
- {
- info = LexTree.Retrieve( name );
- if ( !info ){
- info = new LexInfo( name, translation );
- info = LexTree.Store( name, info );
- }
+ info = LexTree.Retrieve( name );
+ if ( !info ){
+ info = new LexInfo( name, translation );
+ info = LexTree.Store( name, info );
}
return info;
}
diff --git a/src/XMLtools.cxx b/src/XMLtools.cxx
index 6b7434f..33dff5e 100644
--- a/src/XMLtools.cxx
+++ b/src/XMLtools.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
diff --git a/src/runtest.cxx b/src/runtest.cxx
index eec0c7d..8ae93d5 100644
--- a/src/runtest.cxx
+++ b/src/runtest.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -49,6 +49,11 @@ void helper(){
throw runtime_error("fout");
}
+int helper2(){
+ throw runtime_error("mis");
+ return 8;
+}
+
void test_throw(){
assertThrow( helper(), runtime_error );
assertNoThrow( 4==7 );
@@ -204,6 +209,27 @@ void test_opts_basic(){
assertEqual( opts14.toString(), "-ab -ac -d-fiets --appel peer --fout=goed" );
v = opts14.getMassOpts();
assertEqual( v.size(), 2 );
+ CL_Options opts15;
+ opts15.set_debug(true);
+ opts15.parse_args( "--fout=goed\\mis --jan=gek" );
+ assertEqual( opts15.toString(), "--fout=goed\\mis --jan=gek" );
+ string res;
+ opts15.extract("fout", res );
+ assertEqual( res, "goed\\mis" );
+ opts15.extract("jan", res );
+ assertEqual( res, "gek" );
+ CL_Options opts16;
+ opts16.allow_args( "", "test:" );
+ opts16.set_debug(true);
+ opts16.parse_args( "--test goed --test=prima --test niet=eens --test=wel=eens" );
+ opts16.extract("test", res );
+ assertEqual( res, "goed" );
+ opts16.extract("test", res );
+ assertEqual( res, "prima" );
+ opts16.extract("test", res );
+ assertEqual( res, "niet=eens" );
+ opts16.extract("test", res );
+ assertEqual( res, "wel=eens" );
}
void test_opts( CL_Options& opts ){
@@ -234,6 +260,7 @@ void test_opts( CL_Options& opts ){
void test_subtests_fail(){
startTestSerie( "we testen subtests, met faal." );
assertThrow( helper(), range_error );
+ assertEqual( helper2(), 4 );
assertEqual( (1 + 2), (2 + 1) );
assertEqual( 4, 5 );
}
@@ -294,16 +321,36 @@ void test_split(){
string line = "De kat krabt de krullen\n van de trap.";
vector<string> res;
int cnt = split( line, res );
- // cerr << "after split: " << res << endl;
assertEqual( cnt, 8 );
assertEqual( res[5], "van" );
+ vector<string> res2 = split( line );
+ assertEqual( res2.size(), 8 );
+ assertEqual( res2[6], "de" );
+ vector<string> res3 = split( line, 3 );
+ assertEqual( res3.size(), 3 );
+ assertEqual( res3[1], "kat" );
+ assertEqual( res3[2], "krabt de krullen\n van de trap." );
+ vector<string> res4 = split( line, 24 );
+ assertEqual( res4.size(), 8 );
+ assertEqual( res4[1], "kat" );
+ assertEqual( res4[2], "krabt" );
+ vector<string> res5 = split( line, -1 );
+ assertEqual( res5.size(), 8 );
+ assertEqual( res5[1], "kat" );
+ assertEqual( res5[2], "krabt" );
+ vector<string> res6 = split( line, 0 );
+ assertEqual( res6.size(), 8 );
+ assertEqual( res6[1], "kat" );
+ assertEqual( res6[2], "krabt" );
+ vector<string> res7 = split( "APPELTAART", 2 );
+ assertEqual( res7.size(), 1 );
+ assertEqual( res7[0], "APPELTAART" );
}
void test_split_exact(){
string line = "1 2 4 8 10";
vector<string> res;
int cnt = split( line, res, true );
- // cerr << "after split: " << res << endl;
assertEqual( cnt, 10 );
assertEqual( res[5], "" );
}
@@ -312,7 +359,6 @@ void test_split_at_exact(){
string line = "1/2//4////8//10";
vector<string> res;
int cnt = split_at( line, res, "/", true );
- // cerr << "after split: " << res << endl;
assertEqual( cnt, 10 );
assertEqual( res[5], "" );
}
@@ -322,8 +368,14 @@ void test_split_at(){
vector<string> res;
int cnt = split_at( line, res, "rare" );
assertEqual( cnt, 8 );
- // cerr << "after split: " << res << endl;
assertEqual( res[5], "van" );
+ vector<string> res2 = split_at( line, "rare" );
+ assertEqual( res2.size(), 8 );
+ assertEqual( res2[6], "de" );
+ vector<string> res3 = split_at( line, "rare", 4 );
+ assertEqual( res3.size(), 4 );
+ assertEqual( res3[2], "krabt" );
+ assertEqual( res3[3], "derarekrullen\nrarevanrarederaretrap." );
}
void test_split_at_first(){
@@ -331,8 +383,14 @@ void test_split_at_first(){
vector<string> res;
int cnt = split_at_first_of( line, res, ".,?!:;" );
assertEqual( cnt, 8 );
- // cerr << "after split: " << res << endl;
assertEqual( res[5], "van" );
+ vector<string> res2 = split_at_first_of( line, ".,?!:;" );
+ assertEqual( res2.size(), 8 );
+ assertEqual( res2[6], "de" );
+ vector<string> res3 = split_at_first_of( line, ".,?!:;", 7 );
+ assertEqual( res3.size(), 7 );
+ assertEqual( res3[4], "krullen" );
+ assertEqual( res3[6], ",;.;de!trap." );
}
void test_split_at_first_exact(){
@@ -370,16 +428,16 @@ void test_lowercase(){
}
void test_base_dir(){
- assertEqual( basename("/foo/bar" ), "bar" );
- assertEqual( dirname("/foo/bar" ), "/foo" );
- assertEqual( basename("foo/bar" ), "bar" );
- assertEqual( dirname("foo/bar" ), "foo" );
- assertEqual( basename("foobar" ), "foobar" );
- assertEqual( dirname("foobar" ), "." );
- assertEqual( basename("/" ), "/" );
- assertEqual( dirname("/" ), "/" );
- assertEqual( basename("." ), "." );
- assertEqual( dirname("." ), "." );
+ assertEqual( TiCC::basename("/foo/bar" ), "bar" );
+ assertEqual( TiCC::dirname("/foo/bar" ), "/foo" );
+ assertEqual( TiCC::basename("foo/bar" ), "bar" );
+ assertEqual( TiCC::dirname("foo/bar" ), "foo" );
+ assertEqual( TiCC::basename("foobar" ), "foobar" );
+ assertEqual( TiCC::dirname("foobar" ), "." );
+ assertEqual( TiCC::basename("/" ), "" );
+ assertEqual( TiCC::dirname("/" ), "" );
+ assertEqual( TiCC::basename("." ), "." );
+ assertEqual( TiCC::dirname("." ), "." );
}
void test_bz2compression( const string& path ){
@@ -425,13 +483,8 @@ void test_tar( const string& path ){
assertEqual( line, "a testfile." );
assertNoThrow( mytar.extract_file_names( res, ".xml" ) );
assertEqual( res.size(), 1 );
-#ifdef HAVE_BOOST_REGEX
assertNoThrow( mytar.extract_file_names_match( res, "s*b" ) );
assertEqual( res.size(), 3 );
-#else
- assertNoThrow( mytar.extract_file_names_match( res, "txt" ) );
- assertEqual( res.size(), 3 );
-#endif
}
void test_fileutils( const string& path ){
@@ -452,7 +505,6 @@ void test_fileutils( const string& path ){
assertTrue( createPath( "/tmp/test/silly/files/path/raar" ) );
assertFalse( createPath( "/tmp/test/silly/files/path/raar/sub" ) );
-#ifdef HAVE_BOOST_REGEX
assertNoThrow( res = searchFilesMatch( path, "*.txt", false ) );
// non recursive. should match small.txt
assertEqual( res.size(), 1 );
@@ -465,7 +517,6 @@ void test_fileutils( const string& path ){
assertNoThrow( res = searchFilesMatch( path, "s*[lb].txt" ) );
// should match small.txt and sub1/sub.txt
assertEqual( res.size(), 2 );
-#endif
}
void test_configuration( const string& path ){
@@ -486,6 +537,8 @@ void test_configuration( const string& path ){
assertEqual( oud, "gek" );
c.setatt( "pief", "paf", "poef" );
c.clearatt( "piet", "test" );
+ att = c.lookUp( "Truus", "test" );
+ assertEqual( att, "met een \n er in en een \r!" );
assertNoThrow( c.create_configfile( "/tmp/test.cfg" ) );
Configuration c2;
assertTrue( c2.fill( "/tmp/test.cfg" ) );
@@ -499,6 +552,8 @@ void test_configuration( const string& path ){
assertEqual( att, "paf" );
att = c2.lookUp( "piet", "test" );
assertEqual( att, "" );
+ att = c.lookUp( "Truus", "test" );
+ assertEqual( att, "met een \n er in en een \r!" );
}
void test_logstream( const string& path ){
@@ -570,15 +625,22 @@ int main( const int argc, const char* argv[] ){
opts1.is_present( 'd', testdir, dummy );
#ifdef HAVE_BZLIB_H
test_bz2compression( testdir );
+#else
+ cerr << "no BZ2 support available" << endl;
#endif
#ifdef HAVE_LIBZ
test_gzcompression( testdir );
+#else
+ cerr << "no GZ support available" << endl;
#endif
#ifdef HAVE_LIBTAR_H
test_tar( testdir );
+#else
+ cerr << "no tar support available" << endl;
#endif
+ test_base_dir();
test_fileutils( testdir );
test_configuration( testdir );
test_logstream( testdir );
- summarize_tests(3);
+ summarize_tests(4);
}
diff --git a/src/testlogstream.cxx b/src/testlogstream.cxx
new file mode 100644
index 0000000..8be6aff
--- /dev/null
+++ b/src/testlogstream.cxx
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2006 - 2017
+ CLST - Radboud University
+ ILK - Tilburg University
+
+ This file is part of ticcutils
+
+ ticcutils is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ ticcutils is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ For questions and suggestions, see:
+ https://github.com/LanguageMachines/ticcutils/issues
+ or send mail to:
+ lamasoftware (at ) science.ru.nl
+
+*/
+
+#include <string>
+#include <cstdlib>
+#include "config.h"
+#include <iostream>
+#include <unistd.h>
+#include <stdexcept>
+
+#include "ticcutils/StringOps.h"
+#include "ticcutils/LogStream.h"
+
+using namespace std;
+using namespace TiCC;
+
+class Sub1 {
+public:
+ Sub1( LogStream& log ){
+ ls = new LogStream( log, "-SUB1" );
+ *Log(ls) << "created a sub1 " << endl;
+ }
+ void exec( int i ){
+ int sleeps = rand()%(i+1) + 1;
+ sleep(sleeps);
+ *Log(ls) << " 1" << endl;
+ }
+ LogStream *ls;
+};
+
+class Sub2 {
+public:
+ Sub2( LogStream* log ){
+ ls = log;
+ *Log(*ls) << "created a sub2 " << endl;
+ }
+ void exec( int i ){
+ int sleeps = rand()%(i+1) + 1;
+ sleep(sleeps);
+ *Log(ls) << " 2" << endl;
+ }
+ LogStream *ls;
+};
+
+class Sub3 {
+public:
+ Sub3( Sub2& s ){
+ ls = new LogStream( s.ls, "-SUB3", StampMessage );
+ *Log(ls) << "created a sub3 " << endl;
+ }
+ void exec( int i ){
+ int sleeps = rand()%(i+1) + 1;
+ sleep(sleeps);
+ *Log(ls) << " 3" << endl;
+ }
+ LogStream *ls;
+};
+
+int main(){
+ LogStream the_log( "main-log" );
+ Sub1 sub1( the_log );
+ Sub2 sub2( &the_log );
+#pragma omp parallel for schedule(dynamic)
+ for ( int i = 0; i < 5; ++i ){
+ sub1.exec(i);
+ sub2.exec(i);
+ Sub3 sub3( sub2 );
+ sub3.exec(i);
+ }
+}
diff --git a/src/tst.sh b/src/tst.sh
index 04e762f..6002bdc 100755
--- a/src/tst.sh
+++ b/src/tst.sh
@@ -1,2 +1,4 @@
#! /bin/sh
./runtest -ffalse +t true --test=test -d $topsrcdir/tests/ -q --raar blaat arg1 arg2
+
+#./testlogstream
diff --git a/src/zipper.cxx b/src/zipper.cxx
index ce8317e..136b338 100644
--- a/src/zipper.cxx
+++ b/src/zipper.cxx
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2006 - 2016
+ Copyright (c) 2006 - 2017
CLST - Radboud University
ILK - Tilburg University
@@ -202,7 +202,7 @@ namespace TiCC {
if ( pos == string::npos ){
throw runtime_error( "gz: expected an inputfile name with .gz extension" );
}
- igzstream infile( inname.c_str(), ios::binary|ios::in );
+ igzstream infile( inname, ios::binary|ios::in );
if ( !infile ){
throw runtime_error( "gz: unable to open inputfile: " + inName );
}
@@ -215,7 +215,7 @@ namespace TiCC {
}
bool gzWriteFile( const string& outName, const string& buffer ){
- ogzstream outfile( outName.c_str(), ios::binary|ios::out );
+ ogzstream outfile( outName, ios::binary|ios::out );
if ( !outfile ){
cerr << "gz: unable to open outputfile: " << outName << endl;
return false;
@@ -233,7 +233,7 @@ namespace TiCC {
string outname = outName;
if ( outname.empty() )
outname = inName + ".gz";
- ogzstream outfile( outname.c_str(), ios::binary|ios::out );
+ ogzstream outfile( outname, ios::binary|ios::out );
if ( !outfile ){
cerr << "gz: unable to open outputfile: " << outname << endl;
return false;
@@ -249,7 +249,7 @@ namespace TiCC {
}
bool gzDecompress( const string& inName, const string& outName ){
- igzstream infile( inName.c_str(), std::ios::binary|ios::in);
+ igzstream infile( inName, std::ios::binary|ios::in);
if ( !infile ){
cerr << "gz: unable to open inputfile: " << inName << endl;
return false;
diff --git a/tests/testconfig.cfg b/tests/testconfig.cfg
index e154441..acc818d 100644
--- a/tests/testconfig.cfg
+++ b/tests/testconfig.cfg
@@ -2,4 +2,5 @@ jan=gek
[[test]]
piet=ook gek
kees="een jongen"
-klara=speciaal=raar
\ No newline at end of file
+klara=speciaal=raar
+Truus=met een \n er in en een \r!
--
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