From 35360f99001c28e8fb33505d9b81a4f4bca8a9e3 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Fri, 17 Dec 2021 15:19:07 -0700 Subject: [PATCH] Revert "dtcalc: Change the prototype of matherr() to reflect actual usage and remove warnings." This reverts commit a9175c896d45f4e0f7df385bc0d5560071aa9d2e. This is the wrong fix for matherr() troubles. --- cde/programs/dtcalc/calctool.c | 31 +++++++++++++++++++++++++++++-- cde/programs/dtcalc/functions.c | 4 ++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/cde/programs/dtcalc/calctool.c b/cde/programs/dtcalc/calctool.c index 5f91e8884..279582000 100644 --- a/cde/programs/dtcalc/calctool.c +++ b/cde/programs/dtcalc/calctool.c @@ -1201,11 +1201,38 @@ make_number(int *MPnumber, BOOLEAN mkFix) } +/*ARGSUSED*/ /* Default math library exception handling routine. */ -void -matherr(void) +int +matherr(struct exception *exc) { +#if 0 + char msg[100]; + + if (exc) { + strcpy(msg, exc->name); + strcat(msg, ": "); + if(exc->type == DOMAIN) + strcat(msg, "DOMAIN "); + else if(exc->type == SING) + strcat(msg, "SING "); + else if(exc->type == OVERFLOW) + strcat(msg, "OVERFLOW "); + else if(exc->type == UNDERFLOW) + strcat(msg, "UNDERFLOW "); + else if(exc->type == TLOSS) + strcat(msg, "TLOSS "); + else if(exc->type == PLOSS) + strcat(msg, "PLOSS "); + + strcat(msg, vstrs[(int) V_ERROR]); + + _DtSimpleError (v->appname, DtWarning, NULL, msg); + } +#endif + doerr(vstrs[(int) V_ERROR]) ; + return(1) ; /* Value ignored. */ } /* Convert string into an MP number. */ diff --git a/cde/programs/dtcalc/functions.c b/cde/programs/dtcalc/functions.c index 1f985dc23..fa96fe484 100644 --- a/cde/programs/dtcalc/functions.c +++ b/cde/programs/dtcalc/functions.c @@ -677,7 +677,7 @@ do_factorial(int *MPval, int *MPres) /* Calculate the factorial of MPval. */ } mpcim(&i, MPa) ; mpcmi(MP1, &i) ; - if (!i) matherr() ; + if (!i) matherr((struct exception *) NULL) ; else while (i > 0) { @@ -687,7 +687,7 @@ do_factorial(int *MPval, int *MPres) /* Calculate the factorial of MPval. */ i-- ; } } - else matherr() ; + else matherr((struct exception *) NULL) ; mpstr(MPa, MPres) ; }