enhancing hawk::call() to support module functions

This commit is contained in:
hyung-hwan 2022-04-06 15:49:23 +00:00
parent 3361135e97
commit df9106337c
24 changed files with 240 additions and 106 deletions

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # 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/config.sub $(top_srcdir)/ac/install-sh \
$(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \ $(top_srcdir)/ac/ltmain.sh $(top_srcdir)/ac/missing \
$(top_srcdir)/ac/tap-driver.sh $(top_srcdir)/pkgs/hawk.spec.in \ $(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 ac/install-sh ac/ltmain.sh ac/missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION) distdir = $(PACKAGE)-$(VERSION)
@ -353,6 +353,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -603,6 +604,10 @@ dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__post_remove_distdir) $(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 dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \ @echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2 "legacy program 'compress' is deprecated." >&2
@ -645,6 +650,8 @@ distcheck: dist
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
*.tar.zst*) \
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
esac esac
chmod -R a-w $(distdir) chmod -R a-w $(distdir)
chmod u+w $(distdir) chmod u+w $(distdir)
@ -822,18 +829,18 @@ uninstall-am:
am--refresh check check-am clean clean-cscope clean-generic \ am--refresh check check-am clean clean-cscope clean-generic \
clean-libtool cscope cscopelist-am ctags ctags-am dist \ clean-libtool cscope cscopelist-am ctags ctags-am dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-generic \ dist-xz dist-zip dist-zstd distcheck distclean \
distclean-libtool distclean-local distclean-tags \ distclean-generic distclean-libtool distclean-local \
distcleancheck distdir distuninstallcheck dvi dvi-am html \ distclean-tags distcleancheck distdir distuninstallcheck dvi \
html-am info info-am install install-am install-data \ dvi-am html html-am info info-am install install-am \
install-data-am install-dvi install-dvi-am install-exec \ install-data install-data-am install-dvi install-dvi-am \
install-exec-am install-html install-html-am install-info \ install-exec install-exec-am install-html install-html-am \
install-info-am install-man install-pdf install-pdf-am \ install-info install-info-am install-man install-pdf \
install-ps install-ps-am install-strip installcheck \ install-pdf-am install-ps install-ps-am install-strip \
installcheck-am installdirs installdirs-am maintainer-clean \ installcheck installcheck-am installdirs installdirs-am \
maintainer-clean-generic mostlyclean mostlyclean-generic \ maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall-am tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile .PRECIOUS: Makefile

View File

