added the Sed class and SedStd classes

This commit is contained in:
hyung-hwan 2022-06-09 05:33:46 +00:00
parent 3930bfc8f8
commit 676496325e
33 changed files with 2472 additions and 1735 deletions

View File

@ -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

View File

@ -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 <peda@lysator.liu.se>.
#
# 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,8 +224,7 @@ elif test -n "$extract"; then
esac
done
else
$AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \
| while read member
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
do
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done

View File

@ -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 <tromey@cygnus.com>.
#
# 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/*)

114
hawk/ac/config.guess vendored
View File

@ -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
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" 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
{ 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
CC_FOR_BUILD=no_compiler_found ;
fi
;;
,,*) CC_FOR_BUILD=$CC ;;
,*,*) CC_FOR_BUILD=$HOST_CC ;;
esac
}
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 <features.h>
#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 <stdio.h> /* 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 <sys/systemcfg.h>
@ -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 <unistd.h>
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:*:*)
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: "'"

2679
hawk/ac/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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.
#

View File

@ -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 '"$@"'
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 '<hooked_function_name>_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
# '<hooked_function_name>_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
#
# 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
$_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
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
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 <bug-libtool@gnu.org>.
GNU libtool home page: <http://www.gnu.org/software/libtool/>.
GNU libtool home page: <http://www.gnu.org/s/libtool/>.
General help using GNU software: <http://www.gnu.org/gethelp/>."
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
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
@ -2387,14 +2472,21 @@ libtool_parse_options ()
;;
# An option not handled by this hook function:
*) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
*) 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
$_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,9 +7986,6 @@ 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"
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"
@ -7902,6 +7996,9 @@ func_mode_link ()
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
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)

View File

@ -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 <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify

View File

@ -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

50
hawk/aclocal.m4 vendored
View File

@ -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,

View File

@ -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,

View File

@ -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

71
hawk/configure vendored
View File

@ -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
@ -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.

View File

@ -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,8 +346,13 @@ 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;
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
{
hawk_sed_t* _sed;
const void* _str;
const void* _end;
hawk_ooch_t* str;
hawk_ooch_t* end;
const hawk_ooch_t* ptr;
const hawk_ooch_t* end;
const hawk_ooch_t* cur;
} 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);
};
};

View File

@ -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 ();

View File

@ -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.

View File

@ -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;
}

View File

@ -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
{
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);
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_stdio:
sio = open_sio_std(io, std_sio, oflags);
}
}
else
@ -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,40 +194,118 @@ 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)
@ -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
{
if (!out.inited)
{
if (hawk_ooecs_init(&out.buf, (hawk_gem_t*)io, 256) <= -1)
{
((Sed*)io)->setError (HAWK_ENOMEM);
((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);
out.inited = true;
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;
}
hawk_ooecs_clear (&out.buf);
io.setHandle (&out.buf);
this->in.ptr = this->in.str;
this->in._sed = (hawk_sed_t*)io;
}
else
{
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.
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;
// 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)
/////////////////////////////////

View File

@ -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)

View File

@ -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
);
/**

View File

@ -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;
}

View File

@ -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
);
/**
@ -1146,7 +1153,8 @@ 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_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;
};

View File

@ -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)

View File

@ -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;

View File

@ -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)

36
hawk/m4/libtool.m4 vendored
View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

128
hawk/samples/sed21.cpp Normal file
View File

@ -0,0 +1,128 @@
#include <Hawk-Sed.hpp>
#include <stdio.h>
#include <stdarg.h>
#include <locale.h>
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;
}

View File

@ -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,

View File

@ -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,