#include "config.h"
#include "types.h"
-__RCSID("$MirOS: contrib/code/jupp/umath.c,v 1.11 2017/12/02 04:32:42 tg Exp $");
+__RCSID("$MirOS: contrib/code/jupp/umath.c,v 1.15 2017/12/02 18:33:25 tg Exp $");
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
static char math_res[JOE_MSGBUFSIZE];
static char *math_exp;
+static double calc(BW *bw, unsigned char *s);
+
static RETSIGTYPE fperr(int unused)
{
if (!merrf)
while ((*ptr >= '0' && *ptr <= '9') || ((*ptr | 0x20) >= 'a' && (*ptr | 0x20) <= 'f'))
++ptr;
} else if ((*ptr >= '0' && *ptr <= '9') || *ptr == '.') {
- x = strtod(ptr, &ptr);
+ char *eptr;
+
+ x = strtod(ptr, &eptr);
+ ptr = (unsigned char *)eptr;
} else if (*ptr == '(') {
++ptr;
x = expr(0, &v);
#define JOE_IMAXT "l"
#endif
-double calc(BW *bw, unsigned char *s)
+static double
+calc(BW *bw, unsigned char *s)
{
double result;
struct var *v;
binss(bw->cursor, (void *)math_res);
return 0;
}
+
+long
+calcl(BW *bw, unsigned char *s)
+{
+ double rv;
+
+ rv = calc(bw, s);
+ return ((long)rv);
+}
#else
long
calcl(BW *bw, unsigned char *s)