@ -2,9 +2,9 @@
# Wrapper for Microsoft lib.exe # Wrapper for Microsoft lib.exe
me=ar-lib me=ar-lib
scriptversion=2012-03-01.08; # UTC scriptversion=2019-07-04.01; # UTC
# Copyright (C) 2010-2018 Free Software Foundation, Inc. # Copyright (C) 2010-2020 Free Software Foundation, Inc.
# Written by Peter Rosin <peda@lysator.liu.se>. # Written by Peter Rosin <peda@lysator.liu.se>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ func_file_conv ()
MINGW*) MINGW*)
file_conv=mingw file_conv=mingw
;; ;;
CYGWIN*) CYGWIN* | MSYS*)
file_conv=cygwin file_conv=cygwin
;; ;;
*) *)
@ -65,7 +65,7 @@ func_file_conv ()
mingw) mingw)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;; ;;
cygwin) cygwin | msys)
file=`cygpath -m "$file" || echo "$file"` file=`cygpath -m "$file" || echo "$file"`
;; ;;
wine) wine)
@ -224,10 +224,11 @@ elif test -n "$extract"; then
esac esac
done done
else else
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member $AR -NOLOGO -LIST "$archive" | tr -d '\r' | sed -e 's/\\/\\\\/g' \
do | while read member
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? do
done $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
done
fi fi
elif test -n "$quick$replace"; then elif test -n "$quick$replace"; then

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>. # Written by Tom Tromey <tromey@cygnus.com>.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -53,7 +53,7 @@ func_file_conv ()
MINGW*) MINGW*)
file_conv=mingw file_conv=mingw
;; ;;
CYGWIN*) CYGWIN* | MSYS*)
file_conv=cygwin file_conv=cygwin
;; ;;
*) *)
@ -67,7 +67,7 @@ func_file_conv ()
mingw/*) mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;; ;;
cygwin/*) cygwin/* | msys/*)
file=`cygpath -m "$file" || echo "$file"` file=`cygpath -m "$file" || echo "$file"`
;; ;;
wine/*) wine/*)

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Copyright (C) 1999-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by

View File

@ -451,7 +451,18 @@ do
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name. # Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && (umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits. # and set any options; do chmod last to preserve setuid bits.
# #

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2018 Free Software Foundation, Inc. # Copyright (C) 2011-2020 Free Software Foundation, Inc.
# #
# This program is free software; you can redistribute it and/or modify # 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 # 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.1 -*- Autoconf -*- # generated automatically by aclocal 1.16.2 -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Copyright (C) 1996-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # 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. 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'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# Copyright (C) 2002-2018 Free Software Foundation, Inc. # Copyright (C) 2002-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16' [am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to 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. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.1], [], m4_if([$1], [1.16.2], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [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. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.1])dnl [AM_AUTOMAKE_VERSION([1.16.2])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# Copyright (C) 2011-2018 Free Software Foundation, Inc. # Copyright (C) 2011-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -118,7 +118,7 @@ AC_SUBST([AR])dnl
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -170,7 +170,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_CONDITIONAL -*- Autoconf -*- # AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc. # Copyright (C) 1997-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # 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.]]) Usually this means the macro was only invoked conditionally.]])
fi])]) fi])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Copyright (C) 1999-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # 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 -*- # Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Copyright (C) 1999-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -431,7 +431,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
done done
if test $am_rc -ne 0; then if test $am_rc -ne 0; then
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE="gmake" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build '--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).]) the package (albeit without support for automatic dependency tracking).])
fi fi
@ -458,7 +460,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*- # Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Copyright (C) 1996-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -655,7 +657,7 @@ for _am_header in $config_headers :; do
done done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -676,7 +678,7 @@ if test x"${install_sh+set}" != xset; then
fi fi
AC_SUBST([install_sh])]) AC_SUBST([install_sh])])
# Copyright (C) 2003-2018 Free Software Foundation, Inc. # Copyright (C) 2003-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -697,7 +699,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -740,7 +742,7 @@ AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997-2018 Free Software Foundation, Inc. # Copyright (C) 1997-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -779,7 +781,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -808,7 +810,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION], AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Copyright (C) 1999-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -855,7 +857,7 @@ AC_LANG_POP([C])])
# For backward compatibility. # For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -874,7 +876,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*- # Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Copyright (C) 1996-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -955,7 +957,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file rm -f conftest.file
]) ])
# Copyright (C) 2009-2018 Free Software Foundation, Inc. # Copyright (C) 2009-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1015,7 +1017,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
]) ])
# Copyright (C) 2001-2018 Free Software Foundation, Inc. # Copyright (C) 2001-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1043,7 +1045,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006-2018 Free Software Foundation, Inc. # Copyright (C) 2006-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -1062,7 +1064,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*- # Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004-2018 Free Software Foundation, Inc. # Copyright (C) 2004-2020 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -329,6 +329,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

18
hawk/configure vendored
View File

@ -786,6 +786,7 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -888,6 +889,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1140,6 +1142,15 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1277,7 +1288,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir libdir localedir mandir runstatedir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1430,6 +1441,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -26106,7 +26118,9 @@ $as_echo X/"$am_mf" |
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "Something went wrong bootstrapping makefile fragments as_fn_error $? "Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the for automatic dependency tracking. If GNU make was not used, consider
re-running the configure script with MAKE=\"gmake\" (or whatever is
necessary). You can also try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build '--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking). the package (albeit without support for automatic dependency tracking).
See \`config.log' for more details" "$LINENO" 5; } See \`config.log' for more details" "$LINENO" 5; }

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # 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-sed.h hawk-std.h hawk-tre.h hawk-unpack.h hawk-xma.h \
Hawk.hpp HawkStd.hpp Hawk.hpp HawkStd.hpp
HEADERS = $(pkginclude_HEADERS) HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
$(LISP)hawk-cfg.h.in hawk-cfg.h.in
# Read a list of newline-separated strings from the standard input, # Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is # and print each of them once, without duplicates. Input order is
# *not* preserved. # *not* preserved.
@ -566,6 +566,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -3388,6 +3388,12 @@ HAWK_EXPORT hawk_fun_t* hawk_rtx_valtofun (
hawk_val_t* val hawk_val_t* val
); );
HAWK_EXPORT hawk_mod_t* hawk_rtx_valtomodfnc (
hawk_rtx_t* rtx,
hawk_val_t* val,
hawk_fnc_spec_t* spec
);
/** /**
* The hawk_rtx_hashval() function hashes a simple value * The hawk_rtx_hashval() function hashes a simple value
* to a positive integer. It returns -1 for a inhashable value. * to a positive integer. It returns -1 for a inhashable value.

View File

@ -42,7 +42,11 @@ typedef struct mod_data_t mod_data_t;
*/ */
struct pafs_t struct pafs_t
{ {
hawk_fun_t* fun; int is_fun;
const hawk_ooch_t* argspec_ptr;
hawk_oow_t argspec_len;
hawk_oow_t stack_base; hawk_oow_t stack_base;
hawk_oow_t start_index; hawk_oow_t start_index;
hawk_oow_t end_index; hawk_oow_t end_index;
@ -51,7 +55,7 @@ struct pafs_t
static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call, void* data) static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call, void* data)
{ {
struct pafs_t* pasf = (struct pafs_t*)data; struct pafs_t* pasf = (struct pafs_t*)data;
hawk_oow_t org_stack_base, spec_len, i, j; hawk_oow_t org_stack_base, i, j;
hawk_val_t* v; hawk_val_t* v;
if (HAWK_RTX_STACK_AVAIL(rtx) < pasf->end_index - pasf->start_index + 1) if (HAWK_RTX_STACK_AVAIL(rtx) < pasf->end_index - pasf->start_index + 1)
@ -60,8 +64,6 @@ static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call
return (hawk_oow_t)-1; return (hawk_oow_t)-1;
} }
spec_len = pasf->fun->argspec? hawk_count_oocstr(pasf->fun->argspec): 0;
org_stack_base = rtx->stack_base; org_stack_base = rtx->stack_base;
for (i = pasf->start_index, j = 0; i <= pasf->end_index; i++, j++) for (i = pasf->start_index, j = 0; i <= pasf->end_index; i++, j++)
{ {
@ -72,14 +74,20 @@ static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call
rtx->stack_base = org_stack_base; rtx->stack_base = org_stack_base;
/* if not sufficient number of spec characters given, take the last value and use it */ /* if not sufficient number of spec characters given, take the last value and use it */
spec = (spec_len <= 0)? '\0': pasf->fun->argspec[((j < spec_len)? j: spec_len - 1)]; spec = (pasf->argspec_len <= 0)? '\0': pasf->argspec_ptr[((j < pasf->argspec_len)? j: pasf->argspec_len - 1)];
if (HAWK_RTX_GETVALTYPE(rtx, v) == HAWK_VAL_REF) if (HAWK_RTX_GETVALTYPE(rtx, v) == HAWK_VAL_REF)
{ {
v = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)v); if (pasf->is_fun)
{
/* take out the actual value and pass it to the callee
* only if the callee is a user-defined function */
v = hawk_rtx_getrefval(rtx, (hawk_val_ref_t*)v);
}
} }
else else
{ {
/* TODO: verify if R must be checked here.. */
if (spec == 'r') if (spec == 'r')
{ {
hawk_rtx_seterrnum (rtx, &call->loc, HAWK_ENOTREF); hawk_rtx_seterrnum (rtx, &call->loc, HAWK_ENOTREF);
@ -96,7 +104,6 @@ static hawk_oow_t push_args_from_stack (hawk_rtx_t* rtx, hawk_nde_fncall_t* call
static int fnc_call (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi) static int fnc_call (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
{ {
/* TODO: support to call a module function such as sys::getpid() */
hawk_fun_t* fun; hawk_fun_t* fun;
hawk_oow_t nargs; hawk_oow_t nargs;
hawk_nde_fncall_t call; hawk_nde_fncall_t call;
@ -104,25 +111,57 @@ static int fnc_call (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
hawk_val_t* v; hawk_val_t* v;
/* this function is similar to hawk_rtx_callfun() but it is more simplified */ /* this function is similar to hawk_rtx_callfun() but it is more simplified */
HAWK_MEMSET (&call, 0, HAWK_SIZEOF(call));
nargs = hawk_rtx_getnargs(rtx);
fun = hawk_rtx_valtofun(rtx, hawk_rtx_getarg(rtx, 0)); fun = hawk_rtx_valtofun(rtx, hawk_rtx_getarg(rtx, 0));
if (!fun) return -1; /* hard failure */ if (fun)
nargs = hawk_rtx_getnargs(rtx);
if (nargs - 1 > fun->nargs)
{ {
hawk_rtx_seterrnum (rtx, HAWK_NULL, HAWK_EARGTM); if (nargs - 1 > fun->nargs)
return -1; /* hard failure */ {
hawk_rtx_seterrnum (rtx, HAWK_NULL, HAWK_EARGTM);
return -1; /* hard failure */
}
/* user-defined function call */
call.type = HAWK_NDE_FNCALL_FUN;
call.u.fun.name = fun->name;
pafs.is_fun = 1;
pafs.argspec_ptr = fun->argspec;
pafs.argspec_len = fun->argspec? hawk_count_oocstr(fun->argspec): 0;
}
else
{
/* find the name in the modules */
hawk_mod_t* m;
mod_data_t* md;
// TODO: find normal fnc too.
md = (mod_data_t*)fi->mod->ctx;
/* hawk_querymodulewithname() may update some shared data under
* the hawk object. use a mutex for shared data safety */
hawk_mtx_lock (&md->mq_mtx, HAWK_NULL);
m = hawk_rtx_valtomodfnc(rtx, hawk_rtx_getarg(rtx, 0), &call.u.fnc.spec);
hawk_mtx_unlock (&md->mq_mtx);
if (!m) return -1; /* hard failure */
call.type = HAWK_NDE_FNCALL_FNC;
// QQQ0
// call.u.fnc.info.name = name;
call.u.fnc.info.mod = m;
pafs.is_fun = 0;
pafs.argspec_ptr = call.u.fnc.spec.arg.spec;
pafs.argspec_len = call.u.fnc.spec.arg.spec? hawk_count_oocstr(call.u.fnc.spec.arg.spec): 0;
} }
HAWK_MEMSET (&call, 0, HAWK_SIZEOF(call));
call.type = HAWK_NDE_FNCALL_FUN;
call.u.fun.name = fun->name;
call.nargs = nargs - 1; call.nargs = nargs - 1;
/* keep HAWK_NULL in call.args so that hawk_rtx_evalcall() knows it's a fake call structure */ /* keep HAWK_NULL in call.args so that hawk_rtx_evalcall() knows it's a fake call structure */
call.arg_base = rtx->stack_base + 5; /* 5 = 4(stack frame prologue) + 1(the first argument to hawk::call()) */ call.arg_base = rtx->stack_base + 5; /* 5 = 4(stack frame prologue) + 1(the first argument to hawk::call()) */
//pafs.fun = fun;
pafs.fun = fun;
pafs.stack_base = rtx->stack_base; pafs.stack_base = rtx->stack_base;
pafs.start_index = 1; pafs.start_index = 1;
pafs.end_index = nargs - 1; pafs.end_index = nargs - 1;
@ -163,7 +202,7 @@ static int fnc_function_exists (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
/* hawk_query_module_with_name() may update some shared data under /* hawk_query_module_with_name() may update some shared data under
* the hawk object. use a mutex for shared data safety */ * the hawk object. use a mutex for shared data safety */
hawk_mtx_lock (&md->mq_mtx, HAWK_NULL); hawk_mtx_lock (&md->mq_mtx, HAWK_NULL);
rx = (hawk_query_module_with_name(hawk_rtx_gethawk(rtx), &name, &sym) != HAWK_NULL); rx = (hawk_querymodulewithname(hawk_rtx_gethawk(rtx), &name, &sym) != HAWK_NULL);
hawk_mtx_unlock (&md->mq_mtx); hawk_mtx_unlock (&md->mq_mtx);
} }
} }

View File

@ -117,7 +117,7 @@ void hawk_clearsionames (
); );
hawk_mod_t* hawk_query_module_with_name ( hawk_mod_t* hawk_querymodulewithname (
hawk_t* hawk, hawk_t* hawk,
const hawk_oocs_t* name, const hawk_oocs_t* name,
hawk_mod_sym_t* sym hawk_mod_sym_t* sym

View File

@ -7553,7 +7553,7 @@ done:
} }
hawk_mod_t* hawk_query_module_with_name (hawk_t* hawk, const hawk_oocs_t* name, hawk_mod_sym_t* sym) hawk_mod_t* hawk_querymodulewithname (hawk_t* hawk, const hawk_oocs_t* name, hawk_mod_sym_t* sym)
{ {
const hawk_ooch_t* dc; const hawk_ooch_t* dc;
hawk_oocs_t segs[2]; hawk_oocs_t segs[2];

View File

@ -2122,7 +2122,7 @@ static HAWK_INLINE int run_block0 (hawk_rtx_t* rtx, hawk_nde_blk_t* nde)
/*saved_stack_top = rtx->stack_top;*/ /*saved_stack_top = rtx->stack_top;*/
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("securing space for local variables nlcls = %d\n"), (int)nde->nlcls); hawk_logbfmt (hawk_rtx_gethawk(rtx), "securing space for local variables nlcls = %d\n", (int)nde->nlcls);
#endif #endif
if (nde->nlcls > 0) if (nde->nlcls > 0)
@ -2168,7 +2168,7 @@ static HAWK_INLINE int run_block0 (hawk_rtx_t* rtx, hawk_nde_blk_t* nde)
} }
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("executing block statements\n")); hawk_logbfmt (hawk_rtx_gethawk(rtx), "executing block statements\n");
#endif #endif
p = nde->body; p = nde->body;
@ -2184,7 +2184,7 @@ static HAWK_INLINE int run_block0 (hawk_rtx_t* rtx, hawk_nde_blk_t* nde)
/* pop off local variables */ /* pop off local variables */
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("popping off local variables\n")); hawk_logbfmt (hawk_rtx_gethawk(rtx), "popping off local variables\n");
#endif #endif
if (nde->nlcls > 0) if (nde->nlcls > 0)
@ -4146,7 +4146,7 @@ static hawk_val_t* do_assignment_indexed (hawk_rtx_t* rtx, hawk_nde_var_t* var,
#endif #endif
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("**** index str=>%s, map->ref=%d, map->type=%d\n"), str, (int)v->ref, (int)v->type); hawk_logbfmt (hawk_rtx_gethawk(rtx), "**** index str=>%js, map->ref=%d, map->type=%d\n", str, (int)v->ref, (int)v->type);
#endif #endif
if (vtype == HAWK_VAL_MAP) if (vtype == HAWK_VAL_MAP)
@ -6751,7 +6751,7 @@ hawk_val_t* hawk_rtx_evalcall (
saved_stack_top = rtx->stack_top; saved_stack_top = rtx->stack_top;
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("setting up function stack frame top=%zd base=%zd\n"), (hawk_oow_t)rtx->stack_top, (hawk_oow_t)rtx->stack_base); hawk_logbfmt (hawk_rtx_gethawk(rtx), "setting up function stack frame top=%zd base=%zd\n", (hawk_oow_t)rtx->stack_top, (hawk_oow_t)rtx->stack_base);
#endif #endif
/* make a new stack frame */ /* make a new stack frame */
@ -6799,7 +6799,7 @@ hawk_val_t* hawk_rtx_evalcall (
HAWK_RTX_STACK_NARGS(rtx) = (void*)nargs; HAWK_RTX_STACK_NARGS(rtx) = (void*)nargs;
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("running function body\n")); hawk_logbfmt (hawk_rtx_gethawk(rtx), "running function body\n");
#endif #endif
if (fun) if (fun)
@ -6825,7 +6825,7 @@ hawk_val_t* hawk_rtx_evalcall (
/* refdown args in the rtx.stack */ /* refdown args in the rtx.stack */
nargs = (hawk_oow_t)HAWK_RTX_STACK_NARGS(rtx); nargs = (hawk_oow_t)HAWK_RTX_STACK_NARGS(rtx);
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("block rtx complete nargs = %d\n"), (int)nargs); hawk_logbfmt (hawk_rtx_gethawk(rtx), "block rtx complete nargs = %d\n", (int)nargs);
#endif #endif
i = 0; i = 0;
@ -6949,7 +6949,7 @@ hawk_val_t* hawk_rtx_evalcall (
} }
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("got return value\n")); hawk_logbfmt (hawk_rtx_gethawk(rtx), "got return value\n");
#endif #endif
v = HAWK_RTX_STACK_RETVAL(rtx); v = HAWK_RTX_STACK_RETVAL(rtx);
@ -7004,7 +7004,7 @@ hawk_val_t* hawk_rtx_evalcall (
if (rtx->exit_level == EXIT_FUNCTION) rtx->exit_level = EXIT_NONE; if (rtx->exit_level == EXIT_FUNCTION) rtx->exit_level = EXIT_NONE;
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("returning from function top=%zd, base=%zd\n"), (hawk_oow_t)rtx->stack_top, (hawk_oow_t)rtx->stack_base); hawk_logbfmt (hawk_rtx_gethawk(rtx), "returning from function top=%zd, base=%zd\n", (hawk_oow_t)rtx->stack_top, (hawk_oow_t)rtx->stack_base);
#endif #endif
return (n <= -1)? HAWK_NULL: v; return (n <= -1)? HAWK_NULL: v;
@ -7922,7 +7922,7 @@ read_again:
} }
#if defined(DEBUG_RUN) #if defined(DEBUG_RUN)
hawk_logfmt (hawk_rtx_gethawk(rtx), HAWK_T("record len = %d str=[%.*js]\n"), (int)HAWK_OOECS_LEN(buf), HAWK_OOECS_LEN(buf), HAWK_OOECS_PTR(buf)); hawk_logfbmt (hawk_rtx_gethawk(rtx), "record len = %d str=[%.*js]\n", (int)HAWK_OOECS_LEN(buf), HAWK_OOECS_LEN(buf), HAWK_OOECS_PTR(buf));
#endif #endif
if (n == 0) if (n == 0)
{ {

View File

@ -238,7 +238,7 @@ struct hawk_nde_fncall_t
hawk_fun_t* fun; /* cache it */ hawk_fun_t* fun; /* cache it */
} fun; } fun;
/* minimum information of a intrinsic function /* minimum information of an intrinsic function
* needed during run-time. */ * needed during run-time. */
struct struct
{ {

View File

@ -2526,7 +2526,7 @@ hawk_bch_t* hawk_rtx_getvalbcstrwithcmgr (hawk_rtx_t* rtx, hawk_val_t* v, hawk_o
rtx->bctos.b[fi].c[1] = '\0'; rtx->bctos.b[fi].c[1] = '\0';
if (len) *len = l; if (len) *len = l;
HAWK_ASSERT ((void*)&rtx->bctos.b[fi] == (void*)rtx->bctos.b[fi].c); HAWK_ASSERT ((void*)&rtx->bctos.b[fi] == (void*)rtx->bctos.b[fi].c);
return rtx->bctos.b[fi].c; return (hawk_bch_t*)rtx->bctos.b[fi].c; /* type-cast hawk_bchu_t* to hawk_bch_t* */
} }
goto duplicate; goto duplicate;
@ -2821,6 +2821,51 @@ hawk_fun_t* hawk_rtx_valtofun (hawk_rtx_t* rtx, hawk_val_t* v)
return fun; return fun;
} }
hawk_mod_t* hawk_rtx_valtomodfnc (hawk_rtx_t* rtx, hawk_val_t* v, hawk_fnc_spec_t* spec)
{
hawk_t* hawk = hawk_rtx_gethawk(rtx);
hawk_mod_t* mod;
hawk_mod_sym_t sym;
hawk_val_type_t vtype;
vtype = HAWK_RTX_GETVALTYPE(rtx, v);
switch (vtype)
{
case HAWK_VAL_BCHR:
case HAWK_VAL_MBS:
case HAWK_VAL_CHAR:
case HAWK_VAL_STR:
{
hawk_oocs_t x;
x.ptr = hawk_rtx_getvaloocstr(rtx, v, &x.len);
if (HAWK_UNLIKELY(!x.ptr)) return HAWK_NULL;
if (hawk_count_oocstr(x.ptr) != x.len)
{
hawk_rtx_freevaloocstr (rtx, v, x.ptr);
goto error_inval;
}
mod = hawk_querymodulewithname(hawk, &x, &sym);
hawk_rtx_freevaloocstr (rtx, v, x.ptr);
if (!mod) return HAWK_NULL;
break;
}
default:
error_inval:
hawk_rtx_seterrnum (rtx, HAWK_NULL, HAWK_EINVAL);
return HAWK_NULL;
}
if (sym.type != HAWK_MOD_FNC || (hawk->opt.trait & sym.u.fnc_.trait) != sym.u.fnc_.trait)
{
hawk_rtx_seterrnum (rtx, HAWK_NULL, HAWK_ENOENT);
return HAWK_NULL;
}
*spec = sym.u.fnc_;
return mod;
}
/* ========================================================================== */ /* ========================================================================== */

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -416,6 +416,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -157,7 +157,6 @@ static int fnc_str_to_str (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
} }
/* TODO hawk_set_opt (TRAIT) using the optional parameter */ /* TODO hawk_set_opt (TRAIT) using the optional parameter */
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
{ {
a[i] = hawk_rtx_getarg(rtx, i); a[i] = hawk_rtx_getarg(rtx, i);
@ -191,7 +190,7 @@ static int fnc_str_to_str (hawk_rtx_t* rtx, const hawk_fnc_info_t* fi)
} }
hawk_rtx_refupval (rtx, tmp); hawk_rtx_refupval (rtx, tmp);
n = hawk_rtx_setrefval(rtx, (hawk_val_ref_t*)hawk_rtx_getarg (rtx, 2), tmp); n = hawk_rtx_setrefval(rtx, (hawk_val_ref_t*)hawk_rtx_getarg(rtx, 2), tmp);
hawk_rtx_refdownval (rtx, tmp); hawk_rtx_refdownval (rtx, tmp);
if (n <= -1) if (n <= -1)
{ {

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -351,6 +351,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -556,6 +556,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -7,8 +7,12 @@ function run_test_001 ()
{ {
@local tmp, out; @local tmp, out;
tmp = sed::str_to_str("s/a/j/g", "aaabbbaaacccaaaddd", out); if (hawk::function_exists("sed::str_to_str"))
ensure (out === "jjjbbbjjjcccjjjddd", 1, @SCRIPTNAME, @SCRIPTLINE); {
##tmp = sed::str_to_str("s/a/j/g", "aaabbbaaacccaaaddd", out);
tmp = hawk::call("sed::str_to_str", "s/a/j/g", "aaabbbaaacccaaaddd", out);
ensure (out === "jjjbbbjjjcccjjjddd", 1, @SCRIPTNAME, @SCRIPTLINE);
}
} }
function main() function main()

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am. # Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc. # Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -328,6 +328,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@