diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-01 20:29:12 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-03-01 20:29:12 +0200 |
commit | 473623f186c3699c8886ccdd8a2afb7f4fe7a07e (patch) | |
tree | 40b075a492be67b317635d9102e2441d74ce9569 /io.c | |
parent | 2b8a8424212839cd30490e4245c0c5119904eca3 (diff) | |
parent | 1c06c5c6f0f6d46f63977dd7407d86ccc2614226 (diff) | |
download | egawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.tar.gz egawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.tar.bz2 egawk-473623f186c3699c8886ccdd8a2afb7f4fe7a07e.zip |
Merge branch 'gawk_mpfr' of git.sv.gnu.org:/srv/git/gawk into gawk_mpfr
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -132,6 +132,14 @@ #define PIPES_SIMULATED #endif +#ifdef HAVE_MPFR +/* increment NR or FNR */ +#define INCREMENT_R(X) (do_mpfr && X == (LONG_MAX - 1)) ? \ + (mpfr_add_ui(M##X, M##X, 1, RND_MODE), X = 0) : X++ +#else +#define INCREMENT_R(X) X++ +#endif + typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type; /* Several macros make the code a bit clearer: */ @@ -443,7 +451,7 @@ set_FNR() (void) force_number(FNR_node->var_value); #ifdef HAVE_MPFR if ((FNR_node->var_value->flags & MPFN) != 0) - FNR = mpfr_set_var(FNR_node); + FNR = mpg_set_var(FNR_node); else #endif FNR = FNR_node->var_value->numbr; @@ -457,7 +465,7 @@ set_NR() (void) force_number(NR_node->var_value); #ifdef HAVE_MPFR if ((NR_node->var_value->flags & MPFN) != 0) - NR = mpfr_set_var(NR_node); + NR = mpg_set_var(NR_node); else #endif NR = NR_node->var_value->numbr; @@ -484,8 +492,8 @@ inrec(IOBUF *iop, int *errcode) if (*errcode > 0) update_ERRNO_saved(*errcode); } else { - INCREMNT(NR); - INCREMNT(FNR); + INCREMENT_R(NR); + INCREMENT_R(FNR); set_record(begin, cnt); } @@ -2316,8 +2324,8 @@ do_getline(int intovar, IOBUF *iop) if (cnt == EOF) return NULL; /* try next file */ - INCREMNT(NR); - INCREMNT(FNR); + INCREMENT_R(NR); + INCREMENT_R(FNR); if (! intovar) /* no optional var. */ set_record(s, cnt); |