From: Eric S. Raymond Date: Fri, 11 Nov 1994 20:03:05 +0000 (+0000) Subject: This version does both performs and gotos. X-Git-Tag: 1-2~39 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=1288d6fb2edb902ad35d76cac7f1aa7a7477e780;p=cupl.git This version does both performs and gotos. --- diff --git a/execute.c b/execute.c index 0afb607..196e24e 100644 --- a/execute.c +++ b/execute.c @@ -40,7 +40,7 @@ static node *popstack(void) { if (sp <= stack) die("too many END statements\n"); - return(*sp--); + return(*--sp); } static void pushstack(node *st) @@ -157,7 +157,7 @@ static value cupl_eval(node *tree) /* recursively evaluate a CUPL parse tree */ { node *pc; /* pointer to statement being evaluated */ - static node *next; /* the statement node to evaluate next */ + node *next; /* the statement node to evaluate next */ static jmp_buf nextbuf; /* end-of-statement handling */ value leftside, rightside, result, cond; @@ -569,6 +569,8 @@ static value cupl_eval(node *tree) next = pc->cdr; if (setjmp(nextbuf) == 0) (void) cupl_eval(pc->car); + else + next = popstack(); break; } } @@ -576,7 +578,7 @@ static value cupl_eval(node *tree) return(result); case GO: - next = tree->car; + pushstack(tree->car); longjmp(nextbuf, 1); case IF: