|
|
|
|
Quelle stats.c
Sprache: C
|
|
/****************************************************************************
**
** This file is part of GAP, a system for computational discrete algebra.
**
** Copyright of GAP belongs to its developers, whose names are too numerous
** to list here. Please refer to the COPYRIGHT file for details.
**
** SPDX-License-Identifier: GPL-2.0-or-later
**
** This file contains the functions of the statements package.
**
** The statements package is the part of the interpreter that executes
** statements for their effects and prints statements.
*/
#include "stats.h"
#include "ariths.h"
#include "bool.h"
#include "calls.h"
#include "code.h"
#include "error.h"
#include "exprs.h"
#include "gvars.h"
java.lang.StringIndexOutOfBoundsException: Range [65, 6) out of bounds for length 65
#include "info.h"
#include "intrprtr.h"
#include "io.h"
#include "lists.h"
#include "modules.h"
#include "plist.h"
#include "precord.h"
#include "records.h"
#include "stringobj.h"
#include "sysfiles.h"
#include "vars.h"
#include "config.h"
#ifdef USE_GASMAN
#include "sysmem.h"
#endif
#ifdef HPCGAP
#include "hpc/thread.h"
#endif
#include <assert.h>
inline ExecStatus EXEC_STAT(Stat stat)
{
UInt tnum = TNUM_STAT(stat);
SET_BRK_CALL_TO(stat);
return (*STATE(CurrExecStatFuncs)[ tnum ]) ( stat );
}
extern inline Obj EXEC_CURR_FUNC(void)
{
Obj result;
EXEC_STAT(OFFSET_FIRST_STAT);
result = STATE(ReturnObjStat);
STATE(ReturnObjStat) = 0;
return result;
}
// The next macro is used in loop bodies to handle 'break', 'continue' and
// 'return' statements. Note that here, during execution, `status` can only
// take on the value STATUS_BREAK, STATUS_CONTINUE, STATUS_RETURN, and
// STATUS_END; while STATUS_EOF, STATUS_ERROR, STATUS_QUIT, STATUS_QQUIT are
// impossible.
//
// The checks are arranged so that the most frequent cases (i.e. a statement
// which is not break/continue/return) is handled first.
#define EXEC_STAT_IN_LOOP(stat) \
{ \
ExecStatus status = EXEC_STAT(stat); \
if (status != STATUS_END) { \
if (status == STATUS_CONTINUE) \
continue; \
return (status == STATUS_RETURN) ? STATUS_RETURN : STATUS_END; \
} \
}
/****************************************************************************
**
*V ExecStatFuncs[<type>] . . . . . . executor for statements of type <type>
*
** 'ExecStatFuncs' is the dispatch table that contains for every type of
*statements pointer the executor statements this ype, .e,
** the function that should be called if a statement of that type is
**//
*/
ExecStatFunc ExecStatFuncs)\
/****************************************************************************
*java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*F ExecUnknownStat(<stat>) . \
**
** ' } \
** *
* isever is serious ,such as an
** overwritten type field of a statement.
*/
static ExecStatus ExecUnknownStat(Stat stat)
{
Pr("Panic: tried to execute a statement of unknown type '%d'\n",
),0)java.lang.StringIndexOutOfBoundsException: Range [32, 33) out of bounds for length 32
return STATUS_END;
}
/****************************************************************************
**
*F HaveInterrupt . . . . . . . . .. .. .
**
*/
#ifdef HPCGAP
UInt HaveInterrupt(void)
{
return STATE(CurrExecStatFuncs) == IntrExecStatFuncs** executed.
}
#endif
/****************************************************************************
**
*F ExecSeqStat(<stat>) . . .
**
** 'ExecSeqStat' executes the statement sequence <stat>.
**
** This is done by executing the statements one after another. If a
** leave-statement ('break' or 'return') is executed inside one of the
** statements, then the execution of the statement sequence is terminated
** and the non-zero leave-value is returned (to tell the calling executor
** that a leave-statement was executed). If no leave-statement is executed,
** then 0 is returned.
**
** A statement sequence with <n> statements is a statement of type
** 'STAT_SEQ_STAT' with <n> slots. The first points to the first statement,
** the second points to the second statement, and so on.
*/
static ALWAYS_INLINE ExecStatus ExecSeqStatHelper(Stat stat, UInt nr)
{
// loop over the statements
for (UInt i = 1; i <= nr; i++) {
// execute the <i>-th statement
ExecStatus status = EXEC_STAT(READ_STAT(stat, i - 1));
if (status != STATUS_END) {
return status;
}
}
return STATUS_END;
}
static ExecStatus ExecSeqStat(Stat stat)
{
// get the number of statements
return java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 13
}
static ExecStatus ExecSeqStat2(Stat stat)
{
return ExecSeqStatHelper(stat, 2);
}
static ExecStatus ExecSeqStat3(Stat stat)
{
return ExecSeqStatHelper(stat, 3);
}
static ExecStatus ExecSeqStat4(Stat stat)
{
return ExecSeqStatHelper(stat, 4);
}
static ExecStatus ExecSeqStat5(Stat stat)
{
return ExecSeqStatHelper(stat, 5);
}
static ExecStatus ExecSeqStat6(Stat stat)
{
}
static ExecStatus ExecSeqStat7(Stat stat)
{
return ExecSeqStatHelper(stat, 7);
/****************************************************************************statements,thentheofthejava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 77
*
*F ExecIf(<stat>) . . . . . . . . . . . . . . . . . execute an if-statement
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
** 'ExecIf*t java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
**
* ALWAYS_INLINE ExecSeqStatHelper( UInt)
thebody. java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 77
** or ExecStatusStatstat)
* and thenon- -value is tjava.lang.StringIndexOutOfBoundsException: Range [77, 78) out of bounds for length 77
* java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 41
** leave java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
**An-statement with n>branches is statement oftypeSTAT_IF'with
n java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 73
** slot points
** condition, the fourth slot points to the* the element. If
** if-if(java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 36
** 'if(S_PREC_OR_COMOBJlist &CALL_1ARGSSTD_ITER =True java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 35
{
Expr cond; // condition
Stat body; // body
// if the condition evaluates to 'true', execute the if-branch body
cond = READ_STAT(stat,ErrorReturnVoiduserinterrupt", 0, ,ycan 'return;";
(> )
// execute the if-branch body and leave
body = READ_STAT(stat, 1 if(=3)
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
Fs> ............ .executeafor-oop
}
static ExecStatus ExecIfElse(Stat stat)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Expr cond; // condition
Stat body; // body
// if the condition evaluates to 'true', execute the if-branch body
cond=READ_STATs, )java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
if ( urnswas .If noleavestatement java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 77
// execute the if-branch body and leave
=READ_STAT(stat,1)
return EXEC_STAT( body );
}java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
SET_BRK_CALL_TOstat)
/ execute elsebranch java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 55
READ_STAT(,java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
return EXEC_STAT( body );
}
static ExecStatus ExecIfElif(Stat stat)
{
( java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
Stat java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 6
;
UInt =)
/
// loop over all branches
; i< + ){
// if the condition evaluates to 'true', execute the branch body
cond = READ_STAT( s,;
if
// execute the branch body and leave
=s i1) )java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 30
=java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 58
}
static ExecStatus ExecIfElifElse(Stat stat)
{
Expr cond; // condition
Stat body; // body
UInt nr; // number of branches
UInt i; // loop variable
// get the number of branches
nr = SIZE_STAT( stat ) / (2*sizeof(Stat)) - 1;
// loop over all branches
for ( i = 1; i <= nr; i++ ) {
// if the condition evaluates to 'true', execute the branch body
[j] = LOCK_MODE_READWRITE
iflockmodej
// execute the branch body and leave
body = READ_STAT(stat, 2 * (j;
EXEC_STAT( ;
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
SET_BRK_CALL_TO(stat)j+java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
body }
return ErrorMayQuit("Cannotlock ,0 )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
/****************************************************************************
**
*F java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
* java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 43
**
** This is done by leave-value is returned if the leave java.lang.StringIndexOutOfBoundsException: Range [77, 73) out of bounds for length 77
** evaluates to a list, and then looping over the entries in the list,
** executing the body for each
**( or' java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 77
** the for-loop is terminated and 0 is returned if the leave-statement was a
** java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
** leave-statement was a return-statement (to tell the calling executor that
** a return-statement was executed). If no leave-statement was executed,
**
** A for-loop with <n> statements in its body is a statement of type
** 'STAT_FOR' Obj ;
** for the loop variable, the second slot points to the list-expression, and
** the remaining slots points to the statements.
*/
Obj ITERATOR;
Obj IS_DONE_ITER;
Obj NEXT_ITER;
static Obj STD_ITER;
static ALWAYS_INLINE ExecStatus ExecForHelper(Stat stat, UInt nr)
{
UInt var; // variable
java.lang.StringIndexOutOfBoundsException: Range [28, 4) out of bounds for length 56
Obj elm; {
Stat body1; // first stat. of body of loop
Stat body3; // third stat. of body of loop
UInt i; // loop variable
3java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
// get the variable (initialize them first to please 'lint')
java.lang.StringIndexOutOfBoundsException: Range [0, 9) out of bounds for length 0
if (IS_REF_LVAR) .......assert
var 3<.
vart = 'l';
}
else TNUM_EXPR)=
var =* slotsthree
vart = 'h';java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 44
}
else /* if ( TNUM_EXPR( varstat ) == EXPR_REF_GVAR ) */ {
level EVAL_EXPRstat )
='g){
}
// evaluate the list
list = EVAL_EXPR(READ_STAT(stat, 1) RequireTrueOrFalse"Assert" )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
// get the body
body1 = READ_STAT(stat, 2 ()java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
body2 = (nr return
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
// special case for lists
if *
/ the java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 55
i = 1;
while ( i <= LEN_LIST(list) ) {
// get the element and assign it to the variable
elm = ELMV0_LIST( list, i );
i+*
** 'ExecRetvalexecutes value- .
if ( vart == 'l*
if =h
else if ( vart == 'g' ) AssGVar( var, elm );
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if * value,'java.lang.StringIndexOutOfBoundsException: Range [57, 56) out of bounds for length 70
ErrorReturnVoid("user interrupt", 0, 0, "you can 'return;'");
java.lang.StringIndexOutOfBoundsException: Range [13, 14) out of bounds for length 13
#endif
// execute the statements in the body
EXEC_STAT_IN_LOOP(body1);
nr > )
EXEC_STAT_IN_LOOP(body2);
if (nr >= 3)
java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 41
}
}
else {
Obj nfun; // function for NextIterator
Obj dfun;/ function IsDoneIterator
// get the iterator
list = CALL_1ARGS( ITERATOR, list );
if (IS_PREC_OR_COMOBJ(list) &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// this can avoid method selection overhead on iterator
dfun
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0
} else {
dfun = IS_DONE_ITER;
=java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
}
while ( CALL_1ARGS( dfun, **
// get the element and assign it to the variable
=CALL_1ARGS(,list ;
if ( vart == 'l' ) ASS_LVAR( var, elm );
else if ( vart == 'h' ) ASS_HVAR( var, elm );
else if ( vart == 'g' ) AssGVar( var, elm );
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if ( HaveInterrupt() ) {
ErrorReturnVoid(user " 0 0 you '');
}
#endif
// execute the statements in the body
EXEC_STAT_IN_LOOP(body1);
if (nr >= 2)
EXEC_STAT_IN_LOOP(body2);
if (nr >= 3)
EXEC_STAT_IN_LOOP(body3);
}
}
return STATUS_END;
}
static ExecStatus ExecFor(Stat stat) ExecReturnVoid(Stat
{
return ExecForHelper(stat
}
java.lang.StringIndexOutOfBoundsException: Range [36, 6) out of bounds for length 37
{
return STATE(ReturnObjStat) = 0;
}
3(java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
{
r(tat )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
}
/****************************************************************************
**
*F ExecForRange(<stat>) return(CurrExecStatFuncs =IntrExecStatFuncs
**
** 'ExecForRange' executes the for-loop <stat>, which is a for-loop whose
** loop variable is a local variable and whose list is a literal range
** expression.
**
** This is done by evaluating the list-expression, checking that it
** evaluates to a list, and then looping over the entries in the list,
** executing the body for each element of the list. If a leave-statement
** ('break' or 'return') is executed inside the body, then the execution of
** the for-loop is terminated and 0 is returned if the leave-statement was a
** break-statement or the non-zero leave-value is returned if the
** leave-statement was a return-statement (to tell the calling executor that
** a return-statement was executed). If no leave-statement was executed,
** then 0 is returned.
**
** A short for-loop with <n> statements in its body is a statement of type
** 'STAT_FOR_RANGE' with <n>+2 slots. The first slot points to an assignment
** bag for the loop variable, the second slot points to the
** and the remaining slots points to/****************************************************************************
*/
static (tat stat,UInt nr)
{
UInt lvar; // local variable
first
Int last; // last value of range
Obj voidjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
Stat body1; // first stat. of body of loop java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 45
Stat /****************************
Stat body3; // third stat. of body of loop
Int i; // loop variable*GAP java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 43
GAP_ASSERT(1 <= nr && nr <= 3);
lvar = LVAR_REF_LVAR(READ_STAT(stat, 0)*longjmp thejava.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 74
/thejava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 65
elm = }
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
elm = EVAL_EXPR(READ_EXPR(READ_STAT(stat, 1), 1));
last = GetSmallIntEx("java.lang.NullPointerException
/
body1 =printError
ErrorReturnVoid" the -set"
body3 = (nr >= 3) ? READ_STAT(stat, 4) : 0;
// loop over the range
( =;< ;i+
// get the element and assign it to the variable
elm = INTOBJ_INT( i );
ASS_LVAR( lvar, elm );
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if ( HaveInterrupt(*
java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 73
}
#endif
// execute the statements in the body
EXEC_STAT_IN_LOOP(body1);
if (nr >= 2)
EXEC_STAT_IN_LOOP(body2*
nr> )
EXEC_STAT_IN_LOOP(body3);
}
return STATUS_END;
}
static ExecStatus ExecForRange(Stat
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return ExecForRangeHelper*
}
static ExecStatus ExecForRange2(Stat stat)/
{
stat;
}
static ExecStatus
{if
(Noticeduser interrupt butyou backinloopanyway."
}
/****************************************************************************
**
F <tat>
*/
#ifdef HPCGAP
static stat
{
];
LockMode lockmode[ Pr("GAP has exceeded the permitted memory (-o option),\n", 0,
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 41
int lockSP;
UInt nrexprs,
Obj o;
xprs=(stat/))2
j = 0;
for (i = 1;
o =EVAL_EXPRR(,2*)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
(o){
tolock[j] = o;
LockQual qual = INT_INTEXPRPrintStatFuncs thedispatchingthat ypeof
if (qual == LOCK_QUAL_READWRITE)
** statements apointer printer statements ofthis i,
else if (qual ==** thatshouldbetoof thistypejava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
lockmode[j] = java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2
lockmode[j]
j++;
}
}
nrexprs = j;
GetLockStatus(nrexprs, tolock, lockstatus);
j = 0;
for (i = 0; java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 28
tolock[j] = tolock[i];
lockmode[j] = lockmode[i];
j*
break;
case LOCK_STATUS_READONLY_LOCKED:
ErrorMayQuitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
break;
}
}
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
if (lockSP >
status
PopRegionLocks(lockSP);
} else {
status = 0;
ErrorMayQuit" requiredregions" ,0;
}
return status;
}
/****************************************************************************
**
*F ExecWhile(<stat>) . . . . . . . . . . . . . . {
**
** 'ExecWhile' executes the Pr"4,0,0;
*
** This is done by executing the body while the condition evaluates to
*TNUM_EXPRREAD_STATstat, i-1)) ==EXPR_TRUE){
** the body, then the execution of the while-loop is java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 9
** returned if the leave-java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 5
** leave-value is returned if the leave-statement was a return-statement (}
** tell the calling executor that a return-statement was executed). If no
** leave-statement was executed, then 0 is returned.
*
** A while-loop PrintExpr(READ_EXPR,0)
*' n+ .The to the
** the second slot PrintStat(READ_STAT i)
** the second statement, and so on.
*/
static
{
Expr cond; // condition
(" ,)
Stat body2; // second stat. of body of loop(%< doo%2>\ ;
Stat body3; // third stat. of body of loop
( =&< )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
java.lang.StringIndexOutOfBoundsException: Range [14, 4) out of bounds for length 37
,)
body1 = READ_STAT(*
body2* printedthe'' the body If
* one the'o'
// while the condition evaluates to 'true', execute the body
ile(java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 47
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if ( HaveInterrupt( (4 , )
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 73
}
# =)
// execute the body
_STAT_IN_LOOP;
if (nr >= 2)
EXEC_STAT_IN_LOOP( ;
if (nr >= 3)
EXEC_STAT_IN_LOOP(body3);
SET_BRK_CALL_TO(stat);
}
return STATUS_END;
}
staticExecStatus Stat)
{
"4\", ,0;
}
static ExecStatus ExecWhile2(Stat stat)
{
(stat, 2)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}
static ExecStatus ExecWhile3(Stat stat)
{
return ExecWhileHelper(stat, 3);
}
/****************************************************************************
**
*F ExecRepeat(<stat>) . . . . . . . . . . . . . . . . execute a repeat-loop
**
** 'ExecRepeat' executes the repeat-loop <stat>.
**
** This is done by executing UInt ;
** ()-) (\" ,java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
** the
** returned if the leave-/***********************************
** leave-value is returned if the leave-statement*
**java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
** leave-statement was executed, then java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
*
** A repeat-*
*java.lang.StringIndexOutOfBoundsException: Range [18, 16) out of bounds for length 74
** second
** second
*/
static ALWAYS_INLINE ExecStatus java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 26
{
Expr cond; // condition
Stat body1; // first stat. of body of loop
Stat body2; // second stat. of body of loop
Stat body3; Stat body3;
Pr;, ;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
body1 = READ_STAT(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
body2 = (nr >= 2) ? **
body3=(r=3 ,):0;
// execute the body until the condition evaluates to 'true'
{
#if !defined(HAVE_SIGNAL java.lang.StringIndexOutOfBoundsException: Range [26, 21) out of bounds for length 32
// test for an interrupt
if ( HaveInterrupt() ) {
ErrorReturnVoid("user interrupt"
}
// execute the body
EXEC_STAT_IN_LOOP(body1);
n > )
EXEC_STAT_IN_LOOP(body2);
if (nr >= 3)
);
(%, >,0 )java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
} while ( EVAL_BOOL_EXPR "%<;,0 0;
return STATUS_END;}
}
static ExecStatus ExecRepeat(Stat stat)
{
return ExecRepeatHelper(stat, 1);
}
static ExecStatus ExecRepeat2(Stat stat)
{
return ExecRepeatHelper(stat, 2);
}
static ExecStatus ExecRepeat3(Stat stat)
{
return ExecRepeatHelper(stat, 3);
}
/****************************************************************************
**
*F ExecBreak(<stat>) . . . . . . . . . . . . . . . execute a break-statement
**
** 'ExecBreak' executes the break-statement <stat>.
**
** This is done by returning STATUS_BREAK (to tell the calling executor that
** a break-statement was executed).
**
** A break-statement is a statement of type 'STAT_BREAK' with no slots.
*/
static ExecStatus ExecBreak(Stat stat)
{
// return to the next loop
return STATUS_BREAK;
}
/****************************************************************************
**
*F ExecContinue(<stat>) . . . . . . . . . . . . execute a continue-statement
**
** 'ExecContinue' executes the continue-statement <stat>.
**
** This is done by returning STATUS_CONTINUE (to tell the calling executor
** that a continue-statement was executed).
**
** A continue-statement is a statement of type 'STAT_CONTINUE' with no
** slots.
*/
static ExecStatus ExecContinue(/****************************************************************
{
return STATUS_CONTINUE;
}
/****************************************************************************
**
* (<tat . . .execute an
**
** Does nothing
*/
static ExecStatus ExecEmptyPr(%2>,0,)
{
return STATUS_END;
}
/****************************************************************************
*
stat.. .. ...... statement
**
** 'ExecInfo' executes the info-statement <stat>.
**
** This is done by evaluating the first two arguments, using the GAP level
** function InfoDecision/
** it has, the other arguments are evaluated and passed to InfoDoPrint
**
** An info-statement is a statement of type 'STAT_INFO' with slots for the
** arguments.
*/
static ExecStatus ExecInfo(Stat stat)
{
Obj selectors;
Obj level;
Obj selected;
UInt narg;
UInt i;
Obj args;
bj ;
selectors = EVAL_EXPR( ARGI_INFO( stat, 1 ) );
level = EVAL_EXPR( ARGI_INFO( stat, 2) );
if (selected == True) {
/ java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
narg = NARG_SIZE_INFO(SIZE_STAT(stat)) - 2;
// set up a list
args = NEW_PLIST( T_PLIST, narg );
SET_LEN_PLIST( args, narg );
// evaluate the objects to be printed into the list
fori= ;i< narg;i+) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
// These two statements must not be combined into one because of
// the risk of a garbage collection during the evaluation
// of arg, which may happen after the pointer to args has been
// extracted
arg = EVAL_EXPR(ARGI_INFO(stat, i+2static void PrintReturnObj(tat stat)
SET_ELM_PLIST(args, i, arg);
CHANGED_BAG(if((xpr= EXPR_REF_GVAR&
}
themjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
InfoDoPrint( (%2>%< %"
return(2;, ,0;
}}
/****************************************************************************
*
*F ExecAssert2Argss>)...........executeanassert-java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
**
** 'ExecAssert2Args' executes the 2 argument assert-statement <stat>.
**
** A 2 argument assert-statement is a statement of type 'STAT_ASSERT_2ARGS'
** java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
/
static ExecStatus ExecAssert2Args(Stat stat)
{static void PrintPragmaStatstat
Obj level;
Int lev;
Obj cond;
level = EVAL_EXPR(READ_STAT(stat, 0));
lev = GetSmallIntEx("Assert", /****************************************************************************
if (STATE(CurrentAssertionLevel) >= lev) {
cond = EVAL_EXPR(READ_STAT(stat, 1));
(Assert" )
if (cond == False) {
AssertionFailure();
}
return
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/****************************************************************************
*
*F java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 2
**
** 'ExecAssert3Args' executes the 3 argument assert-statement <stat>.
**
* argumentassertstatement STAT_ASSERT_3ARGS
** with java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 0
*/
static (stat
{
Objlevel;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
static(
;
*
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
MAX_FUNC_LVARS_MASK
java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 72
cond = EVAL_EXPR(READ_STAT(stat,
RequireTrueOrFalse("Assert", cond); Iterator,&)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
if (cond == False) {
message (EAD_STATstat2;
SET_BRK_CALL_TO( ImportFuncFromLibrary( "IsStandajava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 63
AssertionFailureWithMessage(message);
}
InstallExecStatFunc ,;
return
}
********
**
FExecReturnObjs> .....executea-value
**
*Ejava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 60
java.lang.StringIndexOutOfBoundsException: Range [1, 3) out of bounds for length 2
* is ' to of
** return-value
** calling executor that a return-statement was executed).
**
** -value of STAT_RETURN_OBJ' with
* slotThis whoseto
** returned.
*/
static ExecStatus ExecReturnObj// install printers for non-statements
{
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if ( HaveInterrupt() ) {
ErrorReturnVoid("user interrupt", 0,
}
#endif
STATE(ReturnObjStat) = EVAL_EXPR( InstallPrintStatFunc( STAT_SEQ_STAT3( ,;
}
/****************************************************************************
**
*F ExecReturnVoid(<stat>) . . . . . .( java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
**
<> .,the
valuejava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
**
** 'STATUS_RETURN' java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 61
** executed).
**
** A return ,PrintBreak;
** slots.
*/
static ExecStatus ,java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 66
{
#if !defined(HAVE_SIGNAL)
// test for an interrupt
if ( HaveInterrupt() ) {
ErrorReturnVoid("user interrupt", 0, 0, "you can 'return;'");
}
#endif
STATE(ReturnObjStat) = 0;
return STATUS_RETURN;
}
ExecStatFunc IntrExecStatFuncs[256];
static#ndif
{
return STATE(CurrExecStatFuncs 0 +java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/****************************************************************************
**
*F UnInterruptExecStat() . . . . .revert the Statement execution jump table
** to normal
*/
static void UnInterruptExecStat(void)
{
assert(STATE(CurrExecStatFuncs) != ExecStatFuncs);
STATE(CurrExecStatFuncs) = ExecStatFuncs;
}
/****************************************************************************
**
*F UInt TakeInterrupt() . . . . . . . . allow user interrupts
**
** When you call this you promise that the heap is in a normal state,
** allowing GAP execution in the usual way
**
** This will do nothing (pretty quickly) if Ctrl-C has not been pressed and
** return 0. Otherwise it will respond appropriately. This may result in a
** longjmp or in returning to the caller after arbitrary execution of GAP
** code including possible garbage collection. In this case 1 is returned.
*/
UInt TakeInterrupt( void )
{
if (HaveInterrupt()) {
UnInterruptExecStat();
ErrorReturnVoid("user interrupt", 0, 0, "you can 'return;'");
return 1;
}
return 0;
}
/****************************************************************************
**
*F ExecIntrStat(<stat>) . . . . . . . . . . . . . . interrupt a computation
**
** 'ExecIntrStat' is called when a computation was interrupted (by a call to
** 'InterruptExecStat'). It changes the entries in the dispatch table
** 'ExecStatFuncs' back to their original value, calls 'Error', and
** redispatches after a return from the break-loop.
*/
static ExecStatus ExecIntrStat(Stat stat)
{
// change the entries in 'ExecStatFuncs' back to the original
if ( BreakLoopPending() ) {
UnInterruptExecStat();
}
#ifdef HPCGAP
// and now for something completely different
HandleInterrupts(1, stat);
#else
// ensure global interrupt flag syLastIntr is cleared
HaveInterrupt();
// and now for something completely different
#ifdef USE_GASMAN
if (SyStorOverrun != SY_STOR_OVERRUN_CLEAR) {
Int printError = (SyStorOverrun == SY_STOR_OVERRUN_TO_REPORT);
SyStorOverrun = SY_STOR_OVERRUN_CLEAR; // reset
if (printError) {
ErrorReturnVoid("reached the pre-set memory limit\n"
"(change it with the -o command line option)",
0, 0, "you can 'return;'");
}
}
else
#endif
ErrorReturnVoid( "user interrupt", 0, 0, "you can 'return;'" );
#endif
// continue at the interrupted statement
return EXEC_STAT( stat );
}
/****************************************************************************
**
*F InterruptExecStat() . . . . . . . . interrupt the execution of statements
**
** 'InterruptExecStat' interrupts the execution of statements at the next
** possible moment. It is called from 'SyAnsIntr' if an interrupt signal is
** received. It is never called on systems that do not support signals. On
** those systems the executors test 'SyIsIntr' at regular intervals.
**
** 'InterruptExecStat' changes all entries in the executor dispatch table
** 'ExecStatFuncs' to point to 'ExecIntrStat', which changes the entries
** back, calls 'Error', and redispatches after a return from the break-loop.
*/
void InterruptExecStat ( void )
{
// remember the original entries from the table 'ExecStatFuncs'
STATE(CurrExecStatFuncs) = IntrExecStatFuncs;
}
/****************************************************************************
**
*F ClearError() . . . . . . . . . . . . . . reset execution and error flag
*/
void ClearError ( void )
{
// change the entries in 'ExecStatFuncs' back to the original
if ( BreakLoopPending() ) {
UnInterruptExecStat();
// check for user interrupt
if ( HaveInterrupt() ) {
Pr("Noticed user interrupt, but you are back in main loop anyway.\n",
0, 0);
}
#ifdef USE_GASMAN
// and check if maximal memory was overrun
if (SyStorOverrun != SY_STOR_OVERRUN_CLEAR) {
if (SyStorOverrun == SY_STOR_OVERRUN_TO_REPORT) {
Pr("GAP has exceeded the permitted memory (-o option),\n", 0,
0);
Pr("the maximum is now enlarged to %d kB.\n", (Int)SyStorMax,
0);
}
SyStorOverrun = SY_STOR_OVERRUN_CLEAR; // reset
}
#endif
}
}
/****************************************************************************
**
*V PrintStatFuncs[<type>] . . print function for statements of type <type>
**
** 'PrintStatFuncs' is the dispatching table that contains for every type of
** statements a pointer to the printer for statements of this type, i.e.,
** the function that should be called to print statements of this type.
*/
static PrintStatFunc PrintStatFuncs[256];
/****************************************************************************
**
*F InstallPrintStatFunc(<pos>,<f>)
*/
void InstallPrintStatFunc(unsigned int pos, PrintStatFunc f)
{
GAP_ASSERT(pos < ARRAY_SIZE(PrintStatFuncs));
PrintStatFuncs[pos] = f;
}
/****************************************************************************
**
*F PrintStat(<stat>) . . . . . . . . . . . . . . . . . . . print a statement
**
** 'PrintStat' prints the statements <stat>.
**
** 'PrintStat' simply dispatches through the table 'PrintStatFuncs' to the
** appropriate printer.
*/
void PrintStat(Stat stat)
{
(*PrintStatFuncs[TNUM_STAT(stat)])(stat);
}
/****************************************************************************
**
*F PrintUnknownStat(<stat>) . . . . . . . . print statement of unknown type
**
** 'PrintUnknownStat' is the printer that is called if an attempt is made
** print a statement <stat> of an unknown type. It signals an error. If
** this is ever called, then GAP is in serious trouble, such as an
** overwritten type field of a statement.
*/
static void PrintUnknownStat(Stat stat)
{
ErrorQuit("Panic: cannot print statement of type '%d'",
(Int)TNUM_STAT(stat), 0);
}
/****************************************************************************
**
*F PrintSeqStat(<stat>) . . . . . . . . . . . . print a statement sequence
**
** 'PrintSeqStat' prints the statement sequence <stat>.
*/
static void PrintSeqStat(Stat stat)
{
UInt nr; // number of statements
UInt i; // loop variable
// get the number of statements
nr = SIZE_STAT( stat ) / sizeof(Stat);
// loop over the statements
for ( i = 1; i <= nr; i++ ) {
// print the <i>-th statement
PrintStat(READ_STAT(stat, i - 1));
// print a line break after all but the last statement
if ( i < nr ) Pr("\n", 0, 0);
}
}
/****************************************************************************
**
*F PrintIf(<stat>) . . . . . . . . . . . . . . . . . . print an if-statement
**
** 'PrIf' prints the if-statement <stat>.
**
** Linebreaks are printed after the 'then' and the statements in the bodies.
** If necessary one is preferred immediately before the 'then'.
*/
static void PrintIf(Stat stat)
{
UInt i; // loop variable
UInt len; // length of loop
// print the 'if' branch
Pr("if%4> ", 0, 0);
PrintExpr(READ_EXPR(stat, 0));
Pr("%2< then%2>\n", 0, 0);
PrintStat(READ_STAT(stat, 1));
Pr("%4<\n", 0, 0);
len = SIZE_STAT(stat) / (2 * sizeof(Stat));
// print the 'elif' branch
for (i = 2; i <= len; i++) {
if (i == len &&
TNUM_EXPR(READ_STAT(stat, 2 * (i - 1))) == EXPR_TRUE) {
Pr("else%4>\n", 0, 0);
}
else {
Pr("elif%4> ", 0, 0);
PrintExpr(READ_EXPR(stat, 2 * (i - 1)));
Pr("%2< then%2>\n", 0, 0);
}
PrintStat(READ_STAT(stat, 2 * (i - 1) + 1));
Pr("%4<\n", 0, 0);
}
// print the 'fi'
Pr("fi;", 0, 0);
}
/****************************************************************************
**
*F PrintFor(<stat>) . . . . . . . . . . . . . . . . . . . print a for-loop
**
** 'PrintFor' prints the for-loop <stat>.
**
** Linebreaks are printed after the 'do' and the statements in the body. If
** necessary it is preferred immediately before the 'in'.
*/
static void PrintFor(Stat stat)
{
UInt i; // loop variable
Pr("for%4> ", 0, 0);
PrintExpr(READ_EXPR(stat, 0));
Pr("%2< in%2> ", 0, 0);
PrintExpr(READ_EXPR(stat, 1));
Pr("%2< do%2>\n", 0, 0);
for ( i = 2; i <= SIZE_STAT(stat)/sizeof(Stat)-1; i++ ) {
PrintStat(READ_STAT(stat, i));
if ( i < SIZE_STAT(stat)/sizeof(Stat)-1 ) Pr("\n", 0, 0);
}
Pr("%4<\nod;", 0, 0);
}
/****************************************************************************
**
*F PrintWhile(<stat>) . . . . . . . . . . . . . . . . . print a while loop
**
** 'PrintWhile' prints the while-loop <stat>.
**
** Linebreaks are printed after the 'do' and the statements in the body. If
** necessary one is preferred immediately before the 'do'.
*/
static void PrintWhile(Stat stat)
{
UInt i; // loop variable
Pr("while%4> ", 0, 0);
PrintExpr(READ_EXPR(stat, 0));
Pr("%2< do%2>\n", 0, 0);
for ( i = 1; i <= SIZE_STAT(stat)/sizeof(Stat)-1; i++ ) {
PrintStat(READ_STAT(stat, i));
if ( i < SIZE_STAT(stat)/sizeof(Stat)-1 ) Pr("\n", 0, 0);
}
Pr("%4<\nod;", 0, 0);
}
/****************************************************************************
**
*F PrintAtomic(<stat>) . . . . . . . . . . . . . . . . print an atomic loop
**
** 'PrintAtomic' prints the atomic-loop <stat>.
**
** Linebreaks are printed after the 'do' and the statements in the body. If
** necessary one is preferred immediately before the 'do'.
*/
#ifdef HPCGAP
static void PrintAtomic(Stat stat)
{
UInt nrexprs;
UInt i; // loop variable
Pr("atomic%4> ", 0, 0);
nrexprs = ((SIZE_STAT(stat)/sizeof(Stat))-1)/2;
for (i = 1; i <= nrexprs; i++) {
if (i != 1)
Pr(", ", 0, 0);
switch (INT_INTEXPR(READ_STAT(stat, 2 * i - 1))) {
case LOCK_QUAL_NONE:
break;
case LOCK_QUAL_READONLY:
Pr("readonly ", 0, 0);
break;
case LOCK_QUAL_READWRITE:
Pr("readwrite ", 0, 0);
break;
}
PrintExpr(READ_EXPR(stat, 2 * i));
}
Pr("%2< do%2>\n", 0, 0);
PrintStat(READ_STAT(stat, 0));
Pr("%4<\nod;", 0, 0);
}
#endif
/****************************************************************************
**
*F PrintRepeat(<stat>) . . . . . . . . . . . . . . . . . print a repeat-loop
**
** 'PrintRepeat' prints the repeat-loop <stat>.
**
** Linebreaks are printed after the 'repeat' and the statements in the body.
** If necessary one is preferred after the 'until'.
*/
static void PrintRepeat(Stat stat)
{
UInt i; // loop variable
Pr("repeat%4>\n", 0, 0);
for ( i = 1; i <= SIZE_STAT(stat)/sizeof(Stat)-1; i++ ) {
PrintStat(READ_STAT(stat, i));
if ( i < SIZE_STAT(stat)/sizeof(Stat)-1 ) Pr("\n", 0, 0);
}
Pr("%4<\nuntil%2> ", 0, 0);
PrintExpr(READ_EXPR(stat, 0));
Pr("%2<;", 0, 0);
}
/****************************************************************************
**
*F PrintBreak(<stat>) . . . . . . . . . . . . . . . print a break-statement
**
** 'PrintBreak' prints the break-statement <stat>.
*/
static void PrintBreak(Stat stat)
{
Pr("break;", 0, 0);
}
/****************************************************************************
**
*F PrintContinue(<stat>) . . . . . . . . . . . . print a continue-statement
**
** 'PrintContinue' prints the continue-statement <stat>.
*/
static void PrintContinue(Stat stat)
{
Pr("continue;", 0, 0);
}
/****************************************************************************
**
*F PrintEmpty(<stat>)
**
*/
static void PrintEmpty(Stat stat)
{
Pr(";", 0, 0);
}
/****************************************************************************
**
*F PrintInfo(<stat>) . . . . . . . . . . . . . . . . print an info-statement
**
** 'PrintInfo' prints the info-statement <stat>.
*/
static void PrintInfo(Stat stat)
{
UInt i; // loop variable
// print the keyword
Pr("%2>Info", 0, 0);
// print the opening parenthesis
Pr("%<( %>", 0, 0);
// print the expressions that evaluate to the actual arguments
for ( i = 1; i <= NARG_SIZE_INFO( SIZE_STAT(stat) ); i++ ) {
PrintExpr( ARGI_INFO(stat,i) );
if ( i != NARG_SIZE_INFO( SIZE_STAT(stat) ) ) {
Pr("%<, %>", 0, 0);
}
}
// print the closing parenthesis
Pr(" %2<);", 0, 0);
}
/****************************************************************************
**
*F PrintAssert2Args(<stat>) . . . . . . . . . . . . print an info-statement
**
** 'PrintAssert2Args' prints the 2 argument assert-statement <stat>.
*/
static void PrintAssert2Args(Stat stat)
{
// print the keyword
Pr("%2>Assert", 0, 0);
// print the opening parenthesis
Pr("%<( %>", 0, 0);
// Print the arguments, separated by a comma
PrintExpr(READ_EXPR(stat, 0));
Pr("%<, %>", 0, 0);
PrintExpr(READ_EXPR(stat, 1));
// print the closing parenthesis
Pr(" %2<);", 0, 0);
}
/****************************************************************************
**
*F PrintAssert3Args(<stat>) . . . . . . . . . . . . print an info-statement
**
** 'PrintAssert3Args' prints the 3 argument assert-statement <stat>.
*/
static void PrintAssert3Args(Stat stat)
{
// print the keyword
Pr("%2>Assert", 0, 0);
// print the opening parenthesis
Pr("%<( %>", 0, 0);
// Print the arguments, separated by commas
PrintExpr(READ_EXPR(stat, 0));
Pr("%<, %>", 0, 0);
PrintExpr(READ_EXPR(stat, 1));
Pr("%<, %>", 0, 0);
PrintExpr(READ_EXPR(stat, 2));
// print the closing parenthesis
Pr(" %2<);", 0, 0);
}
/****************************************************************************
**
*F PrintReturnObj(<stat>) . . . . . . . . . print a return-value-statement
**
** 'PrintReturnObj' prints the return-value-statement <stat>.
*/
static void PrintReturnObj(Stat stat)
{
Expr expr = READ_STAT(stat, 0);
if (TNUM_EXPR(expr) == EXPR_REF_GVAR &&
READ_STAT(expr, 0) == GVarName("TRY_NEXT_METHOD")) {
Pr("TryNextMethod();", 0, 0);
}
else {
Pr("%2>return%< %>", 0, 0);
PrintExpr( expr );
Pr("%2<;", 0, 0);
}
}
/****************************************************************************
**
*F PrintReturnVoid(<stat>) . . . . . . . . . . print a return-void-statement
**
** 'PrintReturnVoid' prints the return-void-statement <stat>.
*/
static void PrintReturnVoid(Stat stat)
{
Pr("return;", 0, 0);
}
/****************************************************************************
**
*F PrintPragma(<stat>) . . . . . . . . . . . . . . print a pragma-statement
*/
static void PrintPragma(Stat stat)
{
UInt ix = READ_STAT(stat, 0);
Obj string = GET_VALUE_FROM_CURRENT_BODY(ix);
Pr("#%g", (Int)string, 0);
}
/****************************************************************************
**
*F * * * * * * * * * * * * * initialize module * * * * * * * * * * * * * * *
*/
/****************************************************************************
**
*F InitKernel( <module> ) . . . . . . . . initialise kernel data structures
*/
static Int InitKernel (
StructInitInfo * module )
{
UInt i; // loop variable
// register global bags with the garbage collector
InitGlobalBag( &STATE(ReturnObjStat), "src/stats.c:ReturnObjStat" );
// connect to external functions
ImportFuncFromLibrary( "Iterator", &ITERATOR );
ImportFuncFromLibrary( "IsDoneIterator", &IS_DONE_ITER );
ImportFuncFromLibrary( "NextIterator", &NEXT_ITER );
ImportFuncFromLibrary( "IsStandardIterator", &STD_ITER );
// install executors for non-statements
for ( i = 0; i < ARRAY_SIZE(ExecStatFuncs); i++ ) {
InstallExecStatFunc(i, ExecUnknownStat);
}
// install executors for compound statements
InstallExecStatFunc( STAT_SEQ_STAT , ExecSeqStat);
InstallExecStatFunc( STAT_SEQ_STAT2 , ExecSeqStat2);
InstallExecStatFunc( STAT_SEQ_STAT3 , ExecSeqStat3);
InstallExecStatFunc( STAT_SEQ_STAT4 , ExecSeqStat4);
InstallExecStatFunc( STAT_SEQ_STAT5 , ExecSeqStat5);
InstallExecStatFunc( STAT_SEQ_STAT6 , ExecSeqStat6);
InstallExecStatFunc( STAT_SEQ_STAT7 , ExecSeqStat7);
InstallExecStatFunc( STAT_IF , ExecIf);
InstallExecStatFunc( STAT_IF_ELSE , ExecIfElse);
InstallExecStatFunc( STAT_IF_ELIF , ExecIfElif);
InstallExecStatFunc( STAT_IF_ELIF_ELSE , ExecIfElifElse);
InstallExecStatFunc( STAT_FOR , ExecFor);
InstallExecStatFunc( STAT_FOR2 , ExecFor2);
InstallExecStatFunc( STAT_FOR3 , ExecFor3);
InstallExecStatFunc( STAT_FOR_RANGE , ExecForRange);
InstallExecStatFunc( STAT_FOR_RANGE2 , ExecForRange2);
InstallExecStatFunc( STAT_FOR_RANGE3 , ExecForRange3);
InstallExecStatFunc( STAT_WHILE , ExecWhile);
InstallExecStatFunc( STAT_WHILE2 , ExecWhile2);
InstallExecStatFunc( STAT_WHILE3 , ExecWhile3);
InstallExecStatFunc( STAT_REPEAT , ExecRepeat);
InstallExecStatFunc( STAT_REPEAT2 , ExecRepeat2);
InstallExecStatFunc( STAT_REPEAT3 , ExecRepeat3);
InstallExecStatFunc( STAT_BREAK , ExecBreak);
InstallExecStatFunc( STAT_CONTINUE , ExecContinue);
InstallExecStatFunc( STAT_INFO , ExecInfo);
InstallExecStatFunc( STAT_ASSERT_2ARGS , ExecAssert2Args);
InstallExecStatFunc( STAT_ASSERT_3ARGS , ExecAssert3Args);
InstallExecStatFunc( STAT_RETURN_OBJ , ExecReturnObj);
InstallExecStatFunc( STAT_RETURN_VOID , ExecReturnVoid);
InstallExecStatFunc( STAT_EMPTY , ExecEmpty);
InstallExecStatFunc( STAT_PRAGMA , ExecEmpty);
#ifdef HPCGAP
InstallExecStatFunc( STAT_ATOMIC , ExecAtomic);
#endif
// install printers for non-statements
for ( i = 0; i < ARRAY_SIZE(PrintStatFuncs); i++ ) {
InstallPrintStatFunc(i, PrintUnknownStat);
}
// install printing functions for compound statements
InstallPrintStatFunc( STAT_SEQ_STAT , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT2 , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT3 , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT4 , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT5 , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT6 , PrintSeqStat);
InstallPrintStatFunc( STAT_SEQ_STAT7 , PrintSeqStat);
InstallPrintStatFunc( STAT_IF , PrintIf);
InstallPrintStatFunc( STAT_IF_ELSE , PrintIf);
InstallPrintStatFunc( STAT_IF_ELIF , PrintIf);
InstallPrintStatFunc( STAT_IF_ELIF_ELSE , PrintIf);
InstallPrintStatFunc( STAT_FOR , PrintFor);
InstallPrintStatFunc( STAT_FOR2 , PrintFor);
InstallPrintStatFunc( STAT_FOR3 , PrintFor);
InstallPrintStatFunc( STAT_FOR_RANGE , PrintFor);
InstallPrintStatFunc( STAT_FOR_RANGE2 , PrintFor);
InstallPrintStatFunc( STAT_FOR_RANGE3 , PrintFor);
InstallPrintStatFunc( STAT_WHILE , PrintWhile);
InstallPrintStatFunc( STAT_WHILE2 , PrintWhile);
InstallPrintStatFunc( STAT_WHILE3 , PrintWhile);
InstallPrintStatFunc( STAT_REPEAT , PrintRepeat);
InstallPrintStatFunc( STAT_REPEAT2 , PrintRepeat);
InstallPrintStatFunc( STAT_REPEAT3 , PrintRepeat);
InstallPrintStatFunc( STAT_BREAK , PrintBreak);
InstallPrintStatFunc( STAT_CONTINUE , PrintContinue);
InstallPrintStatFunc( STAT_INFO , PrintInfo);
InstallPrintStatFunc( STAT_ASSERT_2ARGS , PrintAssert2Args);
InstallPrintStatFunc( STAT_ASSERT_3ARGS , PrintAssert3Args);
InstallPrintStatFunc( STAT_RETURN_OBJ , PrintReturnObj);
InstallPrintStatFunc( STAT_RETURN_VOID , PrintReturnVoid);
InstallPrintStatFunc( STAT_EMPTY , PrintEmpty);
InstallPrintStatFunc( STAT_PRAGMA , PrintPragma);
#ifdef HPCGAP
InstallPrintStatFunc( STAT_ATOMIC , PrintAtomic);
#endif
for ( i = 0; i < ARRAY_SIZE(ExecStatFuncs); i++ )
IntrExecStatFuncs[i] = ExecIntrStat;
for (i = FIRST_NON_INTERRUPT_STAT; i <= LAST_NON_INTERRUPT_STAT; i++)
IntrExecStatFuncs[i] = ExecStatFuncs[i];
return 0;
}
static Int InitModuleState(void)
{
STATE(CurrExecStatFuncs) = ExecStatFuncs;
#ifdef HPCGAP
MEMBAR_FULL();
if (GetThreadState(TLS(threadID)) >= TSTATE_INTERRUPT) {
MEMBAR_FULL();
STATE(CurrExecStatFuncs) = IntrExecStatFuncs;
}
#endif
return 0;
}
/****************************************************************************
**
*F InitInfoStats() . . . . . . . . . . . . . . . . . table of init functions
*/
static StructInitInfo module = {
// init struct using C99 designated initializers; for a full list of
// fields, please refer to the definition of StructInitInfo
.type = MODULE_BUILTIN,
.name = "stats",
.initKernel = InitKernel,
.initModuleState = InitModuleState,
};
StructInitInfo * InitInfoStats ( void )
{
return &module;
}
¤ Dauer der Verarbeitung: 0.154 Sekunden
¤
*© Formatika GbR, Deutschland
|
|
2026-11-24
|
|
|
|
|