From 9ef43720d1b2b3125f4367f3ccf2cb7129d1a9ba Mon Sep 17 00:00:00 2001 From: "Andrew J. Schorr" Date: Fri, 6 Jan 2017 14:48:53 -0500 Subject: Enhance API to support extended-precision arithmetic and implement intdiv as a demonstration. --- awk.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'awk.h') diff --git a/awk.h b/awk.h index 278f54c5..514dfdcb 100644 --- a/awk.h +++ b/awk.h @@ -1060,6 +1060,8 @@ enum block_id { BLOCK_INVALID = 0, /* not legal */ BLOCK_NODE, BLOCK_BUCKET, + BLOCK_MPFR, + BLOCK_MPZ, BLOCK_MAX /* count */ }; @@ -1945,3 +1947,18 @@ erealloc_real(void *ptr, size_t count, const char *where, const char *var, const return ret; } + +static inline NODE * +make_number_node(unsigned int tp) +{ + NODE *r; + getnode(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; + return r; +} -- cgit v1.2.3 From 3e6d7cb2ac0e05aaca43b923cc9e2b408f390d01 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 13 Apr 2017 11:40:24 +0300 Subject: Make MPFR division by zero fatal in intdiv.c. Some other cleanups. --- awk.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'awk.h') diff --git a/awk.h b/awk.h index 0ab47914..f2ad3ebe 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; } -- cgit v1.2.3