aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-04-02 16:40:50 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-04-02 16:40:50 +0300
commitdb0ad810899edd82b68ac681a4b1111fc25b3e30 (patch)
tree853bae05bcf28150f85b53976c505fda8eb40406
parent38126dd894446fdbdddded3f3d4bd807d1764ebc (diff)
parent34021ae7b7b8662b41fe6feeced4cf619cb31c21 (diff)
downloadegawk-db0ad810899edd82b68ac681a4b1111fc25b3e30.tar.gz
egawk-db0ad810899edd82b68ac681a4b1111fc25b3e30.tar.bz2
egawk-db0ad810899edd82b68ac681a4b1111fc25b3e30.zip
Merge branch 'master' into feature/fix-comments
-rw-r--r--ChangeLog19
-rwxr-xr-xconfig.guess4
-rwxr-xr-xconfig.sub4
-rw-r--r--doc/ChangeLog4
-rw-r--r--doc/texinfo.tex6
-rw-r--r--extension/build-aux/ChangeLog4
-rwxr-xr-xextension/build-aux/config.guess4
-rwxr-xr-xextension/build-aux/config.sub4
-rwxr-xr-xextension/build-aux/install-sh25
-rwxr-xr-xinstall-sh25
-rw-r--r--interpret.h27
-rw-r--r--node.c20
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am12
-rw-r--r--test/Makefile.in12
-rw-r--r--test/mpfrfield.awk14
-rw-r--r--test/mpfrfield.in10
-rw-r--r--test/mpfrfield.ok1
18 files changed, 159 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 1edd1ca2..dd22c848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2018-04-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * config.guess, config.sub, install-sh: Updated from GNULIB.
+
+2018-04-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ Fix a nasty MPFR bug in r_dupnode. If the value being copied
+ is MPFN / MPFR, copy those bits over too. Thanks to
+ Noah Dean <N.Dean@gaminglabs.com> for the report.
+
+ * node.c (r_dupnode): Check for MPFN / MPFR and copy the bits
+ over as needed.
+
+ Unrelated:
+
+ * interpret.h (UNFIELD): Turn into an inline function and
+ let UNFIELD macro call it, allows stepping in with a debugger.
+ (unfield): Function holding former body of UNFIELD macro.
+
2018-03-26 Arnold D. Robbins <arnold@skeeve.com>
Remove the tail recursion optimization. It's fundamentally
diff --git a/config.guess b/config.guess
index 8ca6a44c..256083a7 100755
--- a/config.guess
+++ b/config.guess
@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2018-03-01'
+timestamp='2018-03-08'
# 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
@@ -1469,7 +1469,7 @@ EOF
exit 1
# Local variables:
-# eval: (add-hook 'write-file-functions 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/config.sub b/config.sub
index 0b218edc..9ccf09a7 100755
--- a/config.sub
+++ b/config.sub
@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2018-02-28'
+timestamp='2018-03-08'
# 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
@@ -1794,7 +1794,7 @@ echo "$basic_machine$os"
exit
# Local variables:
-# eval: (add-hook 'write-file-functions 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 72ae86fa..44726965 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * texinfo.tex: Updated.
+
2018-03-26 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in, gawk.1: Remove mention of tail recursion
diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index ac5c1d92..aa4f2564 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2018-02-12.17}
+\def\texinfoversion{2018-03-10.14}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -182,7 +182,7 @@
% Hyphenation fixes.
\hyphenation{
Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
- auto-ma-ti-cal-ly ap-pen-dix bit-map bit-maps
+ ap-pen-dix bit-map bit-maps
data-base data-bases eshell fall-ing half-way long-est man-u-script
man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
@@ -11715,7 +11715,7 @@ directory should work if nowhere else does.}
@markupsetuprqdefault
@c Local variables:
-@c eval: (add-hook 'write-file-hooks 'time-stamp)
+@c eval: (add-hook 'before-save-hook 'time-stamp)
@c page-delimiter: "^\\\\message\\|emacs-page"
@c time-stamp-start: "def\\\\texinfoversion{"
@c time-stamp-format: "%:y-%02m-%02d.%02H"
diff --git a/extension/build-aux/ChangeLog b/extension/build-aux/ChangeLog
index 5870f163..87ada523 100644
--- a/extension/build-aux/ChangeLog
+++ b/extension/build-aux/ChangeLog
@@ -1,3 +1,7 @@
+2018-04-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * config.guess, config.sub, install-sh: Updated from GNULIB.
+
2018-03-11 Arnold D. Robbins <arnold@skeeve.com>
* ar-lib, compile, config.guess, config.sub, depcomp,
diff --git a/extension/build-aux/config.guess b/extension/build-aux/config.guess
index 8ca6a44c..256083a7 100755
--- a/extension/build-aux/config.guess
+++ b/extension/build-aux/config.guess
@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2018-03-01'
+timestamp='2018-03-08'
# 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
@@ -1469,7 +1469,7 @@ EOF
exit 1
# Local variables:
-# eval: (add-hook 'write-file-functions 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/extension/build-aux/config.sub b/extension/build-aux/config.sub
index 0b218edc..9ccf09a7 100755
--- a/extension/build-aux/config.sub
+++ b/extension/build-aux/config.sub
@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2018 Free Software Foundation, Inc.
-timestamp='2018-02-28'
+timestamp='2018-03-08'
# 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
@@ -1794,7 +1794,7 @@ echo "$basic_machine$os"
exit
# Local variables:
-# eval: (add-hook 'write-file-functions 'time-stamp)
+# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "timestamp='"
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "'"
diff --git a/extension/build-aux/install-sh b/extension/build-aux/install-sh
index 5f3d36cb..8175c640 100755
--- a/extension/build-aux/install-sh
+++ b/extension/build-aux/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2018-03-07.03; # UTC
+scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -332,34 +332,43 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
+ # Note that $RANDOM variable is not portable (e.g. dash); Use it
+ # here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p' feature.
if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
- rmdir "$tmpdir/d" "$tmpdir"
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
diff --git a/install-sh b/install-sh
index 5f3d36cb..8175c640 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2018-03-07.03; # UTC
+scriptversion=2018-03-11.20; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -332,34 +332,43 @@ do
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
+ # Note that $RANDOM variable is not portable (e.g. dash); Use it
+ # here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+ trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ # Because "mkdir -p" follows existing symlinks and we likely work
+ # directly in world-writeable /tmp, make sure that the '$tmpdir'
+ # directory is successfully created first before we actually test
+ # 'mkdir -p' feature.
if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ $mkdirprog $mkdir_mode "$tmpdir" &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ test_tmpdir="$tmpdir/a"
+ ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
- rmdir "$tmpdir/d" "$tmpdir"
+ rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac;;
diff --git a/interpret.h b/interpret.h
index 96e2c890..20fcb7ad 100644
--- a/interpret.h
+++ b/interpret.h
@@ -32,16 +32,25 @@
* valref 1, that effectively means that this is an assignment like "$n = $n",
* so a no-op, other than triggering $0 reconstitution.
*/
-#define UNFIELD(l, r) \
-{ \
- /* if was a field, turn it into a var */ \
- if ((r->flags & MALLOC) != 0 || r->valref == 1) { \
- l = r; \
- } else { \
- l = dupnode(r); \
- DEREF(r); \
- } \
+
+// not a macro so we can step into it with a debugger
+#ifndef UNFIELD_DEFINED
+#define UNFIELD_DEFINED 1
+static inline void
+unfield(NODE **l, NODE **r)
+{
+ /* if was a field, turn it into a var */
+ if (((*r)->flags & MALLOC) != 0 || (*r)->valref == 1) {
+ (*l) = (*r);
+ } else {
+ (*l) = dupnode(*r);
+ DEREF(*r);
+ }
}
+
+#define UNFIELD(l, r) unfield(& (l), & (r))
+#endif
+
int
r_interpret(INSTRUCTION *code)
{
diff --git a/node.c b/node.c
index add959f7..fcd2bf33 100644
--- a/node.c
+++ b/node.c
@@ -306,8 +306,24 @@ r_dupnode(NODE *n)
}
#endif
- getnode(r);
- *r = *n;
+#ifdef HAVE_MPFR
+ if ((n->flags & MPZN) != 0) {
+ r = mpg_integer();
+ mpz_set(r->mpg_i, n->mpg_i);
+ r->flags = n->flags;
+ } else if ((n->flags & MPFN) != 0) {
+ r = mpg_float();
+ int tval = mpfr_set(r->mpg_numbr, n->mpg_numbr, ROUND_MODE);
+ IEEE_FMT(r->mpg_numbr, tval);
+ r->flags = n->flags;
+ } else {
+#endif
+ getnode(r);
+ *r = *n;
+#ifdef HAVE_MPFR
+ }
+#endif
+
r->flags |= MALLOC;
r->valref = 1;
/*
diff --git a/test/ChangeLog b/test/ChangeLog
index e075e3ac..5f806e11 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): Add files for mpfrfield.
+ (MPFR_TESTS): Add mpfrfield.
+ * mpfrfield.awk, mpfrfield.awk, mpfrfield.ok: New files.
+
2018-03-26 Arnold D. Robbins <arnold@skeeve.com>
* fwtest3.in, mmap8k.awk, mmap8k.ok, rsstart2.in: New files.
diff --git a/test/Makefile.am b/test/Makefile.am
index bfb0c4b3..fe4fd816 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -658,6 +658,9 @@ EXTRA_DIST = \
mpfrbigint.ok \
mpfrexprange.awk \
mpfrexprange.ok \
+ mpfrfield.awk \
+ mpfrfield.in \
+ mpfrfield.ok \
mpfrieee.awk \
mpfrieee.ok \
mpfrmemok1.awk \
@@ -1307,8 +1310,8 @@ INET_TESTS = inetdayu inetdayt inetechu inetecht
MACHINE_TESTS = double1 double2 fmtspcl intformat
-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
+MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \
+ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
mpfrstrtonum mpgforcenum mpfruplus
LOCALE_CHARSET_TESTS = \
@@ -2140,6 +2143,11 @@ mpfrmemok1:
@$(AWK) -p- -M -f "$(srcdir)"/$@.awk 2>&1 | sed 1d > _$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mpfrfield:
+ @echo $@
+ @$(AWK) -M -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ 2>&1
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
jarebug::
@echo $@
@"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@"
diff --git a/test/Makefile.in b/test/Makefile.in
index 1f2ff766..33e2b0bf 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -916,6 +916,9 @@ EXTRA_DIST = \
mpfrbigint.ok \
mpfrexprange.awk \
mpfrexprange.ok \
+ mpfrfield.awk \
+ mpfrfield.in \
+ mpfrfield.ok \
mpfrieee.awk \
mpfrieee.ok \
mpfrmemok1.awk \
@@ -1560,8 +1563,8 @@ ARRAYDEBUG_TESTS = arrdbg
EXTRA_TESTS = inftest regtest ignrcas3
INET_TESTS = inetdayu inetdayt inetechu inetecht
MACHINE_TESTS = double1 double2 fmtspcl intformat
-MPFR_TESTS = mpfrbigint mpfrexprange mpfrieee mpfrmemok1 mpfrnegzero \
- mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
+MPFR_TESTS = mpfrbigint mpfrexprange mpfrfield mpfrieee mpfrmemok1 \
+ mpfrnegzero mpfrnr mpfrrem mpfrrnd mpfrrndeval mpfrsort mpfrsqrt \
mpfrstrtonum mpgforcenum mpfruplus
LOCALE_CHARSET_TESTS = \
@@ -2580,6 +2583,11 @@ mpfrmemok1:
@$(AWK) -p- -M -f "$(srcdir)"/$@.awk 2>&1 | sed 1d > _$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+mpfrfield:
+ @echo $@
+ @$(AWK) -M -f "$(srcdir)"/$@.awk "$(srcdir)"/$@.in > _$@ 2>&1
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
jarebug::
@echo $@
@"$(srcdir)"/$@.sh "$(AWKPROG)" "$(srcdir)"/$@.awk "$(srcdir)"/$@.in "_$@"
diff --git a/test/mpfrfield.awk b/test/mpfrfield.awk
new file mode 100644
index 00000000..35a97b70
--- /dev/null
+++ b/test/mpfrfield.awk
@@ -0,0 +1,14 @@
+#! /bin/gawk -Mf
+
+NR == 1 {
+ min = $1
+}
+
+{
+ if ($1 < min)
+ min = $1
+}
+
+END {
+ print "min", min
+}
diff --git a/test/mpfrfield.in b/test/mpfrfield.in
new file mode 100644
index 00000000..05d33444
--- /dev/null
+++ b/test/mpfrfield.in
@@ -0,0 +1,10 @@
+7
+9
+1
+3
+9
+1
+9
+5
+0
+8
diff --git a/test/mpfrfield.ok b/test/mpfrfield.ok
new file mode 100644
index 00000000..3736de4d
--- /dev/null
+++ b/test/mpfrfield.ok
@@ -0,0 +1 @@
+min 0