From 676496325e6cf4703030caafe1843db1bc8b3620 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 9 Jun 2022 05:33:46 +0000 Subject: [PATCH] added the Sed class and SedStd classes --- hawk/Makefile.in | 36 +- hawk/ac/ar-lib | 17 +- hawk/ac/compile | 6 +- hawk/ac/config.guess | 128 +- hawk/ac/config.sub | 2639 +++++++++++++++++++------------------- hawk/ac/depcomp | 2 +- hawk/ac/install-sh | 13 +- hawk/ac/ltmain.sh | 246 ++-- hawk/ac/missing | 2 +- hawk/ac/tap-driver.sh | 2 +- hawk/aclocal.m4 | 50 +- hawk/bin/Makefile.in | 4 +- hawk/bin/bin-hawk.c | 1 + hawk/configure | 83 +- hawk/lib/Hawk-Sed.hpp | 88 +- hawk/lib/Hawk.cpp | 4 +- hawk/lib/Makefile.in | 8 +- hawk/lib/Sed.cpp | 35 +- hawk/lib/Std-Sed.cpp | 433 +++++-- hawk/lib/gem.c | 4 + hawk/lib/hawk-sed.h | 33 +- hawk/lib/hawk.c | 26 +- hawk/lib/hawk.h | 22 +- hawk/lib/run.c | 30 +- hawk/lib/sed.c | 45 +- hawk/lib/tre-prv.h | 3 + hawk/m4/libtool.m4 | 48 +- hawk/mod/Makefile.in | 4 +- hawk/samples/Makefile.am | 9 +- hawk/samples/Makefile.in | 50 +- hawk/samples/sed21.cpp | 128 ++ hawk/t/Makefile.in | 4 +- hawk/tools/Makefile.in | 4 +- 33 files changed, 2472 insertions(+), 1735 deletions(-) create mode 100644 hawk/samples/sed21.cpp diff --git a/hawk/Makefile.in b/hawk/Makefile.in index 6b25e600..77ea5f63 100644 --- a/hawk/Makefile.in +++ b/hawk/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/ac/ar-lib b/hawk/ac/ar-lib index 1e9388e2..0baa4f60 100755 --- a/hawk/ac/ar-lib +++ b/hawk/ac/ar-lib @@ -2,9 +2,9 @@ # Wrapper for Microsoft lib.exe me=ar-lib -scriptversion=2019-07-04.01; # UTC +scriptversion=2012-03-01.08; # UTC -# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# Copyright (C) 2010-2018 Free Software Foundation, Inc. # Written by Peter Rosin . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN* | MSYS*) + CYGWIN*) file_conv=cygwin ;; *) @@ -65,7 +65,7 @@ func_file_conv () mingw) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin | msys) + cygwin) file=`cygpath -m "$file" || echo "$file"` ;; wine) @@ -224,11 +224,10 @@ elif test -n "$extract"; then esac done else - $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \ - | while read member - do - $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? - done + $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member + do + $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? + done fi elif test -n "$quick$replace"; then diff --git a/hawk/ac/compile b/hawk/ac/compile index 23fcba01..99e50524 100755 --- a/hawk/ac/compile +++ b/hawk/ac/compile @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN* | MSYS*) + CYGWIN*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/* | msys/*) + cygwin/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) diff --git a/hawk/ac/config.guess b/hawk/ac/config.guess index b33c9e89..f50dcdb6 100755 --- a/hawk/ac/config.guess +++ b/hawk/ac/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2018-08-29' +timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -84,6 +84,8 @@ if test $# != 0; then exit 1 fi +trap 'exit 1' 1 2 15 + # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a @@ -94,39 +96,34 @@ fi # Portable tmp directory creation inspired by the Autoconf team. -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15 -trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0 - -set_cc_for_build() { - : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039 - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } - dummy=$tmp/dummy - case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" - for driver in cc gcc c89 c99 ; do - if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD="$driver" - break - fi - done - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; - esac -} +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > "$dummy.c" ; + for c in cc gcc c89 c99 ; do + if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi @@ -141,7 +138,7 @@ Linux|GNU|GNU/*) # We could probably try harder. LIBC=gnu - set_cc_for_build + eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) @@ -202,7 +199,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) - set_cc_for_build + eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -240,7 +237,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi-}" + echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -392,15 +389,20 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" - case `isainfo -b` in - 32) - echo i386-pc-solaris2"$UNAME_REL" - ;; - 64) - echo x86_64-pc-solaris2"$UNAME_REL" - ;; - esac + eval "$set_cc_for_build" + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -480,7 +482,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ @@ -577,7 +579,7 @@ EOF exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include @@ -658,7 +660,7 @@ EOF esac fi if [ "$HP_ARCH" = "" ]; then - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE @@ -698,7 +700,7 @@ EOF esac if [ "$HP_ARCH" = hppa2.0w ] then - set_cc_for_build + eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -724,7 +726,7 @@ EOF echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int @@ -838,17 +840,6 @@ EOF *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; - arm:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - set_cc_for_build - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi - else - echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf - fi - exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in @@ -903,8 +894,8 @@ EOF # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; - *:Minix:*:*) - echo "$UNAME_MACHINE"-unknown-minix + i*86:Minix:*:*) + echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -931,7 +922,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) - set_cc_for_build + eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then @@ -980,7 +971,7 @@ EOF echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) - set_cc_for_build + eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} @@ -1055,7 +1046,11 @@ EOF echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + if objdump -f /bin/sh | grep -q elf32-x86-64; then + echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 + else + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" @@ -1294,7 +1289,7 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - set_cc_for_build + eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi @@ -1367,7 +1362,6 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else @@ -1479,7 +1473,7 @@ EOF exit 1 # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/hawk/ac/config.sub b/hawk/ac/config.sub index b51fb8cd..1d8e98bc 100755 --- a/hawk/ac/config.sub +++ b/hawk/ac/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. -timestamp='2018-08-29' +timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -110,1159 +110,1223 @@ case $# in exit 1;; esac -# Split fields of configuration type -IFS="-" read -r field1 field2 field3 field4 <&2 - exit 1 +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. ;; - *-*-*-*) - basic_machine=$field1-$field2 - os=$field3-$field4 + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc \ - | linux-newlib* | linux-musl* | linux-uclibc* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova*) - basic_machine=$field1 - os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - os=linux-android - ;; - *) - basic_machine=$field1-$field2 - os=$field3 - ;; - esac + -bluegene*) + os=-cnk ;; - *-*) - # A lone config we happen to match not fitting any patern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - os= - ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* \ - | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ - | ultra | tti* | harris | dolphin | highlevel | gould \ - | cbm | ns | masscomp | apple | axis | knuth | cray \ - | microblaze* | sim | cisco \ - | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - os= - ;; - *) - basic_machine=$field1 - os=$field2 - ;; - esac - ;; - esac + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - os=bsd - ;; - a29khif) - basic_machine=a29k-amd - os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=scout - ;; - alliant) - basic_machine=fx80-alliant - os= - ;; - altos | altos3068) - basic_machine=m68k-altos - os= - ;; - am29k) - basic_machine=a29k-none - os=bsd - ;; - amdahl) - basic_machine=580-amdahl - os=sysv - ;; - amiga) - basic_machine=m68k-unknown - os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=bsd - ;; - aros) - basic_machine=i386-pc - os=aros - ;; - aux) - basic_machine=m68k-apple - os=aux - ;; - balance) - basic_machine=ns32k-sequent - os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=linux - ;; - cegcc) - basic_machine=arm-unknown - os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=bsd - ;; - convex-c2) - basic_machine=c2-convex - os=bsd - ;; - convex-c32) - basic_machine=c32-convex - os=bsd - ;; - convex-c34) - basic_machine=c34-convex - os=bsd - ;; - convex-c38) - basic_machine=c38-convex - os=bsd - ;; - cray) - basic_machine=j90-cray - os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - os= - ;; - da30) - basic_machine=m68k-da30 - os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - os= - ;; - delta88) - basic_machine=m88k-motorola - os=sysv3 - ;; - dicos) - basic_machine=i686-pc - os=dicos - ;; - djgpp) - basic_machine=i586-pc - os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=ose - ;; - gmicro) - basic_machine=tron-gmicro - os=sysv - ;; - go32) - basic_machine=i386-pc - os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=hms - ;; - harris) - basic_machine=m88k-harris - os=sysv3 - ;; - hp300) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=hpux - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=proelf - ;; - i386mach) - basic_machine=i386-mach - os=mach - ;; - vsta) - basic_machine=i386-pc - os=vsta - ;; - isi68 | isi) - basic_machine=m68k-isi - os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - os=sysv - ;; - merlin) - basic_machine=ns32k-utek - os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - os=coff - ;; - morphos) - basic_machine=powerpc-unknown - os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=moxiebox - ;; - msdos) - basic_machine=i386-pc - os=msdos - ;; - msys) - basic_machine=i686-pc - os=msys - ;; - mvs) - basic_machine=i370-ibm - os=mvs - ;; - nacl) - basic_machine=le32-unknown - os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=newsos - ;; - news1000) - basic_machine=m68030-sony - os=newsos - ;; - necv70) - basic_machine=v70-nec - os=sysv - ;; - nh3000) - basic_machine=m68k-harris - os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=cxux - ;; - nindy960) - basic_machine=i960-intel - os=nindy - ;; - mon960) - basic_machine=i960-intel - os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=ose - ;; - os68k) - basic_machine=m68k-none - os=os68k - ;; - paragon) - basic_machine=i860-intel - os=osf - ;; - parisc) - basic_machine=hppa-unknown - os=linux - ;; - pw32) - basic_machine=i586-unknown - os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=rdos - ;; - rdos32) - basic_machine=i386-pc - os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=coff - ;; - sa29200) - basic_machine=a29k-amd - os=udi - ;; - sei) - basic_machine=mips-sei - os=seiux - ;; - sequent) - basic_machine=i386-sequent - os= - ;; - sps7) - basic_machine=m68k-bull - os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - os= - ;; - stratus) - basic_machine=i860-stratus - os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - os= - ;; - sun2os3) - basic_machine=m68000-sun - os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - os= - ;; - sun3os3) - basic_machine=m68k-sun - os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - os= - ;; - sun4os3) - basic_machine=sparc-sun - os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - os= - ;; - sv1) - basic_machine=sv1-cray - os=unicos - ;; - symmetry) - basic_machine=i386-sequent - os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=unicos - ;; - t90) - basic_machine=t90-cray - os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - os=tpf - ;; - udi29k) - basic_machine=a29k-amd - os=udi - ;; - ultra3) - basic_machine=a29k-nyu - os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=none - ;; - vaxv) - basic_machine=vax-dec - os=sysv - ;; - vms) - basic_machine=vax-dec - os=vms - ;; - vxworks960) - basic_machine=i960-wrs - os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=vxworks - ;; - xbox) - basic_machine=i686-pc - os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - os=unicos - ;; - *) - basic_machine=$1 - os= - ;; - esac + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint ;; esac -# Decode 1-component or ad-hoc basic machines +# Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in - # Here we handle the default manufacturer of certain CPU types. It is in - # some cases the only manufacturer, in others, it is the most popular. - w89k) - cpu=hppa1.1 - vendor=winbond + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown ;; - op50n) - cpu=hppa1.1 - vendor=oki + c54x) + basic_machine=tic54x-unknown ;; - op60c) - cpu=hppa1.1 - vendor=oki + c55x) + basic_machine=tic55x-unknown ;; - ibm*) - cpu=i370 - vendor=ibm - ;; - orion105) - cpu=clipper - vendor=highlevel - ;; - mac | mpw | mac-mpw) - cpu=m68k - vendor=apple - ;; - pmac | pmac-mpw) - cpu=powerpc - vendor=apple - ;; - - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - cpu=m68000 - vendor=att - ;; - 3b*) - cpu=we32k - vendor=att - ;; - bluegene*) - cpu=powerpc - vendor=ibm - os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - os=${os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - os=hiuxwe2 - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - cpu=m68000 - vendor=hp - ;; - hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - i*86v32) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=sysv32 - ;; - i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=sysv4 - ;; - i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=sysv - ;; - i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - os=${os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $os in - irix*) - ;; - *) - os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $os in - nextstep* ) - ;; - ns2*) - os=nextstep2 - ;; - *) - os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - os=hiuxwe2 - ;; - pbd) - cpu=sparc - vendor=tti - ;; - pbb) - cpu=m68k - vendor=tti - ;; - pc532) - cpu=ns32k - vendor=pc532 - ;; - pn) - cpu=pn - vendor=gould - ;; - power) - cpu=power - vendor=ibm - ;; - ps2) - cpu=i386 - vendor=ibm - ;; - rm[46]00) - cpu=mips - vendor=siemens - ;; - rtpc | rtpc-*) - cpu=romp - vendor=ibm - ;; - sde) - cpu=mipsisa32 - vendor=sde - os=${os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - os=vxworks - ;; - tower | tower-32) - cpu=m68k - vendor=ncr - ;; - vpp*|vx|vx-*) - cpu=f301 - vendor=fujitsu - ;; - w65) - cpu=w65 - vendor=wdc - ;; - w89k-*) - cpu=hppa1.1 - vendor=winbond - os=proelf - ;; - none) - cpu=none - vendor=none + c6x) + basic_machine=tic6x-unknown ;; leon|leon[3-9]) - cpu=sparc - vendor=$basic_machine + basic_machine=sparc-$basic_machine ;; - leon-*|leon[3-9]-*) - cpu=sparc - vendor=`echo "$basic_machine" | sed 's/-.*//'` + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + ;; + ms1) + basic_machine=mt-unknown ;; - *-*) - IFS="-" read -r cpu vendor <&2 + exit 1 ;; - # These rules are duplicated from below for sake of the special case above; - # i.e. things that normalized to x86 arches should also default to "pc" - pc98) - cpu=i386 - vendor=pc + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | ba-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | e2k-* | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ + | pyramid-* \ + | riscv32-* | riscv64-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | wasm32-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) ;; - x64 | amd64) - cpu=x86_64 - vendor=pc + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown ;; - # Recognize the basic CPU types without company name. - *) - cpu=$basic_machine - vendor=unknown + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-pc + os=-bsd ;; -esac - -unset -v basic_machine - -# Decode basic machines in the full and proper CPU-Company form. -case $cpu-$vendor in - # Here we handle the default manufacturer of certain CPU types in cannonical form. It is in - # some cases the only manufacturer, in others, it is the most popular. - craynv-unknown) - vendor=cray - os=${os:-unicosmp} + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att ;; - c90-unknown | c90-cray) - vendor=cray - os=${os:-unicos} + 3b*) + basic_machine=we32k-att ;; - fx80-unknown) - vendor=alliant + a29khif) + basic_machine=a29k-amd + os=-udi ;; - romp-unknown) - vendor=ibm + abacus) + basic_machine=abacus-unknown ;; - mmix-unknown) - vendor=knuth + adobe68k) + basic_machine=m68010-adobe + os=-scout ;; - microblaze-unknown | microblazeel-unknown) - vendor=xilinx + alliant | fx80) + basic_machine=fx80-alliant ;; - rs6000-unknown) - vendor=ibm + altos | altos3068) + basic_machine=m68k-altos ;; - vax-unknown) - vendor=dec + am29k) + basic_machine=a29k-none + os=-bsd ;; - pdp11-unknown) - vendor=dec + amd64) + basic_machine=x86_64-pc ;; - we32k-unknown) - vendor=att - ;; - cydra-unknown) - vendor=cydrome - ;; - i370-ibm*) - vendor=ibm - ;; - orion-unknown) - vendor=highlevel - ;; - xps-unknown | xps100-unknown) - cpu=xps100 - vendor=honeywell - ;; - - # Here we normalize CPU types with a missing or matching vendor - dpx20-unknown | dpx20-bull) - cpu=rs6000 - vendor=bull - os=${os:-bosx} - ;; - - # Here we normalize CPU types irrespective of the vendor amd64-*) - cpu=x86_64 + basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + asmjs) + basic_machine=asmjs-unknown + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux ;; blackfin-*) - cpu=bfin - os=linux + basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk ;; c54x-*) - cpu=tic54x + basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) - cpu=tic55x + basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) - cpu=tic6x + basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; - e500v[12]-*) - cpu=powerpc + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2*) + basic_machine=m68k-bull + os=-sysv3 + ;; + e500v[12]) + basic_machine=powerpc-unknown os=$os"spe" ;; - mips3*-*) - cpu=mips64 + e500v[12]-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=$os"spe" ;; - ms1-*) - cpu=mt + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux ;; m68knommu-*) - cpu=m68k - os=linux + basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux ;; - m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) - cpu=s12z + magnum | m3230) + basic_machine=mips-mips + os=-sysv ;; - openrisc-*) - cpu=or32 + merlin) + basic_machine=ns32k-utek + os=-sysv ;; - parisc-*) - cpu=hppa - os=linux + microblaze*) + basic_machine=microblaze-xilinx ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - cpu=i586 + mingw64) + basic_machine=x86_64-pc + os=-mingw64 ;; - pentiumpro-* | p6-* | 6x86-* | athlon-* | athalon_*-*) - cpu=i686 + mingw32) + basic_machine=i686-pc + os=-mingw32 ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - cpu=i686 + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce ;; - pentium4-*) - cpu=i786 + miniframe) + basic_machine=m68000-convergent ;; - pc98-*) - cpu=i386 + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint ;; - ppc-* | ppcbe-*) - cpu=powerpc + mips3*-*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; - ppcle-* | powerpclittle-*) - cpu=powerpcle + mips3*) + basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; - ppc64-*) - cpu=powerpc64 + monitor) + basic_machine=m68k-rom68k + os=-coff ;; - ppc64le-* | powerpc64little-*) - cpu=powerpc64le + morphos) + basic_machine=powerpc-unknown + os=-morphos ;; - sb1-*) - cpu=mipsisa64sb1 + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox ;; - sb1el-*) - cpu=mipsisa64sb1el + msdos) + basic_machine=i386-pc + os=-msdos ;; - sh5e[lb]-*) - cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + ms1-*) + basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; - spur-*) - cpu=spur + msys) + basic_machine=i686-pc + os=-msys ;; - strongarm-* | thumb-*) - cpu=arm + mvs) + basic_machine=i370-ibm + os=-mvs ;; - tx39-*) - cpu=mipstx39 + nacl) + basic_machine=le32-unknown + os=-nacl ;; - tx39el-*) - cpu=mipstx39el + ncr3000) + basic_machine=i486-ncr + os=-sysv4 ;; - x64-*) - cpu=x86_64 + netbsd386) + basic_machine=i386-unknown + os=-netbsd ;; - xscale-* | xscalee[bl]-*) - cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + netwinder) + basic_machine=armv4l-rebel + os=-linux ;; - - # Recognize the cannonical CPU Types that limit and/or modify the - # company names they are paired with. - cr16-*) - os=${os:-elf} + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos ;; - crisv32-* | etraxfs*-*) - cpu=crisv32 - vendor=axis + news1000) + basic_machine=m68030-sony + os=-newsos ;; - cris-* | etrax*-*) - cpu=cris - vendor=axis + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos ;; - crx-*) - os=${os:-elf} + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould ;; neo-tandem) - cpu=neo - vendor=tandem + basic_machine=neo-tandem ;; nse-tandem) - cpu=nse - vendor=tandem + basic_machine=nse-tandem ;; nsr-tandem) - cpu=nsr - vendor=tandem + basic_machine=nsr-tandem ;; nsv-tandem) - cpu=nsv - vendor=tandem + basic_machine=nsv-tandem ;; nsx-tandem) - cpu=nsx - vendor=tandem + basic_machine=nsx-tandem ;; - s390-*) - cpu=s390 - vendor=ibm + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf ;; - s390x-*) - cpu=s390x - vendor=ibm + openrisc | openrisc-*) + basic_machine=or32-unknown ;; - tile*-*) - os=${os:-linux-gnu} + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + x64) + basic_machine=x86_64-pc + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + none) + basic_machine=none-none + os=-none ;; +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; *) - # Recognize the cannonical CPU types that are allowed with any - # company name. - case $cpu in - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | abacus \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ - | alphapca5[67] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[lb]e | arme[lb] | armv* \ - | avr | avr32 \ - | asmjs \ - | ba \ - | be32 | be64 \ - | bfin | bs2000 \ - | c[123]* | c30 | [cjt]90 | c4x \ - | c8051 | clipper | craynv | csky | cydra \ - | d10v | d30v | dlx | dsp16xx \ - | e2k | elxsi | epiphany \ - | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ - | h8300 | h8500 \ - | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i*86 | i860 | i960 | ia16 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle \ - | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k | v70 | w65 \ - | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip \ - | m88110 | m88k | maxq | mb | mcore | mep | metag \ - | microblaze | microblazeel \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mmix \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nfp \ - | nios | nios2 | nios2eb | nios2el \ - | none | np1 | ns16k | ns32k \ - | open8 \ - | or1k* \ - | or32 \ - | orion \ - | pdp10 | pdp11 | pj | pjl | pn | power \ - | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ - | pru \ - | pyramid \ - | riscv | riscv32 | riscv64 \ - | rl78 | romp | rs6000 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ - | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ - | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ - | spu \ - | tahoe \ - | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ - | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ - | vax \ - | visium \ - | wasm32 \ - | we32k \ - | x86 | x86_64 | xc16x | xgate | xps100 \ - | xstormy16 | xtensa* \ - | ymp \ - | z8k | z80) - ;; - - *) - echo Invalid configuration \`"$1"\': machine \`"$cpu-$vendor"\' not recognized 1>&2 - exit 1 - ;; - esac + echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. -case $vendor in - digital*) - vendor=dec +case $basic_machine in + *-digital*) + basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; - commodore*) - vendor=cbm + *-commodore*) + basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1270,245 +1334,199 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x$os != x ] +if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. - # solaris* is a basic system type, with this one exception. - auroraux) - os=auroraux + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux ;; - bluegene*) - os=cnk - ;; - solaris1 | solaris1.*) + -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; - solaris) - os=solaris2 + -solaris) + os=-solaris2 ;; - unixware*) - os=sysv4.2uw + -unixware*) + os=-sysv4.2uw ;; - gnu/linux*) + -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) - es1800*) - os=ose - ;; - # Some version numbers need modification - chorusos*) - os=chorusos - ;; - isc) - os=isc2.2 - ;; - sco6) - os=sco5v6 - ;; - sco5) - os=sco3.2v5 - ;; - sco4) - os=sco3.2v4 - ;; - sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - ;; - sco3.2v[4-9]* | sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - ;; - scout) - # Don't match below - ;; - sco*) - os=sco3.2v2 - ;; - psos*) - os=psos + -es1800*) + os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. - # sysv* is not here because it comes later, after sysvr4. - gnu* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ - | *vms* | esix* | aix* | cnk* | sunos | sunos[34]*\ - | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ - | sym* | kopensolaris* | plan9* \ - | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ - | aos* | aros* | cloudabi* | sortix* \ - | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ - | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ - | knetbsd* | mirbsd* | netbsd* \ - | bitrig* | openbsd* | solidbsd* | libertybsd* \ - | ekkobsd* | kfreebsd* | freebsd* | riscix* | lynxos* \ - | bosx* | nextstep* | cxux* | aout* | elf* | oabi* \ - | ptx* | coff* | ecoff* | winnt* | domain* | vsta* \ - | udi* | eabi* | lites* | ieee* | go32* | aux* | hcos* \ - | chorusrdb* | cegcc* | glidix* \ - | cygwin* | msys* | pe* | moss* | proelf* | rtems* \ - | midipix* | mingw32* | mingw64* | linux-gnu* | linux-android* \ - | linux-newlib* | linux-musl* | linux-uclibc* \ - | uxpv* | beos* | mpeix* | udk* | moxiebox* \ - | interix* | uwin* | mks* | rhapsody* | darwin* \ - | openstep* | oskit* | conix* | pw32* | nonstopux* \ - | storm-chaos* | tops10* | tenex* | tops20* | its* \ - | os2* | vos* | palmos* | uclinux* | nucleus* \ - | morphos* | superux* | rtmk* | windiss* \ - | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd*) + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ + | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; - qnx*) - case $cpu in - x86 | i*86) + -qnx*) + case $basic_machine in + x86-* | i*86-*) ;; *) - os=nto-$os + os=-nto$os ;; esac ;; - hiux*) - os=hiuxwe2 + -nto-qnx*) ;; - nto-qnx*) - ;; - nto*) + -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - sim | xray | os68k* | v88r* \ - | windows* | osx | abug | netware* | os9* \ - | macos* | mpw* | magic* | mmixware* | mon960* | lnews*) + -sim | -xray | -os68k* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; - linux-dietlibc) - os=linux-dietlibc - ;; - linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - lynx*178) - os=lynxos178 - ;; - lynx*5) - os=lynxos5 - ;; - lynx*) - os=lynxos - ;; - mac*) + -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; - opened*) - os=openedition + -linux-dietlibc) + os=-linux-dietlibc ;; - os400*) - os=os400 + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; - sunos5*) + -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; - sunos6*) + -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; - wince*) - os=wince + -opened*) + os=-openedition ;; - utek*) - os=bsd + -os400*) + os=-os400 ;; - dynix*) - os=bsd + -wince*) + os=-wince ;; - acis*) - os=aos + -utek*) + os=-bsd ;; - atheos*) - os=atheos + -dynix*) + os=-bsd ;; - syllable*) - os=syllable + -acis*) + os=-aos ;; - 386bsd) - os=bsd + -atheos*) + os=-atheos ;; - ctix* | uts*) - os=sysv + -syllable*) + os=-syllable ;; - nova*) - os=rtmk-nova + -386bsd) + os=-bsd ;; - ns2) - os=nextstep2 + -ctix* | -uts*) + os=-sysv ;; - nsk*) - os=nsk + -nova*) + os=-rtmk-nova + ;; + -ns2) + os=-nextstep2 + ;; + -nsk*) + os=-nsk ;; # Preserve the version number of sinix5. - sinix5.*) + -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; - sinix*) - os=sysv4 + -sinix*) + os=-sysv4 ;; - tpf*) - os=tpf + -tpf*) + os=-tpf ;; - triton*) - os=sysv3 + -triton*) + os=-sysv3 ;; - oss*) - os=sysv3 + -oss*) + os=-sysv3 ;; - svr4*) - os=sysv4 + -svr4*) + os=-sysv4 ;; - svr3) - os=sysv3 + -svr3) + os=-sysv3 ;; - sysvr4) - os=sysv4 + -sysvr4) + os=-sysv4 ;; - # This must come after sysvr4. - sysv*) + # This must come after -sysvr4. + -sysv*) ;; - ose*) - os=ose + -ose*) + os=-ose ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) - os=mint + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint ;; - zvmoe) - os=zvmoe + -zvmoe) + os=-zvmoe ;; - dicos*) - os=dicos + -dicos*) + os=-dicos ;; - pikeos*) + -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. - case $cpu in + case $basic_machine in arm*) - os=eabi + os=-eabi ;; *) - os=elf + os=-elf ;; esac ;; - nacl*) + -nacl*) ;; - ios) + -ios) ;; - none) - ;; - *-eabi) + -none) ;; *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; @@ -1525,265 +1543,258 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $cpu-$vendor in +case $basic_machine in score-*) - os=elf + os=-elf ;; spu-*) - os=elf + os=-elf ;; *-acorn) - os=riscix1.2 + os=-riscix1.2 ;; arm*-rebel) - os=linux + os=-linux ;; arm*-semi) - os=aout + os=-aout ;; c4x-* | tic4x-*) - os=coff + os=-coff ;; c8051-*) - os=elf - ;; - clipper-intergraph) - os=clix + os=-elf ;; hexagon-*) - os=elf + os=-elf ;; tic54x-*) - os=coff + os=-coff ;; tic55x-*) - os=coff + os=-coff ;; tic6x-*) - os=coff + os=-coff ;; # This must come before the *-dec entry. pdp10-*) - os=tops20 + os=-tops20 ;; pdp11-*) - os=none + os=-none ;; *-dec | vax-*) - os=ultrix4.2 + os=-ultrix4.2 ;; m68*-apollo) - os=domain + os=-domain ;; i386-sun) - os=sunos4.0.2 + os=-sunos4.0.2 ;; m68000-sun) - os=sunos3 + os=-sunos3 ;; m68*-cisco) - os=aout + os=-aout ;; mep-*) - os=elf + os=-elf ;; mips*-cisco) - os=elf + os=-elf ;; mips*-*) - os=elf + os=-elf ;; or32-*) - os=coff + os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=sysv3 + os=-sysv3 ;; sparc-* | *-sun) - os=sunos4.1.1 + os=-sunos4.1.1 ;; pru-*) - os=elf + os=-elf ;; *-be) - os=beos + os=-beos ;; *-ibm) - os=aix + os=-aix ;; *-knuth) - os=mmixware + os=-mmixware ;; *-wec) - os=proelf + os=-proelf ;; *-winbond) - os=proelf + os=-proelf ;; *-oki) - os=proelf + os=-proelf ;; *-hp) - os=hpux + os=-hpux ;; *-hitachi) - os=hiux + os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=sysv + os=-sysv ;; *-cbm) - os=amigaos + os=-amigaos ;; *-dg) - os=dgux + os=-dgux ;; *-dolphin) - os=sysv3 + os=-sysv3 ;; m68k-ccur) - os=rtu + os=-rtu ;; m88k-omron*) - os=luna + os=-luna ;; *-next) - os=nextstep + os=-nextstep ;; *-sequent) - os=ptx + os=-ptx ;; *-crds) - os=unos + os=-unos ;; *-ns) - os=genix + os=-genix ;; i370-*) - os=mvs + os=-mvs ;; *-gould) - os=sysv + os=-sysv ;; *-highlevel) - os=bsd + os=-bsd ;; *-encore) - os=bsd + os=-bsd ;; *-sgi) - os=irix + os=-irix ;; *-siemens) - os=sysv4 + os=-sysv4 ;; *-masscomp) - os=rtu + os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=uxpv + os=-uxpv ;; *-rom68k) - os=coff + os=-coff ;; *-*bug) - os=coff + os=-coff ;; *-apple) - os=macos + os=-macos ;; *-atari*) - os=mint - ;; - *-wrs) - os=vxworks + os=-mint ;; *) - os=none + os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. -case $vendor in - unknown) +vendor=unknown +case $basic_machine in + *-unknown) case $os in - riscix*) + -riscix*) vendor=acorn ;; - sunos*) + -sunos*) vendor=sun ;; - cnk*|-aix*) + -cnk*|-aix*) vendor=ibm ;; - beos*) + -beos*) vendor=be ;; - hpux*) + -hpux*) vendor=hp ;; - mpeix*) + -mpeix*) vendor=hp ;; - hiux*) + -hiux*) vendor=hitachi ;; - unos*) + -unos*) vendor=crds ;; - dgux*) + -dgux*) vendor=dg ;; - luna*) + -luna*) vendor=omron ;; - genix*) + -genix*) vendor=ns ;; - clix*) - vendor=intergraph - ;; - mvs* | opened*) + -mvs* | -opened*) vendor=ibm ;; - os400*) + -os400*) vendor=ibm ;; - ptx*) + -ptx*) vendor=sequent ;; - tpf*) + -tpf*) vendor=ibm ;; - vxsim* | vxworks* | windiss*) + -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; - aux*) + -aux*) vendor=apple ;; - hms*) + -hms*) vendor=hitachi ;; - mpw* | macos*) + -mpw* | -macos*) vendor=apple ;; - *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; - vos*) + -vos*) vendor=stratus ;; esac + basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac -echo "$cpu-$vendor-$os" +echo "$basic_machine$os" exit # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/hawk/ac/depcomp b/hawk/ac/depcomp index 6b391623..65cbf709 100755 --- a/hawk/ac/depcomp +++ b/hawk/ac/depcomp @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 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 diff --git a/hawk/ac/install-sh b/hawk/ac/install-sh index 20d8b2ea..8175c640 100755 --- a/hawk/ac/install-sh +++ b/hawk/ac/install-sh @@ -451,18 +451,7 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (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") && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # diff --git a/hawk/ac/ltmain.sh b/hawk/ac/ltmain.sh index 7f3523d3..c12c197b 100644 --- a/hawk/ac/ltmain.sh +++ b/hawk/ac/ltmain.sh @@ -31,7 +31,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION=2.4.6 +VERSION="2.4.6 Debian-2.4.6-9" package_revision=2.4.6 @@ -1370,7 +1370,7 @@ func_lt_ver () #! /bin/sh # Set a version string for this script. -scriptversion=2014-01-07.03; # UTC +scriptversion=2015-10-07.11; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 @@ -1530,6 +1530,8 @@ func_run_hooks () { $debug_cmd + _G_rc_run_hooks=false + case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; @@ -1538,16 +1540,16 @@ func_run_hooks () eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do - eval $_G_hook '"$@"' - - # store returned options list back into positional - # parameters for next 'cmd' execution. - eval _G_hook_result=\$${_G_hook}_result - eval set dummy "$_G_hook_result"; shift + if eval $_G_hook '"$@"'; then + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + _G_rc_run_hooks=: + fi done - func_quote_for_eval ${1+"$@"} - func_run_hooks_result=$func_quote_for_eval_result + $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result } @@ -1557,10 +1559,16 @@ func_run_hooks () ## --------------- ## # In order to add your own option parsing hooks, you must accept the -# full positional parameter list in your hook function, remove any -# options that you action, and then pass back the remaining unprocessed +# full positional parameter list in your hook function, you may remove/edit +# any options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for -# 'eval'. Like this: +# 'eval'. In this case you also must return $EXIT_SUCCESS to let the +# hook's caller know that it should pay attention to +# '_result'. Returning $EXIT_FAILURE signalizes that +# arguments are left untouched by the hook and therefore caller will ignore the +# result variable. +# +# Like this: # # my_options_prep () # { @@ -1570,9 +1578,11 @@ func_run_hooks () # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' -# -# func_quote_for_eval ${1+"$@"} -# my_options_prep_result=$func_quote_for_eval_result +# # No change in '$@' (ignored completely by this hook). There is +# # no need to do the equivalent (but slower) action: +# # func_quote_for_eval ${1+"$@"} +# # my_options_prep_result=$func_quote_for_eval_result +# false # } # func_add_hook func_options_prep my_options_prep # @@ -1581,25 +1591,37 @@ func_run_hooks () # { # $debug_cmd # +# args_changed=false +# # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in -# --silent|-s) opt_silent=: ;; +# --silent|-s) opt_silent=: +# args_changed=: +# ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift +# args_changed=: # ;; -# *) set dummy "$_G_opt" "$*"; shift; break ;; +# *) # Make sure the first unrecognised option "$_G_opt" +# # is added back to "$@", we could need that later +# # if $args_changed is true. +# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; # esac # done # -# func_quote_for_eval ${1+"$@"} -# my_silent_option_result=$func_quote_for_eval_result +# if $args_changed; then +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# fi +# +# $args_changed # } # func_add_hook func_parse_options my_silent_option # @@ -1611,16 +1633,32 @@ func_run_hooks () # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # -# func_quote_for_eval ${1+"$@"} -# my_option_validation_result=$func_quote_for_eval_result +# false # } # func_add_hook func_validate_options my_option_validation # -# You'll alse need to manually amend $usage_message to reflect the extra +# You'll also need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. +# func_options_finish [ARG]... +# ---------------------------- +# Finishing the option parse loop (call 'func_options' hooks ATM). +func_options_finish () +{ + $debug_cmd + + _G_func_options_finish_exit=false + if func_run_hooks func_options ${1+"$@"}; then + func_options_finish_result=$func_run_hooks_result + _G_func_options_finish_exit=: + fi + + $_G_func_options_finish_exit +} + + # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the @@ -1630,17 +1668,28 @@ func_options () { $debug_cmd - func_options_prep ${1+"$@"} - eval func_parse_options \ - ${func_options_prep_result+"$func_options_prep_result"} - eval func_validate_options \ - ${func_parse_options_result+"$func_parse_options_result"} + _G_rc_options=false - eval func_run_hooks func_options \ - ${func_validate_options_result+"$func_validate_options_result"} + for my_func in options_prep parse_options validate_options options_finish + do + if eval func_$my_func '${1+"$@"}'; then + eval _G_res_var='$'"func_${my_func}_result" + eval set dummy "$_G_res_var" ; shift + _G_rc_options=: + fi + done - # save modified positional parameters for caller - func_options_result=$func_run_hooks_result + # Save modified positional parameters for caller. As a top-level + # options-parser function we always need to set the 'func_options_result' + # variable (regardless the $_G_rc_options value). + if $_G_rc_options; then + func_options_result=$_G_res_var + else + func_quote_for_eval ${1+"$@"} + func_options_result=$func_quote_for_eval_result + fi + + $_G_rc_options } @@ -1649,9 +1698,9 @@ func_options () # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and -# needs to propogate that back to rest of this script, then the complete +# needs to propagate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before -# returning. +# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). func_hookable func_options_prep func_options_prep () { @@ -1661,10 +1710,14 @@ func_options_prep () opt_verbose=false opt_warning_types= - func_run_hooks func_options_prep ${1+"$@"} + _G_rc_options_prep=false + if func_run_hooks func_options_prep ${1+"$@"}; then + _G_rc_options_prep=: + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result + fi - # save modified positional parameters for caller - func_options_prep_result=$func_run_hooks_result + $_G_rc_options_prep } @@ -1678,18 +1731,20 @@ func_parse_options () func_parse_options_result= + _G_rc_parse_options=false # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. - func_run_hooks func_parse_options ${1+"$@"} - - # Adjust func_parse_options positional parameters to match - eval set dummy "$func_run_hooks_result"; shift + if func_run_hooks func_parse_options ${1+"$@"}; then + eval set dummy "$func_run_hooks_result"; shift + _G_rc_parse_options=: + fi # Break out of the loop if we already parsed every option. test $# -gt 0 || break + _G_match_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -1704,7 +1759,10 @@ func_parse_options () ;; --warnings|--warning|-W) - test $# = 0 && func_missing_arg $_G_opt && break + if test $# = 0 && func_missing_arg $_G_opt; then + _G_rc_parse_options=: + break + fi case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above @@ -1757,15 +1815,25 @@ func_parse_options () shift ;; - --) break ;; + --) _G_rc_parse_options=: ; break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift + _G_match_parse_options=false + break + ;; esac + + $_G_match_parse_options && _G_rc_parse_options=: done - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - func_parse_options_result=$func_quote_for_eval_result + + if $_G_rc_parse_options; then + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result + fi + + $_G_rc_parse_options } @@ -1778,16 +1846,21 @@ func_validate_options () { $debug_cmd + _G_rc_validate_options=false + # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" - func_run_hooks func_validate_options ${1+"$@"} + if func_run_hooks func_validate_options ${1+"$@"}; then + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result + _G_rc_validate_options=: + fi # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE - # save modified positional parameters for caller - func_validate_options_result=$func_run_hooks_result + $_G_rc_validate_options } @@ -2068,12 +2141,12 @@ include the following information: compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) - version: $progname (GNU libtool) 2.4.6 + version: $progname $scriptversion Debian-2.4.6-9 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . -GNU libtool home page: . +GNU libtool home page: . General help using GNU software: ." exit 0 } @@ -2124,7 +2197,7 @@ fi # a configuration failure hint, and exit. func_fatal_configuration () { - func_fatal_error ${1+"$@"} \ + func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } @@ -2270,6 +2343,8 @@ libtool_options_prep () nonopt= preserve_args= + _G_rc_lt_options_prep=: + # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) @@ -2293,11 +2368,18 @@ libtool_options_prep () uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; + *) + _G_rc_lt_options_prep=false + ;; esac - # Pass back the list of options. - func_quote_for_eval ${1+"$@"} - libtool_options_prep_result=$func_quote_for_eval_result + if $_G_rc_lt_options_prep; then + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result + fi + + $_G_rc_lt_options_prep } func_add_hook func_options_prep libtool_options_prep @@ -2309,9 +2391,12 @@ libtool_parse_options () { $debug_cmd + _G_rc_lt_parse_options=false + # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do + _G_match_lt_parse_options=: _G_opt=$1 shift case $_G_opt in @@ -2386,15 +2471,22 @@ libtool_parse_options () func_append preserve_args " $_G_opt" ;; - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"} ; shift + _G_match_lt_parse_options=false + break + ;; esac + $_G_match_lt_parse_options && _G_rc_lt_parse_options=: done + if $_G_rc_lt_parse_options; then + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result + fi - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - libtool_parse_options_result=$func_quote_for_eval_result + $_G_rc_lt_parse_options } func_add_hook func_parse_options libtool_parse_options @@ -7274,10 +7366,12 @@ func_mode_link () # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -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 -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=*) + -specs=*|-fsanitize=*|-fuse-ld=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" @@ -7570,7 +7664,10 @@ func_mode_link () case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + link) + libs="$deplibs %DEPLIBS%" + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" + ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then @@ -7889,19 +7986,19 @@ func_mode_link () # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done continue fi # $pass = conv @@ -8825,6 +8922,9 @@ func_mode_link () revision=$number_minor lt_irix_increment=no ;; + *) + func_fatal_configuration "$modename: unknown library version type '$version_type'" + ;; esac ;; no) diff --git a/hawk/ac/missing b/hawk/ac/missing index 8d0eaad2..625aeb11 100755 --- a/hawk/ac/missing +++ b/hawk/ac/missing @@ -3,7 +3,7 @@ scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify diff --git a/hawk/ac/tap-driver.sh b/hawk/ac/tap-driver.sh index 865761d3..2516e9c3 100755 --- a/hawk/ac/tap-driver.sh +++ b/hawk/ac/tap-driver.sh @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2011-2020 Free Software Foundation, Inc. +# Copyright (C) 2011-2018 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 diff --git a/hawk/aclocal.m4 b/hawk/aclocal.m4 index 6cac91f3..31af506d 100644 --- a/hawk/aclocal.m4 +++ b/hawk/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.in b/hawk/bin/Makefile.in index 7c30563c..1839be6e 100644 --- a/hawk/bin/Makefile.in +++ b/hawk/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/bin-hawk.c b/hawk/bin/bin-hawk.c index 0832d764..34c5d2cf 100644 --- a/hawk/bin/bin-hawk.c +++ b/hawk/bin/bin-hawk.c @@ -1122,6 +1122,7 @@ static HAWK_INLINE int execute_hawk (int argc, hawk_bch_t* argv[]) HAWK_FV(.close, HAWK_NULL), HAWK_FV(.stmt, on_statement), HAWK_FV(.gblset, HAWK_NULL) + HAWK_FV(.ctx, HAWK_NULL) }; #endif diff --git a/hawk/configure b/hawk/configure index 80105b1a..7a42beff 100755 --- a/hawk/configure +++ b/hawk/configure @@ -7881,7 +7881,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else @@ -8744,11 +8744,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" @@ -11583,6 +11580,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie openbsd* | bitrig*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs=no + ;; esac ld_shlibs=yes @@ -11837,7 +11837,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -12507,6 +12507,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + link_all_deplibs=no else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' @@ -12528,7 +12529,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -13623,9 +13624,6 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command @@ -13634,7 +13632,7 @@ fi # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -13646,6 +13644,18 @@ fi dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -15036,7 +15046,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # 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 @@ -15528,7 +15538,7 @@ fi # 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 @@ -15593,7 +15603,7 @@ fi # 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 @@ -15932,7 +15942,7 @@ fi # 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 @@ -16016,7 +16026,7 @@ fi # 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. @@ -16027,7 +16037,7 @@ fi # 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 hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' @@ -16540,7 +16550,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -16915,6 +16925,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + link_all_deplibs_CXX=no + ;; *) export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -17588,9 +17601,6 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command @@ -17599,7 +17609,7 @@ fi # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -17611,6 +17621,18 @@ fi dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -18067,7 +18089,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]; @@ -18113,7 +18135,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]; @@ -18137,7 +18159,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]; @@ -18182,7 +18204,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]; @@ -18206,7 +18228,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]; @@ -26118,9 +26140,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; } @@ -26147,7 +26167,6 @@ See \`config.log' for more details" "$LINENO" 5; } cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. diff --git a/hawk/lib/Hawk-Sed.hpp b/hawk/lib/Hawk-Sed.hpp index 39d8ccf1..eaca0c7d 100644 --- a/hawk/lib/Hawk-Sed.hpp +++ b/hawk/lib/Hawk-Sed.hpp @@ -52,7 +52,7 @@ public: /// The Stream class is a abstract class for I/O operation during /// execution. /// - class HAWK_EXPORT Stream + class HAWK_EXPORT Stream: public Uncopyable { public: /// The Mode type defines I/O modes. @@ -183,7 +183,7 @@ public: /// streams defined through I/O handlers /// \return 0 on success, -1 on failure /// - int execute (Stream& iostream); + int execute (Stream& istream, Stream& ostream); /// /// The halt() function makes a request to break a running loop @@ -246,6 +246,20 @@ public: const hawk_loc_t* loc = HAWK_NULL ///< error location ); + void formatError ( + hawk_errnum_t code, + const hawk_loc_t* loc, + const hawk_bch_t* fmt, + ... + ); + + void formatError ( + hawk_errnum_t code, + const hawk_loc_t* loc, + const hawk_uch_t* fmt, + ... + ); + const hawk_ooch_t* getCompileId () const; const hawk_ooch_t* setCompileId ( @@ -289,12 +303,12 @@ protected: hawk_errstr_t dflerrstr; /// Stream to read script from Stream* sstream; - /// I/O stream to read data from and write output to. - Stream* iostream; - + /// I/O stream to read data from + Stream* istream; + /// I/O stream to write output to + Stream* ostream; private: - static hawk_ooi_t sin (hawk_sed_t* s, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_t* arg, hawk_ooch_t* buf, hawk_oow_t len); static hawk_ooi_t xin (hawk_sed_t* s, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_t* arg, hawk_ooch_t* buf, hawk_oow_t len); static hawk_ooi_t xout (hawk_sed_t* s, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_t* arg, hawk_ooch_t* dat, hawk_oow_t len); @@ -318,12 +332,13 @@ public: class HAWK_EXPORT FileStream: public Stream { public: - FileStream (const hawk_ooch_t* infile = HAWK_NULL, - const hawk_ooch_t* outfile = HAWK_NULL, - hawk_cmgr_t* cmgr = HAWK_NULL): - infile(infile), outfile(outfile), cmgr(cmgr) - { - } + FileStream (const hawk_uch_t* file = HAWK_NULL, + hawk_cmgr_t* cmgr = HAWK_NULL); + + FileStream (const hawk_bch_t* file = HAWK_NULL, + hawk_cmgr_t* cmgr = HAWK_NULL); + + ~FileStream (); int open (Data& io); int close (Data& io); @@ -331,9 +346,14 @@ public: hawk_ooi_t write (Data& io, const hawk_ooch_t* buf, hawk_oow_t len); protected: - const hawk_ooch_t* infile; - const hawk_ooch_t* outfile; - hawk_cmgr_t* cmgr; + enum + { + NAME_UCH, + NAME_BCH + } _type; + const void* _file; + hawk_ooch_t* file; + hawk_cmgr_t* cmgr; }; /// @@ -342,8 +362,11 @@ public: class HAWK_EXPORT StringStream: public Stream { public: - StringStream (const hawk_ooch_t* in); - StringStream (const hawk_ooch_t* in, hawk_oow_t len); + StringStream (hawk_cmgr_t* cmr = HAWK_NULL); + StringStream (const hawk_uch_t* in, hawk_cmgr_t* cmgr = HAWK_NULL); + StringStream (const hawk_uch_t* in, hawk_oow_t len, hawk_cmgr_t* cmgr = HAWK_NULL); + StringStream (const hawk_bch_t* in, hawk_cmgr_t* cmgr = HAWK_NULL); + StringStream (const hawk_bch_t* in, hawk_oow_t len, hawk_cmgr_t* cmgr = HAWK_NULL); ~StringStream (); int open (Data& io); @@ -351,22 +374,45 @@ public: hawk_ooi_t read (Data& io, hawk_ooch_t* buf, hawk_oow_t len); hawk_ooi_t write (Data& io, const hawk_ooch_t* buf, hawk_oow_t len); - const hawk_ooch_t* getInput (hawk_oow_t* len = HAWK_NULL) const; const hawk_ooch_t* getOutput (hawk_oow_t* len = HAWK_NULL) const; + const hawk_bch_t* getOutputB (hawk_oow_t* len = HAWK_NULL); + const hawk_uch_t* getOutputU (hawk_oow_t* len = HAWK_NULL); protected: + enum + { + STR_UCH, + STR_BCH + } _type; + struct { - const hawk_ooch_t* ptr; - const hawk_ooch_t* end; - const hawk_ooch_t* cur; + hawk_sed_t* _sed; + const void* _str; + const void* _end; + + hawk_ooch_t* str; + hawk_ooch_t* end; + const hawk_ooch_t* ptr; } in; struct { bool inited; hawk_ooecs_t buf; + hawk_sed_t* _sed; + hawk_sed_ecb_t sed_ecb; + + void* alt_buf; + hawk_sed_t* alt_sed; } out; + + hawk_cmgr_t* cmgr; + + + static void on_sed_close (hawk_sed_t* sed, void* ctx); + void clearInputData (); + void clearOutputData (bool kill_ecb); }; }; diff --git a/hawk/lib/Hawk.cpp b/hawk/lib/Hawk.cpp index c53511a4..1bb99c4e 100644 --- a/hawk/lib/Hawk.cpp +++ b/hawk/lib/Hawk.cpp @@ -1546,13 +1546,13 @@ void Hawk::retrieveError (Run* run) hawk_rtx_geterrinf (run->rtx, &errinf); } -static void fini_xtn (hawk_t* hawk) +static void fini_xtn (hawk_t* hawk, void* ctx) { xtn_t* xtn = GET_XTN(hawk); xtn->hawk->uponClosing (); } -static void clear_xtn (hawk_t* hawk) +static void clear_xtn (hawk_t* hawk, void* ctx) { xtn_t* xtn = GET_XTN(hawk); xtn->hawk->uponClearing (); diff --git a/hawk/lib/Makefile.in b/hawk/lib/Makefile.in index df0d1f48..93f91d35 100644 --- a/hawk/lib/Makefile.in +++ b/hawk/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, @@ -394,8 +394,8 @@ am__pkginclude_HEADERS_DIST = hawk.h hawk-arr.h hawk-chr.h hawk-cmn.h \ hawk-sed.h hawk-std.h hawk-tre.h hawk-unpack.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/hawk/lib/Sed.cpp index 320e55d4..386baa43 100644 --- a/hawk/lib/Sed.cpp +++ b/hawk/lib/Sed.cpp @@ -98,11 +98,12 @@ int Sed::compile (Stream& sstream) return hawk_sed_comp(this->sed, Sed::sin); } -int Sed::execute (Stream& iostream) +int Sed::execute (Stream& istream, Stream& ostream) { HAWK_ASSERT (this->sed != HAWK_NULL); - this->iostream = &iostream; + this->istream = &istream; + this->ostream = &ostream; return hawk_sed_exec(this->sed, Sed::xin, Sed::xout); } @@ -170,6 +171,24 @@ void Sed::setError (hawk_errnum_t err, const hawk_oocs_t* args, const hawk_loc_t hawk_sed_seterror (this->sed, loc, err, args); } +void Sed::formatError (hawk_errnum_t code, const hawk_loc_t* loc, const hawk_bch_t* fmt, ...) +{ + HAWK_ASSERT (this->rtx != HAWK_NULL); + va_list ap; + va_start (ap, fmt); + hawk_sed_seterrbvfmt (this->sed, loc, code, fmt, ap); + va_end (ap); +} + +void Sed::formatError (hawk_errnum_t code, const hawk_loc_t* loc, const hawk_uch_t* fmt, ...) +{ + HAWK_ASSERT (this->rtx != HAWK_NULL); + va_list ap; + va_start (ap, fmt); + hawk_sed_seterruvfmt (this->sed, loc, code, fmt, ap); + va_end (ap); +} + const hawk_ooch_t* Sed::getCompileId () const { return hawk_sed_getcompid(this->sed); @@ -229,11 +248,11 @@ hawk_ooi_t Sed::xin (hawk_sed_t* s, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_t* ar switch (cmd) { case HAWK_SED_IO_OPEN: - return xtn->sed->iostream->open(iodata); + return xtn->sed->istream->open(iodata); case HAWK_SED_IO_CLOSE: - return xtn->sed->iostream->close(iodata); + return xtn->sed->istream->close(iodata); case HAWK_SED_IO_READ: - return xtn->sed->iostream->read(iodata, buf, len); + return xtn->sed->istream->read(iodata, buf, len); default: return -1; } @@ -255,11 +274,11 @@ hawk_ooi_t Sed::xout (hawk_sed_t* s, hawk_sed_io_cmd_t cmd, hawk_sed_io_arg_t* a switch (cmd) { case HAWK_SED_IO_OPEN: - return xtn->sed->iostream->open(iodata); + return xtn->sed->ostream->open(iodata); case HAWK_SED_IO_CLOSE: - return xtn->sed->iostream->close(iodata); + return xtn->sed->ostream->close(iodata); case HAWK_SED_IO_WRITE: - return xtn->sed->iostream->write(iodata, dat, len); + return xtn->sed->ostream->write(iodata, dat, len); default: return -1; } diff --git a/hawk/lib/Std-Sed.cpp b/hawk/lib/Std-Sed.cpp index 3ce6e98a..fe665a93 100644 --- a/hawk/lib/Std-Sed.cpp +++ b/hawk/lib/Std-Sed.cpp @@ -40,10 +40,8 @@ static hawk_sio_t* open_sio (SedStd::Stream::Data& io, const hawk_ooch_t* file, sio = hawk_sio_open((hawk_gem_t*)io, 0, file, flags); if (sio == HAWK_NULL) { - hawk_oocs_t ea; - ea.ptr = (hawk_ooch_t*)file; - ea.len = hawk_count_oocstr(file); - ((Sed*)io)->setError (HAWK_SED_EIOFIL, &ea); + const hawk_ooch_t* old_errmsg = hawk_sed_backuperrmsg((hawk_sed_t*)io); + ((Sed*)io)->formatError (HAWK_SED_EIOFIL, HAWK_NULL, "unable to open %js - %js", file, old_errmsg); } return sio; } @@ -61,41 +59,81 @@ static hawk_sio_t* open_sio_std (SedStd::Stream::Data& io, hawk_sio_std_t std, i sio = hawk_sio_openstd((hawk_gem_t*)io, 0, std, flags); if (sio == HAWK_NULL) { - hawk_oocs_t ea; - ea.ptr = (hawk_ooch_t*)std_names[std]; - ea.len = hawk_count_oocstr(std_names[std]); - ((Sed*)io)->setError (HAWK_SED_EIOFIL, &ea); + const hawk_ooch_t* old_errmsg = hawk_sed_backuperrmsg((hawk_sed_t*)io); + ((Sed*)io)->formatError (HAWK_SED_EIOFIL, HAWK_NULL, "unable to open %js - %js", std_names[std], old_errmsg); } return sio; } +SedStd::FileStream::FileStream (const hawk_uch_t* file, hawk_cmgr_t* cmgr): + _type(NAME_UCH), _file(file), file(HAWK_NULL), cmgr(cmgr) +{ +} + +SedStd::FileStream::FileStream (const hawk_bch_t* file, hawk_cmgr_t* cmgr ): + _type(NAME_BCH), _file(file), file(HAWK_NULL), cmgr(cmgr) +{ +} +SedStd::FileStream::~FileStream () +{ + HAWK_ASSERT (this->file == HAWK_NULL); +} + int SedStd::FileStream::open (Data& io) { hawk_sio_t* sio; const hawk_ooch_t* ioname = io.getName(); + hawk_sio_std_t std_sio; int oflags; + hawk_gem_t* gem = (hawk_gem_t*)io; if (io.getMode() == READ) + { oflags = HAWK_SIO_READ | HAWK_SIO_IGNOREECERR; + std_sio = HAWK_SIO_STDIN; + } else + { oflags = HAWK_SIO_WRITE | HAWK_SIO_CREATE | HAWK_SIO_TRUNCATE | HAWK_SIO_IGNOREECERR | HAWK_SIO_LINEBREAK; + std_sio = HAWK_SIO_STDOUT; + } if (ioname == HAWK_NULL) { // // a normal console is indicated by a null name or a dash // - if (io.getMode() == READ) + + if (this->_file) { - sio = (infile == HAWK_NULL || (infile[0] == HAWK_T('-') && infile[1] == HAWK_T('\0')))? - open_sio_std (io, HAWK_SIO_STDIN, oflags): - open_sio (io, infile, oflags); + if (this->_type == NAME_UCH) + { + const hawk_uch_t* tmp = (const hawk_uch_t*)this->_file; + if (tmp[0] == '-' || tmp[1] == '\0') goto sio_stdio; + #if defined(HAWK_OOCH_IS_UCH) + this->file = hawk_gem_dupucstr(gem, tmp, HAWK_NULL); + #else + this->file = hawk_duputobcstr(gem, tmp, HAWK_NULL); + #endif + } + else + { + const hawk_bch_t* tmp = (const hawk_bch_t*)this->_file; + if (tmp[0] == '-' || tmp[1] == '\0') goto sio_stdio; + #if defined(HAWK_OOCH_IS_UCH) + this->file = hawk_gem_dupbtoucstr(gem, tmp, HAWK_NULL, 0); + #else + this->file = hawk_gem_dupbcstr(gem, tmp, HAWK_NULL); + #endif + } + if (!this->file) return -1; + sio = open_sio(io, this->file, oflags); + if (!sio) hawk_gem_freemem (gem, this->file); } else { - sio = (outfile == HAWK_NULL || (outfile[0] == HAWK_T('-') && outfile[1] == HAWK_T('\0')))? - open_sio_std (io, HAWK_SIO_STDOUT, oflags): - open_sio (io, outfile, oflags); + sio_stdio: + sio = open_sio_std(io, std_sio, oflags); } } else @@ -103,7 +141,7 @@ int SedStd::FileStream::open (Data& io) // // if ioname is not empty, it is a file name // - sio = open_sio (io, ioname, oflags); + sio = open_sio(io, ioname, oflags); } if (sio == HAWK_NULL) return -1; @@ -115,6 +153,24 @@ int SedStd::FileStream::open (Data& io) int SedStd::FileStream::close (Data& io) { hawk_sio_close ((hawk_sio_t*)io.getHandle()); + + // this stream object may get called more than once and is merely a proxy + // object that has its own lifespan. while io.getHandle() returns a unique + // handle value as set by io.setHandle() in the open method, this object + // is resued for calls over multiple I/O objects created. When releasing + // extra resources stored in the object, we must take extra care to know + // the context of this close method. + + if (!io.getName()) + { + // for a master stream that's not started by r or w + if (this->file) + { + hawk_gem_freemem ((hawk_gem_t*)io, this->file); + this->file = HAWK_NULL; + } + } + return 0; } @@ -122,17 +178,12 @@ hawk_ooi_t SedStd::FileStream::read (Data& io, hawk_ooch_t* buf, hawk_oow_t len) { hawk_ooi_t n = hawk_sio_getoochars((hawk_sio_t*)io.getHandle(), buf, len); - if (n == -1) + if (n <= -1) { - if (io.getName() == HAWK_NULL && infile != HAWK_NULL) + if (!io.getName() && this->file) // io.getMode() must be READ { - // if writing to outfile, set the error message - // explicitly. other cases are handled by - // the caller in sed.c. - hawk_oocs_t ea; - ea.ptr = (hawk_ooch_t*)infile; - ea.len = hawk_count_oocstr(infile); - ((Sed*)io)->setError (HAWK_SED_EIOFIL, &ea); + const hawk_ooch_t* old_errmsg = hawk_sed_backuperrmsg((hawk_sed_t*)io); + ((Sed*)io)->formatError (HAWK_SED_EIOFIL, HAWK_NULL, "unable to read %js - %js", this->file, old_errmsg); } } @@ -143,42 +194,120 @@ hawk_ooi_t SedStd::FileStream::write (Data& io, const hawk_ooch_t* buf, hawk_oow { hawk_ooi_t n = hawk_sio_putoochars((hawk_sio_t*)io.getHandle(), buf, len); - if (n == -1) + if (n <= -1) { - if (io.getName() == HAWK_NULL && outfile != HAWK_NULL) + if (!io.getName() && this->file) // io.getMode() must be WRITE { - // if writing to outfile, set the error message - // explicitly. other cases are handled by - // the caller in sed.c. - hawk_oocs_t ea; - ea.ptr = (hawk_ooch_t*)outfile; - ea.len = hawk_count_oocstr(outfile); - ((Sed*)io)->setError (HAWK_SED_EIOFIL, &ea); + const hawk_ooch_t* old_errmsg = hawk_sed_backuperrmsg((hawk_sed_t*)io); + ((Sed*)io)->formatError (HAWK_SED_EIOFIL, HAWK_NULL, "unable to read %js - %js", this->file, old_errmsg); } } return n; } -SedStd::StringStream::StringStream (const hawk_ooch_t* in) +SedStd::StringStream::StringStream (hawk_cmgr_t* cmgr): _type(STR_UCH) // this type isn't import for this { - this->in.ptr = in; - this->in.end = in + hawk_count_oocstr(in); + this->cmgr = cmgr; + + this->in._sed = HAWK_NULL; + this->in._str = HAWK_NULL; + this->in._end = HAWK_NULL; + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + + this->out._sed = HAWK_NULL; + this->out.sed_ecb.next = HAWK_NULL; this->out.inited = false; + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; } -SedStd::StringStream::StringStream (const hawk_ooch_t* in, hawk_oow_t len) +SedStd::StringStream::StringStream (const hawk_uch_t* in, hawk_cmgr_t* cmgr): _type(STR_UCH) { - this->in.ptr = in; - this->in.end = in + len; + this->cmgr = cmgr; + + this->in._sed = HAWK_NULL; + this->in._str = in; + this->in._end = in + hawk_count_ucstr(in); + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + + this->out._sed = HAWK_NULL; + this->out.sed_ecb.next = HAWK_NULL; this->out.inited = false; + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; +} + +SedStd::StringStream::StringStream (const hawk_uch_t* in, hawk_oow_t len, hawk_cmgr_t* cmgr): _type(STR_UCH) +{ + this->cmgr = cmgr; + + this->in._sed = HAWK_NULL; + this->in._str = in; + this->in._end = in + len; + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + + this->out._sed = HAWK_NULL; + this->out.sed_ecb.next = HAWK_NULL; + this->out.inited = false; + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; + +} + +SedStd::StringStream::StringStream (const hawk_bch_t* in, hawk_cmgr_t* cmgr): _type(STR_BCH) +{ + this->cmgr = cmgr; + + this->in._sed = HAWK_NULL; + this->in._str = in; + this->in._end = in + hawk_count_bcstr(in); + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + + this->out._sed = HAWK_NULL; + this->out.sed_ecb.next = HAWK_NULL; + this->out.inited = false; + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; +} + +SedStd::StringStream::StringStream (const hawk_bch_t* in, hawk_oow_t len, hawk_cmgr_t* cmgr): _type(STR_BCH) +{ + this->cmgr = cmgr; + + this->in._sed = HAWK_NULL; + this->in._str = in; + this->in._end = in + len; + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + + this->out._sed = HAWK_NULL; + this->out.inited = false; + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; + + this->out.sed_ecb.next = HAWK_NULL; } SedStd::StringStream::~StringStream () { - if (out.inited) hawk_ooecs_fini (&out.buf); + HAWK_ASSERT (this->in._sed == HAWK_NULL); + HAWK_ASSERT (this->in.str == HAWK_NULL); + + this->clearOutputData (true); + HAWK_ASSERT (this->out._sed == HAWK_NULL); + HAWK_ASSERT (this->out.inited == false); } - + int SedStd::StringStream::open (Data& io) { const hawk_ooch_t* ioname = io.getName (); @@ -188,25 +317,78 @@ int SedStd::StringStream::open (Data& io) // open a main data stream if (io.getMode() == READ) { - in.cur = in.ptr; - io.setHandle ((void*)in.ptr); + HAWK_ASSERT (this->in.str == HAWK_NULL); + + if (this->in._str == HAWK_NULL) + { + // no input data was passed to this object for construction + + if (this->out.inited) + { + // this object is being reused for input after output + // use the output data as input + hawk_oocs_t out; + hawk_ooecs_yield (&this->out.buf, &out, 0); + this->in.str = out.ptr; + this->in.ptr = out.ptr; + this->in.end = this->in.str + out.len; + this->clearOutputData (true); + } + else + { + ((Sed*)io)->formatError (HAWK_EINVAL, HAWK_NULL, "no input data available to open"); + return -1; + } + } + else + { + hawk_oow_t len; + hawk_gem_t* gem = hawk_sed_getgem((hawk_sed_t*)io); + + if (this->_type == STR_UCH) + { + #if defined(HAWK_OOCH_IS_UCH) + this->in.str = hawk_gem_dupucstr(gem, (const hawk_uch_t*)this->in._str, &len); + #else + this->in.str = hawk_duputobcstr(gem, (const hawk_uch_t*)this->in._str, &len); + #endif + } + else + { + HAWK_ASSERT (this->_type == STR_BCH); + #if defined(HAWK_OOCH_IS_UCH) + this->in.str = hawk_gem_dupbtoucstr(gem, (const hawk_bch_t*)this->in._str, &len, 0); + #else + this->in.str = hawk_gem_dupbcstr(gem, (const hawk_bch_t*)this->in._str, &len); + #endif + } + if (HAWK_UNLIKELY(!this->in.str)) return -1; + + this->in.end = this->in.str + len; + } + + this->in.ptr = this->in.str; + this->in._sed = (hawk_sed_t*)io; } else { - if (!out.inited) - { - if (hawk_ooecs_init(&out.buf, (hawk_gem_t*)io, 256) <= -1) - { - ((Sed*)io)->setError (HAWK_ENOMEM); - return -1; - } + this->clearOutputData (true); + // preserving this previous output data is a bit tricky when hawk_ooecs_init() fails. + // let's not try to preserve the old output data for now. + // full clearing is needed because this object may get passed to different sed objects + // in succession. - out.inited = true; - } + if (hawk_ooecs_init(&this->out.buf, (hawk_gem_t*)io, 256) <= -1) return -1; + this->out.inited = true; + this->out._sed = (hawk_sed_t*)io; - hawk_ooecs_clear (&out.buf); - io.setHandle (&out.buf); + // only if it's not already pushed + this->out.sed_ecb.close = this->on_sed_close; + this->out.sed_ecb.ctx = this; + hawk_sed_pushecb ((hawk_sed_t*)io, &this->out.sed_ecb); } + + io.setHandle (this); } else { @@ -228,8 +410,23 @@ int SedStd::StringStream::open (Data& io) int SedStd::StringStream::close (Data& io) { const void* handle = io.getHandle(); - if (handle != in.ptr && handle != &out.buf) + if (handle == this) + { + if (io.getMode() == READ) + { + this->clearInputData(); + } + else if (io.getMode() == WRITE && this->out.inited) + { + // don't clear anyting here as some output fields are required + // until this object is destroyed or the associated sed object is closed. + } + } + else + { hawk_sio_close ((hawk_sio_t*)handle); + } + return 0; } @@ -238,16 +435,16 @@ hawk_ooi_t SedStd::StringStream::read (Data& io, hawk_ooch_t* buf, hawk_oow_t le const void* handle = io.getHandle(); if (len == (hawk_oow_t)-1) len--; // shrink buffer if too long - if (handle == in.ptr) + if (handle == this) { + HAWK_ASSERT (this->in.str != HAWK_NULL); hawk_oow_t n = 0; - while (in.cur < in.end && n < len) - buf[n++] = *in.cur++; + while (this->in.ptr < this->in.end && n < len) + buf[n++] = *this->in.ptr++; return (hawk_ooi_t)n; } else { - HAWK_ASSERT (handle != &out.buf); return hawk_sio_getoochars((hawk_sio_t*)handle, buf, len); } } @@ -258,35 +455,24 @@ hawk_ooi_t SedStd::StringStream::write (Data& io, const hawk_ooch_t* data, hawk_ if (len == (hawk_oow_t)-1) len--; // shrink data if too long - if (handle == &out.buf) + if (handle == this) { - if (hawk_ooecs_ncat(&out.buf, data, len) == (hawk_oow_t)-1) - { - ((Sed*)io)->setError (HAWK_ENOMEM); - return -1; - } - + HAWK_ASSERT (this->out.inited != 0); + if (hawk_ooecs_ncat(&this->out.buf, data, len) == (hawk_oow_t)-1) return -1; return len; } else { - HAWK_ASSERT (handle != in.ptr); return hawk_sio_putoochars((hawk_sio_t*)handle, data, len); } } -const hawk_ooch_t* SedStd::StringStream::getInput (hawk_oow_t* len) const -{ - if (len) *len = in.end - in.ptr; - return in.ptr; -} - const hawk_ooch_t* SedStd::StringStream::getOutput (hawk_oow_t* len) const { - if (out.inited) + if (this->out.inited) { - if (len) *len = HAWK_OOECS_LEN(&out.buf); - return HAWK_OOECS_PTR(&out.buf); + if (len) *len = HAWK_OOECS_LEN(&this->out.buf); + return HAWK_OOECS_PTR(&this->out.buf); } else { @@ -295,6 +481,99 @@ const hawk_ooch_t* SedStd::StringStream::getOutput (hawk_oow_t* len) const } } +const hawk_uch_t* SedStd::StringStream::getOutputU (hawk_oow_t* len) +{ +#if defined(HAWK_OOCH_IS_UCH) + return this->getOutput(len); +#else + if (this->out.inited) + { + hawk_uch_t* tmp = hawk_gem_dupbtoucharswithcmgr(hawk_sed_getgem(this->out._sed), HAWK_OOECS_PTR(&this->out.buf), HAWK_OOECS_LEN(&this->out.buf), len, this->cmgr, 1); + if (tmp) + { + if (this->out.alt_buf) hawk_sed_freemem(this->out._sed, this->out.alt_buf); + this->out.alt_buf = (void*)tmp; + this->out.alt_sed = this->out._sed; + } + return tmp; + } + else + { + if (len) *len = 0; + return HAWK_UT(""); + } +#endif +} + +const hawk_bch_t* SedStd::StringStream::getOutputB (hawk_oow_t* len) +{ +#if defined(HAWK_OOCH_IS_UCH) + if (this->out.inited) + { + hawk_bch_t* tmp = hawk_gem_duputobcharswithcmgr(hawk_sed_getgem(this->out._sed), HAWK_OOECS_PTR(&this->out.buf), HAWK_OOECS_LEN(&this->out.buf), len, this->cmgr); + if (tmp) + { + if (this->out.alt_buf) hawk_sed_freemem(this->out._sed, this->out.alt_buf); + this->out.alt_buf = (void*)tmp; + this->out.alt_sed = this->out._sed; + } + return tmp; + } + else + { + if (len) *len = 0; + return HAWK_BT(""); + } +#else + return this->getOutput(len); +#endif +} + +void SedStd::StringStream::clearInputData () +{ + if (this->in.str) + { + hawk_sed_freemem (this->in._sed, this->in.str); + this->in.str = HAWK_NULL; + this->in.end = HAWK_NULL; + this->in.ptr = HAWK_NULL; + this->in._sed = HAWK_NULL; + } +} + +void SedStd::StringStream::clearOutputData (bool kill_ecb) +{ + if (this->out.alt_buf) + { + HAWK_ASSERT (this->out.alt_sed != HAWK_NULL); + hawk_sed_freemem(this->out.alt_sed, this->out.alt_buf); + this->out.alt_buf = HAWK_NULL; + this->out.alt_sed = HAWK_NULL; + } + + if (this->out.inited) + { + hawk_ooecs_fini (&this->out.buf); + if (this->out.alt_buf) + { + hawk_sed_freemem (this->out._sed, this->out.alt_buf); + this->out.alt_buf = HAWK_NULL; + } + this->out.inited = false; + + if (kill_ecb && this->out.sed_ecb.next) + hawk_sed_killecb (this->out._sed, &this->out.sed_ecb); + + this->out._sed = HAWK_NULL; + } +} + +void SedStd::StringStream::on_sed_close (hawk_sed_t* sed, void* ctx) +{ + SedStd::StringStream* strm = (SedStd::StringStream*)ctx; + strm->clearOutputData (false); +} + ///////////////////////////////// HAWK_END_NAMESPACE(HAWK) ///////////////////////////////// diff --git a/hawk/lib/gem.c b/hawk/lib/gem.c index db4188b3..79e63c4a 100644 --- a/hawk/lib/gem.c +++ b/hawk/lib/gem.c @@ -345,6 +345,8 @@ hawk_uch_t* hawk_gem_dupbtoucharswithcmgr (hawk_gem_t* gem, const hawk_bch_t* bc hawk_uch_t* ucs; int n; + if (!cmgr) cmgr = gem->cmgr; + bcslen = _bcslen; n = hawk_conv_bchars_to_uchars_with_cmgr(bcs, &bcslen, HAWK_NULL, &ucslen, cmgr, all); if (n <= -1) @@ -371,6 +373,8 @@ hawk_bch_t* hawk_gem_duputobcharswithcmgr (hawk_gem_t* gem, const hawk_uch_t* uc hawk_bch_t* bcs; int n; + if (!cmgr) cmgr = gem->cmgr; + ucslen = _ucslen; n = hawk_conv_uchars_to_bchars_with_cmgr(ucs, &ucslen, HAWK_NULL, &bcslen, cmgr); if (n <= -1) diff --git a/hawk/lib/hawk-sed.h b/hawk/lib/hawk-sed.h index 6e2833e0..fb26ce1f 100644 --- a/hawk/lib/hawk-sed.h +++ b/hawk/lib/hawk-sed.h @@ -307,7 +307,8 @@ typedef int (*hawk_sed_lformatter_t) ( * called when an sed object is closed. */ typedef void (*hawk_sed_ecb_close_t) ( - hawk_sed_t* sed /**< sed */ + hawk_sed_t* sed, /**< sed */ + void* ctx ); /** @@ -323,6 +324,7 @@ struct hawk_sed_ecb_t * called by hawk_sed_close(). */ hawk_sed_ecb_close_t close; + void* ctx; /* internal use only. don't touch this field */ hawk_sed_ecb_t* next; @@ -610,21 +612,44 @@ HAWK_EXPORT void hawk_sed_seterrufmt ( ... ); + +HAWK_EXPORT void hawk_sed_seterrbvfmt ( + hawk_sed_t* sed, + const hawk_loc_t* errloc, + hawk_errnum_t errnum, + const hawk_bch_t* errfmt, + va_list ap +); + +HAWK_EXPORT void hawk_sed_seterruvfmt ( + hawk_sed_t* sed, + const hawk_loc_t* errloc, + hawk_errnum_t errnum, + const hawk_uch_t* errfmt, + va_list ap +); + + +HAWK_EXPORT void hawk_sed_killecb ( + hawk_sed_t* sed, + hawk_sed_ecb_t* ecb +); + /** * The hawk_sed_popecb() function pops an sed event callback set * and returns the pointer to it. If no callback set can be popped, * it returns #HAWK_NULL. */ HAWK_EXPORT hawk_sed_ecb_t* hawk_sed_popecb ( - hawk_sed_t* sed /**< sed */ + hawk_sed_t* sed ); /** * The hawk_sed_pushecb() function register a runtime callback set. */ HAWK_EXPORT void hawk_sed_pushecb ( - hawk_sed_t* sed, /**< sed */ - hawk_sed_ecb_t* ecb /**< callback set */ + hawk_sed_t* sed, + hawk_sed_ecb_t* ecb ); /** diff --git a/hawk/lib/hawk.c b/hawk/lib/hawk.c index 2f7d2845..32ae84ef 100644 --- a/hawk/lib/hawk.c +++ b/hawk/lib/hawk.c @@ -156,6 +156,7 @@ int hawk_init (hawk_t* hawk, hawk_mmgr_t* mmgr, hawk_cmgr_t* cmgr, const hawk_pr hawk->_gem.errloc.file = HAWK_NULL; hawk->_gem.errstr = hawk_dfl_errstr; hawk->haltall = 0; + hawk->ecb = (hawk_ecb_t*)hawk; /* use this as a sentinel node instead of HAWK_NULL */ /* progagate the primitive functions */ HAWK_ASSERT (prm != HAWK_NULL); @@ -271,7 +272,7 @@ oops: void hawk_fini (hawk_t* hawk) { - hawk_ecb_t* ecb; + hawk_ecb_t* ecb, * ecb_next; int i; hawk_clear (hawk); @@ -285,8 +286,15 @@ void hawk_fini (hawk_t* hawk) hawk->shuterr = shuterr; } - for (ecb = hawk->ecb; ecb; ecb = ecb->next) - if (ecb->close) ecb->close (hawk); + for (ecb = hawk->ecb; ecb != (hawk_ecb_t*)hawk; ecb = ecb_next) + { + ecb_next = ecb->next; + if (ecb->close) ecb->close (hawk, ecb->ctx); + } + + do { ecb = hawk_popecb(hawk); } while (ecb); + HAWK_ASSERT (hawk->ecb == (hawk_ecb_t*)hawk); + hawk_rbt_close (hawk->modtab); hawk_htb_close (hawk->fnc.user); @@ -346,12 +354,14 @@ static hawk_rbt_walk_t unload_module (hawk_rbt_t* rbt, hawk_rbt_pair_t* pair, vo void hawk_clear (hawk_t* hawk) { - hawk_ecb_t* ecb; + hawk_ecb_t* ecb, * ecb_next; - for (ecb = hawk->ecb; ecb; ecb = ecb->next) + for (ecb = hawk->ecb; ecb != (hawk_ecb_t*)hawk; ecb = ecb_next) { - if (ecb->clear) ecb->clear (hawk); + ecb_next = ecb->next; + if (ecb->clear) ecb->clear (hawk, ecb->ctx); } + /* hawk_clear() this doesn't pop event callbacks */ hawk->haltall = 0; @@ -571,7 +581,9 @@ void hawk_haltall (hawk_t* hawk) hawk_ecb_t* hawk_popecb (hawk_t* hawk) { hawk_ecb_t* top = hawk->ecb; - if (top) hawk->ecb = top->next; + if (top == (hawk_ecb_t*)hawk) return HAWK_NULL; + hawk->ecb = top->next; + top->next = HAWK_NULL; return top; } diff --git a/hawk/lib/hawk.h b/hawk/lib/hawk.h index abadb58c..1e1707fb 100644 --- a/hawk/lib/hawk.h +++ b/hawk/lib/hawk.h @@ -1082,7 +1082,8 @@ struct hawk_mod_flt_tab_t * but before actual closing. */ typedef void (*hawk_ecb_close_t) ( - hawk_t* hawk /**< hawk */ + hawk_t* hawk, + void* ctx ); /** @@ -1091,7 +1092,8 @@ typedef void (*hawk_ecb_close_t) ( * calls this calllback function before it performs actual clearing. */ typedef void (*hawk_ecb_clear_t) ( - hawk_t* hawk /**< hawk */ + hawk_t* hawk, + void* ctx ); /** @@ -1113,6 +1115,9 @@ struct hawk_ecb_t */ hawk_ecb_clear_t clear; + + void* ctx; + /* internal use only. don't touch this field */ hawk_ecb_t* next; }; @@ -1124,7 +1129,8 @@ struct hawk_ecb_t * called when the runtime context is closed. */ typedef void (*hawk_rtx_ecb_close_t) ( - hawk_rtx_t* rtx /**< runtime context */ + hawk_rtx_t* rtx, /**< runtime context */ + void* ctx ); @@ -1134,7 +1140,8 @@ typedef void (*hawk_rtx_ecb_close_t) ( */ typedef void (*hawk_rtx_ecb_stmt_t) ( hawk_rtx_t* rtx, /**< runtime context */ - hawk_nde_t* nde /**< node */ + hawk_nde_t* nde, /**< node */ + void* ctx ); /** @@ -1145,8 +1152,9 @@ typedef void (*hawk_rtx_ecb_stmt_t) ( */ typedef void (*hawk_rtx_ecb_gblset_t) ( hawk_rtx_t* rtx, /**< runtime context */ - hawk_oow_t idx, /**< global variable index */ - hawk_val_t* val /**< value */ + hawk_oow_t idx, /**< global variable index */ + hawk_val_t* val, /**< value */ + void* ctx ); /** @@ -1174,6 +1182,8 @@ struct hawk_rtx_ecb_t */ hawk_rtx_ecb_gblset_t gblset; + void* ctx; + /* internal use only. don't touch this field */ hawk_rtx_ecb_t* next; }; diff --git a/hawk/lib/run.c b/hawk/lib/run.c index 0c1815d6..051fb60c 100644 --- a/hawk/lib/run.c +++ b/hawk/lib/run.c @@ -218,7 +218,7 @@ const hawk_oocs_t* hawk_rtx_getsubsep (hawk_rtx_t* rtx) static int set_global (hawk_rtx_t* rtx, int idx, hawk_nde_var_t* var, hawk_val_t* val, int assign) { hawk_val_t* old; - hawk_rtx_ecb_t* ecb; + hawk_rtx_ecb_t* ecb, * ecb_next; hawk_val_type_t vtype, old_vtype; old = HAWK_RTX_STACK_GBL (rtx, idx); @@ -629,9 +629,10 @@ static int set_global (hawk_rtx_t* rtx, int idx, hawk_nde_var_t* var, hawk_val_t HAWK_RTX_STACK_GBL(rtx,idx) = val; hawk_rtx_refupval (rtx, val); - for (ecb = (rtx)->ecb; ecb; ecb = ecb->next) + for (ecb = rtx->ecb; ecb != (hawk_rtx_ecb_t*)rtx; ecb = ecb_next) { - if (ecb->gblset) ecb->gblset (rtx, idx, val); + ecb_next = ecb->next; + if (ecb->gblset) ecb->gblset (rtx, idx, val, ecb->ctx); } return 0; @@ -877,6 +878,8 @@ hawk_rtx_t* hawk_rtx_open (hawk_t* hawk, hawk_oow_t xtnsize, hawk_rio_cbs_t* rio return HAWK_NULL; } + rtx->ecb = (hawk_rtx_ecb_t*)rtx; /* use this as a special sentinel node */ + if (HAWK_UNLIKELY(init_globals(rtx) <= -1)) { hawk_rtx_errortohawk (rtx, hawk); @@ -928,7 +931,7 @@ hawk_rtx_t* hawk_rtx_open (hawk_t* hawk, hawk_oow_t xtnsize, hawk_rio_cbs_t* rio void hawk_rtx_close (hawk_rtx_t* rtx) { - hawk_rtx_ecb_t* ecb; + hawk_rtx_ecb_t* ecb, * ecb_next; struct module_fini_ctx_t mfc; mfc.limit = 0; @@ -936,11 +939,15 @@ void hawk_rtx_close (hawk_rtx_t* rtx) mfc.rtx = rtx; hawk_rbt_walk (rtx->hawk->modtab, fini_module, &mfc); - for (ecb = rtx->ecb; ecb; ecb = ecb->next) + for (ecb = rtx->ecb; ecb != (hawk_rtx_ecb_t*)rtx; ecb = ecb_next) { - if (ecb->close) ecb->close (rtx); + ecb_next = ecb->next; + if (ecb->close) ecb->close (rtx, ecb->ctx); } + do { ecb = hawk_rtx_popecb(rtx); } while (ecb); + HAWK_ASSERT (rtx->ecb == (hawk_rtx_ecb_t*)rtx); + /* NOTE: * the close callbacks are called before data in rtx * is destroyed. if the destruction count on any data @@ -979,7 +986,9 @@ void hawk_rtx_setrio (hawk_rtx_t* rtx, const hawk_rio_cbs_t* rio) hawk_rtx_ecb_t* hawk_rtx_popecb (hawk_rtx_t* rtx) { hawk_rtx_ecb_t* top = rtx->ecb; - if (top) rtx->ecb = top->next; + if (top == (hawk_rtx_ecb_t*)rtx) return HAWK_NULL; + rtx->ecb = top->next; + top->next = HAWK_NULL; return top; } @@ -2222,10 +2231,11 @@ static int run_block (hawk_rtx_t* rtx, hawk_nde_blk_t* nde) } #define ON_STATEMENT(rtx,nde) do { \ - hawk_rtx_ecb_t* ecb; \ + hawk_rtx_ecb_t* ecb, * ecb_next; \ if ((rtx)->hawk->haltall) (rtx)->exit_level = EXIT_ABORT; \ - for (ecb = (rtx)->ecb; ecb; ecb = ecb->next) \ - if (ecb->stmt) ecb->stmt (rtx, nde); \ + for (ecb = (rtx)->ecb; ecb != (hawk_rtx_ecb_t*)(rtx); ecb = ecb_next) \ + ecb_next = ecb->next; \ + if (ecb->stmt) ecb->stmt (rtx, nde, ecb->ctx); \ } while(0) static int run_statement (hawk_rtx_t* rtx, hawk_nde_t* nde) diff --git a/hawk/lib/sed.c b/hawk/lib/sed.c index d676fcfe..6e4fa69b 100644 --- a/hawk/lib/sed.c +++ b/hawk/lib/sed.c @@ -70,10 +70,16 @@ hawk_sed_t* hawk_sed_open (hawk_mmgr_t* mmgr, hawk_oow_t xtnsize, hawk_cmgr_t* c void hawk_sed_close (hawk_sed_t* sed) { - hawk_sed_ecb_t* ecb; + hawk_sed_ecb_t* ecb, * ecb_next; - for (ecb = sed->ecb; ecb; ecb = ecb->next) - if (ecb->close) ecb->close (sed); + for (ecb = sed->ecb; ecb != (hawk_sed_ecb_t*)sed; ecb = ecb_next) + { + ecb_next = ecb->next; /* in case the callback deregisters itself */ + if (ecb->close) ecb->close (sed, ecb->ctx); + } + + do { ecb = hawk_sed_popecb(sed); } while (ecb); + HAWK_ASSERT (sed->ecb == (hawk_sed_ecb_t*)sed); hawk_sed_fini (sed); HAWK_MMGR_FREE (hawk_sed_getmmgr(sed), sed); @@ -95,6 +101,8 @@ int hawk_sed_init (hawk_sed_t* sed, hawk_mmgr_t* mmgr, hawk_cmgr_t* cmgr) sed->_gem.errloc.file = HAWK_NULL; sed->_gem.errstr = hawk_dfl_errstr; + sed->ecb = (hawk_sed_ecb_t*)sed; /* use this as a special sentinel node */ + if (hawk_ooecs_init(&sed->tmp.rex, hawk_sed_getgem(sed), 0) <= -1) goto oops_1; if (hawk_ooecs_init(&sed->tmp.lab, hawk_sed_getgem(sed), 0) <= -1) goto oops_2; @@ -166,6 +174,18 @@ void hawk_sed_seterrufmt (hawk_sed_t* sed, const hawk_loc_t* errloc, hawk_errnum va_end (ap); } + +void hawk_sed_seterrbvfmt (hawk_sed_t* sed, const hawk_loc_t* errloc, hawk_errnum_t errnum, const hawk_bch_t* errfmt, va_list ap) +{ + hawk_gem_seterrbvfmt (hawk_sed_getgem(sed), errloc, errnum, errfmt, ap); +} + +void hawk_sed_seterruvfmt (hawk_sed_t* sed, const hawk_loc_t* errloc, hawk_errnum_t errnum, const hawk_uch_t* errfmt, va_list ap) +{ + hawk_gem_seterruvfmt (hawk_sed_getgem(sed), errloc, errnum, errfmt, ap); +} + + int hawk_sed_setopt (hawk_sed_t* sed, hawk_sed_opt_t id, const void* value) { switch (id) @@ -3904,10 +3924,27 @@ void hawk_sed_setlinenum (hawk_sed_t* sed, hawk_oow_t num) hawk_sed_ecb_t* hawk_sed_popecb (hawk_sed_t* sed) { hawk_sed_ecb_t* top = sed->ecb; - if (top) sed->ecb = top->next; + if (top == (hawk_sed_ecb_t*)sed) return HAWK_NULL; + sed->ecb = top->next; + top->next = HAWK_NULL; return top; } +void hawk_sed_killecb (hawk_sed_t* sed, hawk_sed_ecb_t* ecb) +{ + hawk_sed_ecb_t* prev, * cur; + for (cur = sed->ecb, prev = HAWK_NULL; cur != (hawk_sed_ecb_t*)sed; cur = cur->next) + { + if (cur == ecb) + { + if (prev) prev->next = cur->next; + else sed->ecb = cur->next; + cur->next = HAWK_NULL; + break; + } + } +} + void hawk_sed_pushecb (hawk_sed_t* sed, hawk_sed_ecb_t* ecb) { ecb->next = sed->ecb; diff --git a/hawk/lib/tre-prv.h b/hawk/lib/tre-prv.h index 3884b4ca..fa31e3ea 100644 --- a/hawk/lib/tre-prv.h +++ b/hawk/lib/tre-prv.h @@ -150,6 +150,9 @@ SUBMATCH[4] = [defg] #define TRE_REGEX_T_FIELD value /*#define assert(x) HAWK_ASSERT(x)*/ #define assert(x) +#if defined(NULL) +# undef NULL +#endif #define NULL HAWK_NULL #define tre_islower(c) hawk_is_ooch_lower(c) diff --git a/hawk/m4/libtool.m4 b/hawk/m4/libtool.m4 index a644432f..c81e6692 100644 --- a/hawk/m4/libtool.m4 +++ b/hawk/m4/libtool.m4 @@ -728,7 +728,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. @@ -2867,9 +2866,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Add ABI-specific directories to the system library path. - sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" - # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command @@ -2878,7 +2874,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on @@ -2890,6 +2886,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -3549,7 +3557,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -4055,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" @@ -4427,7 +4436,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4939,6 +4948,9 @@ m4_if([$1], [CXX], [ ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -5001,6 +5013,9 @@ dnl Note also adjust exclude_expsyms for C++ above. openbsd* | bitrig*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -5255,7 +5270,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5776,6 +5791,7 @@ _LT_EOF if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' @@ -5797,7 +5813,7 @@ _LT_EOF esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -6423,7 +6439,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 @@ -6798,7 +6814,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 @@ -6863,7 +6879,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 @@ -7202,7 +7218,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 @@ -7286,7 +7302,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. @@ -7297,7 +7313,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/hawk/mod/Makefile.in b/hawk/mod/Makefile.in index 112da930..a78704d9 100644 --- a/hawk/mod/Makefile.in +++ b/hawk/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/samples/Makefile.am b/hawk/samples/Makefile.am index 0d5ace42..72472e60 100644 --- a/hawk/samples/Makefile.am +++ b/hawk/samples/Makefile.am @@ -16,7 +16,7 @@ noinst_PROGRAMS = if ENABLE_CXX -noinst_PROGRAMS += hawk02 hawk51 +noinst_PROGRAMS += hawk02 hawk51 sed21 hawk02_SOURCES = hawk02.c hawk02_CPPFLAGS = $(CPPFLAGS_COMMON) @@ -31,4 +31,11 @@ hawk51_CXXFLAGS = $(CXXFLAGS_COMMON) hawk51_LDFLAGS = $(LDFLAGS_COMMON) hawk51_LDADD = $(LIBADD_COMMON) +sed21_SOURCES = sed21.cpp +sed21_CPPFLAGS = $(CPPFLAGS_COMMON) +sed21_CFLAGS = $(CFLAGS_COMMON) +sed21_CXXFLAGS = $(CXXFLAGS_COMMON) +sed21_LDFLAGS = $(LDFLAGS_COMMON) +sed21_LDADD = $(LIBADD_COMMON) + endif diff --git a/hawk/samples/Makefile.in b/hawk/samples/Makefile.in index 0a0e2ebc..d1aa5198 100644 --- a/hawk/samples/Makefile.in +++ b/hawk/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, @@ -89,7 +89,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = $(am__EXEEXT_1) -@ENABLE_CXX_TRUE@am__append_1 = hawk02 hawk51 +@ENABLE_CXX_TRUE@am__append_1 = hawk02 hawk51 sed21 subdir = samples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \ @@ -108,7 +108,8 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/lib/hawk-cfg.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -@ENABLE_CXX_TRUE@am__EXEEXT_1 = hawk02$(EXEEXT) hawk51$(EXEEXT) +@ENABLE_CXX_TRUE@am__EXEEXT_1 = hawk02$(EXEEXT) hawk51$(EXEEXT) \ +@ENABLE_CXX_TRUE@ sed21$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am__hawk02_SOURCES_DIST = hawk02.c @ENABLE_CXX_TRUE@am_hawk02_OBJECTS = hawk02-hawk02.$(OBJEXT) @@ -130,6 +131,13 @@ hawk51_OBJECTS = $(am_hawk51_OBJECTS) hawk51_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(hawk51_CXXFLAGS) \ $(CXXFLAGS) $(hawk51_LDFLAGS) $(LDFLAGS) -o $@ +am__sed21_SOURCES_DIST = sed21.cpp +@ENABLE_CXX_TRUE@am_sed21_OBJECTS = sed21-sed21.$(OBJEXT) +sed21_OBJECTS = $(am_sed21_OBJECTS) +@ENABLE_CXX_TRUE@sed21_DEPENDENCIES = $(LIBADD_COMMON) +sed21_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(sed21_CXXFLAGS) \ + $(CXXFLAGS) $(sed21_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -146,7 +154,7 @@ DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/ac/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/hawk02-hawk02.Po \ - ./$(DEPDIR)/hawk51-hawk51.Po + ./$(DEPDIR)/hawk51-hawk51.Po ./$(DEPDIR)/sed21-sed21.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -184,8 +192,9 @@ AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) am__v_CXXLD_0 = @echo " CXXLD " $@; am__v_CXXLD_1 = -SOURCES = $(hawk02_SOURCES) $(hawk51_SOURCES) -DIST_SOURCES = $(am__hawk02_SOURCES_DIST) $(am__hawk51_SOURCES_DIST) +SOURCES = $(hawk02_SOURCES) $(hawk51_SOURCES) $(sed21_SOURCES) +DIST_SOURCES = $(am__hawk02_SOURCES_DIST) $(am__hawk51_SOURCES_DIST) \ + $(am__sed21_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -383,6 +392,12 @@ LIBADD_COMMON = ../lib/libhawk.la @ENABLE_CXX_TRUE@hawk51_CXXFLAGS = $(CXXFLAGS_COMMON) @ENABLE_CXX_TRUE@hawk51_LDFLAGS = $(LDFLAGS_COMMON) @ENABLE_CXX_TRUE@hawk51_LDADD = $(LIBADD_COMMON) +@ENABLE_CXX_TRUE@sed21_SOURCES = sed21.cpp +@ENABLE_CXX_TRUE@sed21_CPPFLAGS = $(CPPFLAGS_COMMON) +@ENABLE_CXX_TRUE@sed21_CFLAGS = $(CFLAGS_COMMON) +@ENABLE_CXX_TRUE@sed21_CXXFLAGS = $(CXXFLAGS_COMMON) +@ENABLE_CXX_TRUE@sed21_LDFLAGS = $(LDFLAGS_COMMON) +@ENABLE_CXX_TRUE@sed21_LDADD = $(LIBADD_COMMON) all: all-am .SUFFIXES: @@ -434,6 +449,10 @@ hawk51$(EXEEXT): $(hawk51_OBJECTS) $(hawk51_DEPENDENCIES) $(EXTRA_hawk51_DEPENDE @rm -f hawk51$(EXEEXT) $(AM_V_CXXLD)$(hawk51_LINK) $(hawk51_OBJECTS) $(hawk51_LDADD) $(LIBS) +sed21$(EXEEXT): $(sed21_OBJECTS) $(sed21_DEPENDENCIES) $(EXTRA_sed21_DEPENDENCIES) + @rm -f sed21$(EXEEXT) + $(AM_V_CXXLD)$(sed21_LINK) $(sed21_OBJECTS) $(sed21_LDADD) $(LIBS) + mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -442,6 +461,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hawk02-hawk02.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hawk51-hawk51.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sed21-sed21.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -525,6 +545,20 @@ hawk51-hawk51.obj: hawk51.cpp @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(hawk51_CPPFLAGS) $(CPPFLAGS) $(hawk51_CXXFLAGS) $(CXXFLAGS) -c -o hawk51-hawk51.obj `if test -f 'hawk51.cpp'; then $(CYGPATH_W) 'hawk51.cpp'; else $(CYGPATH_W) '$(srcdir)/hawk51.cpp'; fi` +sed21-sed21.o: sed21.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sed21_CPPFLAGS) $(CPPFLAGS) $(sed21_CXXFLAGS) $(CXXFLAGS) -MT sed21-sed21.o -MD -MP -MF $(DEPDIR)/sed21-sed21.Tpo -c -o sed21-sed21.o `test -f 'sed21.cpp' || echo '$(srcdir)/'`sed21.cpp +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sed21-sed21.Tpo $(DEPDIR)/sed21-sed21.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sed21.cpp' object='sed21-sed21.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sed21_CPPFLAGS) $(CPPFLAGS) $(sed21_CXXFLAGS) $(CXXFLAGS) -c -o sed21-sed21.o `test -f 'sed21.cpp' || echo '$(srcdir)/'`sed21.cpp + +sed21-sed21.obj: sed21.cpp +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sed21_CPPFLAGS) $(CPPFLAGS) $(sed21_CXXFLAGS) $(CXXFLAGS) -MT sed21-sed21.obj -MD -MP -MF $(DEPDIR)/sed21-sed21.Tpo -c -o sed21-sed21.obj `if test -f 'sed21.cpp'; then $(CYGPATH_W) 'sed21.cpp'; else $(CYGPATH_W) '$(srcdir)/sed21.cpp'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/sed21-sed21.Tpo $(DEPDIR)/sed21-sed21.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='sed21.cpp' object='sed21-sed21.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(sed21_CPPFLAGS) $(CPPFLAGS) $(sed21_CXXFLAGS) $(CXXFLAGS) -c -o sed21-sed21.obj `if test -f 'sed21.cpp'; then $(CYGPATH_W) 'sed21.cpp'; else $(CYGPATH_W) '$(srcdir)/sed21.cpp'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -658,6 +692,7 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ distclean: distclean-am -rm -f ./$(DEPDIR)/hawk02-hawk02.Po -rm -f ./$(DEPDIR)/hawk51-hawk51.Po + -rm -f ./$(DEPDIR)/sed21-sed21.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -705,6 +740,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/hawk02-hawk02.Po -rm -f ./$(DEPDIR)/hawk51-hawk51.Po + -rm -f ./$(DEPDIR)/sed21-sed21.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/hawk/samples/sed21.cpp b/hawk/samples/sed21.cpp new file mode 100644 index 00000000..a0dc7e65 --- /dev/null +++ b/hawk/samples/sed21.cpp @@ -0,0 +1,128 @@ +#include +#include +#include +#include + +static void print_error (const hawk_bch_t* fmt, ...) +{ + va_list va; + fprintf (stderr, "ERROR: "); + va_start (va, fmt); + vfprintf (stderr, fmt, va); + va_end (va); +} + +static void print_error (HAWK::SedStd& sed) +{ + hawk_errnum_t code = sed.getErrorNumber(); + hawk_loc_t loc = sed.getErrorLocation(); + print_error ("code %d line %lu column %lu - %s\n", (int)code, (unsigned long int)loc.line, (unsigned long int)loc.colm, sed.getErrorMessageB()); +} + +int execute_sed (int argc, hawk_bch_t* argv[]) +{ + if (argc < 2 || argc > 4) + { + print_error ("USAGE: %s command-string [input-file [output-file]]\n", argv[0]); + return -1; + } + + HAWK::SedStd sed; + + if (sed.open() <= -1) + { + print_error (sed); + return -1; + } + + HAWK::SedStd::StringStream sstream (argv[1]); + if (sed.compile(sstream) <= -1) + { + print_error (sed); + sed.close (); + return -1; + } + + hawk_bch_t* infile = (argc >= 3)? argv[2]: HAWK_NULL; + hawk_bch_t* outfile = (argc >= 4)? argv[3]: HAWK_NULL; + HAWK::SedStd::FileStream ifstream (infile); + HAWK::SedStd::FileStream ofstream (outfile); + + if (sed.execute(ifstream, ofstream) <= -1) + { + print_error (sed); + sed.close (); + return -1; + } + +#if 0 + HAWK::SedStd::StringStream istream2 ("xxxxxxxxxCCCQQQQ ZZZZ hello"); + HAWK::SedStd::StringStream ostream2; + if (sed.execute(istream2, ostream2) <= -1) + { + print_error (sed); + sed.close (); + return -1; + } + hawk_oow_t len; + const hawk_bch_t* tmp = ostream2.getOutputB(&len); + printf ("[%.*s]\n", (int)len, tmp); + + { + HAWK::SedStd::StringStream sstream ("s|CCC|BBBBBBBBBBB|g"); + if (sed.compile(sstream) <= -1) + { + print_error (sed); + sed.close (); + return -1; + } + + HAWK::SedStd::FileStream of("/dev/stdout"); + if (sed.execute(ostream2, of) <= -1) + { + print_error (sed); + sed.close (); + return -1; + } + } +#endif + + + sed.close (); + return 0; +} + +int main (int argc, hawk_bch_t* argv[]) +{ + int ret; + +#if defined(_WIN32) + char locale[100]; + UINT codepage; + /* nothing special */ +#endif + +#if defined(_WIN32) + codepage = GetConsoleOutputCP(); + if (codepage == CP_UTF8) + { + /*SetConsoleOUtputCP (CP_UTF8);*/ + /*hawk_setdflcmgrbyid (HAWK_CMGR_UTF8);*/ + } + else + { + /* .codepage */ + hawk_fmt_uintmax_to_bcstr (locale, HAWK_COUNTOF(locale), codepage, 10, -1, '\0', "."); + setlocale (LC_ALL, locale); + /* hawk_setdflcmgrbyid (HAWK_CMGR_SLMB); */ + } + +#else + setlocale (LC_ALL, ""); + /* hawk_setdflcmgrbyid (HAWK_CMGR_SLMB); */ +#endif + + ret = execute_sed(argc, argv); + + return ret; +} diff --git a/hawk/t/Makefile.in b/hawk/t/Makefile.in index 02c6059f..00cb6584 100644 --- a/hawk/t/Makefile.in +++ b/hawk/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, diff --git a/hawk/tools/Makefile.in b/hawk/tools/Makefile.in index 0dad1bfe..d8eb9b32 100644 --- a/hawk/tools/Makefile.in +++ b/hawk/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,