=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/parse.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/parse.c 2000/01/22 14:15:59 1.1.1.2 +++ OpenXM_contrib/gnuplot/Attic/parse.c 2003/09/15 07:09:25 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: parse.c,v 1.1.1.2 2000/01/22 14:15:59 maekawa Exp $"; +static char *RCSid = "$Id: parse.c,v 1.1.1.3 2003/09/15 07:09:25 ohara Exp $"; #endif /* GNUPLOT - parse.c */ @@ -34,10 +34,15 @@ static char *RCSid = "$Id: parse.c,v 1.1.1.2 2000/01/2 * to the extent permitted by applicable law. ]*/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include +#include + #include "plot.h" #include "help.h" -#include RETSIGTYPE fpe __PROTO((int an_int)); static void extend_at __PROTO((void)); @@ -68,9 +73,9 @@ static void unary __PROTO((void)); static struct at_type *at = NULL; static int at_size = 0; #if defined(_Windows) && !defined(WIN32) -static jmp_buf far fpe_env; +static JMP_BUF far fpe_env; #else -static jmp_buf fpe_env; +static JMP_BUF fpe_env; #endif #define dummy (struct value *) 0 @@ -89,7 +94,7 @@ int an_int; (void) signal(SIGFPE, (sigfunc) fpe); #endif undefined = TRUE; - longjmp(fpe_env, TRUE); + LONGJMP(fpe_env, TRUE); } @@ -135,7 +140,7 @@ struct value *val_ptr; reset_stack(); #ifndef DOSX286 - if (setjmp(fpe_env)) + if (SETJMP(fpe_env, 1)) return; /* just bail out */ (void) signal(SIGFPE, (sigfunc) fpe); #endif @@ -339,12 +344,10 @@ static void factor() add_action(DOLLARS)->v_arg = a; } else if (isanumber(c_token)) { /* 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); convert(&(foo->v_arg), c_token); -#else - convert(&(add_action(PUSHC)->v_arg), c_token); -#endif c_token++; } else if (isletter(c_token)) { if ((c_token + 1 < num_tokens) && equals(c_token + 1, "(")) { @@ -435,61 +438,66 @@ 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 */ if (equals(c_token, "?")) { register int savepc1, savepc2; - register union argument *argptr1, *argptr2; + c_token++; savepc1 = at->a_count; - argptr1 = add_action(JTERN); + add_action(JTERN); express(); if (!equals(c_token, ":")) int_error("expecting ':'", c_token); + c_token++; savepc2 = at->a_count; - argptr2 = add_action(JUMP); - argptr1->j_arg = at->a_count - savepc1; + add_action(JUMP); + at->actions[savepc1].arg.j_arg = at->a_count - savepc1; express(); - argptr2->j_arg = at->a_count - savepc2; + at->actions[savepc2].arg.j_arg = at->a_count - savepc2; } } - -static void aterms() +static void +aterms() { /* create action codes for || operator */ while (equals(c_token, "||")) { register int savepc; - register union argument *argptr; + c_token++; savepc = at->a_count; - argptr = add_action(JUMPNZ); /* short-circuit if already - * TRUE */ + add_action(JUMPNZ); /* short-circuit if already TRUE */ 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); } } -static void bterms() +static void +bterms() { /* create action code for && operator */ while (equals(c_token, "&&")) { register int savepc; - register union argument *argptr; + c_token++; savepc = at->a_count; - argptr = add_action(JUMPZ); /* short-circuit if already - * FALSE */ + add_action(JUMPZ); /* short-circuit if already FALSE */ 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); } }