diff --git a/src/common.h b/src/common.h index 995e991134..a3ebf1df26 100644 --- a/src/common.h +++ b/src/common.h @@ -244,6 +244,25 @@ typedef struct TypInputFile TypInputFile; typedef struct TypOutputFile TypOutputFile; +/**************************************************************************** +** +*T ExecStatus . . . . type of status values returned by read, eval and exec +** subroutines, explaining why evaluation, or execution +** has terminated. +*/ + +typedef enum { + STATUS_END, // ran off the end of the code + STATUS_RETURN, // 'return' statement + STATUS_BREAK, // 'break' statement + STATUS_CONTINUE, // 'continue' statement + STATUS_QUIT, // 'quit' statement + STATUS_QQUIT, // 'QUIT' statement + STATUS_EOF, // end of file while parsing + STATUS_ERROR, // syntax error while parsing +} ExecStatus; + + /**************************************************************************** ** *T EvalBoolFunc @@ -254,7 +273,7 @@ typedef struct TypOutputFile TypOutputFile; */ typedef Obj (*EvalBoolFunc)(Expr); typedef Obj (*EvalExprFunc)(Expr); -typedef UInt (*ExecStatFunc)(Stat); +typedef ExecStatus (*ExecStatFunc)(Stat); typedef void (*PrintStatFunc)(Stat); typedef void (*PrintExprFunc)(Expr); diff --git a/src/funcs.c b/src/funcs.c index f65c290b31..e9e6456b82 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -193,7 +193,7 @@ static ALWAYS_INLINE Obj EvalOrExecCall(Int ignoreResult, UInt nr, Stat call, St ** handled here */ -static UInt ExecProccallOpts(Stat call) +static ExecStatus ExecProccallOpts(Stat call) { Expr opts = READ_STAT(call, 0); Expr real_call = READ_STAT(call, 1); @@ -203,75 +203,59 @@ static UInt ExecProccallOpts(Stat call) EvalOrExecCall(1, narg, real_call, opts); - return 0; + return STATUS_END; } -static UInt ExecProccall0args(Stat call) +static ExecStatus ExecProccall0args(Stat call) { EvalOrExecCall(1, 0, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall1args(Stat call) +static ExecStatus ExecProccall1args(Stat call) { EvalOrExecCall(1, 1, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall2args(Stat call) +static ExecStatus ExecProccall2args(Stat call) { EvalOrExecCall(1, 2, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall3args(Stat call) +static ExecStatus ExecProccall3args(Stat call) { EvalOrExecCall(1, 3, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall4args(Stat call) +static ExecStatus ExecProccall4args(Stat call) { EvalOrExecCall(1, 4, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall5args(Stat call) +static ExecStatus ExecProccall5args(Stat call) { EvalOrExecCall(1, 5, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccall6args(Stat call) +static ExecStatus ExecProccall6args(Stat call) { EvalOrExecCall(1, 6, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecProccallXargs(Stat call) +static ExecStatus ExecProccallXargs(Stat call) { // pass in 7 (instead of NARG_SIZE_CALL(SIZE_STAT(call))) // to allow the compiler to perform better optimizations // (as we know that the number of arguments is >= 7 here) EvalOrExecCall(1, 7, call, 0); - - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } /**************************************************************************** diff --git a/src/gap.c b/src/gap.c index 87f3832439..162eefe845 100644 --- a/src/gap.c +++ b/src/gap.c @@ -229,7 +229,7 @@ static Obj FuncSHELL(Obj self, // // return values of ReadEvalCommand // - UInt status; + ExecStatus status; Obj evalResult; // diff --git a/src/gap.h b/src/gap.h index 808ea2c285..bad9423125 100644 --- a/src/gap.h +++ b/src/gap.h @@ -43,25 +43,6 @@ extern UInt ViewObjGVar; void ViewObjHandler(Obj obj); -/**************************************************************************** -** -*T ExecStatus . . . . type of status values returned by read, eval and exec -** subroutines, explaining why evaluation, or execution -** has terminated. -*/ - -typedef enum { - STATUS_END, // ran off the end of the code - STATUS_RETURN, // 'return' statement - STATUS_BREAK, // 'break' statement - STATUS_CONTINUE, // 'continue' statement - STATUS_QUIT, // 'quit' statement - STATUS_QQUIT, // 'QUIT' statement - STATUS_EOF, // end of file while parsing - STATUS_ERROR, // syntax error while parsing -} ExecStatus; - - /**************************************************************************** ** *S MAX_FUNC_EXPR_NESTING_BITS diff --git a/src/hookintrprtr.c b/src/hookintrprtr.c index 3b5d2c73bf..adc799e7f5 100644 --- a/src/hookintrprtr.c +++ b/src/hookintrprtr.c @@ -103,7 +103,7 @@ void InstallPrintExprFunc(Int pos, PrintExprFunc f) HashUnlock(&activeHooks); } -static UInt ProfileExecStatPassthrough(Stat stat) +static ExecStatus ProfileExecStatPassthrough(Stat stat) { GAP_HOOK_LOOP(visitStat, stat); return OriginalExecStatFuncsForHook[TNUM_STAT(stat)](stat); diff --git a/src/intrprtr.c b/src/intrprtr.c index a65b5f5ef9..c7e3878aef 100644 --- a/src/intrprtr.c +++ b/src/intrprtr.c @@ -59,9 +59,9 @@ static void INTERPRETER_PROFILE_HOOK(IntrState * intr, int ignoreLevel) { if (!intr->coding) { - InterpreterHook(GetInputFilenameID(GetCurrentInput()), - intr->startLine, - intr->returning || (intr->ignoring > ignoreLevel)); + InterpreterHook( + GetInputFilenameID(GetCurrentInput()), intr->startLine, + intr->returning != STATUS_END || (intr->ignoring > ignoreLevel)); } intr->startLine = 0; } @@ -75,7 +75,7 @@ static void INTERPRETER_PROFILE_HOOK(IntrState * intr, int ignoreLevel) // Need to #define SKIP_IF_RETURNING_NO_PROFILE_HOOK() \ - if (intr->returning > 0) { \ + if (intr->returning != STATUS_END) { \ return; \ } @@ -245,7 +245,7 @@ void IntrBegin(IntrState * intr) GAP_ASSERT(intr->coding == 0); /* no return-statement was yet interpreted */ - intr->returning = 0; + intr->returning = STATUS_END; } ExecStatus IntrEnd(IntrState * intr, BOOL error, Obj * result) @@ -590,7 +590,7 @@ Int IntrIfEndBody(IntrState * intr, UInt nr) INTERPRETER_PROFILE_HOOK(intr, 0); /* ignore or code */ - if (intr->returning > 0) { + if (intr->returning != STATUS_END) { return 0; } if (intr->ignoring > 0) { diff --git a/src/read.c b/src/read.c index 13974dcebd..a85ffe0c59 100644 --- a/src/read.c +++ b/src/read.c @@ -2506,10 +2506,10 @@ static void RecreateStackNams(ReaderState * rs, Obj context) ** will be set to 1 if the command was followed by a double semicolon, else ** it is set to 0. If 'dualSemicolon' is zero then it is ignored. */ -UInt ReadEvalCommand(Obj context, - TypInputFile * input, - Obj * evalResult, - BOOL * dualSemicolon) +ExecStatus ReadEvalCommand(Obj context, + TypInputFile * input, + Obj * evalResult, + BOOL * dualSemicolon) { volatile ExecStatus status; volatile Obj tilde; @@ -2642,7 +2642,7 @@ UInt ReadEvalCommand(Obj context, ** It does not expect the first symbol of its input already read and reads ** to the end of the input (unless an error happens). */ -UInt ReadEvalFile(TypInputFile * input, Obj * evalResult) +ExecStatus ReadEvalFile(TypInputFile * input, Obj * evalResult) { volatile ExecStatus status; volatile Obj tilde; diff --git a/src/read.h b/src/read.h index 2374aba995..242346a12c 100644 --- a/src/read.h +++ b/src/read.h @@ -34,10 +34,10 @@ ** will be set to 1 if the command was followed by a double semicolon, else ** it is set to 0. If 'dualSemicolon' is zero then it is ignored. */ -UInt ReadEvalCommand(Obj context, - TypInputFile * input, - Obj * evalResult, - BOOL * dualSemicolon); +ExecStatus ReadEvalCommand(Obj context, + TypInputFile * input, + Obj * evalResult, + BOOL * dualSemicolon); /**************************************************************************** @@ -50,7 +50,7 @@ UInt ReadEvalCommand(Obj context, ** It does not expect the first symbol of its input already read and reads ** to the end of the input (unless an error happens). */ -UInt ReadEvalFile(TypInputFile * input, Obj * evalResult); +ExecStatus ReadEvalFile(TypInputFile * input, Obj * evalResult); /**************************************************************************** diff --git a/src/stats.c b/src/stats.c index 0bc5e4737e..b9021d0e43 100644 --- a/src/stats.c +++ b/src/stats.c @@ -48,7 +48,7 @@ #include -inline UInt EXEC_STAT(Stat stat) +inline ExecStatus EXEC_STAT(Stat stat) { UInt tnum = TNUM_STAT(stat); SET_BRK_CALL_TO(stat); @@ -74,7 +74,7 @@ extern inline Obj EXEC_CURR_FUNC(void) // which is not break/continue/return) is handled first. #define EXEC_STAT_IN_LOOP(stat) \ { \ - UInt status = EXEC_STAT(stat); \ + ExecStatus status = EXEC_STAT(stat); \ if (status != STATUS_END) { \ if (status == STATUS_CONTINUE) \ continue; \ @@ -103,11 +103,11 @@ ExecStatFunc ExecStatFuncs[256]; ** this is ever called, then GAP is in serious trouble, such as an ** overwritten type field of a statement. */ -static UInt ExecUnknownStat(Stat stat) +static ExecStatus ExecUnknownStat(Stat stat) { Pr("Panic: tried to execute a statement of unknown type '%d'\n", (Int)TNUM_STAT(stat), 0); - return 0; + return STATUS_END; } /**************************************************************************** @@ -139,54 +139,53 @@ UInt HaveInterrupt(void) ** 'STAT_SEQ_STAT' with slots. The first points to the first statement, ** the second points to the second statement, and so on. */ -static ALWAYS_INLINE UInt ExecSeqStatHelper(Stat stat, UInt nr) +static ALWAYS_INLINE ExecStatus ExecSeqStatHelper(Stat stat, UInt nr) { // loop over the statements for (UInt i = 1; i <= nr; i++) { // execute the -th statement - UInt leave = EXEC_STAT(READ_STAT(stat, i - 1)); - if ( leave != 0 ) { - return leave; + ExecStatus status = EXEC_STAT(READ_STAT(stat, i - 1)); + if (status != STATUS_END) { + return status; } } - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } -static UInt ExecSeqStat(Stat stat) +static ExecStatus ExecSeqStat(Stat stat) { // get the number of statements UInt nr = SIZE_STAT( stat ) / sizeof(Stat); return ExecSeqStatHelper(stat, nr); } -static UInt ExecSeqStat2(Stat stat) +static ExecStatus ExecSeqStat2(Stat stat) { return ExecSeqStatHelper(stat, 2); } -static UInt ExecSeqStat3(Stat stat) +static ExecStatus ExecSeqStat3(Stat stat) { return ExecSeqStatHelper(stat, 3); } -static UInt ExecSeqStat4(Stat stat) +static ExecStatus ExecSeqStat4(Stat stat) { return ExecSeqStatHelper(stat, 4); } -static UInt ExecSeqStat5(Stat stat) +static ExecStatus ExecSeqStat5(Stat stat) { return ExecSeqStatHelper(stat, 5); } -static UInt ExecSeqStat6(Stat stat) +static ExecStatus ExecSeqStat6(Stat stat) { return ExecSeqStatHelper(stat, 6); } -static UInt ExecSeqStat7(Stat stat) +static ExecStatus ExecSeqStat7(Stat stat) { return ExecSeqStatHelper(stat, 7); } @@ -212,7 +211,7 @@ static UInt ExecSeqStat7(Stat stat) ** if-statement has an else-branch, this is represented by a branch with ** 'EXPR_TRUE' as condition. */ -static UInt ExecIf(Stat stat) +static ExecStatus ExecIf(Stat stat) { Expr cond; /* condition */ Stat body; /* body */ @@ -227,11 +226,10 @@ static UInt ExecIf(Stat stat) } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecIfElse(Stat stat) +static ExecStatus ExecIfElse(Stat stat) { Expr cond; /* condition */ Stat body; /* body */ @@ -253,7 +251,7 @@ static UInt ExecIfElse(Stat stat) return EXEC_STAT( body ); } -static UInt ExecIfElif(Stat stat) +static ExecStatus ExecIfElif(Stat stat) { Expr cond; /* condition */ Stat body; /* body */ @@ -279,11 +277,10 @@ static UInt ExecIfElif(Stat stat) SET_BRK_CALL_TO(stat); } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecIfElifElse(Stat stat) +static ExecStatus ExecIfElifElse(Stat stat) { Expr cond; /* condition */ Stat body; /* body */ @@ -341,7 +338,7 @@ Obj IS_DONE_ITER; Obj NEXT_ITER; static Obj STD_ITER; -static ALWAYS_INLINE UInt ExecForHelper(Stat stat, UInt nr) +static ALWAYS_INLINE ExecStatus ExecForHelper(Stat stat, UInt nr) { UInt var; /* variable */ UInt vart; /* variable type */ @@ -452,22 +449,21 @@ static ALWAYS_INLINE UInt ExecForHelper(Stat stat, UInt nr) } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecFor(Stat stat) +static ExecStatus ExecFor(Stat stat) { return ExecForHelper(stat, 1); } -static UInt ExecFor2(Stat stat) +static ExecStatus ExecFor2(Stat stat) { return ExecForHelper(stat, 2); } -static UInt ExecFor3(Stat stat) +static ExecStatus ExecFor3(Stat stat) { return ExecForHelper(stat, 3); } @@ -496,7 +492,7 @@ static UInt ExecFor3(Stat stat) ** bag for the loop variable, the second slot points to the list-expression, ** and the remaining slots points to the statements. */ -static ALWAYS_INLINE UInt ExecForRangeHelper(Stat stat, UInt nr) +static ALWAYS_INLINE ExecStatus ExecForRangeHelper(Stat stat, UInt nr) { UInt lvar; /* local variable */ Int first; /* first value of range */ @@ -546,21 +542,20 @@ static ALWAYS_INLINE UInt ExecForRangeHelper(Stat stat, UInt nr) EXEC_STAT_IN_LOOP(body3); } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecForRange(Stat stat) +static ExecStatus ExecForRange(Stat stat) { return ExecForRangeHelper(stat, 1); } -static UInt ExecForRange2(Stat stat) +static ExecStatus ExecForRange2(Stat stat) { return ExecForRangeHelper(stat, 2); } -static UInt ExecForRange3(Stat stat) +static ExecStatus ExecForRange3(Stat stat) { return ExecForRangeHelper(stat, 3); } @@ -571,7 +566,7 @@ static UInt ExecForRange3(Stat stat) */ #ifdef HPCGAP -static UInt ExecAtomic(Stat stat) +static ExecStatus ExecAtomic(Stat stat) { Obj tolock[MAX_ATOMIC_OBJS]; LockMode lockmode[MAX_ATOMIC_OBJS]; @@ -650,7 +645,7 @@ static UInt ExecAtomic(Stat stat) ** the second slot points to the first statement, the third slot points to ** the second statement, and so on. */ -static ALWAYS_INLINE UInt ExecWhileHelper(Stat stat, UInt nr) +static ALWAYS_INLINE ExecStatus ExecWhileHelper(Stat stat, UInt nr) { Expr cond; /* condition */ Stat body1; /* first stat. of body of loop */ @@ -685,21 +680,20 @@ static ALWAYS_INLINE UInt ExecWhileHelper(Stat stat, UInt nr) SET_BRK_CALL_TO(stat); } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecWhile(Stat stat) +static ExecStatus ExecWhile(Stat stat) { return ExecWhileHelper(stat, 1); } -static UInt ExecWhile2(Stat stat) +static ExecStatus ExecWhile2(Stat stat) { return ExecWhileHelper(stat, 2); } -static UInt ExecWhile3(Stat stat) +static ExecStatus ExecWhile3(Stat stat) { return ExecWhileHelper(stat, 3); } @@ -724,7 +718,7 @@ static UInt ExecWhile3(Stat stat) ** second slot points to the first statement, the third slot points to the ** second statement, and so on. */ -static ALWAYS_INLINE UInt ExecRepeatHelper(Stat stat, UInt nr) +static ALWAYS_INLINE ExecStatus ExecRepeatHelper(Stat stat, UInt nr) { Expr cond; /* condition */ Stat body1; /* first stat. of body of loop */ @@ -758,21 +752,20 @@ static ALWAYS_INLINE UInt ExecRepeatHelper(Stat stat, UInt nr) } while ( EVAL_BOOL_EXPR( cond ) == False ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecRepeat(Stat stat) +static ExecStatus ExecRepeat(Stat stat) { return ExecRepeatHelper(stat, 1); } -static UInt ExecRepeat2(Stat stat) +static ExecStatus ExecRepeat2(Stat stat) { return ExecRepeatHelper(stat, 2); } -static UInt ExecRepeat3(Stat stat) +static ExecStatus ExecRepeat3(Stat stat) { return ExecRepeatHelper(stat, 3); } @@ -789,7 +782,7 @@ static UInt ExecRepeat3(Stat stat) ** ** A break-statement is a statement of type 'STAT_BREAK' with no slots. */ -static UInt ExecBreak(Stat stat) +static ExecStatus ExecBreak(Stat stat) { /* return to the next loop */ return STATUS_BREAK; @@ -807,7 +800,7 @@ static UInt ExecBreak(Stat stat) ** A continue-statement is a statement of type 'STAT_CONTINUE' with no ** slots. */ -static UInt ExecContinue(Stat stat) +static ExecStatus ExecContinue(Stat stat) { /* return to the next loop */ return STATUS_CONTINUE; @@ -819,9 +812,9 @@ static UInt ExecContinue(Stat stat) ** ** Does nothing */ -static UInt ExecEmpty(Stat stat) +static ExecStatus ExecEmpty(Stat stat) { - return 0; + return STATUS_END; } @@ -838,7 +831,7 @@ static UInt ExecEmpty(Stat stat) ** An info-statement is a statement of type 'STAT_INFO' with slots for the ** arguments. */ -static UInt ExecInfo(Stat stat) +static ExecStatus ExecInfo(Stat stat) { Obj selectors; Obj level; @@ -877,7 +870,7 @@ static UInt ExecInfo(Stat stat) /* and print them */ InfoDoPrint(selectors, level, args); } - return 0; + return STATUS_END; } /**************************************************************************** @@ -889,7 +882,7 @@ static UInt ExecInfo(Stat stat) ** A 2 argument assert-statement is a statement of type 'STAT_ASSERT_2ARGS' ** with slots for the two arguments */ -static UInt ExecAssert2Args(Stat stat) +static ExecStatus ExecAssert2Args(Stat stat) { Obj level; Int lev; @@ -905,7 +898,8 @@ static UInt ExecAssert2Args(Stat stat) AssertionFailure(); } } - return 0; + + return STATUS_END; } /**************************************************************************** @@ -917,7 +911,7 @@ static UInt ExecAssert2Args(Stat stat) ** A 3 argument assert-statement is a statement of type 'STAT_ASSERT_3ARGS' ** with slots for the three arguments. */ -static UInt ExecAssert3Args(Stat stat) +static ExecStatus ExecAssert3Args(Stat stat) { Obj level; Int lev; @@ -941,7 +935,7 @@ static UInt ExecAssert3Args(Stat stat) } } } - return 0; + return STATUS_END; } @@ -959,7 +953,7 @@ static UInt ExecAssert3Args(Stat stat) ** one slot. This slot points to the expression whose value is to be ** returned. */ -static UInt ExecReturnObj(Stat stat) +static ExecStatus ExecReturnObj(Stat stat) { #if !defined(HAVE_SIGNAL) /* test for an interrupt */ @@ -987,7 +981,7 @@ static UInt ExecReturnObj(Stat stat) ** A return-void-statement is a statement of type 'STAT_RETURN_VOID' with no ** slots. */ -static UInt ExecReturnVoid(Stat stat) +static ExecStatus ExecReturnVoid(Stat stat) { #if !defined(HAVE_SIGNAL) /* test for an interrupt */ @@ -1056,7 +1050,7 @@ UInt TakeInterrupt( void ) ** redispatches after a return from the break-loop. */ -static UInt ExecIntrStat(Stat stat) +static ExecStatus ExecIntrStat(Stat stat) { /* change the entries in 'ExecStatFuncs' back to the original */ diff --git a/src/stats.h b/src/stats.h index a378ebf05f..999fb9aeca 100644 --- a/src/stats.h +++ b/src/stats.h @@ -48,7 +48,7 @@ extern ExecStatFunc ExecStatFuncs[256]; ** executor, i.e., to the function that executes statements of the type of ** . */ -UInt EXEC_STAT(Stat stat); +ExecStatus EXEC_STAT(Stat stat); // Executes the current function and returns its return value // if the last statement was STAT_RETURN_OBJ, or null if the last diff --git a/src/vars.c b/src/vars.c index b1a23779b9..cc5697517e 100644 --- a/src/vars.c +++ b/src/vars.c @@ -159,7 +159,7 @@ void FreeLVarsBag(Bag bag) ** 'ExecAssLVar' executes the local variable assignment statement to ** the local variable that is referenced in . */ -static UInt ExecAssLVar(Stat stat) +static ExecStatus ExecAssLVar(Stat stat) { Obj rhs; /* value of right hand side */ @@ -167,17 +167,15 @@ static UInt ExecAssLVar(Stat stat) rhs = EVAL_EXPR(READ_STAT(stat, 1)); ASS_LVAR(READ_STAT(stat, 0), rhs); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecUnbLVar(Stat stat) +static ExecStatus ExecUnbLVar(Stat stat) { /* unbind the local variable */ ASS_LVAR(READ_STAT(stat, 0), (Obj)0); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -307,7 +305,7 @@ Obj NAME_HVAR_WITH_CONTEXT(Obj context, UInt hvar) ** 'ExecAssHVar' executes the higher variable assignment statement to ** the higher variable that is referenced in . */ -static UInt ExecAssHVar(Stat stat) +static ExecStatus ExecAssHVar(Stat stat) { Obj rhs; /* value of right hand side */ @@ -315,17 +313,15 @@ static UInt ExecAssHVar(Stat stat) rhs = EVAL_EXPR(READ_STAT(stat, 1)); ASS_HVAR(READ_STAT(stat, 0), rhs); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecUnbHVar(Stat stat) +static ExecStatus ExecUnbHVar(Stat stat) { /* unbind the higher variable */ ASS_HVAR(READ_STAT(stat, 0), 0); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -413,7 +409,7 @@ static void PrintIsbHVar(Expr expr) ** 'ExecAssGVar' executes the global variable assignment statement to ** the global variable that is referenced in . */ -static UInt ExecAssGVar(Stat stat) +static ExecStatus ExecAssGVar(Stat stat) { Obj rhs; /* value of right hand side */ @@ -421,17 +417,15 @@ static UInt ExecAssGVar(Stat stat) rhs = EVAL_EXPR(READ_STAT(stat, 1)); AssGVar(READ_STAT(stat, 0), rhs); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } -static UInt ExecUnbGVar(Stat stat) +static ExecStatus ExecUnbGVar(Stat stat) { /* unbind the global variable */ AssGVar(READ_STAT(stat, 0), (Obj)0); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -518,7 +512,7 @@ static void PrintIsbGVar(Expr expr) ** 'ExecAssList' executes the list assignment statement of the form ** '[] := ;'. */ -static UInt ExecAssList(Expr stat) +static ExecStatus ExecAssList(Expr stat) { Obj list; /* list, left operand */ Obj pos; /* position, left operand */ @@ -555,8 +549,7 @@ static UInt ExecAssList(Expr stat) ASSB_LIST(list, pos, rhs); } - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } /**************************************************************************** ** @@ -565,7 +558,7 @@ static UInt ExecAssList(Expr stat) ** 'ExecAssMat' executes the matrix assignment statement of the form ** '[,] := ;'. */ -static UInt ExecAssMat(Expr stat) +static ExecStatus ExecAssMat(Expr stat) { // evaluate the matrix (checking is done by 'ASS_MAT') Obj mat = EVAL_EXPR(READ_STAT(stat, 0)); @@ -579,8 +572,7 @@ static UInt ExecAssMat(Expr stat) ASS_MAT(mat, row, col, rhs); - // return 0 (to indicate that no leave-statement was executed) - return 0; + return STATUS_END; } @@ -591,7 +583,7 @@ static UInt ExecAssMat(Expr stat) ** 'ExecAsssList' executes the list assignment statement of the form ** '{} := ;'. */ -static UInt ExecAsssList(Expr stat) +static ExecStatus ExecAsssList(Expr stat) { Obj list; /* list, left operand */ Obj poss; /* positions, left operand */ @@ -612,8 +604,7 @@ static UInt ExecAsssList(Expr stat) /* assign the right hand sides to several elements of the list */ ASSS_LIST( list, poss, rhss ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -631,7 +622,7 @@ static UInt ExecAsssList(Expr stat) ** a list, and 'ExecAssListLevel' assigns the element '[]' to the ** list '[]' at . */ -static UInt ExecAssListLevel(Expr stat) +static ExecStatus ExecAssListLevel(Expr stat) { Obj lists; /* lists, left operand */ Obj pos; /* position, left operand */ @@ -661,8 +652,7 @@ static UInt ExecAssListLevel(Expr stat) /* assign the right hand sides to the elements of several lists */ AssListLevel( lists, ixs, rhss, level ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -680,7 +670,7 @@ static UInt ExecAssListLevel(Expr stat) ** a list, and 'ExecAsssListLevel' assigns the elements '[]' to the ** list '[]' at the positions . */ -static UInt ExecAsssListLevel(Expr stat) +static ExecStatus ExecAsssListLevel(Expr stat) { Obj lists; /* lists, left operand */ Obj poss; /* position, left operand */ @@ -704,8 +694,7 @@ static UInt ExecAsssListLevel(Expr stat) /* assign the right hand sides to several elements of several lists */ AsssListLevel( lists, poss, rhss, level ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -716,7 +705,7 @@ static UInt ExecAsssListLevel(Expr stat) ** 'ExecUnbList' executes the list unbind statement of the form ** 'Unbind( [] );'. */ -static UInt ExecUnbList(Expr stat) +static ExecStatus ExecUnbList(Expr stat) { Obj list; /* list, left operand */ Obj pos; /* position, left operand */ @@ -746,10 +735,8 @@ static UInt ExecUnbList(Expr stat) SET_LEN_PLIST(ixs, narg); UNBB_LIST(list, ixs); } - - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1133,7 +1120,7 @@ static void PrintElmsList(Expr expr) ** 'ExecAssRecName' executes the record assignment statement of the ** form '. := ;'. */ -static UInt ExecAssRecName(Stat stat) +static ExecStatus ExecAssRecName(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1151,8 +1138,7 @@ static UInt ExecAssRecName(Stat stat) /* assign the right hand side to the element of the record */ ASS_REC( record, rnam, rhs ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1163,7 +1149,7 @@ static UInt ExecAssRecName(Stat stat) ** 'ExecAssRecExpr' executes the record assignment statement of the ** form '.() := ;'. */ -static UInt ExecAssRecExpr(Stat stat) +static ExecStatus ExecAssRecExpr(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1181,8 +1167,7 @@ static UInt ExecAssRecExpr(Stat stat) /* assign the right hand side to the element of the record */ ASS_REC( record, rnam, rhs ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1193,7 +1178,7 @@ static UInt ExecAssRecExpr(Stat stat) ** 'ExecUnbRecName' executes the record unbind statement of the form ** 'Unbind( . );'. */ -static UInt ExecUnbRecName(Stat stat) +static ExecStatus ExecUnbRecName(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1207,8 +1192,7 @@ static UInt ExecUnbRecName(Stat stat) /* unbind the element of the record */ UNB_REC( record, rnam ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1219,7 +1203,7 @@ static UInt ExecUnbRecName(Stat stat) ** 'ExecUnbRecExpr' executes the record unbind statement of the form ** 'Unbind( .() );'. */ -static UInt ExecUnbRecExpr(Stat stat) +static ExecStatus ExecUnbRecExpr(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1233,8 +1217,7 @@ static UInt ExecUnbRecExpr(Stat stat) /* unbind the element of the record */ UNB_REC( record, rnam ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1461,7 +1444,7 @@ static void PrintIsbRecExpr(Expr expr) ** 'ExecAssPosObj' executes the list assignment statement of the form ** '[] := ;'. */ -static UInt ExecAssPosObj(Expr stat) +static ExecStatus ExecAssPosObj(Expr stat) { Obj list; /* list, left operand */ Obj pos; /* position, left operand */ @@ -1481,8 +1464,7 @@ static UInt ExecAssPosObj(Expr stat) /* special case for plain list */ AssPosObj(list, p, rhs); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1493,7 +1475,7 @@ static UInt ExecAssPosObj(Expr stat) ** 'ExecUnbPosObj' executes the list unbind statement of the form ** 'Unbind( [] );'. */ -static UInt ExecUnbPosObj(Expr stat) +static ExecStatus ExecUnbPosObj(Expr stat) { Obj list; /* list, left operand */ Obj pos; /* position, left operand */ @@ -1509,8 +1491,7 @@ static UInt ExecUnbPosObj(Expr stat) /* unbind the element */ UnbPosObj(list, p); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1641,7 +1622,7 @@ static void PrintIsbPosObj(Expr expr) ** 'ExecAssComObjName' executes the record assignment statement of the ** form '. := ;'. */ -static UInt ExecAssComObjName(Stat stat) +static ExecStatus ExecAssComObjName(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1659,8 +1640,7 @@ static UInt ExecAssComObjName(Stat stat) /* assign the right hand side to the element of the record */ AssComObj( record, rnam, rhs ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1671,7 +1651,7 @@ static UInt ExecAssComObjName(Stat stat) ** 'ExecAssComObjExpr' executes the record assignment statement of the ** form '.() := ;'. */ -static UInt ExecAssComObjExpr(Stat stat) +static ExecStatus ExecAssComObjExpr(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1689,8 +1669,7 @@ static UInt ExecAssComObjExpr(Stat stat) /* assign the right hand side to the element of the record */ AssComObj( record, rnam, rhs ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1701,7 +1680,7 @@ static UInt ExecAssComObjExpr(Stat stat) ** 'ExecUnbComObjName' executes the record unbind statement of the form ** 'Unbind( . );'. */ -static UInt ExecUnbComObjName(Stat stat) +static ExecStatus ExecUnbComObjName(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1715,8 +1694,7 @@ static UInt ExecUnbComObjName(Stat stat) /* unbind the element of the record */ UnbComObj( record, rnam ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; } @@ -1727,7 +1705,7 @@ static UInt ExecUnbComObjName(Stat stat) ** 'ExecUnbComObjExpr' executes the record unbind statement of the form ** 'Unbind( .() );'. */ -static UInt ExecUnbComObjExpr(Stat stat) +static ExecStatus ExecUnbComObjExpr(Stat stat) { Obj record; /* record, left operand */ UInt rnam; /* name, left operand */ @@ -1741,8 +1719,7 @@ static UInt ExecUnbComObjExpr(Stat stat) /* unbind the element of the record */ UnbComObj( record, rnam ); - /* return 0 (to indicate that no leave-statement was executed) */ - return 0; + return STATUS_END; }