diff --git a/hawk/Makefile.am b/Makefile.am similarity index 100% rename from hawk/Makefile.am rename to Makefile.am diff --git a/hawk/Makefile.in b/Makefile.in similarity index 96% rename from hawk/Makefile.in rename to Makefile.in index 6b25e600..77ea5f63 100644 --- a/hawk/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/ar-lib \ $(top_srcdir)/ac/config.sub $(top_srcdir)/ac/install-sh \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \ $(top_srcdir)/ac/tap-driver.sh $(top_srcdir)/pkgs/hawk.spec.in \ - ac/ar-lib ac/compile ac/config.guess ac/config.sub ac/depcomp \ + ac/ar-lib ac/compile ac/config.guess ac/config.sub \ ac/install-sh ac/ltmain.sh ac/missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) @@ -604,10 +604,6 @@ 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 @@ -650,8 +646,6 @@ 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) @@ -829,18 +823,18 @@ uninstall-am: 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-lzip dist-shar dist-tarZ \ - dist-xz dist-zip dist-zstd distcheck distclean \ - distclean-generic distclean-libtool distclean-local \ - distclean-tags distcleancheck distdir distuninstallcheck 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 installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-libtool distclean-local distclean-tags \ + distcleancheck distdir distuninstallcheck 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 installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am .PRECIOUS: Makefile diff --git a/hawk/README.md b/README.md similarity index 100% rename from hawk/README.md rename to README.md diff --git a/hawk/ac/ar-lib b/ac/ar-lib similarity index 100% rename from hawk/ac/ar-lib rename to ac/ar-lib diff --git a/hawk/ac/compile b/ac/compile similarity index 100% rename from hawk/ac/compile rename to ac/compile diff --git a/hawk/ac/config.guess b/ac/config.guess similarity index 100% rename from hawk/ac/config.guess rename to ac/config.guess diff --git a/hawk/ac/config.sub b/ac/config.sub similarity index 100% rename from hawk/ac/config.sub rename to ac/config.sub diff --git a/hawk/ac/depcomp b/ac/depcomp similarity index 100% rename from hawk/ac/depcomp rename to ac/depcomp diff --git a/hawk/ac/install-sh b/ac/install-sh similarity index 100% rename from hawk/ac/install-sh rename to ac/install-sh diff --git a/hawk/ac/ltmain.sh b/ac/ltmain.sh similarity index 99% rename from hawk/ac/ltmain.sh rename to ac/ltmain.sh index c12c197b..0cb7f90d 100644 --- a/hawk/ac/ltmain.sh +++ b/ac/ltmain.sh @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-9" +VERSION="2.4.6 Debian-2.4.6-14" package_revision=2.4.6 @@ -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=: @@ -2141,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-9 + version: $progname $scriptversion Debian-2.4.6-14 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` @@ -7368,10 +7368,12 @@ func_mode_link () # -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=*|-fuse-ld=*) + -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" diff --git a/hawk/ac/missing b/ac/missing similarity index 100% rename from hawk/ac/missing rename to ac/missing diff --git a/hawk/ac/tap-driver.sh b/ac/tap-driver.sh similarity index 100% rename from hawk/ac/tap-driver.sh rename to ac/tap-driver.sh diff --git a/hawk/ac/test-driver b/ac/test-driver similarity index 100% rename from hawk/ac/test-driver rename to ac/test-driver diff --git a/hawk/aclocal.m4 b/aclocal.m4 similarity index 96% rename from hawk/aclocal.m4 rename to aclocal.m4 index 6cac91f3..31af506d 100644 --- a/hawk/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.16.2 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [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.16.2], [], +m4_if([$1], [1.16.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,12 @@ 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.16.2])dnl +[AM_AUTOMAKE_VERSION([1.16.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ AC_SUBST([AR])dnl # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -170,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -201,7 +201,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -392,7 +392,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -431,9 +431,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], 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 + for automatic dependency tracking. 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 @@ -460,7 +458,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -657,7 +655,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-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -678,7 +676,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -699,7 +697,7 @@ AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -742,7 +740,7 @@ AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -781,7 +779,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -810,7 +808,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -857,7 +855,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -876,7 +874,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -957,7 +955,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2009-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1017,7 +1015,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1045,7 +1043,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# Copyright (C) 2006-2018 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1064,7 +1062,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# Copyright (C) 2004-2018 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/hawk/bin/Makefile.am b/bin/Makefile.am similarity index 100% rename from hawk/bin/Makefile.am rename to bin/Makefile.am diff --git a/hawk/bin/Makefile.in b/bin/Makefile.in similarity index 99% rename from hawk/bin/Makefile.in rename to bin/Makefile.in index e3022127..a3674ff3 100644 --- a/hawk/bin/Makefile.in +++ b/bin/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/hawk/bin/hawk.c b/bin/hawk.c similarity index 100% rename from hawk/bin/hawk.c rename to bin/hawk.c diff --git a/hawk/bin/sed.c b/bin/sed.c similarity index 100% rename from hawk/bin/sed.c rename to bin/sed.c diff --git a/hawk/configure b/configure similarity index 99% rename from hawk/configure rename to configure index 5da5ace0..fa7a13b8 100755 --- a/hawk/configure +++ b/configure @@ -8243,7 +8243,7 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cru} +: ${AR_FLAGS=cr} @@ -9964,8 +9964,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 @@ -11104,6 +11104,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*) @@ -18089,7 +18095,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -18135,7 +18141,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -18159,7 +18165,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -18204,7 +18210,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -18228,7 +18234,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; @@ -26140,9 +26146,7 @@ $as_echo X/"$am_mf" | { { $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 + for automatic dependency tracking. 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; } diff --git a/hawk/configure.ac b/configure.ac similarity index 100% rename from hawk/configure.ac rename to configure.ac diff --git a/hawk/lib/Hawk-Sed.hpp b/lib/Hawk-Sed.hpp similarity index 100% rename from hawk/lib/Hawk-Sed.hpp rename to lib/Hawk-Sed.hpp diff --git a/hawk/lib/Hawk.cpp b/lib/Hawk.cpp similarity index 100% rename from hawk/lib/Hawk.cpp rename to lib/Hawk.cpp diff --git a/hawk/lib/Hawk.hpp b/lib/Hawk.hpp similarity index 100% rename from hawk/lib/Hawk.hpp rename to lib/Hawk.hpp diff --git a/hawk/lib/Makefile.am b/lib/Makefile.am similarity index 100% rename from hawk/lib/Makefile.am rename to lib/Makefile.am diff --git a/hawk/lib/Makefile.in b/lib/Makefile.in similarity index 99% rename from hawk/lib/Makefile.in rename to lib/Makefile.in index 989f9b5f..3859bacd 100644 --- a/hawk/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -398,8 +398,8 @@ am__pkginclude_HEADERS_DIST = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \ hawk-utl.h hawk-sed.h hawk-std.h hawk-tre.h hawk-upac.h \ hawk-xma.h Hawk.hpp Hawk-Sed.hpp HEADERS = $(pkginclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ - hawk-cfg.h.in +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)hawk-cfg.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. diff --git a/hawk/lib/Sed.cpp b/lib/Sed.cpp similarity index 100% rename from hawk/lib/Sed.cpp rename to lib/Sed.cpp diff --git a/hawk/lib/Std-Sed.cpp b/lib/Std-Sed.cpp similarity index 100% rename from hawk/lib/Std-Sed.cpp rename to lib/Std-Sed.cpp diff --git a/hawk/lib/Std.cpp b/lib/Std.cpp similarity index 100% rename from hawk/lib/Std.cpp rename to lib/Std.cpp diff --git a/hawk/lib/arr.c b/lib/arr.c similarity index 100% rename from hawk/lib/arr.c rename to lib/arr.c diff --git a/hawk/lib/chr.c b/lib/chr.c similarity index 100% rename from hawk/lib/chr.c rename to lib/chr.c diff --git a/hawk/lib/cli-imp.h b/lib/cli-imp.h similarity index 100% rename from hawk/lib/cli-imp.h rename to lib/cli-imp.h diff --git a/hawk/lib/cli.c b/lib/cli.c similarity index 100% rename from hawk/lib/cli.c rename to lib/cli.c diff --git a/hawk/lib/dir.c b/lib/dir.c similarity index 100% rename from hawk/lib/dir.c rename to lib/dir.c diff --git a/hawk/lib/ecs-imp.h b/lib/ecs-imp.h similarity index 100% rename from hawk/lib/ecs-imp.h rename to lib/ecs-imp.h diff --git a/hawk/lib/ecs.c b/lib/ecs.c similarity index 100% rename from hawk/lib/ecs.c rename to lib/ecs.c diff --git a/hawk/lib/err-prv.h b/lib/err-prv.h similarity index 100% rename from hawk/lib/err-prv.h rename to lib/err-prv.h diff --git a/hawk/lib/err-sys.c b/lib/err-sys.c similarity index 100% rename from hawk/lib/err-sys.c rename to lib/err-sys.c diff --git a/hawk/lib/err.c b/lib/err.c similarity index 100% rename from hawk/lib/err.c rename to lib/err.c diff --git a/hawk/lib/fio.c b/lib/fio.c similarity index 100% rename from hawk/lib/fio.c rename to lib/fio.c diff --git a/hawk/lib/fmt-imp.h b/lib/fmt-imp.h similarity index 100% rename from hawk/lib/fmt-imp.h rename to lib/fmt-imp.h diff --git a/hawk/lib/fmt.c b/lib/fmt.c similarity index 100% rename from hawk/lib/fmt.c rename to lib/fmt.c diff --git a/hawk/lib/fnc-prv.h b/lib/fnc-prv.h similarity index 100% rename from hawk/lib/fnc-prv.h rename to lib/fnc-prv.h diff --git a/hawk/lib/fnc.c b/lib/fnc.c similarity index 100% rename from hawk/lib/fnc.c rename to lib/fnc.c diff --git a/lib/gem-glob.c b/lib/gem-glob.c new file mode 100644 index 00000000..a0980e69 --- /dev/null +++ b/lib/gem-glob.c @@ -0,0 +1,1065 @@ +/* + Copyright (c) 2006-2020 Chung, Hyung-Hwan. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Do NOT edit glob.c. Edit glob.c.m4 instead. + * + * Generate gem-glob.c with m4 + * $ m4 gem-glob.c.m4 > gem-glob.c + */ + +#include "hawk-prv.h" +#include +#include +#include +#include + +#include "syscall.h" + +#define NO_RECURSION 1 + +enum segment_type_t +{ + NONE, + ROOT, + NORMAL +}; +typedef enum segment_type_t segment_type_t; + + +#define IS_ESC(c) HAWK_FNMAT_IS_ESC(c) +#define IS_SEP(c) HAWK_FNMAT_IS_SEP(c) +#define IS_NIL(c) ((c) == '\0') +#define IS_SEP_OR_NIL(c) (IS_SEP(c) || IS_NIL(c)) + +/* this macro only checks for top-level wild-cards among these. + * *, ?, [], !, - + * see str-fnmat.c for more wild-card letters + */ +#define IS_WILD(c) ((c) == '*' || (c) == '?' || (c) == '[') + + +static hawk_bch_t* wcs_to_mbuf (hawk_gem_t* g, const hawk_uch_t* wcs, hawk_becs_t* mbuf) +{ + hawk_oow_t ml, wl; + + if (hawk_gem_convutobcstr(g, wcs, &wl, HAWK_NULL, &ml) <= -1 || + hawk_becs_setlen(mbuf, ml) == (hawk_oow_t)-1) return HAWK_NULL; + + hawk_gem_convutobcstr (g, wcs, &wl, HAWK_BECS_PTR(mbuf), &ml); + return HAWK_BECS_PTR(mbuf); +} + +#if defined(_WIN32) && !defined(INVALID_FILE_ATTRIBUTES) +#define INVALID_FILE_ATTRIBUTES ((DWORD)-1) +#endif + +static int upath_exists (hawk_gem_t* g, const hawk_uch_t* name, hawk_becs_t* mbuf) +{ +#if defined(_WIN32) + return (GetFileAttributesW(name) != INVALID_FILE_ATTRIBUTES)? 1: 0; + +#elif defined(__OS2__) + FILESTATUS3 fs; + APIRET rc; + const hawk_bch_t* mptr; + + mptr = wcs_to_mbuf(g, name, mbuf); + if (HAWK_UNLIKELY(!mptr)) return -1; + + rc = DosQueryPathInfo(mptr, FIL_STANDARD, &fs, HAWK_SIZEOF(fs)); + return (rc == NO_ERROR)? 1: ((rc == ERROR_PATH_NOT_FOUND)? 0: -1); + +#elif defined(__DOS__) + unsigned int x, attr; + const hawk_bch_t* mptr; + + mptr = wcs_to_mbuf(g, name, mbuf); + if (HAWK_UNLIKELY(!mptr)) return -1; + + x = _dos_getfileattr (mptr, &attr); + return (x == 0)? 1: ((errno == ENOENT)? 0: -1); + +#elif defined(macintosh) + HFileInfo fpb; + const hawk_bch_t* mptr; + + mptr = wcs_to_mbuf(g, name, mbuf); + if (HAWK_UNLIKELY(!mptr)) return -1; + + HAWK_MEMSET (&fpb, 0, HAWK_SIZEOF(fpb)); + fpb.ioNamePtr = (unsigned char*)mptr; + + return (PBGetCatInfoSync ((CInfoPBRec*)&fpb) == noErr)? 1: 0; +#else + struct stat st; + const hawk_bch_t* mptr; + int t; + + mptr = wcs_to_mbuf(g, name, mbuf); + if (HAWK_UNLIKELY(!mptr)) return -1; + + #if defined(HAVE_LSTAT) + t = HAWK_LSTAT(mptr, &st); + #else + t = HAWK_STAT(mptr, &st);/* use stat() if no lstat() is available. */ + #endif + return (t == 0); +#endif +} + +static int bpath_exists (hawk_gem_t* g, const hawk_bch_t* name, hawk_becs_t* mbuf) +{ +#if defined(_WIN32) + return (GetFileAttributesA(name) != INVALID_FILE_ATTRIBUTES)? 1: 0; +#elif defined(__OS2__) + + FILESTATUS3 fs; + APIRET rc; + rc = DosQueryPathInfo(name, FIL_STANDARD, &fs, HAWK_SIZEOF(fs)); + return (rc == NO_ERROR)? 1: ((rc == ERROR_PATH_NOT_FOUND)? 0: -1); + +#elif defined(__DOS__) + unsigned int x, attr; + x = _dos_getfileattr(name, &attr); + return (x == 0)? 1: ((errno == ENOENT)? 0: -1); + +#elif defined(macintosh) + HFileInfo fpb; + HAWK_MEMSET (&fpb, 0, HAWK_SIZEOF(fpb)); + fpb.ioNamePtr = (unsigned char*)name; + return (PBGetCatInfoSync((CInfoPBRec*)&fpb) == noErr)? 1: 0; +#else + struct stat st; + int t; + #if defined(HAVE_LSTAT) + t = HAWK_LSTAT(name, &st); + #else + t = HAWK_STAT(name, &st); /* use stat() if no lstat() is available. */ + #endif + return (t == 0); +#endif +} + + + + +#if defined(NO_RECURSION) +typedef struct __u_stack_node_t __u_stack_node_t; +#endif + +struct __u_glob_t +{ + hawk_gem_uglob_cb_t cbimpl; + void* cbctx; + + hawk_gem_t* gem; + int flags; + + hawk_uecs_t path; + hawk_uecs_t tbuf; /* temporary buffer */ + + hawk_becs_t mbuf; /* not used if the base character type is hawk_bch_t */ + + int expanded; + int fnmat_flags; + +#if defined(NO_RECURSION) + __u_stack_node_t* stack; + __u_stack_node_t* free; +#endif +}; + +typedef struct __u_glob_t __u_glob_t; + +struct __u_segment_t +{ + segment_type_t type; + + const hawk_uch_t* ptr; + hawk_oow_t len; + + hawk_uch_t sep; /* preceeding separator */ + unsigned int wild: 1; /* indicate that it contains wildcards */ + unsigned int esc: 1; /* indicate that it contains escaped letters */ + unsigned int next: 1; /* indicate that it has the following segment */ +}; +typedef struct __u_segment_t __u_segment_t; + +#if defined(NO_RECURSION) +struct __u_stack_node_t +{ + hawk_oow_t tmp; + hawk_oow_t tmp2; + hawk_dir_t* dp; + __u_segment_t seg; + __u_stack_node_t* next; +}; +#endif + +static int __u_get_next_segment (__u_glob_t* g, __u_segment_t* seg) +{ + if (seg->type == NONE) + { + /* seg->ptr must point to the beginning of the pattern + * and seg->len must be zero when seg->type is NONE. */ + if (IS_NIL(seg->ptr[0])) + { + /* nothing to do */ + } + else if (IS_SEP(seg->ptr[0])) + { + seg->type = ROOT; + seg->len = 1; + seg->next = IS_NIL(seg->ptr[1])? 0: 1; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + } + #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + else if (IS_DRIVE(seg->ptr)) + { + seg->type = ROOT; + seg->len = 2; + if (IS_SEP(seg->ptr[2])) seg->len++; + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + } + #endif + else + { + int escaped = 0; + seg->type = NORMAL; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + do + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + + seg->len++; + } + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])); + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + } + else if (seg->type == ROOT) + { + int escaped = 0; + seg->type = NORMAL; + seg->ptr = &seg->ptr[seg->len]; + seg->len = 0; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + seg->len++; + } + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + else + { + HAWK_ASSERT (seg->type == NORMAL); + + seg->ptr = &seg->ptr[seg->len + 1]; + seg->len = 0; + seg->wild = 0; + seg->esc = 0; + if (IS_NIL(seg->ptr[-1])) + { + seg->type = NONE; + seg->next = 0; + seg->sep = '\0'; + } + else + { + int escaped = 0; + seg->sep = seg->ptr[-1]; + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + seg->len++; + } + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + } + + return seg->type; +} + +static int __u_handle_non_wild_segments (__u_glob_t* g, __u_segment_t* seg) +{ + while (__u_get_next_segment(g, seg) != NONE && !seg->wild) + { + HAWK_ASSERT (seg->type != NONE && !seg->wild); + + if (seg->sep && hawk_uecs_ccat (&g->path, seg->sep) == (hawk_oow_t)-1) return -1; + if (seg->esc) + { + /* if the segment contains escape sequences, + * strip the escape letters off the segment */ + + + hawk_ucs_t tmp; + hawk_oow_t i; + int escaped = 0; + + if (HAWK_UECS_CAPA(&g->tbuf) < seg->len && + hawk_uecs_setcapa (&g->tbuf, seg->len) == (hawk_oow_t)-1) return -1; + + tmp.ptr = HAWK_UECS_PTR(&g->tbuf); + tmp.len = 0; + + /* the following loop drops the last character + * if it is the escape character */ + for (i = 0; i < seg->len; i++) + { + if (escaped) + { + escaped = 0; + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + else + { + if (IS_ESC(seg->ptr[i])) + escaped = 1; + else + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + } + + if (hawk_uecs_ncat (&g->path, tmp.ptr, tmp.len) == (hawk_oow_t)-1) return -1; + } + else + { + /* if the segment doesn't contain escape sequences, + * append the segment to the path without special handling */ + if (hawk_uecs_ncat (&g->path, seg->ptr, seg->len) == (hawk_oow_t)-1) return -1; + } + + if (!seg->next && upath_exists(g->gem, HAWK_UECS_PTR(&g->path), &g->mbuf) > 0) + { + /* reached the last segment. match if the path exists */ + if (g->cbimpl(HAWK_UECS_CS(&g->path), g->cbctx) <= -1) return -1; + g->expanded = 1; + } + } + + return 0; +} + +static int __u_search (__u_glob_t* g, __u_segment_t* seg) +{ + hawk_dir_t* dp; + hawk_oow_t tmp, tmp2; + hawk_dir_ent_t ent; + int x; + +#if defined(NO_RECURSION) + __u_stack_node_t* r; + +entry: +#endif + + dp = HAWK_NULL; + + if (__u_handle_non_wild_segments(g, seg) <= -1) goto oops; + + if (seg->wild) + { + int dir_flags = 0; + if (g->flags & HAWK_GLOB_SKIPSPCDIR) dir_flags |= HAWK_DIR_SKIPSPCDIR; + if (HAWK_SIZEOF(hawk_uch_t) == HAWK_SIZEOF(hawk_bch_t)) dir_flags |= HAWK_DIR_BPATH; + + dp = hawk_dir_open(g->gem, 0, (const hawk_uch_t*)HAWK_UECS_PTR(&g->path), dir_flags); + if (dp) + { + tmp = HAWK_UECS_LEN(&g->path); + + if (seg->sep && hawk_uecs_ccat(&g->path, seg->sep) == (hawk_oow_t)-1) goto oops; + tmp2 = HAWK_UECS_LEN(&g->path); + + while (1) + { + hawk_uecs_setlen (&g->path, tmp2); + + x = hawk_dir_read(dp, &ent); + if (x <= -1) + { + if (g->flags & HAWK_GLOB_TOLERANT) break; + else goto oops; + } + if (x == 0) break; + + if (hawk_uecs_cat(&g->path, (const hawk_uch_t*)ent.name) == (hawk_oow_t)-1) goto oops; + + if (hawk_fnmat_ucstr_uchars(HAWK_UECS_CPTR(&g->path,tmp2), seg->ptr, seg->len, g->fnmat_flags) > 0) + { + if (seg->next) + { + #if defined(NO_RECURSION) + if (g->free) + { + r = g->free; + g->free = r->next; + } + else + { + r = hawk_gem_allocmem(g->gem, HAWK_SIZEOF(*r)); + if (r == HAWK_NULL) goto oops; + } + + /* push key variables that must be restored + * into the stack. */ + r->tmp = tmp; + r->tmp2 = tmp2; + r->dp = dp; + r->seg = *seg; + + r->next = g->stack; + g->stack = r; + + /* move to the function entry point as if + * a recursive call has been made */ + goto entry; + + resume: + ; + + #else + __u_segment_t save; + int x; + + save = *seg; + x = __u_search(g, seg); + *seg = save; + if (x <= -1) goto oops; + #endif + } + else + { + if (g->cbimpl(HAWK_UECS_CS(&g->path), g->cbctx) <= -1) goto oops; + g->expanded = 1; + } + } + } + + hawk_uecs_setlen (&g->path, tmp); + hawk_dir_close (dp); dp = HAWK_NULL; + } + } + + HAWK_ASSERT (dp == HAWK_NULL); + +#if defined(NO_RECURSION) + if (g->stack) + { + /* the stack is not empty. the emulated recusive call + * must have been made. restore the variables pushed + * and jump to the resumption point */ + r = g->stack; + g->stack = r->next; + + tmp = r->tmp; + tmp2 = r->tmp2; + dp = r->dp; + *seg = r->seg; + + /* link the stack node to the free list + * instead of freeing it here */ + r->next = g->free; + g->free = r; + + goto resume; + } + + while (g->free) + { + /* destory the free list */ + r = g->free; + g->free = r->next; + hawk_gem_freemem (g->gem, r); + } +#endif + + return 0; + +oops: + if (dp) hawk_dir_close (dp); + +#if defined(NO_RECURSION) + while (g->stack) + { + r = g->stack; + g->stack = r->next; + hawk_dir_close (r->dp); + hawk_gem_freemem (g->gem, r); + } + + while (g->free) + { + r = g->stack; + g->free = r->next; + hawk_gem_freemem (g->gem, r); + } +#endif + return -1; +} + +int hawk_gem_uglob (hawk_gem_t* gem, const hawk_uch_t* pattern, hawk_gem_uglob_cb_t cbimpl, void* cbctx, int flags) +{ + __u_segment_t seg; + __u_glob_t g; + int x; + + HAWK_MEMSET (&g, 0, HAWK_SIZEOF(g)); + g.gem = gem; + g.cbimpl = cbimpl; + g.cbctx = cbctx; + g.flags = flags; + +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + g.fnmat_flags |= HAWK_FNMAT_IGNORECASE; + g.fnmat_flags |= HAWK_FNMAT_NOESCAPE; +#else + if (flags & HAWK_GLOB_IGNORECASE) g.fnmat_flags |= HAWK_FNMAT_IGNORECASE; + if (flags & HAWK_GLOB_NOESCAPE) g.fnmat_flags |= HAWK_FNMAT_NOESCAPE; +#endif + if (flags & HAWK_GLOB_PERIOD) g.fnmat_flags |= HAWK_FNMAT_PERIOD; + + if (hawk_uecs_init(&g.path, g.gem, 512) <= -1) return -1; + if (hawk_uecs_init(&g.tbuf, g.gem, 256) <= -1) + { + hawk_uecs_fini (&g.path); + return -1; + } + + if (HAWK_SIZEOF(hawk_uch_t) != HAWK_SIZEOF(hawk_bch_t)) + { + if (hawk_becs_init(&g.mbuf, g.gem, 512) <= -1) + { + hawk_uecs_fini (&g.path); + hawk_uecs_fini (&g.path); + return -1; + } + } + + HAWK_MEMSET (&seg, 0, HAWK_SIZEOF(seg)); + seg.type = NONE; + seg.ptr = pattern; + seg.len = 0; + + x = __u_search(&g, &seg); + + if (HAWK_SIZEOF(hawk_uch_t) != HAWK_SIZEOF(hawk_uch_t)) hawk_becs_fini (&g.mbuf); + hawk_uecs_fini (&g.tbuf); + hawk_uecs_fini (&g.path); + + if (x <= -1) return -1; + return g.expanded; +} + + + + +#if defined(NO_RECURSION) +typedef struct __b_stack_node_t __b_stack_node_t; +#endif + +struct __b_glob_t +{ + hawk_gem_bglob_cb_t cbimpl; + void* cbctx; + + hawk_gem_t* gem; + int flags; + + hawk_becs_t path; + hawk_becs_t tbuf; /* temporary buffer */ + + hawk_becs_t mbuf; /* not used if the base character type is hawk_bch_t */ + + int expanded; + int fnmat_flags; + +#if defined(NO_RECURSION) + __b_stack_node_t* stack; + __b_stack_node_t* free; +#endif +}; + +typedef struct __b_glob_t __b_glob_t; + +struct __b_segment_t +{ + segment_type_t type; + + const hawk_bch_t* ptr; + hawk_oow_t len; + + hawk_bch_t sep; /* preceeding separator */ + unsigned int wild: 1; /* indicate that it contains wildcards */ + unsigned int esc: 1; /* indicate that it contains escaped letters */ + unsigned int next: 1; /* indicate that it has the following segment */ +}; +typedef struct __b_segment_t __b_segment_t; + +#if defined(NO_RECURSION) +struct __b_stack_node_t +{ + hawk_oow_t tmp; + hawk_oow_t tmp2; + hawk_dir_t* dp; + __b_segment_t seg; + __b_stack_node_t* next; +}; +#endif + +static int __b_get_next_segment (__b_glob_t* g, __b_segment_t* seg) +{ + if (seg->type == NONE) + { + /* seg->ptr must point to the beginning of the pattern + * and seg->len must be zero when seg->type is NONE. */ + if (IS_NIL(seg->ptr[0])) + { + /* nothing to do */ + } + else if (IS_SEP(seg->ptr[0])) + { + seg->type = ROOT; + seg->len = 1; + seg->next = IS_NIL(seg->ptr[1])? 0: 1; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + } + #if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + else if (IS_DRIVE(seg->ptr)) + { + seg->type = ROOT; + seg->len = 2; + if (IS_SEP(seg->ptr[2])) seg->len++; + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + } + #endif + else + { + int escaped = 0; + seg->type = NORMAL; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + do + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + + seg->len++; + } + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])); + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + } + else if (seg->type == ROOT) + { + int escaped = 0; + seg->type = NORMAL; + seg->ptr = &seg->ptr[seg->len]; + seg->len = 0; + seg->sep = '\0'; + seg->wild = 0; + seg->esc = 0; + + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + seg->len++; + } + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + else + { + HAWK_ASSERT (seg->type == NORMAL); + + seg->ptr = &seg->ptr[seg->len + 1]; + seg->len = 0; + seg->wild = 0; + seg->esc = 0; + if (IS_NIL(seg->ptr[-1])) + { + seg->type = NONE; + seg->next = 0; + seg->sep = '\0'; + } + else + { + int escaped = 0; + seg->sep = seg->ptr[-1]; + while (!IS_SEP_OR_NIL(seg->ptr[seg->len])) + { + if (escaped) escaped = 0; + else + { + if (IS_ESC(seg->ptr[seg->len])) + { + escaped = 1; + seg->esc = 1; + } + else if (IS_WILD(seg->ptr[seg->len])) seg->wild = 1; + } + seg->len++; + } + seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1; + } + } + + return seg->type; +} + +static int __b_handle_non_wild_segments (__b_glob_t* g, __b_segment_t* seg) +{ + while (__b_get_next_segment(g, seg) != NONE && !seg->wild) + { + HAWK_ASSERT (seg->type != NONE && !seg->wild); + + if (seg->sep && hawk_becs_ccat (&g->path, seg->sep) == (hawk_oow_t)-1) return -1; + if (seg->esc) + { + /* if the segment contains escape sequences, + * strip the escape letters off the segment */ + + + hawk_bcs_t tmp; + hawk_oow_t i; + int escaped = 0; + + if (HAWK_BECS_CAPA(&g->tbuf) < seg->len && + hawk_becs_setcapa (&g->tbuf, seg->len) == (hawk_oow_t)-1) return -1; + + tmp.ptr = HAWK_BECS_PTR(&g->tbuf); + tmp.len = 0; + + /* the following loop drops the last character + * if it is the escape character */ + for (i = 0; i < seg->len; i++) + { + if (escaped) + { + escaped = 0; + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + else + { + if (IS_ESC(seg->ptr[i])) + escaped = 1; + else + tmp.ptr[tmp.len++] = seg->ptr[i]; + } + } + + if (hawk_becs_ncat (&g->path, tmp.ptr, tmp.len) == (hawk_oow_t)-1) return -1; + } + else + { + /* if the segment doesn't contain escape sequences, + * append the segment to the path without special handling */ + if (hawk_becs_ncat (&g->path, seg->ptr, seg->len) == (hawk_oow_t)-1) return -1; + } + + if (!seg->next && bpath_exists(g->gem, HAWK_BECS_PTR(&g->path), &g->mbuf) > 0) + { + /* reached the last segment. match if the path exists */ + if (g->cbimpl(HAWK_BECS_CS(&g->path), g->cbctx) <= -1) return -1; + g->expanded = 1; + } + } + + return 0; +} + +static int __b_search (__b_glob_t* g, __b_segment_t* seg) +{ + hawk_dir_t* dp; + hawk_oow_t tmp, tmp2; + hawk_dir_ent_t ent; + int x; + +#if defined(NO_RECURSION) + __b_stack_node_t* r; + +entry: +#endif + + dp = HAWK_NULL; + + if (__b_handle_non_wild_segments(g, seg) <= -1) goto oops; + + if (seg->wild) + { + int dir_flags = 0; + if (g->flags & HAWK_GLOB_SKIPSPCDIR) dir_flags |= HAWK_DIR_SKIPSPCDIR; + if (HAWK_SIZEOF(hawk_bch_t) == HAWK_SIZEOF(hawk_bch_t)) dir_flags |= HAWK_DIR_BPATH; + + dp = hawk_dir_open(g->gem, 0, (const hawk_bch_t*)HAWK_BECS_PTR(&g->path), dir_flags); + if (dp) + { + tmp = HAWK_BECS_LEN(&g->path); + + if (seg->sep && hawk_becs_ccat(&g->path, seg->sep) == (hawk_oow_t)-1) goto oops; + tmp2 = HAWK_BECS_LEN(&g->path); + + while (1) + { + hawk_becs_setlen (&g->path, tmp2); + + x = hawk_dir_read(dp, &ent); + if (x <= -1) + { + if (g->flags & HAWK_GLOB_TOLERANT) break; + else goto oops; + } + if (x == 0) break; + + if (hawk_becs_cat(&g->path, (const hawk_bch_t*)ent.name) == (hawk_oow_t)-1) goto oops; + + if (hawk_fnmat_bcstr_bchars(HAWK_BECS_CPTR(&g->path,tmp2), seg->ptr, seg->len, g->fnmat_flags) > 0) + { + if (seg->next) + { + #if defined(NO_RECURSION) + if (g->free) + { + r = g->free; + g->free = r->next; + } + else + { + r = hawk_gem_allocmem(g->gem, HAWK_SIZEOF(*r)); + if (r == HAWK_NULL) goto oops; + } + + /* push key variables that must be restored + * into the stack. */ + r->tmp = tmp; + r->tmp2 = tmp2; + r->dp = dp; + r->seg = *seg; + + r->next = g->stack; + g->stack = r; + + /* move to the function entry point as if + * a recursive call has been made */ + goto entry; + + resume: + ; + + #else + __b_segment_t save; + int x; + + save = *seg; + x = __b_search(g, seg); + *seg = save; + if (x <= -1) goto oops; + #endif + } + else + { + if (g->cbimpl(HAWK_BECS_CS(&g->path), g->cbctx) <= -1) goto oops; + g->expanded = 1; + } + } + } + + hawk_becs_setlen (&g->path, tmp); + hawk_dir_close (dp); dp = HAWK_NULL; + } + } + + HAWK_ASSERT (dp == HAWK_NULL); + +#if defined(NO_RECURSION) + if (g->stack) + { + /* the stack is not empty. the emulated recusive call + * must have been made. restore the variables pushed + * and jump to the resumption point */ + r = g->stack; + g->stack = r->next; + + tmp = r->tmp; + tmp2 = r->tmp2; + dp = r->dp; + *seg = r->seg; + + /* link the stack node to the free list + * instead of freeing it here */ + r->next = g->free; + g->free = r; + + goto resume; + } + + while (g->free) + { + /* destory the free list */ + r = g->free; + g->free = r->next; + hawk_gem_freemem (g->gem, r); + } +#endif + + return 0; + +oops: + if (dp) hawk_dir_close (dp); + +#if defined(NO_RECURSION) + while (g->stack) + { + r = g->stack; + g->stack = r->next; + hawk_dir_close (r->dp); + hawk_gem_freemem (g->gem, r); + } + + while (g->free) + { + r = g->stack; + g->free = r->next; + hawk_gem_freemem (g->gem, r); + } +#endif + return -1; +} + +int hawk_gem_bglob (hawk_gem_t* gem, const hawk_bch_t* pattern, hawk_gem_bglob_cb_t cbimpl, void* cbctx, int flags) +{ + __b_segment_t seg; + __b_glob_t g; + int x; + + HAWK_MEMSET (&g, 0, HAWK_SIZEOF(g)); + g.gem = gem; + g.cbimpl = cbimpl; + g.cbctx = cbctx; + g.flags = flags; + +#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__) + g.fnmat_flags |= HAWK_FNMAT_IGNORECASE; + g.fnmat_flags |= HAWK_FNMAT_NOESCAPE; +#else + if (flags & HAWK_GLOB_IGNORECASE) g.fnmat_flags |= HAWK_FNMAT_IGNORECASE; + if (flags & HAWK_GLOB_NOESCAPE) g.fnmat_flags |= HAWK_FNMAT_NOESCAPE; +#endif + if (flags & HAWK_GLOB_PERIOD) g.fnmat_flags |= HAWK_FNMAT_PERIOD; + + if (hawk_becs_init(&g.path, g.gem, 512) <= -1) return -1; + if (hawk_becs_init(&g.tbuf, g.gem, 256) <= -1) + { + hawk_becs_fini (&g.path); + return -1; + } + + if (HAWK_SIZEOF(hawk_bch_t) != HAWK_SIZEOF(hawk_bch_t)) + { + if (hawk_becs_init(&g.mbuf, g.gem, 512) <= -1) + { + hawk_becs_fini (&g.path); + hawk_becs_fini (&g.path); + return -1; + } + } + + HAWK_MEMSET (&seg, 0, HAWK_SIZEOF(seg)); + seg.type = NONE; + seg.ptr = pattern; + seg.len = 0; + + x = __b_search(&g, &seg); + + if (HAWK_SIZEOF(hawk_bch_t) != HAWK_SIZEOF(hawk_uch_t)) hawk_becs_fini (&g.mbuf); + hawk_becs_fini (&g.tbuf); + hawk_becs_fini (&g.path); + + if (x <= -1) return -1; + return g.expanded; +} + + diff --git a/hawk/lib/gem-glob.c.m4 b/lib/gem-glob.c.m4 similarity index 100% rename from hawk/lib/gem-glob.c.m4 rename to lib/gem-glob.c.m4 diff --git a/hawk/lib/gem-glob.m4 b/lib/gem-glob.m4 similarity index 100% rename from hawk/lib/gem-glob.m4 rename to lib/gem-glob.m4 diff --git a/hawk/lib/gem-nwif.c b/lib/gem-nwif.c similarity index 100% rename from hawk/lib/gem-nwif.c rename to lib/gem-nwif.c diff --git a/hawk/lib/gem-nwif2.c b/lib/gem-nwif2.c similarity index 100% rename from hawk/lib/gem-nwif2.c rename to lib/gem-nwif2.c diff --git a/hawk/lib/gem.c b/lib/gem.c similarity index 100% rename from hawk/lib/gem.c rename to lib/gem.c diff --git a/hawk/lib/hawk-arr.h b/lib/hawk-arr.h similarity index 100% rename from hawk/lib/hawk-arr.h rename to lib/hawk-arr.h diff --git a/hawk/lib/hawk-cfg.h.in b/lib/hawk-cfg.h.in similarity index 100% rename from hawk/lib/hawk-cfg.h.in rename to lib/hawk-cfg.h.in diff --git a/hawk/lib/hawk-chr.h b/lib/hawk-chr.h similarity index 100% rename from hawk/lib/hawk-chr.h rename to lib/hawk-chr.h diff --git a/hawk/lib/hawk-cli.h b/lib/hawk-cli.h similarity index 100% rename from hawk/lib/hawk-cli.h rename to lib/hawk-cli.h diff --git a/hawk/lib/hawk-cmn.h b/lib/hawk-cmn.h similarity index 100% rename from hawk/lib/hawk-cmn.h rename to lib/hawk-cmn.h diff --git a/hawk/lib/hawk-dir.h b/lib/hawk-dir.h similarity index 100% rename from hawk/lib/hawk-dir.h rename to lib/hawk-dir.h diff --git a/hawk/lib/hawk-ecs.h b/lib/hawk-ecs.h similarity index 100% rename from hawk/lib/hawk-ecs.h rename to lib/hawk-ecs.h diff --git a/hawk/lib/hawk-fio.h b/lib/hawk-fio.h similarity index 100% rename from hawk/lib/hawk-fio.h rename to lib/hawk-fio.h diff --git a/hawk/lib/hawk-fmt.h b/lib/hawk-fmt.h similarity index 100% rename from hawk/lib/hawk-fmt.h rename to lib/hawk-fmt.h diff --git a/hawk/lib/hawk-gem.h b/lib/hawk-gem.h similarity index 100% rename from hawk/lib/hawk-gem.h rename to lib/hawk-gem.h diff --git a/hawk/lib/hawk-glob.h b/lib/hawk-glob.h similarity index 100% rename from hawk/lib/hawk-glob.h rename to lib/hawk-glob.h diff --git a/hawk/lib/hawk-htb.h b/lib/hawk-htb.h similarity index 100% rename from hawk/lib/hawk-htb.h rename to lib/hawk-htb.h diff --git a/hawk/lib/hawk-map.h b/lib/hawk-map.h similarity index 100% rename from hawk/lib/hawk-map.h rename to lib/hawk-map.h diff --git a/hawk/lib/hawk-mtx.h b/lib/hawk-mtx.h similarity index 100% rename from hawk/lib/hawk-mtx.h rename to lib/hawk-mtx.h diff --git a/hawk/lib/hawk-pac1.h b/lib/hawk-pac1.h similarity index 100% rename from hawk/lib/hawk-pac1.h rename to lib/hawk-pac1.h diff --git a/hawk/lib/hawk-pio.h b/lib/hawk-pio.h similarity index 100% rename from hawk/lib/hawk-pio.h rename to lib/hawk-pio.h diff --git a/hawk/lib/hawk-prv.h b/lib/hawk-prv.h similarity index 100% rename from hawk/lib/hawk-prv.h rename to lib/hawk-prv.h diff --git a/hawk/lib/hawk-rbt.h b/lib/hawk-rbt.h similarity index 100% rename from hawk/lib/hawk-rbt.h rename to lib/hawk-rbt.h diff --git a/hawk/lib/hawk-sed.h b/lib/hawk-sed.h similarity index 100% rename from hawk/lib/hawk-sed.h rename to lib/hawk-sed.h diff --git a/hawk/lib/hawk-sio.h b/lib/hawk-sio.h similarity index 100% rename from hawk/lib/hawk-sio.h rename to lib/hawk-sio.h diff --git a/hawk/lib/hawk-skad.h b/lib/hawk-skad.h similarity index 100% rename from hawk/lib/hawk-skad.h rename to lib/hawk-skad.h diff --git a/hawk/lib/hawk-std.h b/lib/hawk-std.h similarity index 100% rename from hawk/lib/hawk-std.h rename to lib/hawk-std.h diff --git a/hawk/lib/hawk-str.h b/lib/hawk-str.h similarity index 100% rename from hawk/lib/hawk-str.h rename to lib/hawk-str.h diff --git a/hawk/lib/hawk-str.h.m4 b/lib/hawk-str.h.m4 similarity index 100% rename from hawk/lib/hawk-str.h.m4 rename to lib/hawk-str.h.m4 diff --git a/hawk/lib/hawk-tio.h b/lib/hawk-tio.h similarity index 100% rename from hawk/lib/hawk-tio.h rename to lib/hawk-tio.h diff --git a/hawk/lib/hawk-tre.h b/lib/hawk-tre.h similarity index 100% rename from hawk/lib/hawk-tre.h rename to lib/hawk-tre.h diff --git a/hawk/lib/hawk-upac.h b/lib/hawk-upac.h similarity index 100% rename from hawk/lib/hawk-upac.h rename to lib/hawk-upac.h diff --git a/hawk/lib/hawk-utl.h b/lib/hawk-utl.h similarity index 100% rename from hawk/lib/hawk-utl.h rename to lib/hawk-utl.h diff --git a/hawk/lib/hawk-xma.h b/lib/hawk-xma.h similarity index 100% rename from hawk/lib/hawk-xma.h rename to lib/hawk-xma.h diff --git a/hawk/lib/hawk.c b/lib/hawk.c similarity index 100% rename from hawk/lib/hawk.c rename to lib/hawk.c diff --git a/hawk/lib/hawk.h b/lib/hawk.h similarity index 100% rename from hawk/lib/hawk.h rename to lib/hawk.h diff --git a/hawk/lib/hawk.txt b/lib/hawk.txt similarity index 100% rename from hawk/lib/hawk.txt rename to lib/hawk.txt diff --git a/hawk/lib/htb.c b/lib/htb.c similarity index 100% rename from hawk/lib/htb.c rename to lib/htb.c diff --git a/hawk/lib/idmap-imp.h b/lib/idmap-imp.h similarity index 100% rename from hawk/lib/idmap-imp.h rename to lib/idmap-imp.h diff --git a/hawk/lib/mb8.c b/lib/mb8.c similarity index 100% rename from hawk/lib/mb8.c rename to lib/mb8.c diff --git a/hawk/lib/misc-imp.h b/lib/misc-imp.h similarity index 100% rename from hawk/lib/misc-imp.h rename to lib/misc-imp.h diff --git a/hawk/lib/misc-prv.h b/lib/misc-prv.h similarity index 100% rename from hawk/lib/misc-prv.h rename to lib/misc-prv.h diff --git a/hawk/lib/misc.c b/lib/misc.c similarity index 100% rename from hawk/lib/misc.c rename to lib/misc.c diff --git a/hawk/lib/mod-hawk.c b/lib/mod-hawk.c similarity index 100% rename from hawk/lib/mod-hawk.c rename to lib/mod-hawk.c diff --git a/hawk/lib/mod-hawk.h b/lib/mod-hawk.h similarity index 100% rename from hawk/lib/mod-hawk.h rename to lib/mod-hawk.h diff --git a/hawk/lib/mod-math.c b/lib/mod-math.c similarity index 100% rename from hawk/lib/mod-math.c rename to lib/mod-math.c diff --git a/hawk/lib/mod-math.h b/lib/mod-math.h similarity index 100% rename from hawk/lib/mod-math.h rename to lib/mod-math.h diff --git a/hawk/lib/mod-str.c b/lib/mod-str.c similarity index 100% rename from hawk/lib/mod-str.c rename to lib/mod-str.c diff --git a/hawk/lib/mod-str.h b/lib/mod-str.h similarity index 100% rename from hawk/lib/mod-str.h rename to lib/mod-str.h diff --git a/hawk/lib/mod-sys.c b/lib/mod-sys.c similarity index 100% rename from hawk/lib/mod-sys.c rename to lib/mod-sys.c diff --git a/hawk/lib/mod-sys.h b/lib/mod-sys.h similarity index 100% rename from hawk/lib/mod-sys.h rename to lib/mod-sys.h diff --git a/hawk/lib/mtx.c b/lib/mtx.c similarity index 100% rename from hawk/lib/mtx.c rename to lib/mtx.c diff --git a/hawk/lib/parse-prv.h b/lib/parse-prv.h similarity index 100% rename from hawk/lib/parse-prv.h rename to lib/parse-prv.h diff --git a/hawk/lib/parse.c b/lib/parse.c similarity index 100% rename from hawk/lib/parse.c rename to lib/parse.c diff --git a/hawk/lib/pio.c b/lib/pio.c similarity index 100% rename from hawk/lib/pio.c rename to lib/pio.c diff --git a/hawk/lib/rbt.c b/lib/rbt.c similarity index 100% rename from hawk/lib/rbt.c rename to lib/rbt.c diff --git a/hawk/lib/rec.c b/lib/rec.c similarity index 100% rename from hawk/lib/rec.c rename to lib/rec.c diff --git a/hawk/lib/rio-prv.h b/lib/rio-prv.h similarity index 100% rename from hawk/lib/rio-prv.h rename to lib/rio-prv.h diff --git a/hawk/lib/rio.c b/lib/rio.c similarity index 100% rename from hawk/lib/rio.c rename to lib/rio.c diff --git a/hawk/lib/run-prv.h b/lib/run-prv.h similarity index 100% rename from hawk/lib/run-prv.h rename to lib/run-prv.h diff --git a/hawk/lib/run.c b/lib/run.c similarity index 100% rename from hawk/lib/run.c rename to lib/run.c diff --git a/hawk/lib/sed-prv.h b/lib/sed-prv.h similarity index 100% rename from hawk/lib/sed-prv.h rename to lib/sed-prv.h diff --git a/hawk/lib/sed.c b/lib/sed.c similarity index 100% rename from hawk/lib/sed.c rename to lib/sed.c diff --git a/hawk/lib/sio.c b/lib/sio.c similarity index 100% rename from hawk/lib/sio.c rename to lib/sio.c diff --git a/hawk/lib/skad-prv.h b/lib/skad-prv.h similarity index 100% rename from hawk/lib/skad-prv.h rename to lib/skad-prv.h diff --git a/hawk/lib/skad.c b/lib/skad.c similarity index 100% rename from hawk/lib/skad.c rename to lib/skad.c diff --git a/hawk/lib/std-sed.c b/lib/std-sed.c similarity index 100% rename from hawk/lib/std-sed.c rename to lib/std-sed.c diff --git a/hawk/lib/std.c b/lib/std.c similarity index 100% rename from hawk/lib/std.c rename to lib/std.c diff --git a/hawk/lib/syscall.h b/lib/syscall.h similarity index 100% rename from hawk/lib/syscall.h rename to lib/syscall.h diff --git a/hawk/lib/tio.c b/lib/tio.c similarity index 100% rename from hawk/lib/tio.c rename to lib/tio.c diff --git a/hawk/lib/tre-ast.c b/lib/tre-ast.c similarity index 100% rename from hawk/lib/tre-ast.c rename to lib/tre-ast.c diff --git a/hawk/lib/tre-ast.h b/lib/tre-ast.h similarity index 100% rename from hawk/lib/tre-ast.h rename to lib/tre-ast.h diff --git a/hawk/lib/tre-compile.c b/lib/tre-compile.c similarity index 100% rename from hawk/lib/tre-compile.c rename to lib/tre-compile.c diff --git a/hawk/lib/tre-compile.h b/lib/tre-compile.h similarity index 100% rename from hawk/lib/tre-compile.h rename to lib/tre-compile.h diff --git a/hawk/lib/tre-match-bt.c b/lib/tre-match-bt.c similarity index 100% rename from hawk/lib/tre-match-bt.c rename to lib/tre-match-bt.c diff --git a/hawk/lib/tre-match-pa.c b/lib/tre-match-pa.c similarity index 100% rename from hawk/lib/tre-match-pa.c rename to lib/tre-match-pa.c diff --git a/hawk/lib/tre-match-ut.h b/lib/tre-match-ut.h similarity index 100% rename from hawk/lib/tre-match-ut.h rename to lib/tre-match-ut.h diff --git a/hawk/lib/tre-mem.c b/lib/tre-mem.c similarity index 100% rename from hawk/lib/tre-mem.c rename to lib/tre-mem.c diff --git a/hawk/lib/tre-mem.h b/lib/tre-mem.h similarity index 100% rename from hawk/lib/tre-mem.h rename to lib/tre-mem.h diff --git a/hawk/lib/tre-parse.c b/lib/tre-parse.c similarity index 100% rename from hawk/lib/tre-parse.c rename to lib/tre-parse.c diff --git a/hawk/lib/tre-parse.h b/lib/tre-parse.h similarity index 100% rename from hawk/lib/tre-parse.h rename to lib/tre-parse.h diff --git a/hawk/lib/tre-prv.h b/lib/tre-prv.h similarity index 100% rename from hawk/lib/tre-prv.h rename to lib/tre-prv.h diff --git a/hawk/lib/tre-stack.c b/lib/tre-stack.c similarity index 100% rename from hawk/lib/tre-stack.c rename to lib/tre-stack.c diff --git a/hawk/lib/tre-stack.h b/lib/tre-stack.h similarity index 100% rename from hawk/lib/tre-stack.h rename to lib/tre-stack.h diff --git a/hawk/lib/tre.c b/lib/tre.c similarity index 100% rename from hawk/lib/tre.c rename to lib/tre.c diff --git a/hawk/lib/tree-prv.h b/lib/tree-prv.h similarity index 100% rename from hawk/lib/tree-prv.h rename to lib/tree-prv.h diff --git a/hawk/lib/tree.c b/lib/tree.c similarity index 100% rename from hawk/lib/tree.c rename to lib/tree.c diff --git a/hawk/lib/uch-case.h b/lib/uch-case.h similarity index 100% rename from hawk/lib/uch-case.h rename to lib/uch-case.h diff --git a/hawk/lib/uch-prop.h b/lib/uch-prop.h similarity index 100% rename from hawk/lib/uch-prop.h rename to lib/uch-prop.h diff --git a/hawk/lib/utf16.c b/lib/utf16.c similarity index 100% rename from hawk/lib/utf16.c rename to lib/utf16.c diff --git a/hawk/lib/utf8.c b/lib/utf8.c similarity index 100% rename from hawk/lib/utf8.c rename to lib/utf8.c diff --git a/hawk/lib/utl-ass.c b/lib/utl-ass.c similarity index 100% rename from hawk/lib/utl-ass.c rename to lib/utl-ass.c diff --git a/hawk/lib/utl-cmgr.c b/lib/utl-cmgr.c similarity index 100% rename from hawk/lib/utl-cmgr.c rename to lib/utl-cmgr.c diff --git a/hawk/lib/utl-rnd.c b/lib/utl-rnd.c similarity index 100% rename from hawk/lib/utl-rnd.c rename to lib/utl-rnd.c diff --git a/hawk/lib/utl-sort.c b/lib/utl-sort.c similarity index 100% rename from hawk/lib/utl-sort.c rename to lib/utl-sort.c diff --git a/hawk/lib/utl-str.c b/lib/utl-str.c similarity index 100% rename from hawk/lib/utl-str.c rename to lib/utl-str.c diff --git a/hawk/lib/utl-str.c.m4 b/lib/utl-str.c.m4 similarity index 100% rename from hawk/lib/utl-str.c.m4 rename to lib/utl-str.c.m4 diff --git a/hawk/lib/utl-str.m4 b/lib/utl-str.m4 similarity index 100% rename from hawk/lib/utl-str.m4 rename to lib/utl-str.m4 diff --git a/hawk/lib/utl-sys.c b/lib/utl-sys.c similarity index 100% rename from hawk/lib/utl-sys.c rename to lib/utl-sys.c diff --git a/hawk/lib/utl-xstr.c b/lib/utl-xstr.c similarity index 100% rename from hawk/lib/utl-xstr.c rename to lib/utl-xstr.c diff --git a/hawk/lib/utl.c b/lib/utl.c similarity index 100% rename from hawk/lib/utl.c rename to lib/utl.c diff --git a/hawk/lib/val-prv.h b/lib/val-prv.h similarity index 100% rename from hawk/lib/val-prv.h rename to lib/val-prv.h diff --git a/hawk/lib/val.c b/lib/val.c similarity index 100% rename from hawk/lib/val.c rename to lib/val.c diff --git a/hawk/lib/xma.c b/lib/xma.c similarity index 100% rename from hawk/lib/xma.c rename to lib/xma.c diff --git a/hawk/m4/ax_check_sign.m4 b/m4/ax_check_sign.m4 similarity index 100% rename from hawk/m4/ax_check_sign.m4 rename to m4/ax_check_sign.m4 diff --git a/hawk/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 similarity index 100% rename from hawk/m4/ax_cxx_compile_stdcxx.m4 rename to m4/ax_cxx_compile_stdcxx.m4 diff --git a/hawk/m4/ax_cxx_namespace.m4 b/m4/ax_cxx_namespace.m4 similarity index 100% rename from hawk/m4/ax_cxx_namespace.m4 rename to m4/ax_cxx_namespace.m4 diff --git a/hawk/m4/ax_lib_mysql.m4 b/m4/ax_lib_mysql.m4 similarity index 100% rename from hawk/m4/ax_lib_mysql.m4 rename to m4/ax_lib_mysql.m4 diff --git a/hawk/m4/ax_numval.m4 b/m4/ax_numval.m4 similarity index 100% rename from hawk/m4/ax_numval.m4 rename to m4/ax_numval.m4 diff --git a/hawk/m4/ax_pthread.m4 b/m4/ax_pthread.m4 similarity index 100% rename from hawk/m4/ax_pthread.m4 rename to m4/ax_pthread.m4 diff --git a/hawk/m4/hawk_try_cflags.m4 b/m4/hawk_try_cflags.m4 similarity index 100% rename from hawk/m4/hawk_try_cflags.m4 rename to m4/hawk_try_cflags.m4 diff --git a/hawk/m4/libtool.m4 b/m4/libtool.m4 similarity index 99% rename from hawk/m4/libtool.m4 rename to m4/libtool.m4 index c81e6692..a6d21ae5 100644 --- a/hawk/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 @@ -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]) @@ -4704,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*) diff --git a/hawk/m4/ltoptions.m4 b/m4/ltoptions.m4 similarity index 100% rename from hawk/m4/ltoptions.m4 rename to m4/ltoptions.m4 diff --git a/hawk/m4/ltsugar.m4 b/m4/ltsugar.m4 similarity index 100% rename from hawk/m4/ltsugar.m4 rename to m4/ltsugar.m4 diff --git a/hawk/m4/ltversion.m4 b/m4/ltversion.m4 similarity index 100% rename from hawk/m4/ltversion.m4 rename to m4/ltversion.m4 diff --git a/hawk/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 similarity index 100% rename from hawk/m4/lt~obsolete.m4 rename to m4/lt~obsolete.m4 diff --git a/hawk/mod/Makefile.am b/mod/Makefile.am similarity index 100% rename from hawk/mod/Makefile.am rename to mod/Makefile.am diff --git a/hawk/mod/Makefile.in b/mod/Makefile.in similarity index 99% rename from hawk/mod/Makefile.in rename to mod/Makefile.in index 112da930..a78704d9 100644 --- a/hawk/mod/Makefile.in +++ b/mod/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/hawk/mod/mod-ffi.c b/mod/mod-ffi.c similarity index 100% rename from hawk/mod/mod-ffi.c rename to mod/mod-ffi.c diff --git a/hawk/mod/mod-ffi.h b/mod/mod-ffi.h similarity index 100% rename from hawk/mod/mod-ffi.h rename to mod/mod-ffi.h diff --git a/hawk/mod/mod-mysql.c b/mod/mod-mysql.c similarity index 100% rename from hawk/mod/mod-mysql.c rename to mod/mod-mysql.c diff --git a/hawk/mod/mod-mysql.h b/mod/mod-mysql.h similarity index 100% rename from hawk/mod/mod-mysql.h rename to mod/mod-mysql.h diff --git a/hawk/mod/mod-sed.c b/mod/mod-sed.c similarity index 100% rename from hawk/mod/mod-sed.c rename to mod/mod-sed.c diff --git a/hawk/mod/mod-sed.h b/mod/mod-sed.h similarity index 100% rename from hawk/mod/mod-sed.h rename to mod/mod-sed.h diff --git a/hawk/mod/mod-uci.c b/mod/mod-uci.c similarity index 100% rename from hawk/mod/mod-uci.c rename to mod/mod-uci.c diff --git a/hawk/mod/mod-uci.h b/mod/mod-uci.h similarity index 100% rename from hawk/mod/mod-uci.h rename to mod/mod-uci.h diff --git a/hawk/pkgs/hawk.spec.in b/pkgs/hawk.spec.in similarity index 100% rename from hawk/pkgs/hawk.spec.in rename to pkgs/hawk.spec.in diff --git a/hawk/samples/Makefile.am b/samples/Makefile.am similarity index 100% rename from hawk/samples/Makefile.am rename to samples/Makefile.am diff --git a/hawk/samples/Makefile.in b/samples/Makefile.in similarity index 99% rename from hawk/samples/Makefile.in rename to samples/Makefile.in index 2f5c3594..d1aa5198 100644 --- a/hawk/samples/Makefile.in +++ b/samples/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/hawk/samples/hawk02.c b/samples/hawk02.c similarity index 100% rename from hawk/samples/hawk02.c rename to samples/hawk02.c diff --git a/hawk/samples/hawk51.cpp b/samples/hawk51.cpp similarity index 100% rename from hawk/samples/hawk51.cpp rename to samples/hawk51.cpp diff --git a/hawk/samples/sed21.cpp b/samples/sed21.cpp similarity index 100% rename from hawk/samples/sed21.cpp rename to samples/sed21.cpp diff --git a/hawk/scripts/generrcode.hawk b/scripts/generrcode.hawk similarity index 100% rename from hawk/scripts/generrcode.hawk rename to scripts/generrcode.hawk diff --git a/hawk/scripts/genoptcode.hawk b/scripts/genoptcode.hawk similarity index 100% rename from hawk/scripts/genoptcode.hawk rename to scripts/genoptcode.hawk diff --git a/hawk/scripts/tcp-proxy.hawk b/scripts/tcp-proxy.hawk similarity index 100% rename from hawk/scripts/tcp-proxy.hawk rename to scripts/tcp-proxy.hawk diff --git a/hawk/t/Makefile.am b/t/Makefile.am similarity index 90% rename from hawk/t/Makefile.am rename to t/Makefile.am index d1aeacdf..d4a674e7 100644 --- a/hawk/t/Makefile.am +++ b/t/Makefile.am @@ -21,34 +21,34 @@ EXTRA_DIST = $(check_SCRIPTS) ensure.inc \ check_PROGRAMS = t-001 t-002 t-003 t-004 t-005 t-006 -t_001_SOURCES = t-001.c t.h +t_001_SOURCES = t-001.c tap.h t_001_CPPFLAGS = $(CPPFLAGS_COMMON) -t_002_SOURCES = t-002.c t.h +t_002_SOURCES = t-002.c tap.h t_002_CPPFLAGS = $(CPPFLAGS_COMMON) t_002_CFLAGS = $(CFLAGS_COMMON) t_002_LDFLAGS = $(LDFLAGS_COMMON) t_002_LDADD = $(LIBADD_COMMON) -t_003_SOURCES = t-003.c t.h +t_003_SOURCES = t-003.c tap.h t_003_CPPFLAGS = $(CPPFLAGS_COMMON) t_003_CFLAGS = $(CFLAGS_COMMON) t_003_LDFLAGS = $(LDFLAGS_COMMON) t_003_LDADD = $(LIBADD_COMMON) -t_004_SOURCES = t-004.c t.h +t_004_SOURCES = t-004.c tap.h t_004_CPPFLAGS = $(CPPFLAGS_COMMON) t_004_CFLAGS = $(CFLAGS_COMMON) t_004_LDFLAGS = $(LDFLAGS_COMMON) t_004_LDADD = $(LIBADD_COMMON) -t_005_SOURCES = t-005.c t.h +t_005_SOURCES = t-005.c tap.h t_005_CPPFLAGS = $(CPPFLAGS_COMMON) t_005_CFLAGS = $(CFLAGS_COMMON) t_005_LDFLAGS = $(LDFLAGS_COMMON) t_005_LDADD = $(LIBADD_COMMON) -t_006_SOURCES = t-006.c t.h +t_006_SOURCES = t-006.c tap.h t_006_CPPFLAGS = $(CPPFLAGS_COMMON) t_006_CFLAGS = $(CFLAGS_COMMON) t_006_LDFLAGS = $(LDFLAGS_COMMON) diff --git a/hawk/t/Makefile.in b/t/Makefile.in similarity index 99% rename from hawk/t/Makefile.in rename to t/Makefile.in index 02c6059f..ef78025b 100644 --- a/hawk/t/Makefile.in +++ b/t/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -579,29 +579,29 @@ EXTRA_DIST = $(check_SCRIPTS) ensure.inc \ journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \ bibtex-to-html.hawk bibtex-to-html.out -t_001_SOURCES = t-001.c t.h +t_001_SOURCES = t-001.c tap.h t_001_CPPFLAGS = $(CPPFLAGS_COMMON) -t_002_SOURCES = t-002.c t.h +t_002_SOURCES = t-002.c tap.h t_002_CPPFLAGS = $(CPPFLAGS_COMMON) t_002_CFLAGS = $(CFLAGS_COMMON) t_002_LDFLAGS = $(LDFLAGS_COMMON) t_002_LDADD = $(LIBADD_COMMON) -t_003_SOURCES = t-003.c t.h +t_003_SOURCES = t-003.c tap.h t_003_CPPFLAGS = $(CPPFLAGS_COMMON) t_003_CFLAGS = $(CFLAGS_COMMON) t_003_LDFLAGS = $(LDFLAGS_COMMON) t_003_LDADD = $(LIBADD_COMMON) -t_004_SOURCES = t-004.c t.h +t_004_SOURCES = t-004.c tap.h t_004_CPPFLAGS = $(CPPFLAGS_COMMON) t_004_CFLAGS = $(CFLAGS_COMMON) t_004_LDFLAGS = $(LDFLAGS_COMMON) t_004_LDADD = $(LIBADD_COMMON) -t_005_SOURCES = t-005.c t.h +t_005_SOURCES = t-005.c tap.h t_005_CPPFLAGS = $(CPPFLAGS_COMMON) t_005_CFLAGS = $(CFLAGS_COMMON) t_005_LDFLAGS = $(LDFLAGS_COMMON) t_005_LDADD = $(LIBADD_COMMON) -t_006_SOURCES = t-006.c t.h +t_006_SOURCES = t-006.c tap.h t_006_CPPFLAGS = $(CPPFLAGS_COMMON) t_006_CFLAGS = $(CFLAGS_COMMON) t_006_LDFLAGS = $(LDFLAGS_COMMON) diff --git a/hawk/t/bibtex-to-html.hawk b/t/bibtex-to-html.hawk similarity index 100% rename from hawk/t/bibtex-to-html.hawk rename to t/bibtex-to-html.hawk diff --git a/hawk/t/bibtex-to-html.out b/t/bibtex-to-html.out similarity index 100% rename from hawk/t/bibtex-to-html.out rename to t/bibtex-to-html.out diff --git a/hawk/t/h-001.hawk b/t/h-001.hawk similarity index 100% rename from hawk/t/h-001.hawk rename to t/h-001.hawk diff --git a/hawk/t/h-002.hawk b/t/h-002.hawk similarity index 100% rename from hawk/t/h-002.hawk rename to t/h-002.hawk diff --git a/hawk/t/h-003.hawk b/t/h-003.hawk similarity index 100% rename from hawk/t/h-003.hawk rename to t/h-003.hawk diff --git a/hawk/t/h-009.hawk b/t/h-009.hawk similarity index 100% rename from hawk/t/h-009.hawk rename to t/h-009.hawk diff --git a/hawk/t/journal-toc-html.out b/t/journal-toc-html.out similarity index 100% rename from hawk/t/journal-toc-html.out rename to t/journal-toc-html.out diff --git a/hawk/t/journal-toc.hawk b/t/journal-toc.hawk similarity index 100% rename from hawk/t/journal-toc.hawk rename to t/journal-toc.hawk diff --git a/hawk/t/journal-toc.in b/t/journal-toc.in similarity index 100% rename from hawk/t/journal-toc.in rename to t/journal-toc.in diff --git a/hawk/t/journal-toc.out b/t/journal-toc.out similarity index 100% rename from hawk/t/journal-toc.out rename to t/journal-toc.out diff --git a/hawk/t/t-001.c b/t/t-001.c similarity index 100% rename from hawk/t/t-001.c rename to t/t-001.c diff --git a/hawk/t/t-002.c b/t/t-002.c similarity index 100% rename from hawk/t/t-002.c rename to t/t-002.c diff --git a/hawk/t/t-003.c b/t/t-003.c similarity index 100% rename from hawk/t/t-003.c rename to t/t-003.c diff --git a/hawk/t/t-004.c b/t/t-004.c similarity index 100% rename from hawk/t/t-004.c rename to t/t-004.c diff --git a/hawk/t/t-005.c b/t/t-005.c similarity index 100% rename from hawk/t/t-005.c rename to t/t-005.c diff --git a/hawk/t/t-006.c b/t/t-006.c similarity index 100% rename from hawk/t/t-006.c rename to t/t-006.c diff --git a/hawk/t/tap.h b/t/tap.h similarity index 100% rename from hawk/t/tap.h rename to t/tap.h diff --git a/hawk/t/tap.inc b/t/tap.inc similarity index 100% rename from hawk/t/tap.inc rename to t/tap.inc diff --git a/hawk/t/test.txt b/t/test.txt similarity index 100% rename from hawk/t/test.txt rename to t/test.txt diff --git a/hawk/tools/Makefile.am b/tools/Makefile.am similarity index 100% rename from hawk/tools/Makefile.am rename to tools/Makefile.am diff --git a/hawk/tools/Makefile.in b/tools/Makefile.in similarity index 99% rename from hawk/tools/Makefile.in rename to tools/Makefile.in index 0dad1bfe..d8eb9b32 100644 --- a/hawk/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/hawk/tools/uni-case.c b/tools/uni-case.c similarity index 100% rename from hawk/tools/uni-case.c rename to tools/uni-case.c diff --git a/hawk/tools/uni-prop.c b/tools/uni-prop.c similarity index 100% rename from hawk/tools/uni-prop.c rename to tools/uni-prop.c