From eed2ede410a3fc2d35efad54fd4b795c95172dbf Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 21 Dec 2021 14:25:27 +0900 Subject: [PATCH] Imported Upstream version 0.2.13 --- ChangeLog | 288 ++++++++++++++++++++++++++++++++++ Makefile.am | 2 - Makefile.in | 81 +++++----- NEWS | 17 ++ VERSION | 2 +- aclocal.m4 | 204 +++++++++++------------- build-aux/compile | 17 +- build-aux/depcomp | 8 +- build-aux/install-sh | 181 +++++++++++++--------- build-aux/ltmain.sh | 379 +++++++++++++++++---------------------------- build-aux/missing | 16 +- build-aux/test-driver | 18 ++- config.h.in | 6 +- configure | 335 +++++++++++++++++---------------------- configure.ac | 10 +- datrie/Makefile.in | 61 +++++--- datrie/alpha-map-private.h | 5 + datrie/alpha-map.c | 81 +++++++--- datrie/alpha-map.h | 3 +- datrie/darray.c | 22 +++ datrie/darray.h | 4 + datrie/fileutils.c | 59 +++++-- datrie/fileutils.h | 2 + datrie/libdatrie.def | 2 + datrie/libdatrie.map | 4 + datrie/tail.c | 90 +++++++---- datrie/tail.h | 6 +- datrie/trie-string.c | 42 ++++- datrie/trie-string.h | 16 ++ datrie/trie.c | 67 ++++++-- datrie/trie.h | 6 +- doc/Makefile.in | 13 +- m4/libtool.m4 | 31 ++-- man/Makefile.in | 13 +- tests/Makefile.am | 16 ++ tests/Makefile.in | 163 ++++++++++++++----- tests/test_byte_list.c | 186 ++++++++++++++++++++++ tests/test_file.c | 7 +- tests/test_serialization.c | 129 +++++++++++++++ tools/Makefile.in | 30 ++-- tools/trietool.c | 8 +- 41 files changed, 1748 insertions(+), 882 deletions(-) mode change 100644 => 100755 build-aux/ltmain.sh create mode 100644 tests/test_byte_list.c create mode 100644 tests/test_serialization.c diff --git a/ChangeLog b/ChangeLog index 2d87b42..3e0a12b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,291 @@ +2021-01-29 Theppitak Karoonboonyanan + + * NEWS: + === Version 0.2.13 === + +2021-01-24 Theppitak Karoonboonyanan + + Update library versioning + + * configure.ac: Bump library versioning to reflect API addition. + +2021-01-24 Theppitak Karoonboonyanan + + Rename trie_byte_strlen() to trie_char_strsize(). + + The object of the function is TrieChar string. Let's keep + that semantics in the name. + + * datrie/trie-string.h, datrie/trie-string.c + (trie_byte_strlen -> trie_char_strsize): + - Rename the function. + * datrie/tail.c (tail_get_serialized_size, tail_serialize): + - Replace trie_byte_strlen() calls with the new name. + +2021-01-24 Theppitak Karoonboonyanan + + Revise test_serialization. + + * tests/test_serialization.c (-trie_enum_mark_rec): + - Drop unused callback function. + * tests/test_serialization (main): + - Drop unused 'is_failed' variable. + - "%Ilu" -> "%lu" printf format. + - Rearrange error handling in stack unwinding style. + - Add '\n' to printf messages. + - Free 'trieSerializedData'. + + We're not moving to C99 yet, but the declaration amid code is + too useful to remove. And it's just in the test code, not in + the main source. So we still allow it. + +2021-01-24 Theppitak Karoonboonyanan + + Get rid of include in the new test. + + * tests/test_serialization.c (main): + - Replace unlink() calls with remove() from and drop + include. + +2021-01-24 Theppitak Karoonboonyanan + + Adjust file-internal function declarations. + + * datrie/fileutils.c + (parse_int16_be, serialize_int32_be, serialize_int16_be): + - Re-declare functions as static. + * datrie/fileutils.c (parse_int16_be): + - Make the 'buff' arg const pointer. + * datrie/fileutils.c: + - Remove some blank lines in source. + +2021-01-24 Theppitak Karoonboonyanan + + Fix documentation. + + * datrie/tail.h (Tail typedef): + - Fix comment (Double-array -> Tail). + +2021-01-24 Theppitak Karoonboonyanan + + Cosmetic changes. + + * datrie/fileutils.c: + * datrie/trie-string.c: + * datrie/alpha-map.c: + * datrie/darray.h: + * datrie/darray.c: + * datrie/tail.h: + * datrie/tail.c: + * datrie/trie.c: + * tools/trie-tool.c: + * tests/test_serialization.c: + - Use space before left parenthesis. + - Use old-style C comments. + - Remove trailing spaces. + - Re-wrap lines. + +2021-01-23 KOLANICH + + Added serialization of the trie into a memory buffer. + + * datrie/fileutils.c + (file_write_int32, +serialize_int32, + file_write_int16, +serialize_int16, + file_read_int32, +parse_int32_be, + file_read_int16, +parse_int16_be): + - Split binary read/write operations into separate functions. + * datrie/fileutils.h, datrie/fileutils.c + (+serialize_int32_be_incr, +serialize_int16_be_incr): + - Add serialization utility functions with pointer advancement. + * datrie/trie-string.h, datrie/trie-string.c + (+trie_byte_strlen): + - Add utility method for calculating TrieChar string size in bytes. + + * datrie/alpha-map-private.h, datrie/alpha-map.c + (+alpha_map_get_serialized_size, +alpha_map_serialize_bin): + - Add AlphaMap serialization methods. + * datrie/darray.h, datrie/darray.c + (+da_get_serialized_size, +da_serialize): + - Add DArray serialization methods. + * datrie/tail.h, datrie/tail.c + (+tail_get_serialized_size, +tail_serialize): + - Add Tail serialization methods. + * datrie/trie.h, datrie/trie.c + (+trie_get_serialized_size, +trie_serialize): + - Add Trie serialization methods. + * datrie/libdatrie.map, datrie/libdatrie.def: + - Add export symbols for Trie serialization. + + * tests/Makefile.am, +tests/test_serialization.c: + - Add serialization test. + + Pull Request #12. + +2021-01-22 Theppitak Karoonboonyanan + + Get rid of include. + + * tests/test_file.c (main): + - Replace unlink() calls with remove() from and drop + include, fixing build issue on Windows. + + Addressing Windows build issue differently from what proposed by + @fanc999 in pull request #15. Thanks @fanc999 for first raising this. + +2021-01-15 Theppitak Karoonboonyanan + + Use TRIE_CHAR_TERM in TAIL I/O methods. + + * datrie/tail.c (tail_fwrite): + - Replace strlen() with trie_char_strlen() on suffix, + which is TrieChar string. + * datrie/tail.c (tail_fread): + - Append TRIE_CHAR_TERM, rather than literal zero, + as suffix terminator. + +2021-01-15 Theppitak Karoonboonyanan + + Use TRIE_CHAR_TERM in TrieIterator methods. + + * datrie/trie.c (trie_iterator_get_key): + - Replace strlen() with trie_char_strlen() on tail_str, + which is TrieChar string. + - Check tail_str termination against TRIE_CHAR_TERM, not zero. + +2021-01-14 Theppitak Karoonboonyanan + + Fix wrong TRIE_CHAR_TERM semantics. + + * datrie/trie.h (trie_state_is_terminal): + - Test for terminal state using zero AlphaChar. + TRIE_CHAR_TERM is a TrieChar, although it's also accidentally zero. + +2021-01-14 Theppitak Karoonboonyanan + + Reduce loops in alpha_map_recalc_work_area(). + + * datrie/alpha-map.c (alpha_map_recalc_work_area): + - Instead of pre-filling trie-to-alpha map with errors + and setting valid cells afterward, just fill error cells + left after valid cells are done. Then, finally set + TRIE_CHAR_TERM cell. + +2021-01-10 Theppitak Karoonboonyanan + + Rewrite AlphaMap recalc. + + * datrie/alpha-map.c (alpha_map_recalc_work_area): + Rewrite alpha-to-trie & trie-to-alpha maps recalculation + - For clearer relation between the two maps + - To allow other TRIE_CHAR_TERM values than zero + +2021-01-09 Theppitak Karoonboonyanan + + Use TRIE_CHAR_TERM macro instead of zero. + + * datrie/alpha-map.c + (alpha_map_char_to_trie, alpha_map_char_to_trie_str): + * datrie/trie.c (trie_branch_in_branch, trie_branch_in_tail): + * datrie/tail.c (tail_walk_str, tail_walk_char): + - Use TRIE_CHAR_TERM instead of hard-wired zero when working + with raw trie string termination. + * datrie/trie-string.c (trie_string_terminate): + - Append TRIE_CHAR_TERM instead of simply delegating to + dstring_terminate(). + +2021-01-09 Theppitak Karoonboonyanan + + Share static trie string functions internally. + + * datrie/trie-string.h, datrie/trie-string.c, datrie/tail.c + (tc_strlen -> trie_char_strlen, tc_strdup -> trie_char_strdup): + - Move private functions in tail.c to trie-string.[ch], + with new full names under new "static trie string" section. + - Check/assign string terminator using TRIE_CHAR_TERM + instead of zero. + * datrie/tail.c (tail_set_suffix): + - Call the new trie_char_strdup() instead of tc_strdup(). + * datrie/alpha-map.c (alpha_map_trie_to_char_str): + - Call trie_char_strlen() instead of strlen(). + +2021-01-06 Theppitak Karoonboonyanan + + Get rid of char semantics from TrieChar + + * datrie/trie.c (trie_branch_in_branch, trie_branch_in_tail): + - Check null TrieChar with int zero instead of char. + +2021-01-05 Theppitak Karoonboonyanan + + Use proper #include form in installed header. + + * datrie/alpha-map.h: + - Use angle quotes form instead of double quotes in #include. + +2021-01-05 Theppitak Karoonboonyanan + + Fix some documentations. + + * datrie/trie.c (trie_is_dirty): + - Adjust wording to make clear the file is out of sync, + not the other way around. + * datrie/trie.c (trie_store, trie_store_if_absent): + - Fix typo in the description of 'key' parameter. + * datrie/trie.c (trie_store_if_absent): + - Minor wording adjustment (inserted, not appended). + +2020-12-30 Theppitak Karoonboonyanan + + Fix isspace() arg problem on NetBSD. + + * tools/trietool.c (command_add_list, string_trim): + - Cast char to unsigned char before passing to isspace(). + + Thanks Sean for the report via a personal mail. + +2019-12-20 Theppitak Karoonboonyanan + + Use GitHub issue tracker as bug report address. + + * configure.ac: + - Replace bug report e-mail address with GitHub issue tracker URL. + +2019-08-05 Theppitak Karoonboonyanan + + Stop installing README.migration + + It's supposed to be internal document now. + + * Makefile.am: + - Remove README.migration from doc_DATA. + +2019-01-21 Theppitak Karoonboonyanan + + Fix cross-compiling issue caused by AC_FUNC_MALLOC + + * configure.ac: + - Replace AC_FUNC_MALLOC with AC_CHECK_FUNCS([malloc]), + as we don't rely on GNU's malloc(0) behavior. + + Thanks Vanessa McHale for the report. Closes: #11 + +2018-11-23 Theppitak Karoonboonyanan + + Fix wrong key listing in byte trie + + * tests/Makefile.am, +tests/test_byte_list.c: + - Add test case + * datrie/alpha-map.c (alpha_map_recalc_work_area): + - Index trie_to_alpha_map[] using TrieIndex, not TrieChar type, + to prevent overflow upon incrementing over 0xff. + - Drop tc variable and just reuse trie_last. + + Thanks @legale for the report. + + Closes: #9 + https://github.com/tlwg/libdatrie/issues/9 + 2018-06-19 Theppitak Karoonboonyanan * configure.ac: diff --git a/Makefile.am b/Makefile.am index 0278dac..1197445 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,8 +7,6 @@ EXTRA_DIST = \ build-aux/git-version-gen \ $(NULL) -doc_DATA = README.migration - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = datrie-0.2.pc diff --git a/Makefile.in b/Makefile.in index ba4f3f3..9dee21c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -158,8 +158,8 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)" -DATA = $(doc_DATA) $(pkgconfig_DATA) +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +DATA = $(pkgconfig_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ @@ -167,9 +167,9 @@ am__recursive_targets = \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ - $(LISP)config.h.in + cscope distdir distdir-am dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ + config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. @@ -238,6 +238,8 @@ am__relativize = \ GZIP_ENV = --best DIST_ARCHIVES = $(distdir).tar.xz DIST_TARGETS = dist-xz +# Exists only to be overridden by the user if desired. +AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -372,7 +374,6 @@ EXTRA_DIST = \ build-aux/git-version-gen \ $(NULL) -doc_DATA = README.migration pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = datrie-0.2.pc all: config.h @@ -400,8 +401,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -438,27 +439,6 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt -install-docDATA: $(doc_DATA) - @$(NORMAL_INSTALL) - @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \ - done - -uninstall-docDATA: - @$(NORMAL_UNINSTALL) - @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ @@ -587,7 +567,10 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -669,6 +652,10 @@ dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) +dist-zstd: distdir + tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst + $(am__post_remove_distdir) + dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @@ -711,6 +698,8 @@ distcheck: dist eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ + *.tar.zst*) \ + zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) @@ -726,7 +715,7 @@ distcheck: dist $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -782,7 +771,7 @@ check: check-recursive all-am: Makefile $(DATA) config.h installdirs: installdirs-recursive installdirs-am: - for dir in "$(DESTDIR)$(docdir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive @@ -837,7 +826,7 @@ info: info-recursive info-am: -install-data-am: install-docDATA install-pkgconfigDATA +install-data-am: install-pkgconfigDATA install-dvi: install-dvi-recursive @@ -883,7 +872,7 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-docDATA uninstall-pkgconfigDATA +uninstall-am: uninstall-pkgconfigDATA .MAKE: $(am__recursive_targets) all install-am install-strip @@ -891,19 +880,19 @@ uninstall-am: uninstall-docDATA uninstall-pkgconfigDATA am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-hook dist-lzip dist-shar \ - dist-tarZ dist-xz dist-zip distcheck distclean \ + dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-docDATA install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-docDATA uninstall-pkgconfigDATA + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-pkgconfigDATA .PRECIOUS: Makefile diff --git a/NEWS b/NEWS index 9d011a9..cad0afd 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,22 @@ libdatrie +0.2.13 (2021-01-29) +====== +- Fix wrong key listing in byte trie + (Issue #9, Thanks @legale for the report.) +- Fix cross-compiling issue caused by AC_FUNC_MALLOC + (Issue #11, Thanks Vanessa McHale for the report.) +- Fix isspace() arg problem on NetBSD. + (Personal mail, Thanks Sean for the report; + PR #8, Thanks OBATA Akio for an individual pull request.) +- Fix some documentations. +- Really use TRIE_CHAR_TERM in TrieChar string termination. + Changing TRIE_CHAR_TERM definition now won't break the code. +- Fix Windows build issue by avoiding include. + (Partially addressing PR #15, Thanks @fanc999 for first raising this.) +- [New APIs] Add serialization of the trie into memory buffer. + (PR #12, Thanks KOLANICH for the contribution.) + 0.2.12 (2018-06-19) ====== - More C90 (ANSI C) compliance. diff --git a/VERSION b/VERSION index f2722b1..2779245 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.2.12 +0.2.13 diff --git a/aclocal.m4 b/aclocal.m4 index 0f3bbcc..6c3c7e7 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.3 -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -101,7 +101,7 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.]) # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 12 +#serial 13 dnl ######################################################################### AC_DEFUN([AX_COMPARE_VERSION], [ @@ -168,7 +168,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` ], [.+],[ AC_WARNING( - [illegal OP numeric parameter: $2]) + [invalid OP numeric parameter: $2]) ],[]) # Pad zeros at end of numbers to make same length. @@ -184,7 +184,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` [ne],[ test "x$A" != "x$B" && ax_compare_version=true ],[ - AC_WARNING([illegal OP parameter: $2]) + AC_WARNING([invalid OP parameter: $2]) ]) ]) @@ -198,7 +198,7 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` fi ]) dnl AX_COMPARE_VERSION -# Copyright (C) 2002-2017 Free Software Foundation, Inc. +# Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -210,10 +210,10 @@ x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' +[am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15.1], [], +m4_if([$1], [1.16.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -229,14 +229,14 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15.1])dnl +[AM_AUTOMAKE_VERSION([1.16.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -288,7 +288,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -319,7 +319,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -510,13 +510,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. - # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], @@ -524,49 +523,43 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -575,18 +568,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -673,8 +665,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. @@ -741,7 +733,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -783,7 +775,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -804,7 +796,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2017 Free Software Foundation, Inc. +# Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -825,7 +817,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -833,49 +825,42 @@ AC_SUBST([am__leading_dot])]) # AM_MAKE_INCLUDE() # ----------------- -# Check to see how make treats includes. +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2017 Free Software Foundation, Inc. +# Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -896,12 +881,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -914,7 +894,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -943,7 +923,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -990,7 +970,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1009,7 +989,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2017 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1090,7 +1070,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2017 Free Software Foundation, Inc. +# Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1150,7 +1130,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2017 Free Software Foundation, Inc. +# Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1178,7 +1158,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2017 Free Software Foundation, Inc. +# Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1197,7 +1177,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2017 Free Software Foundation, Inc. +# Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/build-aux/compile b/build-aux/compile index a85b723..23fcba0 100755 --- a/build-aux/compile +++ b/build-aux/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # 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 . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/build-aux/depcomp b/build-aux/depcomp index b39f98f..6b39162 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -1,9 +1,9 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2016-01-11.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2017 Free Software Foundation, Inc. +# Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ scriptversion=2016-01-11.22; # UTC # 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 . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -783,7 +783,7 @@ exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" diff --git a/build-aux/install-sh b/build-aux/install-sh index 59990a1..ec298b5 100755 --- a/build-aux/install-sh +++ b/build-aux/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2014-09-12.12; # UTC +scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -69,6 +69,11 @@ posix_mkdir= # Desired mode of installed file. mode=0755 +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -99,18 +104,28 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve the last data modification time) + -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,8 +152,13 @@ while test $# -ne 0; do -o) chowncmd="$chownprog $2" shift;; + -p) cpprog="$cpprog -p";; + -s) stripcmd=$stripprog;; + -S) backupsuffix="$2" + shift;; + -t) is_target_a_directory=always dst_arg=$2 @@ -255,6 +275,10 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -271,15 +295,18 @@ do fi dst=$dst_arg - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. + # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst - dst=$dstdir/`basename "$src"` + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac dstdir_status=0 else dstdir=`dirname "$dst"` @@ -288,27 +315,16 @@ do fi fi + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then @@ -318,50 +334,49 @@ do fi posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - # $RANDOM is not portable (e.g. dash); use it when possible to - # lower collision chance - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0 - - # As "mkdir -p" follows symlinks and we work in /tmp possibly; so - # create the $tmpdir first (and fail if unsuccessful) to make sure - # that nobody tries to guess the $tmpdir name. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac;; + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; esac if @@ -372,7 +387,7 @@ do then : else - # The umask is ridiculous, or mkdir does not conform to POSIX, + # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. @@ -401,7 +416,7 @@ do prefixes= else if $posix_mkdir; then - (umask=$mkdir_umask && + (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 @@ -434,14 +449,25 @@ do else # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -467,6 +493,13 @@ do then rm -f "$dsttmp" else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -481,9 +514,9 @@ do # file should still install successfully. { test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || + $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 @@ -500,9 +533,9 @@ do done # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh old mode 100644 new mode 100755 index e4eda6d..21e5e07 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-2.1" +VERSION="2.4.6 Debian-2.4.6-15" package_revision=2.4.6 @@ -64,7 +64,7 @@ package_revision=2.4.6 # libraries, which are installed to $pkgauxdir. # Set a version string for this script. -scriptversion=2015-10-12.13; # UTC +scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 @@ -387,7 +387,7 @@ EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # -# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: @@ -580,16 +580,16 @@ if test yes = "$_G_HAVE_PLUSEQ_OP"; then { $debug_cmd - func_quote_arg pretty "$2" - eval "$1+=\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd - func_quote_arg pretty "$2" - eval "$1=\$$1\\ \$func_quote_arg_result" + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi @@ -1091,181 +1091,85 @@ func_relative_path () } -# func_quote_portable EVAL ARG -# ---------------------------- -# Internal function to portably implement func_quote_arg. Note that we still -# keep attention to performance here so we as much as possible try to avoid -# calling sed binary (so far O(N) complexity as long as func_append is O(1)). -func_quote_portable () +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () { $debug_cmd - func_quote_portable_result=$2 - - # one-time-loop (easy break) - while true - do - if $1; then - func_quote_portable_result=`$ECHO "$2" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` - break - fi - - # Quote for eval. - case $func_quote_portable_result in + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in *[\\\`\"\$]*) - case $func_quote_portable_result in - *[\[\*\?]*) - func_quote_portable_result=`$ECHO "$func_quote_portable_result" | $SED "$sed_quote_subst"` - break - ;; - esac + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi - func_quote_portable_old_IFS=$IFS - for _G_char in '\' '`' '"' '$' - do - # STATE($1) PREV($2) SEPARATOR($3) - set start "" "" - func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy - IFS=$_G_char - for _G_part in $func_quote_portable_result - do - case $1 in - quote) - func_append func_quote_portable_result "$3$2" - set quote "$_G_part" "\\$_G_char" - ;; - start) - set first "" "" - func_quote_portable_result= - ;; - first) - set quote "$_G_part" "" - ;; - esac - done - done - IFS=$func_quote_portable_old_IFS + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" ;; - *) ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; esac - break - done - func_quote_portable_unquoted_result=$func_quote_portable_result - case $func_quote_portable_result in - # double-quote args containing shell metacharacters to delay - # word splitting, command substitution and variable expansion - # for a subsequent eval. - # many bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_portable_result=\"$func_quote_portable_result\" - ;; - esac + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done } -# func_quotefast_eval ARG -# ----------------------- -# Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG', -# but optimized for speed. Result is stored in $func_quotefast_eval. -if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then - func_quotefast_eval () - { - printf -v func_quotefast_eval_result %q "$1" - } -else - func_quotefast_eval () - { - func_quote_portable false "$1" - func_quotefast_eval_result=$func_quote_portable_result - } -fi - +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd -# func_quote_arg MODEs ARG -# ------------------------ -# Quote one ARG to be evaled later. MODEs argument may contain zero ore more -# specifiers listed below separated by ',' character. This function returns two -# values: -# i) func_quote_arg_result -# double-quoted (when needed), suitable for a subsequent eval -# ii) func_quote_arg_unquoted_result -# has all characters that are still active within double -# quotes backslashified. Available only if 'unquoted' is specified. -# -# Available modes: -# ---------------- -# 'eval' (default) -# - escape shell special characters -# 'expand' -# - the same as 'eval'; but do not quote variable references -# 'pretty' -# - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might -# later used in func_quote to get output like: 'echo "a b"' instead of -# 'echo a\ b'. This is slower than default on some shells. -# 'unquoted' -# - produce also $func_quote_arg_unquoted_result which does not contain -# wrapping double-quotes. -# -# Examples for 'func_quote_arg pretty,unquoted string': -# -# string | *_result | *_unquoted_result -# ------------+-----------------------+------------------- -# " | \" | \" -# a b | "a b" | a b -# "a b" | "\"a b\"" | \"a b\" -# * | "*" | * -# z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\" -# -# Examples for 'func_quote_arg pretty,unquoted,expand string': -# -# string | *_result | *_unquoted_result -# --------------+---------------------+-------------------- -# z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\" -func_quote_arg () -{ - _G_quote_expand=false - case ,$1, in - *,expand,*) - _G_quote_expand=: - ;; + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; esac - case ,$1, in - *,pretty,*|*,expand,*|*,unquoted,*) - func_quote_portable $_G_quote_expand "$2" - func_quote_arg_result=$func_quote_portable_result - func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result - ;; - *) - # Faster quote-for-eval for some shells. - func_quotefast_eval "$2" - func_quote_arg_result=$func_quotefast_eval_result + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" ;; esac -} - -# func_quote MODEs ARGs... -# ------------------------ -# Quote all ARGs to be evaled later and join them into single command. See -# func_quote_arg's description for more info. -func_quote () -{ - $debug_cmd - _G_func_quote_mode=$1 ; shift - func_quote_result= - while test 0 -lt $#; do - func_quote_arg "$_G_func_quote_mode" "$1" - if test -n "$func_quote_result"; then - func_append func_quote_result " $func_quote_arg_result" - else - func_append func_quote_result "$func_quote_arg_result" - fi - shift - done + func_quote_for_expand_result=$_G_arg } @@ -1311,8 +1215,8 @@ func_show_eval () _G_cmd=$1 _G_fail_exp=${2-':'} - func_quote_arg pretty,expand "$_G_cmd" - eval "func_notquiet $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" @@ -1337,8 +1241,8 @@ func_show_eval_locale () _G_fail_exp=${2-':'} $opt_quiet || { - func_quote_arg expand,pretty "$_G_cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { @@ -1466,7 +1370,7 @@ func_lt_ver () #! /bin/sh # Set a version string for this script. -scriptversion=2015-10-12.13; # UTC +scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 @@ -1676,8 +1580,8 @@ func_run_hooks () # ' # # No change in '$@' (ignored completely by this hook). There is # # no need to do the equivalent (but slower) action: -# # func_quote eval ${1+"$@"} -# # my_options_prep_result=$func_quote_result +# # func_quote_for_eval ${1+"$@"} +# # my_options_prep_result=$func_quote_for_eval_result # false # } # func_add_hook func_options_prep my_options_prep @@ -1713,8 +1617,8 @@ func_run_hooks () # done # # if $args_changed; then -# func_quote eval ${1+"$@"} -# my_silent_option_result=$func_quote_result +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result # fi # # $args_changed @@ -1781,8 +1685,8 @@ func_options () if $_G_rc_options; then func_options_result=$_G_res_var else - func_quote eval ${1+"$@"} - func_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + func_options_result=$func_quote_for_eval_result fi $_G_rc_options @@ -1925,8 +1829,8 @@ func_parse_options () if $_G_rc_parse_options; then # save modified positional parameters for caller - func_quote eval ${1+"$@"} - func_parse_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result fi $_G_rc_parse_options @@ -2237,7 +2141,7 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-2.1 + version: $progname $scriptversion Debian-2.4.6-15 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -2471,8 +2375,8 @@ libtool_options_prep () if $_G_rc_lt_options_prep; then # Pass back the list of options. - func_quote eval ${1+"$@"} - libtool_options_prep_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result fi $_G_rc_lt_options_prep @@ -2578,8 +2482,8 @@ libtool_parse_options () if $_G_rc_lt_parse_options; then # save modified positional parameters for caller - func_quote eval ${1+"$@"} - libtool_parse_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result fi $_G_rc_lt_parse_options @@ -2639,8 +2543,8 @@ libtool_validate_options () } # Pass back the unparsed argument list - func_quote eval ${1+"$@"} - libtool_validate_options_result=$func_quote_result + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options @@ -3606,8 +3510,8 @@ func_mode_compile () esac done - func_quote_arg pretty "$libobj" - test "X$libobj" != "X$func_quote_arg_result" \ + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" @@ -3680,8 +3584,8 @@ compiler." func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result - func_quote_arg pretty "$srcfile" - qsrcfile=$func_quote_arg_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then @@ -4284,8 +4188,8 @@ func_mode_install () case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. - func_quote_arg pretty "$nonopt" - install_prog="$func_quote_arg_result " + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " arg=$1 shift else @@ -4295,8 +4199,8 @@ func_mode_install () # The real first argument should be the name of the installation program. # Aesthetically quote it. - func_quote_arg pretty "$arg" - func_append install_prog "$func_quote_arg_result" + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; @@ -4353,12 +4257,12 @@ func_mode_install () esac # Aesthetically quote the argument. - func_quote_arg pretty "$arg" - func_append install_prog " $func_quote_arg_result" + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then - func_quote_arg pretty "$arg2" + func_quote_for_eval "$arg2" fi - func_append install_shared_prog " $func_quote_arg_result" + func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ @@ -4369,8 +4273,8 @@ func_mode_install () if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else - func_quote_arg pretty "$install_override_mode" - func_append install_shared_prog " -m $func_quote_arg_result" + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi @@ -4666,8 +4570,8 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { - func_quote_arg expand,pretty "$relink_command" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else @@ -5446,8 +5350,7 @@ else if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" - func_quote_arg pretty "$ECHO" - qECHO=$func_quote_arg_result + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. @@ -5457,7 +5360,7 @@ func_fallback_echo () \$1 _LTECHO_EOF' } - ECHO=$qECHO + ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to @@ -6800,9 +6703,9 @@ func_mode_link () while test "$#" -gt 0; do arg=$1 shift - func_quote_arg pretty,unquoted "$arg" - qarg=$func_quote_arg_unquoted_result - func_append libtool_args " $func_quote_arg_result" + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then @@ -7400,9 +7303,9 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $func_quote_arg_result" - func_append compiler_flags " $func_quote_arg_result" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7416,10 +7319,10 @@ func_mode_link () save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs - func_quote_arg pretty "$flag" - func_append arg " $wl$func_quote_arg_result" - func_append compiler_flags " $wl$func_quote_arg_result" - func_append linker_flags " $func_quote_arg_result" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" @@ -7443,8 +7346,8 @@ func_mode_link () # -msg_* for osf cc -msg_*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: @@ -7464,12 +7367,15 @@ func_mode_link () # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang # -fsanitize=* Clang/GCC memory and address sanitizer + # -fuse-ld=* Linker select flags for GCC + # -static-* direct GCC to link specific libraries statically + # -fcilkplus Cilk Plus language extension features for C/C++ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" @@ -7490,15 +7396,15 @@ func_mode_link () continue else # Otherwise treat like 'Some other compiler flag' below - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; *.$objext) @@ -7618,8 +7524,8 @@ func_mode_link () *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. - func_quote_arg pretty "$arg" - arg=$func_quote_arg_result + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result ;; esac # arg @@ -10131,8 +10037,8 @@ EOF for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10225,8 +10131,8 @@ EOF eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { - func_quote_arg expand,pretty "$cmd" - eval "func_echo $func_quote_arg_result" + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? @@ -10700,12 +10606,12 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty "$var_value" - relink_command="$var=$func_quote_arg_result; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done - func_quote_arg pretty,unquoted "(cd `pwd`; $relink_command)" - relink_command=$func_quote_arg_unquoted_result + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. @@ -10945,14 +10851,13 @@ EOF elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else - func_quote_arg pretty,unquoted "$var_value" - relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command" + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - func_quote_arg pretty,unquoted "$relink_command" - relink_command=$func_quote_arg_unquoted_result + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi diff --git a/build-aux/missing b/build-aux/missing index f62bbae..8d0eaad 100755 --- a/build-aux/missing +++ b/build-aux/missing @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC # 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 . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ else exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ give_advice "$1" | sed -e '1s/^/WARNING: /' \ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/build-aux/test-driver b/build-aux/test-driver index 8e575b0..9759384 100755 --- a/build-aux/test-driver +++ b/build-aux/test-driver @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2020 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ scriptversion=2013-07-13.22; # UTC # 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 . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -42,11 +42,13 @@ print_usage () { cat <> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/config.h.in b/config.h.in index 4e6fbce..d091341 100644 --- a/config.h.in +++ b/config.h.in @@ -15,8 +15,7 @@ /* Have locale_charset() */ #undef HAVE_LOCALE_CHARSET -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ +/* Define to 1 if you have the `malloc' function. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ @@ -79,8 +78,5 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - /* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/configure b/configure index 3e13f49..52c4269 100755 --- a/configure +++ b/configure @@ -1,8 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for libdatrie 0.2.12. +# Generated by GNU Autoconf 2.69 for libdatrie 0.2.13. # -# Report bugs to . +# Report bugs to . # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -275,10 +275,10 @@ fi $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: theppitak@gmail.com about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." +$0: https://github.com/tlwg/libdatrie/issues about your +$0: system, including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." fi exit 1 fi @@ -590,9 +590,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libdatrie' PACKAGE_TARNAME='libdatrie' -PACKAGE_VERSION='0.2.12' -PACKAGE_STRING='libdatrie 0.2.12' -PACKAGE_BUGREPORT='theppitak@gmail.com' +PACKAGE_VERSION='0.2.13' +PACKAGE_STRING='libdatrie 0.2.13' +PACKAGE_BUGREPORT='https://github.com/tlwg/libdatrie/issues' PACKAGE_URL='' ac_unique_file="datrie/trie.h" @@ -682,7 +682,6 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE -am__quote am__include DEPDIR OBJEXT @@ -760,7 +759,8 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL' +SHELL +am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -1337,7 +1337,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 libdatrie 0.2.12 to adapt to many kinds of systems. +\`configure' configures libdatrie 0.2.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1408,7 +1408,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libdatrie 0.2.12:";; + short | recursive ) echo "Configuration of libdatrie 0.2.13:";; esac cat <<\_ACEOF @@ -1458,7 +1458,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to . _ACEOF ac_status=$? fi @@ -1521,7 +1521,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libdatrie configure 0.2.12 +libdatrie configure 0.2.13 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1866,9 +1866,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------- ## -## Report this to theppitak@gmail.com ## -## ---------------------------------- ##" +( $as_echo "## ------------------------------------------------------- ## +## Report this to https://github.com/tlwg/libdatrie/issues ## +## ------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac @@ -1944,7 +1944,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 libdatrie $as_me 0.2.12, which was +It was created by libdatrie $as_me 0.2.13, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2326,7 +2326,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. -am__api_version='1.15' +am__api_version='1.16' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2502,12 +2502,7 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac + MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then @@ -2812,7 +2807,7 @@ fi # Define the identity of the package. PACKAGE='libdatrie' - VERSION='0.2.12' + VERSION='0.2.13' cat >>confdefs.h <<_ACEOF @@ -2842,8 +2837,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: -# -# +# +# mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The @@ -2894,7 +2889,7 @@ END Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . +that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM @@ -2910,9 +2905,9 @@ fi # Library code modified: REVISION++ # Interfaces added: CURRENT++ REVISION=0 AGE++ # Interfaces changed/removed: CURRENT++ REVISION=0 AGE=0 -LT_CURRENT=4 -LT_REVISION=5 -LT_AGE=3 +LT_CURRENT=5 +LT_REVISION=0 +LT_AGE=4 @@ -3771,45 +3766,45 @@ DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" - -am_make=${MAKE-make} -cat > confinc << 'END' +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' am__doit: - @echo this is the am__doit target + @echo this is the am__doit target >confinc.out .PHONY: am__doit END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : ;; - esac -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +$as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -5960,7 +5955,7 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} @@ -6461,11 +6456,8 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -7684,8 +7676,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 + echo "$AR cr libconftest.a conftest.o" >&5 + $AR cr libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -7717,11 +7709,11 @@ $as_echo "$lt_cv_ld_force_load" >&6; } # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + 10.0,*86*-darwin8*|10.0,*-darwin[912]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; @@ -8812,6 +8804,12 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -12953,73 +12951,17 @@ fi # Checks for library functions. -for ac_header in stdlib.h +for ac_func in malloc do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : + ac_fn_c_check_func "$LINENO" "malloc" "ac_cv_func_malloc" +if test "x$ac_cv_func_malloc" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 +#define HAVE_MALLOC 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 -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_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 - - ac_config_files="$ac_config_files Makefile datrie-0.2.pc datrie/Makefile tools/Makefile man/Makefile doc/Makefile doc/Doxyfile tests/Makefile" @@ -13561,7 +13503,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 libdatrie $as_me 0.2.12, which was +This file was extended by libdatrie $as_me 0.2.13, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13621,13 +13563,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libdatrie config.status 0.2.12 +libdatrie config.status 0.2.13 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -13746,7 +13688,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -14651,29 +14593,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac shift - for mf + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf do # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line + am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -14691,53 +14639,50 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } - /^X\(\/\/\)$/{ + /^X\/\(\/\/\)$/{ s//\1/ q } - /^X\(\/\).*/{ + /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? done + if test $am_rc -ne 0; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk } ;; "libtool":C) diff --git a/configure.ac b/configure.ac index e477b2f..7bca279 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_PREREQ(2.59) AC_INIT(libdatrie, m4_esyscmd([build-aux/git-version-gen]), - theppitak@gmail.com) + [https://github.com/tlwg/libdatrie/issues]) AC_CONFIG_SRCDIR([datrie/trie.h]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_AUX_DIR(build-aux) @@ -16,9 +16,9 @@ AM_INIT_AUTOMAKE(dist-xz no-dist-gzip) # Library code modified: REVISION++ # Interfaces added: CURRENT++ REVISION=0 AGE++ # Interfaces changed/removed: CURRENT++ REVISION=0 AGE=0 -LT_CURRENT=4 -LT_REVISION=5 -LT_AGE=3 +LT_CURRENT=5 +LT_REVISION=0 +LT_AGE=4 AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) @@ -132,7 +132,7 @@ AC_SUBST(htmldocdir) AM_CONDITIONAL(ENABLE_DOXYGEN_DOC,test "x$enable_doxygen_doc" = "xyes") # Checks for library functions. -AC_FUNC_MALLOC +AC_CHECK_FUNCS([malloc]) AC_CONFIG_FILES([Makefile datrie-0.2.pc diff --git a/datrie/Makefile.in b/datrie/Makefile.in index ad44c16..fa0abe1 100644 --- a/datrie/Makefile.in +++ b/datrie/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -156,7 +156,11 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/alpha-map.Plo ./$(DEPDIR)/darray.Plo \ + ./$(DEPDIR)/dstring.Plo ./$(DEPDIR)/fileutils.Plo \ + ./$(DEPDIR)/tail.Plo ./$(DEPDIR)/trie-string.Plo \ + ./$(DEPDIR)/trie.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -390,8 +394,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -447,13 +451,19 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha-map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darray.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstring.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileutils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tail.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie-string.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha-map.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/darray.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstring.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileutils.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tail.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie-string.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trie.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -555,7 +565,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -628,7 +641,13 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/alpha-map.Plo + -rm -f ./$(DEPDIR)/darray.Plo + -rm -f ./$(DEPDIR)/dstring.Plo + -rm -f ./$(DEPDIR)/fileutils.Plo + -rm -f ./$(DEPDIR)/tail.Plo + -rm -f ./$(DEPDIR)/trie-string.Plo + -rm -f ./$(DEPDIR)/trie.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -674,7 +693,13 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/alpha-map.Plo + -rm -f ./$(DEPDIR)/darray.Plo + -rm -f ./$(DEPDIR)/dstring.Plo + -rm -f ./$(DEPDIR)/fileutils.Plo + -rm -f ./$(DEPDIR)/tail.Plo + -rm -f ./$(DEPDIR)/trie-string.Plo + -rm -f ./$(DEPDIR)/trie.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -695,9 +720,9 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ diff --git a/datrie/alpha-map-private.h b/datrie/alpha-map-private.h index a2058a6..60903ae 100644 --- a/datrie/alpha-map-private.h +++ b/datrie/alpha-map-private.h @@ -34,6 +34,11 @@ AlphaMap * alpha_map_fread_bin (FILE *file); int alpha_map_fwrite_bin (const AlphaMap *alpha_map, FILE *file); +size_t alpha_map_get_serialized_size (const AlphaMap *alpha_map); + +void alpha_map_serialize_bin (const AlphaMap *alpha_map, uint8 **ptr); + + TrieIndex alpha_map_char_to_trie (const AlphaMap *alpha_map, AlphaChar ac); diff --git a/datrie/alpha-map.c b/datrie/alpha-map.c index 9bd313d..7443fb4 100644 --- a/datrie/alpha-map.c +++ b/datrie/alpha-map.c @@ -34,6 +34,7 @@ #include "alpha-map-private.h" #include "trie-private.h" #include "fileutils.h" +#include "trie-string.h" /** * @brief Alphabet string length @@ -59,7 +60,7 @@ alpha_char_strlen (const AlphaChar *str) * to compare * * @return negative if @a str1 < @a str2; - * 0 if @a str1 == @a str2; + * 0 if @a str1 == @a str2; * positive if @a str1 > @a str2 * * Available since: 0.2.7 @@ -299,6 +300,30 @@ alpha_map_fwrite_bin (const AlphaMap *alpha_map, FILE *file) return 0; } +size_t +alpha_map_get_serialized_size (const AlphaMap *alpha_map) +{ + int32 ranges_count = alpha_map_get_total_ranges (alpha_map); + return ( + 4 /* ALPHAMAP_SIGNATURE */ + + sizeof (ranges_count) + + (sizeof (AlphaChar) * 2) * ranges_count /* range->begin, range->end */ + ); +} + +void +alpha_map_serialize_bin (const AlphaMap *alpha_map, uint8 **ptr) +{ + AlphaRange *range; + serialize_int32_be_incr (ptr, ALPHAMAP_SIGNATURE); + serialize_int32_be_incr (ptr, alpha_map_get_total_ranges (alpha_map)); + + for (range = alpha_map->first_range; range; range = range->next) { + serialize_int32_be_incr (ptr, range->begin); + serialize_int32_be_incr (ptr, range->end); + } +} + static int alpha_map_add_range_only (AlphaMap *alpha_map, AlphaChar begin, AlphaChar end) { @@ -415,44 +440,54 @@ alpha_map_recalc_work_area (AlphaMap *alpha_map) range = alpha_map->first_range; if (range) { const AlphaChar alpha_begin = range->begin; - int n_cells, i; + int n_alpha, n_trie, i; AlphaChar a; - TrieIndex trie_last = 0; - TrieChar tc; + TrieIndex trie_char; - /* reconstruct alpha-to-trie map */ alpha_map->alpha_begin = alpha_begin; - while (range->next) { + n_trie = 0; + for ( ;; ) { + n_trie += range->end - range->begin + 1; + if (!range->next) + break; range = range->next; } + if (n_trie < TRIE_CHAR_TERM) { + n_trie = TRIE_CHAR_TERM + 1; + } else { + n_trie++; + } alpha_map->alpha_end = range->end; - alpha_map->alpha_map_sz = n_cells = range->end - alpha_begin + 1; + + alpha_map->alpha_map_sz = n_alpha = range->end - alpha_begin + 1; alpha_map->alpha_to_trie_map - = (TrieIndex *) malloc (n_cells * sizeof (TrieIndex)); + = (TrieIndex *) malloc (n_alpha * sizeof (TrieIndex)); if (UNLIKELY (!alpha_map->alpha_to_trie_map)) goto error_alpha_map_not_created; - for (i = 0; i < n_cells; i++) { + for (i = 0; i < n_alpha; i++) { alpha_map->alpha_to_trie_map[i] = TRIE_INDEX_MAX; } - for (range = alpha_map->first_range; range; range = range->next) { - for (a = range->begin; a <= range->end; a++) { - alpha_map->alpha_to_trie_map[a - alpha_begin] = ++trie_last; - } - } - /* reconstruct trie-to-alpha map */ - alpha_map->trie_map_sz = n_cells = trie_last + 1; + alpha_map->trie_map_sz = n_trie; alpha_map->trie_to_alpha_map - = (AlphaChar *) malloc (n_cells * sizeof (AlphaChar)); + = (AlphaChar *) malloc (n_trie * sizeof (AlphaChar)); if (UNLIKELY (!alpha_map->trie_to_alpha_map)) goto error_alpha_map_created; - alpha_map->trie_to_alpha_map[0] = 0; - tc = 1; + + trie_char = 0; for (range = alpha_map->first_range; range; range = range->next) { for (a = range->begin; a <= range->end; a++) { - alpha_map->trie_to_alpha_map[tc++] = a; + if (TRIE_CHAR_TERM == trie_char) + trie_char++; + alpha_map->alpha_to_trie_map[a - alpha_begin] = trie_char; + alpha_map->trie_to_alpha_map[trie_char] = a; + trie_char++; } } + while (trie_char < n_trie) { + alpha_map->trie_to_alpha_map[trie_char++] = ALPHA_CHAR_ERROR; + } + alpha_map->trie_to_alpha_map[TRIE_CHAR_TERM] = 0; } return 0; @@ -491,7 +526,7 @@ alpha_map_char_to_trie (const AlphaMap *alpha_map, AlphaChar ac) TrieIndex alpha_begin; if (UNLIKELY (0 == ac)) - return 0; + return TRIE_CHAR_TERM; if (UNLIKELY (!alpha_map->alpha_to_trie_map)) return TRIE_INDEX_MAX; @@ -529,7 +564,7 @@ alpha_map_char_to_trie_str (const AlphaMap *alpha_map, const AlphaChar *str) goto error_str_allocated; *p = (TrieChar) tc; } - *p = 0; + *p = TRIE_CHAR_TERM; return trie_str; @@ -543,7 +578,7 @@ alpha_map_trie_to_char_str (const AlphaMap *alpha_map, const TrieChar *str) { AlphaChar *alpha_str, *p; - alpha_str = (AlphaChar *) malloc ((strlen ((const char *)str) + 1) + alpha_str = (AlphaChar *) malloc ((trie_char_strlen (str) + 1) * sizeof (AlphaChar)); if (UNLIKELY (!alpha_str)) return NULL; diff --git a/datrie/alpha-map.h b/datrie/alpha-map.h index 2066737..8982571 100644 --- a/datrie/alpha-map.h +++ b/datrie/alpha-map.h @@ -29,8 +29,7 @@ #include -#include "typedefs.h" -#include "triedefs.h" +#include #ifdef __cplusplus extern "C" { diff --git a/datrie/darray.c b/datrie/darray.c index d1a04b0..b0b23bb 100644 --- a/datrie/darray.c +++ b/datrie/darray.c @@ -305,6 +305,28 @@ da_fwrite (const DArray *d, FILE *file) } +size_t +da_get_serialized_size (const DArray *d) +{ + if (d->num_cells > 0) + return 4 * d->num_cells * 2; /* 'base' and 'check' */ + else + return 0; +} + + +void +da_serialize (const DArray *d, uint8 **ptr) +{ + TrieIndex i; + + for (i = 0; i < d->num_cells; i++) { + serialize_int32_be_incr (ptr, d->cells[i].base); + serialize_int32_be_incr (ptr, d->cells[i].check); + } +} + + /** * @brief Get root state * diff --git a/datrie/darray.h b/datrie/darray.h index 8907683..9a7b26e 100644 --- a/datrie/darray.h +++ b/datrie/darray.h @@ -56,6 +56,10 @@ DArray * da_fread (FILE *file); void da_free (DArray *d); +size_t da_get_serialized_size (const DArray *d); + +void da_serialize (const DArray *d, uint8 **ptr); + int da_fwrite (const DArray *d, FILE *file); diff --git a/datrie/fileutils.c b/datrie/fileutils.c index d8fb532..da2d979 100644 --- a/datrie/fileutils.c +++ b/datrie/fileutils.c @@ -35,53 +35,88 @@ * FUNCTIONS IMPLEMENTATIONS * *--------------------------------*/ +static int32 +parse_int32_be (const uint8 *buff) +{ + return (buff[0] << 24) | (buff[1] << 16) | (buff[2] << 8) | buff[3]; +} + Bool file_read_int32 (FILE *file, int32 *o_val) { - unsigned char buff[4]; + uint8 buff[4]; if (fread (buff, 4, 1, file) == 1) { - *o_val = (buff[0] << 24) | (buff[1] << 16) | (buff[2] << 8) | buff[3]; + *o_val = parse_int32_be (buff); return TRUE; } return FALSE; } -Bool -file_write_int32 (FILE *file, int32 val) +static void +serialize_int32_be (uint8 *buff, int32 val) { - unsigned char buff[4]; - buff[0] = (val >> 24) & 0xff; buff[1] = (val >> 16) & 0xff; buff[2] = (val >> 8) & 0xff; buff[3] = val & 0xff; +} + +void +serialize_int32_be_incr (uint8 **buff, int32 val) +{ + serialize_int32_be (*buff, val); + *buff += 4; /* don't sizeof! */ +} + +Bool +file_write_int32 (FILE *file, int32 val) +{ + uint8 buff[4]; + serialize_int32_be (buff, val); return (fwrite (buff, 4, 1, file) == 1); } +static int16 +parse_int16_be (const uint8 *buff) +{ + return (buff[0] << 8) | buff[1]; +} + Bool file_read_int16 (FILE *file, int16 *o_val) { - unsigned char buff[2]; + uint8 buff[2]; if (fread (buff, 2, 1, file) == 1) { - *o_val = (buff[0] << 8) | buff[1]; + *o_val = parse_int16_be (buff); return TRUE; } return FALSE; } -Bool -file_write_int16 (FILE *file, int16 val) +static void +serialize_int16_be (uint8 *buff, int16 val) { - unsigned char buff[2]; - buff[0] = val >> 8; buff[1] = val & 0xff; +} +void +serialize_int16_be_incr (uint8 **buff, int16 val) +{ + serialize_int16_be (*buff, val); + *buff += 2; /* don't sizeof! */ +} + +Bool +file_write_int16 (FILE *file, int16 val) +{ + uint8 buff[2]; + serialize_int16_be (buff, val); return (fwrite (buff, 2, 1, file) == 1); } diff --git a/datrie/fileutils.h b/datrie/fileutils.h index de43501..d18215f 100644 --- a/datrie/fileutils.h +++ b/datrie/fileutils.h @@ -30,9 +30,11 @@ #include #include +void serialize_int32_be_incr (uint8 **buff, int32 val); Bool file_read_int32 (FILE *file, int32 *o_val); Bool file_write_int32 (FILE *file, int32 val); +void serialize_int16_be_incr (uint8 **buff, int16 val); Bool file_read_int16 (FILE *file, int16 *o_val); Bool file_write_int16 (FILE *file, int16 val); diff --git a/datrie/libdatrie.def b/datrie/libdatrie.def index 185bda5..e88e36f 100644 --- a/datrie/libdatrie.def +++ b/datrie/libdatrie.def @@ -8,6 +8,8 @@ trie_new trie_new_from_file trie_fread trie_free +trie_get_serialized_size +trie_serialize trie_save trie_fwrite trie_is_dirty diff --git a/datrie/libdatrie.map b/datrie/libdatrie.map index 8c9a0da..ad758b5 100644 --- a/datrie/libdatrie.map +++ b/datrie/libdatrie.map @@ -45,3 +45,7 @@ DATRIE_0.2.7 { alpha_char_strcmp; } DATRIE_0.2.6; +DATRIE_0.2.13 { + trie_get_serialized_size; + trie_serialize; +} DATRIE_0.2.7; diff --git a/datrie/tail.c b/datrie/tail.c index 25d78b4..27f9454 100644 --- a/datrie/tail.c +++ b/datrie/tail.c @@ -34,6 +34,7 @@ #include "tail.h" #include "trie-private.h" #include "fileutils.h" +#include "trie-string.h" /*----------------------------------* * INTERNAL TYPES DECLARATIONS * @@ -165,7 +166,7 @@ tail_fread (FILE *file) goto exit_in_loop; } } - t->tails[i].suffix[length] = '\0'; + t->tails[i].suffix[length] = TRIE_CHAR_TERM; } return t; @@ -236,7 +237,7 @@ tail_fwrite (const Tail *t, FILE *file) return -1; } - length = t->tails[i].suffix ? strlen ((const char *)t->tails[i].suffix) + length = t->tails[i].suffix ? trie_char_strlen (t->tails[i].suffix) : 0; if (!file_write_int16 (file, length)) return -1; @@ -251,6 +252,60 @@ tail_fwrite (const Tail *t, FILE *file) } +size_t +tail_get_serialized_size (const Tail *t) +{ + size_t static_count = ( + sizeof (int32) /* sizeof (TAIL_SIGNATURE) */ + + sizeof (t->first_free) + + sizeof (t->num_tails) + ); + size_t dynamic_count = 0u; + if (t->num_tails > 0) { + TrieIndex i = 0; + dynamic_count += ( + sizeof (t->tails[i].next_free) + sizeof (t->tails[i].data) + + sizeof (int16) /* length */ + ) * t->num_tails; + for (; i < t->num_tails; i++) { + if (t->tails[i].suffix) + { + dynamic_count += trie_char_strsize (t->tails[i].suffix); + } + } + } + return static_count + dynamic_count; +} + + +int +tail_serialize (const Tail *t, uint8 **ptr) +{ + TrieIndex i; + + serialize_int32_be_incr (ptr, TAIL_SIGNATURE); + serialize_int32_be_incr (ptr, t->first_free); + serialize_int32_be_incr (ptr, t->num_tails); + + for (i = 0; i < t->num_tails; i++) { + int16 length; + serialize_int32_be_incr (ptr, t->tails[i].next_free); + serialize_int32_be_incr (ptr, t->tails[i].data); + + length = t->tails[i].suffix ? trie_char_strsize (t->tails[i].suffix) + : 0; + serialize_int16_be_incr (ptr, length); + if (length) + { + memcpy (*ptr, (char *)t->tails[i].suffix, length); + *ptr += length; + } + } + + return 0; +} + + /** * @brief Get suffix * @@ -270,31 +325,6 @@ tail_get_suffix (const Tail *t, TrieIndex index) return LIKELY (index < t->num_tails) ? t->tails[index].suffix : NULL; } -static size_t -tc_strlen (const TrieChar *str) -{ - size_t len = 0; - while (*str++) { - ++len; - } - return len; -} - -static TrieChar * -tc_strdup (const TrieChar *str) -{ - TrieChar *dup - = (TrieChar *) malloc (sizeof (TrieChar) * (tc_strlen (str) + 1)); - TrieChar *p = dup; - - while (*str) { - *p++ = *str++; - } - *p = (TrieChar) 0; - - return dup; -} - /** * @brief Set suffix of existing entry * @@ -314,7 +344,7 @@ tail_set_suffix (Tail *t, TrieIndex index, const TrieChar *suffix) */ TrieChar *tmp = NULL; if (suffix) { - tmp = tc_strdup (suffix); + tmp = trie_char_strdup (suffix); if (UNLIKELY (!tmp)) return FALSE; } @@ -499,7 +529,7 @@ tail_walk_str (const Tail *t, break; ++i; /* stop and stay at null-terminator */ - if (0 == suffix[j]) + if (TRIE_CHAR_TERM == suffix[j]) break; ++j; } @@ -537,7 +567,7 @@ tail_walk_char (const Tail *t, suffix_char = suffix[*suffix_idx]; if (suffix_char == c) { - if (0 != suffix_char) + if (TRIE_CHAR_TERM != suffix_char) ++*suffix_idx; return TRUE; } diff --git a/datrie/tail.h b/datrie/tail.h index accab94..3bdaa63 100644 --- a/datrie/tail.h +++ b/datrie/tail.h @@ -35,7 +35,7 @@ */ /** - * @brief Double-array structure type + * @brief Tail structure type */ typedef struct _Tail Tail; @@ -45,6 +45,10 @@ Tail * tail_fread (FILE *file); void tail_free (Tail *t); +size_t tail_get_serialized_size (const Tail *t); + +int tail_serialize (const Tail *t, uint8 **ptr); + int tail_fwrite (const Tail *t, FILE *file); diff --git a/datrie/trie-string.c b/datrie/trie-string.c index 6e52759..13744a8 100644 --- a/datrie/trie-string.c +++ b/datrie/trie-string.c @@ -29,7 +29,46 @@ #include "triedefs.h" #include +#include +/*----------------------------* + * STATIC TRIECHAR STRING * + *----------------------------*/ + +size_t +trie_char_strlen (const TrieChar *str) +{ + size_t len = 0; + while (*str++ != TRIE_CHAR_TERM) { + ++len; + } + return len; +} + +size_t +trie_char_strsize (const TrieChar *str) +{ + return trie_char_strlen (str) * sizeof (TrieChar); +} + +TrieChar * +trie_char_strdup (const TrieChar *str) +{ + TrieChar *dup + = (TrieChar *) malloc (sizeof (TrieChar) * (trie_char_strlen (str) + 1)); + TrieChar *p = dup; + + while (*str != TRIE_CHAR_TERM) { + *p++ = *str++; + } + *p = TRIE_CHAR_TERM; + + return dup; +} + +/*-----------------------------* + * DYNAMIC TRIECHAR STRING * + *-----------------------------*/ struct _TrieString { DString ds; @@ -100,7 +139,8 @@ trie_string_append_char (TrieString *ts, TrieChar tc) Bool trie_string_terminate (TrieString *ts) { - return dstring_terminate ((DString *)ts); + static const TrieChar term = TRIE_CHAR_TERM; + return dstring_append_char ((DString *)ts, &term); } Bool diff --git a/datrie/trie-string.h b/datrie/trie-string.h index 851bf10..3372588 100644 --- a/datrie/trie-string.h +++ b/datrie/trie-string.h @@ -30,6 +30,22 @@ #include "dstring.h" #include "triedefs.h" +#include + +/*----------------------------* + * STATIC TRIECHAR STRING * + *----------------------------*/ + +size_t trie_char_strlen (const TrieChar *str); + +size_t trie_char_strsize (const TrieChar *str); + +TrieChar * trie_char_strdup (const TrieChar *str); + +/*-----------------------------* + * DYNAMIC TRIECHAR STRING * + *-----------------------------*/ + typedef struct _TrieString TrieString; TrieString * trie_string_new (int n_elm); diff --git a/datrie/trie.c b/datrie/trie.c index 55f23c3..c5b7f51 100644 --- a/datrie/trie.c +++ b/datrie/trie.c @@ -258,6 +258,54 @@ trie_save (Trie *trie, const char *path) return res; } + +/** + * @brief Get trie serialized size + * + * @param trie : the trie + * + * @return size of the trie in bytes + * + * Returns size that would be occupied by a trie if it was + * serialized into a binary blob or file. + * + * Available since: 0.2.13 + */ +size_t +trie_get_serialized_size (Trie *trie) +{ + return alpha_map_get_serialized_size (trie->alpha_map) + + da_get_serialized_size (trie->da) + + tail_get_serialized_size (trie->tail); +} + + +/** + * @brief Serializes trie data into a memory buffer (including mapping) + * + * @param trie : the trie + * + * @param ptr : a pointer to current position inside of a preallocated buffer. + * + * Write @a trie data to a current position in a buffer pointed by @a ptr. + * This can be useful for embedding trie index as part of a file data. + * + * The size that the trie will occupy can be calculated using + * trie_get_serialized_size() + * + * Available since: 0.2.13 + */ +void +trie_serialize (Trie *trie, uint8 *ptr) +{ + uint8 *ptr1 = ptr; + alpha_map_serialize_bin (trie->alpha_map, &ptr1); + da_serialize (trie->da, &ptr1); + tail_serialize (trie->tail, &ptr1); + trie->is_dirty = FALSE; +} + + /** * @brief Write trie data to an open file * @@ -298,7 +346,7 @@ trie_fwrite (Trie *trie, FILE *file) * @return TRUE if there are pending changes, FALSE otherwise * * Check if the @a trie is dirty with some pending changes and needs saving - * to synchronize with the file. + * to keep the file synchronized. */ Bool trie_is_dirty (const Trie *trie) @@ -366,7 +414,7 @@ trie_retrieve (const Trie *trie, const AlphaChar *key, TrieData *o_data) * @brief Store a value for an entry to trie * * @param trie : the trie - * @param key : the key for the entry to retrieve + * @param key : the key for the entry to store * @param data : the data associated to the entry * * @return boolean value indicating the success of the operation @@ -385,13 +433,13 @@ trie_store (Trie *trie, const AlphaChar *key, TrieData data) * @brief Store a value for an entry to trie only if the key is not present * * @param trie : the trie - * @param key : the key for the entry to retrieve + * @param key : the key for the entry to store * @param data : the data associated to the entry * * @return boolean value indicating the success of the operation * * Store a @a data for the given @a key in @a trie. If @a key does not - * exist in @a trie, it will be appended. If it does, the function will + * exist in @a trie, it will be inserted. If it does, the function will * return failure and the existing value will not be touched. * * This can be useful for multi-thread applications, as race condition @@ -482,7 +530,7 @@ trie_branch_in_branch (Trie *trie, if (TRIE_INDEX_ERROR == new_da) return FALSE; - if ('\0' != *suffix) + if (TRIE_CHAR_TERM != *suffix) ++suffix; new_tail = tail_add_suffix (trie->tail, suffix); @@ -519,7 +567,7 @@ trie_branch_in_tail (Trie *trie, if (TRIE_INDEX_ERROR == old_da) goto fail; - if ('\0' != *p) + if (TRIE_CHAR_TERM != *p) ++p; tail_set_suffix (trie->tail, old_tail, p); trie_da_set_tail_index (trie->da, old_da, old_tail); @@ -1037,8 +1085,7 @@ trie_iterator_get_key (const TrieIterator *iter) tail_str += s->suffix_idx; alpha_key = (AlphaChar *) malloc (sizeof (AlphaChar) - * (strlen ((const char *)tail_str) - + 1)); + * (trie_char_strlen (tail_str) + 1)); alpha_p = alpha_key; } else { TrieIndex tail_idx; @@ -1054,7 +1101,7 @@ trie_iterator_get_key (const TrieIterator *iter) key_p = trie_string_get_val (iter->key); alpha_key = (AlphaChar *) malloc ( sizeof (AlphaChar) - * (key_len + strlen ((const char *)tail_str) + 1) + * (key_len + trie_char_strlen (tail_str) + 1) ); alpha_p = alpha_key; for (i = key_len; i > 0; i--) { @@ -1062,7 +1109,7 @@ trie_iterator_get_key (const TrieIterator *iter) } } - while (*tail_str) { + while (TRIE_CHAR_TERM != *tail_str) { *alpha_p++ = alpha_map_trie_to_char (s->trie->alpha_map, *tail_str++); } *alpha_p = 0; diff --git a/datrie/trie.h b/datrie/trie.h index 1daa0d9..a0f7ca4 100644 --- a/datrie/trie.h +++ b/datrie/trie.h @@ -125,6 +125,10 @@ Trie * trie_fread (FILE *file); void trie_free (Trie *trie); +size_t trie_get_serialized_size (Trie *trie); + +void trie_serialize (Trie *trie, uint8 *ptr); + int trie_save (Trie *trie, const char *path); int trie_fwrite (Trie *trie, FILE *file); @@ -188,7 +192,7 @@ int trie_state_walkable_chars (const TrieState *s, * Check if the given state is a terminal state. A terminal state is a trie * state that terminates a key, and stores a value associated with it. */ -#define trie_state_is_terminal(s) trie_state_is_walkable((s),TRIE_CHAR_TERM) +#define trie_state_is_terminal(s) trie_state_is_walkable((s),0) Bool trie_state_is_single (const TrieState *s); diff --git a/doc/Makefile.in b/doc/Makefile.in index 4aedba2..20ffccd 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -265,8 +265,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -292,7 +292,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/m4/libtool.m4 b/m4/libtool.m4 index ee80844..c4c0294 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1041,8 +1041,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1071,11 +1071,11 @@ _LT_EOF # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) + 10.*|11.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; @@ -1492,7 +1492,7 @@ need_locks=$enable_libtool_lock m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) @@ -4063,7 +4063,8 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4703,6 +4704,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -6438,7 +6445,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no @@ -6813,7 +6820,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6878,7 +6885,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7217,7 +7224,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support @@ -7301,7 +7308,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7312,7 +7319,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' diff --git a/man/Makefile.in b/man/Makefile.in index 958bcad..ecf48cf 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -299,8 +299,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -367,7 +367,10 @@ ctags CTAGS: cscope cscopelist: -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 943ebc7..41b55cb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -7,10 +7,12 @@ TESTS = \ test_iterator \ test_store-retrieve \ test_file \ + test_serialization \ test_nonalpha \ test_null_trie \ test_term_state \ test_byte_alpha \ + test_byte_list \ $(NULL) check_PROGRAMS = \ @@ -18,10 +20,12 @@ check_PROGRAMS = \ test_iterator \ test_store-retrieve \ test_file \ + test_serialization \ test_nonalpha \ test_null_trie \ test_term_state \ test_byte_alpha \ + test_byte_list \ $(NULL) noinst_HEADERS = \ @@ -52,6 +56,12 @@ test_file_SOURCES = \ $(NULL) test_file_LDADD = $(top_builddir)/datrie/libdatrie.la +test_serialization_SOURCES = \ + test_serialization.c \ + utils.c \ + $(NULL) +test_serialization_LDADD = $(top_builddir)/datrie/libdatrie.la + test_nonalpha_SOURCES = \ test_nonalpha.c \ utils.c \ @@ -76,3 +86,9 @@ test_byte_alpha_SOURCES = \ $(NULL) test_byte_alpha_LDADD = $(top_builddir)/datrie/libdatrie.la +test_byte_list_SOURCES = \ + test_byte_list.c \ + utils.c \ + $(NULL) +test_byte_list_LDADD = $(top_builddir)/datrie/libdatrie.la + diff --git a/tests/Makefile.in b/tests/Makefile.in index 529d65c..935b557 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -90,12 +90,14 @@ build_triplet = @build@ host_triplet = @host@ TESTS = test_walk$(EXEEXT) test_iterator$(EXEEXT) \ test_store-retrieve$(EXEEXT) test_file$(EXEEXT) \ - test_nonalpha$(EXEEXT) test_null_trie$(EXEEXT) \ - test_term_state$(EXEEXT) test_byte_alpha$(EXEEXT) + test_serialization$(EXEEXT) test_nonalpha$(EXEEXT) \ + test_null_trie$(EXEEXT) test_term_state$(EXEEXT) \ + test_byte_alpha$(EXEEXT) test_byte_list$(EXEEXT) check_PROGRAMS = test_walk$(EXEEXT) test_iterator$(EXEEXT) \ test_store-retrieve$(EXEEXT) test_file$(EXEEXT) \ - test_nonalpha$(EXEEXT) test_null_trie$(EXEEXT) \ - test_term_state$(EXEEXT) test_byte_alpha$(EXEEXT) + test_serialization$(EXEEXT) test_nonalpha$(EXEEXT) \ + test_null_trie$(EXEEXT) test_term_state$(EXEEXT) \ + test_byte_alpha$(EXEEXT) test_byte_list$(EXEEXT) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ @@ -117,6 +119,9 @@ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = +am_test_byte_list_OBJECTS = test_byte_list.$(OBJEXT) utils.$(OBJEXT) +test_byte_list_OBJECTS = $(am_test_byte_list_OBJECTS) +test_byte_list_DEPENDENCIES = $(top_builddir)/datrie/libdatrie.la am_test_file_OBJECTS = test_file.$(OBJEXT) utils.$(OBJEXT) test_file_OBJECTS = $(am_test_file_OBJECTS) test_file_DEPENDENCIES = $(top_builddir)/datrie/libdatrie.la @@ -129,6 +134,10 @@ test_nonalpha_DEPENDENCIES = $(top_builddir)/datrie/libdatrie.la am_test_null_trie_OBJECTS = test_null_trie.$(OBJEXT) utils.$(OBJEXT) test_null_trie_OBJECTS = $(am_test_null_trie_OBJECTS) test_null_trie_DEPENDENCIES = $(top_builddir)/datrie/libdatrie.la +am_test_serialization_OBJECTS = test_serialization.$(OBJEXT) \ + utils.$(OBJEXT) +test_serialization_OBJECTS = $(am_test_serialization_OBJECTS) +test_serialization_DEPENDENCIES = $(top_builddir)/datrie/libdatrie.la am_test_store_retrieve_OBJECTS = test_store-retrieve.$(OBJEXT) \ utils.$(OBJEXT) test_store_retrieve_OBJECTS = $(am_test_store_retrieve_OBJECTS) @@ -154,7 +163,15 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/test_byte_alpha.Po \ + ./$(DEPDIR)/test_byte_list.Po ./$(DEPDIR)/test_file.Po \ + ./$(DEPDIR)/test_iterator.Po ./$(DEPDIR)/test_nonalpha.Po \ + ./$(DEPDIR)/test_null_trie.Po \ + ./$(DEPDIR)/test_serialization.Po \ + ./$(DEPDIR)/test_store-retrieve.Po \ + ./$(DEPDIR)/test_term_state.Po ./$(DEPDIR)/test_walk.Po \ + ./$(DEPDIR)/utils.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -174,13 +191,15 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(test_byte_alpha_SOURCES) $(test_file_SOURCES) \ - $(test_iterator_SOURCES) $(test_nonalpha_SOURCES) \ - $(test_null_trie_SOURCES) $(test_store_retrieve_SOURCES) \ +SOURCES = $(test_byte_alpha_SOURCES) $(test_byte_list_SOURCES) \ + $(test_file_SOURCES) $(test_iterator_SOURCES) \ + $(test_nonalpha_SOURCES) $(test_null_trie_SOURCES) \ + $(test_serialization_SOURCES) $(test_store_retrieve_SOURCES) \ $(test_term_state_SOURCES) $(test_walk_SOURCES) -DIST_SOURCES = $(test_byte_alpha_SOURCES) $(test_file_SOURCES) \ - $(test_iterator_SOURCES) $(test_nonalpha_SOURCES) \ - $(test_null_trie_SOURCES) $(test_store_retrieve_SOURCES) \ +DIST_SOURCES = $(test_byte_alpha_SOURCES) $(test_byte_list_SOURCES) \ + $(test_file_SOURCES) $(test_iterator_SOURCES) \ + $(test_nonalpha_SOURCES) $(test_null_trie_SOURCES) \ + $(test_serialization_SOURCES) $(test_store_retrieve_SOURCES) \ $(test_term_state_SOURCES) $(test_walk_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -389,6 +408,7 @@ am__set_TESTS_bases = \ bases='$(TEST_LOGS)'; \ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ bases=`echo $$bases` +AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' RECHECK_LOGS = $(TEST_LOGS) AM_RECURSIVE_TARGETS = check recheck TEST_SUITE_LOG = test-suite.log @@ -568,6 +588,12 @@ test_file_SOURCES = \ $(NULL) test_file_LDADD = $(top_builddir)/datrie/libdatrie.la +test_serialization_SOURCES = \ + test_serialization.c \ + utils.c \ + $(NULL) + +test_serialization_LDADD = $(top_builddir)/datrie/libdatrie.la test_nonalpha_SOURCES = \ test_nonalpha.c \ utils.c \ @@ -592,6 +618,12 @@ test_byte_alpha_SOURCES = \ $(NULL) test_byte_alpha_LDADD = $(top_builddir)/datrie/libdatrie.la +test_byte_list_SOURCES = \ + test_byte_list.c \ + utils.c \ + $(NULL) + +test_byte_list_LDADD = $(top_builddir)/datrie/libdatrie.la all: all-am .SUFFIXES: @@ -613,8 +645,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -639,6 +671,10 @@ test_byte_alpha$(EXEEXT): $(test_byte_alpha_OBJECTS) $(test_byte_alpha_DEPENDENC @rm -f test_byte_alpha$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_byte_alpha_OBJECTS) $(test_byte_alpha_LDADD) $(LIBS) +test_byte_list$(EXEEXT): $(test_byte_list_OBJECTS) $(test_byte_list_DEPENDENCIES) $(EXTRA_test_byte_list_DEPENDENCIES) + @rm -f test_byte_list$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_byte_list_OBJECTS) $(test_byte_list_LDADD) $(LIBS) + test_file$(EXEEXT): $(test_file_OBJECTS) $(test_file_DEPENDENCIES) $(EXTRA_test_file_DEPENDENCIES) @rm -f test_file$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_file_OBJECTS) $(test_file_LDADD) $(LIBS) @@ -655,6 +691,10 @@ test_null_trie$(EXEEXT): $(test_null_trie_OBJECTS) $(test_null_trie_DEPENDENCIES @rm -f test_null_trie$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_null_trie_OBJECTS) $(test_null_trie_LDADD) $(LIBS) +test_serialization$(EXEEXT): $(test_serialization_OBJECTS) $(test_serialization_DEPENDENCIES) $(EXTRA_test_serialization_DEPENDENCIES) + @rm -f test_serialization$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_serialization_OBJECTS) $(test_serialization_LDADD) $(LIBS) + test_store-retrieve$(EXEEXT): $(test_store_retrieve_OBJECTS) $(test_store_retrieve_DEPENDENCIES) $(EXTRA_test_store_retrieve_DEPENDENCIES) @rm -f test_store-retrieve$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_store_retrieve_OBJECTS) $(test_store_retrieve_LDADD) $(LIBS) @@ -673,15 +713,23 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byte_alpha.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_file.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_iterator.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nonalpha.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_null_trie.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_store-retrieve.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_term_state.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_walk.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byte_alpha.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_byte_list.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_file.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_iterator.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nonalpha.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_null_trie.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_serialization.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_store-retrieve.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_term_state.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_walk.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -869,7 +917,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ fi; \ echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ echo "$${col}$$br$${std}"; \ create_testsuite_report --maybe-color; \ echo "$$col$$br$$std"; \ @@ -882,7 +930,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS) fi; \ $$success || exit 1 -check-TESTS: +check-TESTS: $(check_PROGRAMS) @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) @@ -931,6 +979,13 @@ test_file.log: test_file$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test_serialization.log: test_serialization$(EXEEXT) + @p='test_serialization$(EXEEXT)'; \ + b='test_serialization'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) test_nonalpha.log: test_nonalpha$(EXEEXT) @p='test_nonalpha$(EXEEXT)'; \ b='test_nonalpha'; \ @@ -959,6 +1014,13 @@ test_byte_alpha.log: test_byte_alpha$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test_byte_list.log: test_byte_list$(EXEEXT) + @p='test_byte_list$(EXEEXT)'; \ + b='test_byte_list'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ @@ -974,7 +1036,10 @@ test_byte_alpha.log: test_byte_alpha$(EXEEXT) @am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ @am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1049,7 +1114,17 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/test_byte_alpha.Po + -rm -f ./$(DEPDIR)/test_byte_list.Po + -rm -f ./$(DEPDIR)/test_file.Po + -rm -f ./$(DEPDIR)/test_iterator.Po + -rm -f ./$(DEPDIR)/test_nonalpha.Po + -rm -f ./$(DEPDIR)/test_null_trie.Po + -rm -f ./$(DEPDIR)/test_serialization.Po + -rm -f ./$(DEPDIR)/test_store-retrieve.Po + -rm -f ./$(DEPDIR)/test_term_state.Po + -rm -f ./$(DEPDIR)/test_walk.Po + -rm -f ./$(DEPDIR)/utils.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1095,7 +1170,17 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/test_byte_alpha.Po + -rm -f ./$(DEPDIR)/test_byte_list.Po + -rm -f ./$(DEPDIR)/test_file.Po + -rm -f ./$(DEPDIR)/test_iterator.Po + -rm -f ./$(DEPDIR)/test_nonalpha.Po + -rm -f ./$(DEPDIR)/test_null_trie.Po + -rm -f ./$(DEPDIR)/test_serialization.Po + -rm -f ./$(DEPDIR)/test_store-retrieve.Po + -rm -f ./$(DEPDIR)/test_term_state.Po + -rm -f ./$(DEPDIR)/test_walk.Po + -rm -f ./$(DEPDIR)/utils.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1116,16 +1201,16 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ + check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ recheck tags tags-am uninstall uninstall-am diff --git a/tests/test_byte_list.c b/tests/test_byte_list.c new file mode 100644 index 0000000..e451dba --- /dev/null +++ b/tests/test_byte_list.c @@ -0,0 +1,186 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libdatrie - Double-Array Trie Library + * Copyright (C) 2018 Theppitak Karoonboonyanan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * test_byte_list.c - Test byte trie enumeration + * Created: 2018-11-20 + * Author: Theppitak Karoonboonyanan + * Based on test case in issue #9 + * https://github.com/tlwg/libdatrie/issues/9 + */ + +#include +#include "utils.h" +#include +#include + +typedef struct _DictEntry DictEntry; +struct _DictEntry { + AlphaChar key[4]; + TrieData data; + int is_checked; +}; + +#define N_ELM(v) (sizeof(v)/sizeof(v[0])) + +/* Dictionary source */ +static DictEntry Source[] = { + { { '1', '2', 0 }, 1, 0 }, + { { '1', '2', '3', 0 }, 2, 0 }, +}; + +static void +dump_key_data (const AlphaChar *key, TrieData data) +{ + const AlphaChar *p; + + printf ("["); + for (p = key; *p; ++p) { + if (p != key) { + printf (", "); + } + printf ("%04x", *p); + } + printf ("] : %d\n", data); +} + +static void +dump_entry (const TrieIterator *iter) +{ + AlphaChar *key = trie_iterator_get_key (iter); + dump_key_data (key, trie_iterator_get_data (iter)); + free (key); +} + +/* + * Check if the trie entry referenced by iter match any Source[] element + * and mark the matched element as checked. + * Return: 1 if matched, 0 otherwise + */ +static int +validate_entry (const TrieIterator *iter) +{ + AlphaChar *key = trie_iterator_get_key (iter); + TrieData data = trie_iterator_get_data (iter); + int i; + + for (i = 0; i < N_ELM (Source); i++) { + if (alpha_char_strcmp (Source[i].key, key) == 0 + && Source[i].data == data) + { + Source[i].is_checked = 1; + free (key); + return 1; + } + } + free (key); + return 0; +} + +/* + * Check if all Source[] elements are checked and reported unchecked one. + * Return: 1 if all are checked, 0 otherwise. + */ +static int +is_all_checked() +{ + int i; + int ret = 1; + + for (i = 0; i < N_ELM (Source); i++) { + if (!Source[i].is_checked) { + printf ("Not visited Source entry: "); + dump_key_data (Source[i].key, Source[i].data); + ret = 0; + } + } + + return ret; +} + +int +main (void) +{ + AlphaMap *alpha_map; + Trie *test_trie; + int i; + TrieState *root; + TrieIterator *iter; + int ret = 0; + + msg_step ("Preparing alpha map"); + alpha_map = alpha_map_new (); + if (!alpha_map) { + printf ("Fail to allocate alpha map\n"); + goto err_alpha_map_not_created; + } + if (alpha_map_add_range (alpha_map, 0x00, 0xff) != 0) { + printf ("Fail to add full alpha map range\n"); + goto err_alpha_map_created; + } + + msg_step ("Preparing trie"); + test_trie = trie_new (alpha_map); + alpha_map_free (alpha_map); + if (!test_trie) { + printf ("Fail to create test trie\n"); + goto err_alpha_map_created; + } + + msg_step ("Storing entries to test trie"); + for (i = 0; i < N_ELM (Source); i++) { + if (!trie_store (test_trie, Source[i].key, Source[i].data)) { + printf ("Fail to store entry %d to test trie:\n", i); + dump_key_data (Source[i].key, Source[i].data); + goto err_trie_created; + } + } + + msg_step ("Iterating trie"); + root = trie_root (test_trie); + iter = trie_iterator_new (root); + while (trie_iterator_next (iter)) { + if (!validate_entry (iter)) { + printf ("Fail to validate trie entry:\n"); + dump_entry (iter); + ret = 1; + } + } + if (!is_all_checked()) { + ret = 1; + } + trie_iterator_free (iter); + trie_state_free (root); + + msg_step ("Freeing test trie"); + trie_free (test_trie); + return ret; + +err_trie_created: + trie_free (test_trie); +err_alpha_map_created: + alpha_map_free (alpha_map); +err_alpha_map_not_created: + return 1; +} + +/* +vi:ts=4:ai:expandtab +*/ diff --git a/tests/test_file.c b/tests/test_file.c index 9c53b2a..bf52a49 100644 --- a/tests/test_file.c +++ b/tests/test_file.c @@ -28,7 +28,6 @@ #include "utils.h" #include #include -#include #define TRIE_FILENAME "test.tri" @@ -79,7 +78,7 @@ main (void) /* save & close */ msg_step ("Saving trie to file"); - unlink (TRIE_FILENAME); /* error ignored */ + remove (TRIE_FILENAME); /* error ignored */ if (trie_save (test_trie, TRIE_FILENAME) != 0) { printf ("Failed to save trie to file '%s'.\n", TRIE_FILENAME); goto err_trie_created; @@ -116,12 +115,12 @@ main (void) goto err_trie_saved; } - unlink (TRIE_FILENAME); + remove (TRIE_FILENAME); trie_free (test_trie); return 0; err_trie_saved: - unlink (TRIE_FILENAME); + remove (TRIE_FILENAME); err_trie_created: trie_free (test_trie); err_trie_not_created: diff --git a/tests/test_serialization.c b/tests/test_serialization.c new file mode 100644 index 0000000..63c1a52 --- /dev/null +++ b/tests/test_serialization.c @@ -0,0 +1,129 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libdatrie - Double-Array Trie Library + * Copyright (C) 2013 Theppitak Karoonboonyanan + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * test_serialization.c - Test for datrie file and in-memory blob operations + * Created: 2019-11-11 + * Author: Theppitak Karoonboonyanan and KOLANICH + */ + +#include +#include "utils.h" +#include +#include +#include +#include + +#define TRIE_FILENAME "test.tri" + +int +main (void) +{ + Trie *test_trie; + DictRec *dict_p; + + msg_step ("Preparing trie"); + test_trie = en_trie_new (); + if (!test_trie) { + printf ("Failed to allocate test trie.\n"); + goto err_trie_not_created; + } + + /* add/remove some words */ + for (dict_p = dict_src; dict_p->key; dict_p++) { + if (!trie_store (test_trie, dict_p->key, dict_p->data)) { + printf ("Failed to add key '%ls', data %d.\n", + (wchar_t *)dict_p->key, dict_p->data); + goto err_trie_created; + } + } + + /* save & close */ + msg_step ("Saving trie to file"); + remove (TRIE_FILENAME); /* error ignored */ + if (trie_save (test_trie, TRIE_FILENAME) != 0) { + printf ("Failed to save trie to file '%s'.\n", TRIE_FILENAME); + goto err_trie_created; + } + + msg_step ("Getting serialized trie size"); + size_t size = trie_get_serialized_size (test_trie); + printf ("serialized trie size %lu\n", size); + msg_step ("Allocating"); + uint8 *trieSerializedData = malloc (size); + if (!trieSerializedData) { + printf ("Failed to allocate trieSerializedData.\n"); + goto err_trie_saved; + } + printf ("allocated %p\n", trieSerializedData); + msg_step ("Serializing"); + trie_serialize (test_trie, trieSerializedData); + msg_step ("Serialized"); + + FILE *f = fopen (TRIE_FILENAME, "rb"); + if (!f) { + printf ("Failed to reopen trie file " TRIE_FILENAME ".\n"); + goto err_serial_data_allocated; + } + fseek (f, 0, SEEK_END); + size_t file_size = ftell (f); + fseek (f, 0, SEEK_SET); + + if (size != file_size) { + printf ("Trie serialized data doesn't match size of the file.\n"); + goto err_file_reopened; + } + + unsigned char *trieFileData = malloc (size); + if (!trieFileData) { + printf ("Failed to allocate trieFileData.\n"); + goto err_file_reopened; + } + fread (trieFileData, 1, size, f); + if (memcmp (trieSerializedData, trieFileData, size) != 0) { + printf ("Trie serialized data doesn't match contents of the file.\n"); + goto err_file_data_allocated; + } + printf ("PASS!\n"); + + free (trieFileData); + fclose (f); + free (trieSerializedData); + remove (TRIE_FILENAME); + trie_free (test_trie); + return 0; + +err_file_data_allocated: + free (trieFileData); +err_file_reopened: + fclose (f); +err_serial_data_allocated: + free (trieSerializedData); +err_trie_saved: + remove (TRIE_FILENAME); +err_trie_created: + trie_free (test_trie); +err_trie_not_created: + return 1; +} + +/* +vi:ts=4:ai:expandtab +*/ diff --git a/tools/Makefile.in b/tools/Makefile.in index 2ed9843..d45cf11 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15.1 from Makefile.am. +# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2017 Free Software Foundation, Inc. +# Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -127,7 +127,8 @@ am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/trietool.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -327,8 +328,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -399,7 +400,13 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trietool.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trietool.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @@ -480,7 +487,10 @@ cscopelist-am: $(am__tagged_files) distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(DISTFILES) +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -552,7 +562,7 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/trietool.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -599,7 +609,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/trietool.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -621,7 +631,7 @@ uninstall-am: uninstall-binPROGRAMS $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: install-am install-data-am install-strip uninstall-am -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ diff --git a/tools/trietool.c b/tools/trietool.c index 11d9812..2ccef4f 100644 --- a/tools/trietool.c +++ b/tools/trietool.c @@ -220,7 +220,7 @@ prepare_trie (ProgEnv *env) /* read the range * format: [b,e] * where: b = begin char, e = end char; both in hex values - */ + */ if (sscanf (buff, " [ %x , %x ] ", &b, &e) != 2) continue; if (b > e) { @@ -405,7 +405,7 @@ command_add_list (int argc, char *argv[], ProgEnv *env) /* mark key ending and find data begin */ if ('\0' != *data) { *data++ = '\0'; - while (isspace (*data)) + while (isspace ((unsigned char)*data)) ++data; } /* decode data */ @@ -614,12 +614,12 @@ string_trim (char *s) char *p; /* skip leading white spaces */ - while (*s && isspace (*s)) + while (*s && isspace ((unsigned char)*s)) ++s; /* trim trailing white spaces */ p = s + strlen (s) - 1; - while (isspace (*p)) + while (isspace ((unsigned char)*p)) --p; *++p = '\0'; -- 2.7.4