version 1.1.1.2, 2000/01/22 14:15:59 |
version 1.1.1.3, 2003/09/15 07:09:25 |
Line 34 static char *RCSid = "$Id$"; |
|
Line 34 static char *RCSid = "$Id$"; |
|
* to the extent permitted by applicable law. |
* to the extent permitted by applicable law. |
]*/ |
]*/ |
|
|
|
#ifdef HAVE_CONFIG_H |
|
# include "config.h" |
|
#endif |
|
|
#include <signal.h> |
#include <signal.h> |
|
#include <setjmp.h> |
|
|
#include "plot.h" |
#include "plot.h" |
#include "help.h" |
#include "help.h" |
#include <setjmp.h> |
|
|
|
RETSIGTYPE fpe __PROTO((int an_int)); |
RETSIGTYPE fpe __PROTO((int an_int)); |
static void extend_at __PROTO((void)); |
static void extend_at __PROTO((void)); |
Line 68 static void unary __PROTO((void)); |
|
Line 73 static void unary __PROTO((void)); |
|
static struct at_type *at = NULL; |
static struct at_type *at = NULL; |
static int at_size = 0; |
static int at_size = 0; |
#if defined(_Windows) && !defined(WIN32) |
#if defined(_Windows) && !defined(WIN32) |
static jmp_buf far fpe_env; |
static JMP_BUF far fpe_env; |
#else |
#else |
static jmp_buf fpe_env; |
static JMP_BUF fpe_env; |
#endif |
#endif |
|
|
#define dummy (struct value *) 0 |
#define dummy (struct value *) 0 |
|
|
(void) signal(SIGFPE, (sigfunc) fpe); |
(void) signal(SIGFPE, (sigfunc) fpe); |
#endif |
#endif |
undefined = TRUE; |
undefined = TRUE; |
longjmp(fpe_env, TRUE); |
LONGJMP(fpe_env, TRUE); |
} |
} |
|
|
|
|
Line 135 struct value *val_ptr; |
|
Line 140 struct value *val_ptr; |
|
reset_stack(); |
reset_stack(); |
|
|
#ifndef DOSX286 |
#ifndef DOSX286 |
if (setjmp(fpe_env)) |
if (SETJMP(fpe_env, 1)) |
return; /* just bail out */ |
return; /* just bail out */ |
(void) signal(SIGFPE, (sigfunc) fpe); |
(void) signal(SIGFPE, (sigfunc) fpe); |
#endif |
#endif |
Line 339 static void factor() |
|
Line 344 static void factor() |
|
add_action(DOLLARS)->v_arg = a; |
add_action(DOLLARS)->v_arg = a; |
} else if (isanumber(c_token)) { |
} else if (isanumber(c_token)) { |
/* work around HP 9000S/300 HP-UX 9.10 cc limitation ... */ |
/* work around HP 9000S/300 HP-UX 9.10 cc limitation ... */ |
#if defined(__hpux) && defined(__hp9000s300) && !defined(__GNUC__) |
/* HBB 20010724: use this code for all platforms, then */ |
|
|
union argument *foo = add_action(PUSHC); |
union argument *foo = add_action(PUSHC); |
convert(&(foo->v_arg), c_token); |
convert(&(foo->v_arg), c_token); |
#else |
|
convert(&(add_action(PUSHC)->v_arg), c_token); |
|
#endif |
|
c_token++; |
c_token++; |
} else if (isletter(c_token)) { |
} else if (isletter(c_token)) { |
if ((c_token + 1 < num_tokens) && equals(c_token + 1, "(")) { |
if ((c_token + 1 < num_tokens) && equals(c_token + 1, "(")) { |
Line 435 static void factor() |
|
Line 438 static void factor() |
|
} |
} |
|
|
|
|
|
/* HBB 20010309: Here and below: can't store pointers into the middle |
|
* of at->actions[]. That array may be realloc()ed by add_action() or |
|
* express() calls!. Access via index savepc1/savepc2, instead. */ |
|
|
static void xterms() |
static void |
|
xterms() |
{ |
{ |
/* create action code for ? : expressions */ |
/* create action code for ? : expressions */ |
|
|
if (equals(c_token, "?")) { |
if (equals(c_token, "?")) { |
register int savepc1, savepc2; |
register int savepc1, savepc2; |
register union argument *argptr1, *argptr2; |
|
c_token++; |
c_token++; |
savepc1 = at->a_count; |
savepc1 = at->a_count; |
argptr1 = add_action(JTERN); |
add_action(JTERN); |
express(); |
express(); |
if (!equals(c_token, ":")) |
if (!equals(c_token, ":")) |
int_error("expecting ':'", c_token); |
int_error("expecting ':'", c_token); |
|
|
c_token++; |
c_token++; |
savepc2 = at->a_count; |
savepc2 = at->a_count; |
argptr2 = add_action(JUMP); |
add_action(JUMP); |
argptr1->j_arg = at->a_count - savepc1; |
at->actions[savepc1].arg.j_arg = at->a_count - savepc1; |
express(); |
express(); |
argptr2->j_arg = at->a_count - savepc2; |
at->actions[savepc2].arg.j_arg = at->a_count - savepc2; |
} |
} |
} |
} |
|
|
|
static void |
static void aterms() |
aterms() |
{ |
{ |
/* create action codes for || operator */ |
/* create action codes for || operator */ |
|
|
while (equals(c_token, "||")) { |
while (equals(c_token, "||")) { |
register int savepc; |
register int savepc; |
register union argument *argptr; |
|
c_token++; |
c_token++; |
savepc = at->a_count; |
savepc = at->a_count; |
argptr = add_action(JUMPNZ); /* short-circuit if already |
add_action(JUMPNZ); /* short-circuit if already TRUE */ |
* TRUE */ |
|
aterm(); |
aterm(); |
argptr->j_arg = at->a_count - savepc; /* offset for jump */ |
/* offset for jump */ |
|
at->actions[savepc].arg.j_arg = at->a_count - savepc; |
(void) add_action(BOOLE); |
(void) add_action(BOOLE); |
} |
} |
} |
} |
|
|
|
|
static void bterms() |
static void |
|
bterms() |
{ |
{ |
/* create action code for && operator */ |
/* create action code for && operator */ |
|
|
while (equals(c_token, "&&")) { |
while (equals(c_token, "&&")) { |
register int savepc; |
register int savepc; |
register union argument *argptr; |
|
c_token++; |
c_token++; |
savepc = at->a_count; |
savepc = at->a_count; |
argptr = add_action(JUMPZ); /* short-circuit if already |
add_action(JUMPZ); /* short-circuit if already FALSE */ |
* FALSE */ |
|
bterm(); |
bterm(); |
argptr->j_arg = at->a_count - savepc; /* offset for jump */ |
at->actions[savepc].arg.j_arg = at->a_count - savepc; /* offset for jump */ |
(void) add_action(BOOLE); |
(void) add_action(BOOLE); |
} |
} |
} |
} |