[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-25
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-2594-g3e6d7cb |
Date: |
Thu, 13 Apr 2017 04:40:56 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/api-mpfr has been updated
via 3e6d7cb2ac0e05aaca43b923cc9e2b408f390d01 (commit)
from cb6411df195fc515dd5062a8c368e3422594a71f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=3e6d7cb2ac0e05aaca43b923cc9e2b408f390d01
commit 3e6d7cb2ac0e05aaca43b923cc9e2b408f390d01
Author: Arnold D. Robbins <address@hidden>
Date: Thu Apr 13 11:40:24 2017 +0300
Make MPFR division by zero fatal in intdiv.c. Some other cleanups.
diff --git a/ChangeLog b/ChangeLog
index 0a391e1..12e9ab0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-13 Arnold D. Robbins <address@hidden>
+
+ * awk.h (make_number_node): Simplify.
+ * mpfr.c (mpg_node): Change parameter name to `flags'.
+
2017-04-12 Arnold D. Robbins <address@hidden>
* mpfr.c (mpg_format_val): Set STRCUR flag when we're done.
@@ -503,7 +508,7 @@
gmp_minor_version, mpfr_major_version, and mpfr_minor_version.
Add functions api_get_mpfr and api_get_mpz to allocate memory for
extended-precision numbers to hand to gawk.
- (get_mpfr_ptr, get_mpz_ptr): Helper macros to warp api_get_mpfr and
+ (get_mpfr_ptr, get_mpz_ptr): Helper macros to wrap api_get_mpfr and
api_get_mpz.
(make_number): Modify to populate awk_number_t correctly.
(make_number_mpz, make_number_mpfr): New helper functions to create
@@ -512,12 +517,11 @@
in extensions that want to support extended-precision math.
* gawkapi.c (getmpfr, freempfr, getmpz, freempz): New macros to
allocate and free memory blocks for extended-precision math.
- (awk_value_to_node): For AWK_NUMBER values, support 3 different kinds
- of internal numbers: double, mpz_t, and mpfr_t.
+ (awk_value_to_node): For AWK_NUMBER values, support three different
+ kinds of internal numbers: double, mpz_t, and mpfr_t.
(assign_number): New helper function to convert a numeric node to
an awk_value_t.
- (node_to_awk_value): Use assign_number in a couple of places to
- pass numbers properly.
+ (node_to_awk_value): Use assign_number to pass numbers properly.
(api_get_mpfr): Implement new api_get_mpfr hook.
(api_get_mpfz): Implement new api_get_mpz hook.
(api_impl): Add GMP & MPFR versions, api_get_mpfr, and api_get_mpz.
diff --git a/awk.h b/awk.h
index 0ab4791..f2ad3eb 100644
--- a/awk.h
+++ b/awk.h
@@ -1976,20 +1976,17 @@ erealloc_real(void *ptr, size_t count, const char
*where, const char *var, const
return ret;
}
-/* make_number_node --- make node with the give flags */
+/* make_number_node --- make node with the given flags */
static inline NODE *
-make_number_node(unsigned int tp)
+make_number_node(unsigned int flags)
{
NODE *r;
getnode(r);
+ memset(r, 0, sizeof(*r));
r->type = Node_val;
r->valref = 1;
- r->flags = (tp|MALLOC|NUMBER|NUMCUR);
- r->stptr = NULL;
- r->stlen = 0;
- r->wstptr = NULL;
- r->wstlen = 0;
+ r->flags = (flags|MALLOC|NUMBER|NUMCUR);
return r;
}
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 87d4358..784daf2 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-13 Arnold D. Robbins <address@hidden>
+
+ * configure.ac: Alphabetize function list in AC_CHECK_FUNCS.
+ * intdiv.c: Add descriptive comments to some functions.
+ (do_intdiv): Make division by zero fatal in MPFR case.
+
2017-04-03 Arnold D. Robbins <address@hidden>
* inplace.c (inplace_end): Correct the function name in the
diff --git a/extension/Makefile.in b/extension/Makefile.in
index c386eac..000c3b7 100644
--- a/extension/Makefile.in
+++ b/extension/Makefile.in
@@ -284,16 +284,16 @@ am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(filefuncs_la_SOURCES) $(fnmatch_la_SOURCES) \
$(fork_la_SOURCES) $(inplace_la_SOURCES) $(intdiv_la_SOURCES) \
- $(ordchr_la_SOURCES) $(readdir_la_SOURCES) $(readdir_test_la_SOURCES) \
- $(readfile_la_SOURCES) $(revoutput_la_SOURCES) \
- $(revtwoway_la_SOURCES) $(rwarray_la_SOURCES) \
- $(testext_la_SOURCES) $(time_la_SOURCES)
+ $(ordchr_la_SOURCES) $(readdir_la_SOURCES) \
+ $(readdir_test_la_SOURCES) $(readfile_la_SOURCES) \
+ $(revoutput_la_SOURCES) $(revtwoway_la_SOURCES) \
+ $(rwarray_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
DIST_SOURCES = $(filefuncs_la_SOURCES) $(fnmatch_la_SOURCES) \
$(fork_la_SOURCES) $(inplace_la_SOURCES) $(intdiv_la_SOURCES) \
- $(ordchr_la_SOURCES) $(readdir_la_SOURCES) $(readdir_test_la_SOURCES) \
- $(readfile_la_SOURCES) $(revoutput_la_SOURCES) \
- $(revtwoway_la_SOURCES) $(rwarray_la_SOURCES) \
- $(testext_la_SOURCES) $(time_la_SOURCES)
+ $(ordchr_la_SOURCES) $(readdir_la_SOURCES) \
+ $(readdir_test_la_SOURCES) $(readfile_la_SOURCES) \
+ $(revoutput_la_SOURCES) $(revtwoway_la_SOURCES) \
+ $(rwarray_la_SOURCES) $(testext_la_SOURCES) $(time_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
diff --git a/extension/configure b/extension/configure
index 580cc15..7ae6654 100755
--- a/extension/configure
+++ b/extension/configure
@@ -12943,8 +12943,8 @@ $as_echo "#define HAVE_MPFR 1" >>confdefs.h
;;
esac
-for ac_func in fdopendir fnmatch gettimeofday fmod \
- getdtablesize nanosleep select statvfs GetSystemTimeAsFileTime
+for ac_func in fdopendir fmod fnmatch getdtablesize \
+ gettimeofday nanosleep select statvfs GetSystemTimeAsFileTime
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/extension/configure.ac b/extension/configure.ac
index 58935b6..bde6e3d 100644
--- a/extension/configure.ac
+++ b/extension/configure.ac
@@ -78,8 +78,8 @@ case `uname -m` in
;;
esac
-AC_CHECK_FUNCS(fdopendir fnmatch gettimeofday fmod \
- getdtablesize nanosleep select statvfs GetSystemTimeAsFileTime)
+AC_CHECK_FUNCS(fdopendir fmod fnmatch getdtablesize \
+ gettimeofday nanosleep select statvfs GetSystemTimeAsFileTime)
GAWK_FUNC_DIRFD
GAWK_PREREQ_DIRFD
diff --git a/extension/intdiv.c b/extension/intdiv.c
index 2f446c4..bde9289 100644
--- a/extension/intdiv.c
+++ b/extension/intdiv.c
@@ -29,6 +29,8 @@ static const char *ext_version = "intdiv extension: version
1.0";
int plugin_is_GPL_compatible;
+/* double_to_int --- get the integer part of a double */
+
static double
double_to_int(double d)
{
@@ -39,6 +41,8 @@ double_to_int(double d)
return d;
}
+/* array_set_number --- set an array element to a numeric value */
+
static void
array_set_number(awk_array_t array, const char *sub, size_t sublen, double num)
{
@@ -49,6 +53,8 @@ array_set_number(awk_array_t array, const char *sub, size_t
sublen, double num)
#ifdef HAVE_MPFR
+/* mpz_conv --- convert an awk_value_t to an MPZ value */
+
static mpz_ptr
mpz_conv(const awk_value_t *arg, mpz_ptr tmp)
{
@@ -71,6 +77,8 @@ mpz_conv(const awk_value_t *arg, mpz_ptr tmp)
}
}
+/* array_set_mpz --- set an array element to an MPZ value */
+
static void
array_set_mpz(awk_array_t array, const char *sub, size_t sublen, mpz_ptr num)
{
@@ -136,8 +144,7 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
array_set_number(array, "quotient", 8, quotient);
array_set_number(array, "remainder", 9, remainder);
#ifdef HAVE_MPFR
- }
- else {
+ } else {
/* extended precision */
mpz_ptr numer, denom;
mpz_t numer_tmp, denom_tmp;
@@ -155,11 +162,13 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
return make_number(-1, result);
}
if (mpz_sgn(denom) == 0) {
- warning(ext_id, _("intdiv: division by zero
attempted"));
if (numer == numer_tmp)
mpz_clear(numer);
if (denom == denom_tmp)
mpz_clear(denom);
+
+ fatal(ext_id, _("intdiv: division by zero attempted"));
+ // won't get here, but keep the compiler happy
return make_number(-1, result);
}
diff --git a/mpfr.c b/mpfr.c
index 447e23c..ea1d5a5 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -103,11 +103,11 @@ cleanup_mpfr(void)
/* mpg_node --- allocate a node to store MPFR float or GMP integer */
NODE *
-mpg_node(unsigned int tp)
+mpg_node(unsigned int flags)
{
- NODE *r = make_number_node(tp);
+ NODE *r = make_number_node(flags);
- if (tp == MPFN)
+ if (flags == MPFN)
/* Initialize, set precision to the default precision, and
value to NaN */
mpfr_init(r->mpg_numbr);
else
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 +++++++++-----
awk.h | 11 ++++-------
extension/ChangeLog | 6 ++++++
extension/Makefile.in | 16 ++++++++--------
extension/configure | 4 ++--
extension/configure.ac | 4 ++--
extension/intdiv.c | 15 ++++++++++++---
mpfr.c | 6 +++---
8 files changed, 46 insertions(+), 30 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-2594-g3e6d7cb,
Arnold Robbins <=