[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. 154f72534002c0c49df2
From: |
John Haque |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. 154f72534002c0c49df249b52fe76d126eed72a3 |
Date: |
Mon, 09 Apr 2012 09:56:46 +0000 |
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, gawk_mpfr has been updated
via 154f72534002c0c49df249b52fe76d126eed72a3 (commit)
from 5481d2ffcd24d5983d95013c62e046634c6c73dc (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=154f72534002c0c49df249b52fe76d126eed72a3
commit 154f72534002c0c49df249b52fe76d126eed72a3
Author: john haque <address@hidden>
Date: Mon Apr 9 04:35:56 2012 -0500
Remove an unneeded define, more fixes for gcc -Wall.
diff --git a/awk.h b/awk.h
index 56fd49e..b4103d4 100644
--- a/awk.h
+++ b/awk.h
@@ -1548,7 +1548,7 @@ extern long getenv_long(const char *name);
extern void set_PREC(void);
extern void set_RNDMODE(void);
#ifdef HAVE_MPFR
-extern int mpg_cmp(const NODE *t1, const NODE *t2);
+extern int mpg_cmp(const NODE *, const NODE *);
extern int format_ieee(mpfr_ptr, int);
extern NODE *mpg_update_var(NODE *);
extern long mpg_set_var(NODE *);
@@ -1568,10 +1568,10 @@ extern NODE *do_mpfr_sqrt(int);
extern NODE *do_mpfr_srand(int);
extern NODE *do_mpfr_strtonum(int);
extern NODE *do_mpfr_xor(int);
-extern void init_mpfr(const char *);
+extern void init_mpfr(mpfr_prec_t, const char *);
extern NODE *mpg_node(unsigned int);
-extern const char *mpg_fmt(const char *mesg, ...);
-extern int mpg_strtoui(mpz_ptr zi, char *str, size_t len, char **end, int
base);
+extern const char *mpg_fmt(const char *, ...);
+extern int mpg_strtoui(mpz_ptr, char *, size_t, char **, int);
#endif
/* msg.c */
extern void gawk_exit(int status);
diff --git a/builtin.c b/builtin.c
index 5049bfe..3045858 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1322,7 +1322,9 @@ mpf1:
if ((AWKNUM)uval != double_to_int(tmpval))
goto out_of_range;
}
+#ifdef HAVE_MPFR
int0:
+#endif
/*
* When to fill with zeroes is of course not simple.
* First: No zero fill if left-justifying.
@@ -1437,7 +1439,9 @@ mpf1:
fmt1:
if (! have_prec)
prec = DEFAULT_G_PRECISION;
+#ifdef HAVE_MPFR
fmt0:
+#endif
chksize(fw + prec + 11); /* 11 == slop */
cp = cpbuf;
*cp++ = '%';
@@ -1458,30 +1462,26 @@ mpf1:
#endif
switch (fmt_type) {
- case MP_INT_WITH_PREC:
#ifdef HAVE_MPFR
+ case MP_INT_WITH_PREC:
sprintf(cp, "*.*Z%c", cs1);
while ((nc = mpfr_snprintf(obufout, ofre, cpbuf,
(int) fw, (int) prec, zi)) >= ofre)
chksize(nc)
-#endif
break;
case MP_INT_WITHOUT_PREC:
-#ifdef HAVE_MPFR
sprintf(cp, "*Z%c", cs1);
while ((nc = mpfr_snprintf(obufout, ofre, cpbuf,
(int) fw, zi)) >= ofre)
chksize(nc)
-#endif
break;
case MP_FLOAT:
-#ifdef HAVE_MPFR
sprintf(cp, "*.*R*%c", cs1);
while ((nc = mpfr_snprintf(obufout, ofre, cpbuf,
(int) fw, (int) prec, RND_MODE,
mf)) >= ofre)
chksize(nc)
-#endif
break;
+#endif
default:
sprintf(cp, "*.*%c", cs1);
while ((nc = snprintf(obufout, ofre, cpbuf,
diff --git a/main.c b/main.c
index d1c7448..26049e5 100644
--- a/main.c
+++ b/main.c
@@ -73,11 +73,6 @@ NODE *TEXTDOMAIN_node;
NODE *_r; /* used as temporary in stack macros */
-#ifdef HAVE_MPFR
-mpfr_prec_t PRECISION = DEFAULT_PREC;
-mpfr_rnd_t RND_MODE = MPFR_RNDN;
-#endif
-
long NF;
long NR;
long FNR;
@@ -577,7 +572,7 @@ out:
#ifdef HAVE_MPFR
/* Set up MPFR defaults, and register pre-exec hook to process
arithmetic opcodes */
if (do_mpfr)
- init_mpfr(DEFAULT_RNDMODE);
+ init_mpfr(DEFAULT_PREC, DEFAULT_RNDMODE);
#endif
/* load group set */
diff --git a/mpfr.c b/mpfr.c
index 2adf918..927f161 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -37,6 +37,7 @@ mpz_t mpzval; /* GMP integer type, used as temporary in few
places */
mpz_t MNR;
mpz_t MFNR;
int do_ieee_fmt; /* IEEE-754 floating-point emulation */
+mpfr_rnd_t RND_MODE;
static mpfr_rnd_t get_rnd_mode(const char rmode);
static NODE *mpg_force_number(NODE *n);
@@ -78,9 +79,9 @@ static inline mpfr_ptr mpg_tofloat(mpfr_ptr mf, mpz_ptr mz);
/* init_mpfr --- set up MPFR related variables */
void
-init_mpfr(const char *rmode)
+init_mpfr(mpfr_prec_t prec, const char *rmode)
{
- mpfr_set_default_prec(PRECISION);
+ mpfr_set_default_prec(prec);
RND_MODE = get_rnd_mode(rmode[0]);
mpfr_set_default_rounding_mode(RND_MODE);
make_number = mpg_make_number;
@@ -565,10 +566,8 @@ set_PREC()
do_ieee_fmt = FALSE;
}
- if (prec > 0) {
+ if (prec > 0)
mpfr_set_default_prec(prec);
- PRECISION = mpfr_get_default_prec();
- }
}
@@ -607,14 +606,14 @@ void
set_RNDMODE()
{
if (do_mpfr) {
- mpfr_rnd_t rnd = -1;
+ mpfr_rnd_t rndm = -1;
NODE *n;
n = force_string(RNDMODE_node->var_value);
if (n->stlen == 1)
- rnd = get_rnd_mode(n->stptr[0]);
- if (rnd != -1) {
- mpfr_set_default_rounding_mode(rnd);
- RND_MODE = rnd;
+ rndm = get_rnd_mode(n->stptr[0]);
+ if (rndm != -1) {
+ mpfr_set_default_rounding_mode(rndm);
+ RND_MODE = rndm;
} else
warning(_("RNDMODE value `%.*s' is invalid"), (int)
n->stlen, n->stptr);
}
-----------------------------------------------------------------------
Summary of changes:
awk.h | 8 ++++----
builtin.c | 12 ++++++------
main.c | 7 +------
mpfr.c | 19 +++++++++----------
4 files changed, 20 insertions(+), 26 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. 154f72534002c0c49df249b52fe76d126eed72a3,
John Haque <=