/**************************************************************************** ** ** 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 declares the functions of the coder package. ** ** The coder package is the part of the interpreter that creates the ** expressions. Its functions are called from the reader.
*/
#ifndef GAP_CODE_H #define GAP_CODE_H
#include"gapstate.h" #include"objects.h"
/**************************************************************************** ** *T StatHeader ** ** Header for any statement or expression encoded in a function body.
*/ typedefstruct { // `visited` starts out as 0 and is set to 1 if the statement or // expression has ever been executed while profiling is turned on unsignedint visited : 1;
// `line` records the line number in the source file in which the // statement or expression started unsignedint line : 31;
// `size` is the length in bytes of the statement or expression in // bytes; the actual encoding rounds this up to a multiple of // `sizeof(Stat)` unsignedint size : 24;
// the type of the expression or statement, see `enum STAT_TNUM` // and `enum EXPR_TNUM`. unsignedint type : 8;
} StatHeader;
GAP_STATIC_ASSERT((sizeof(StatHeader) % sizeof(Stat)) == 0, "StatHeader size must be multiple of Stat size");
/**************************************************************************** ** *T CodeState ** ** Internal state of the coder; stored as part of the interpreter state in ** struct IntrState.
*/ struct CodeState {
// the offset in the current body. It is only valid while coding
Stat OffsBody;
// a stack of further OffsBody values, used when coding // nested function expressions
Obj OffsBodyStack;
// the result of the coding, i.e., the function that was coded
Obj CodeResult;
// place to store the previous value of STATE(CurrLVars)
Bag CodeLVars;
//
Obj currBody;
};
typedefstruct CodeState CodeState;
/**************************************************************************** ** ** Function body headers ** ** 'FILENAME_BODY' is a string containing the file of a function. ** 'STARTLINE_BODY' is the line number where a function starts. ** 'ENDLINE_BODY' is the line number where a function ends. ** 'LOCATION_BODY' is a string describing the location of a function. ** Typically this will be the name of a C function implementing it. ** ** These each have a 'GET' and a 'SET' variant, to read or set the value. ** Note that STARTLINE_BODY and LOCATION_BODY are stored in the same place, ** so writing one will overwrite the other. ** ** All of these variables may be 0, if the information is not known,
*/
typedefstruct { // if non-zero, this is either a string containing the name of the // file of a function, or an immediate integer containing the index // of the filename inside FilenameCache
Obj filename_or_id;
// if non-zero, this is either an immediate integer encoding the // line number where a function starts, or string describing the // location of a function. Typically this will be the name of a C // function implementing it.
Obj startline_or_location;
// if non-zero, this is an immediate integer encoding the line // number where a function ends
Obj endline;
// if non-zero, this points to a dense plist containing constant values // referenced by the code in this function body
Obj values;
/**************************************************************************** ** *F NewStatOrExpr(<type>,<size>,<line>) . . . . . . allocate a new statement ** ** 'NewStatOrExpr' allocates a new statement or expressions memory block of ** type <type> and with <size> bytes. It also records the line number <line> ** of the statement for profiling. It returns the offset of the new ** statement. ** ** Callers may pass zero for <line> to denote a statement which should not ** be tracked by the profiling code.
*/
Stat NewStatOrExpr(CodeState * cs, UInt type, UInt size, UInt line);
void PushStat(Stat stat);
/**************************************************************************** ** *V OFFSET_FIRST_STAT . . . . . . . . . . offset of first statement in a body ** ** 'OFFSET_FIRST_STAT' is the offset of the first statement in a body.
*/
// STAT_EMPTY could also be considered to be "T_SEQ_STAT0", but it // must be an interruptible statement, so that loops with empty // body can be interrupted.
STAT_EMPTY,
// The statement types between FIRST_NON_INTERRUPT_STAT and // LAST_NON_INTERRUPT_STAT will not be interrupted (which may happen // for two reasons: the user interrupted, e.g. via ctrl-c; or memory // run full). We don't want to compound statements to be interrupted, // relying instead on their sub-statements being interruptible. This // results in a slightly better user experience in break loops, where // the interrupted statement is printed, which works better for // single statements than for compound statements.
START_ENUM_RANGE(FIRST_NON_INTERRUPT_STAT),
/**************************************************************************** ** *F TNUM_STAT(<stat>) . . . . . . . . . . . . . . . . . . type of a statement ** ** 'TNUM_STAT' returns the type of the statement <stat>.
*/
EXPORT_INLINE Int TNUM_STAT(Stat stat)
{ return CONST_STAT_HEADER(stat)->type;
}
/**************************************************************************** ** *F SIZE_STAT(<stat>) . . . . . . . . . . . . . . . . . . size of a statement ** ** 'SIZE_STAT' returns the size of the statement <stat>.
*/
EXPORT_INLINE Int SIZE_STAT(Stat stat)
{ return CONST_STAT_HEADER(stat)->size;
}
/**************************************************************************** ** *F LINE_STAT(<stat>) . . . . . . . . . . . . . . line number of a statement ** ** 'LINE_STAT' returns the line number of the statement <stat>.
*/
EXPORT_INLINE Int LINE_STAT(Stat stat)
{ return CONST_STAT_HEADER(stat)->line;
}
/**************************************************************************** ** *F VISITED_STAT(<stat>) . . . . . . . . . . . if statement has even been run ** ** 'VISITED_STAT' returns true if the statement has ever been executed ** while profiling is turned on.
*/
EXPORT_INLINE Int VISITED_STAT(Stat stat)
{ return CONST_STAT_HEADER(stat)->visited;
}
/**************************************************************************** ** *F SET_VISITED_STAT(<stat>) . . . . . . . . . . mark statement as having run ** ** 'SET_VISITED_STAT' marks the statement as having been executed while ** profiling was turned on.
*/ void SET_VISITED_STAT(Stat stat);
/**************************************************************************** ** *F IS_REF_LVAR(<expr>) . . . test if an expression is a reference to a local *F REF_LVAR_LVAR(<lvar>) . . . . . convert a local to a reference to a local *F LVAR_REF_LVAR(<expr>) . . . . . convert a reference to a local to a local ** ** 'IS_REF_LVAR' returns 1 if the expression <expr> is an (immediate) ** reference to a local variable, and 0 otherwise. ** ** 'REF_LVAR_LVAR' returns a (immediate) reference to the local variable ** <lvar> (given by its index). ** ** 'LVAR_REF_LVAR' returns the local variable (by its index) to which <expr> ** is a (immediate) reference.
*/
EXPORT_INLINE BOOL IS_REF_LVAR(Expr expr)
{ return ((Int)expr & 0x03) == 0x03;
}
EXPORT_INLINE Int LVAR_REF_LVAR(Expr expr)
{ return (Int)expr >> 2;
}
/**************************************************************************** ** *F IS_INTEXPR(<expr>). . . . test if an expression is an integer expression *F INTEXPR_INT(<i>) . . . . . convert a C integer to an integer expression *F INT_INTEXPR(<expr>) . . . . convert an integer expression to a C integer ** ** 'IS_INTEXPR' returns 1 if the expression <expr> is an (immediate) integer ** expression, and 0 otherwise. ** ** 'INTEXPR_INT' converts the C integer <i> to an (immediate) integer ** expression. ** ** 'INT_INTEXPR' converts the (immediate) integer expression <expr> to a C ** integer.
*/
EXPORT_INLINE BOOL IS_INTEXPR(Expr expr)
{ return ((Int)expr & 0x03) == 0x01;
}
/**************************************************************************** ** *F TNUM_EXPR(<expr>) . . . . . . . . . . . . . . . . . type of an expression ** ** 'TNUM_EXPR' returns the type of the expression <expr>.
*/
EXPORT_INLINE Int TNUM_EXPR(Expr expr)
{ if (IS_REF_LVAR(expr)) return EXPR_REF_LVAR; if (IS_INTEXPR(expr)) return EXPR_INT; return TNUM_STAT(expr);
}
/**************************************************************************** ** *F SIZE_EXPR(<expr>) . . . . . . . . . . . . . . . . . size of an expression ** ** 'SIZE_EXPR' returns the size of the expression <expr>. ** ** Note that it is *fatal* to apply 'SIZE_EXPR' to expressions of type ** 'EXPR_REF_LVAR' or 'EXPR_INT'.
*/ #define SIZE_EXPR(expr) SIZE_STAT(expr)
/**************************************************************************** ** *F ADDR_EXPR(<expr>) . . . . . . . . . . . absolute address of an expression ** ** 'ADDR_EXPR' returns the absolute address of the memory block of the ** expression <expr>. ** ** Note that it is *fatal* to apply 'ADDR_EXPR' to expressions of type ** 'EXPR_REF_LVAR' or 'EXPR_INT'.
*/ #define CONST_ADDR_EXPR(expr) CONST_ADDR_STAT(expr)
EXPORT_INLINE Stat READ_EXPR(Expr expr, Int idx)
{
GAP_ASSERT(!IS_REF_LVAR(expr));
GAP_ASSERT(!IS_INTEXPR(expr));
GAP_ASSERT(idx >= 0);
GAP_ASSERT(idx < SIZE_EXPR(expr) / sizeof(Expr)); return CONST_ADDR_EXPR(expr)[idx];
}
/**************************************************************************** ** *F FUNC_CALL(<call>) . . . . . . . . . . . . . function for a function call *F ARGI_CALL(<call>,<i>) . . . . <i>-th formal argument for a function call *F NARG_SIZE_CALL(<size>) . . . . . number of arguments for a function call *F SIZE_NARG_CALL(<narg>) . . . . . . . size of the bag for a function call ** ** 'FUNC_CALL' returns the expression that should evaluate to the function ** for the procedure or function call <call>. This is a legal left value, ** so it can be used to set the expression too. ** ** 'ARGI_CALL' returns the expression that evaluate to the <i>-th actual ** argument for the procedure or function call <call>. This is a legal left ** value, so it can be used to set the expression too. ** ** 'NARG_SIZE_CALL' returns the number of arguments in a function call from ** the size <size> of the function call bag (as returned by 'SIZE_EXPR'). ** ** 'SIZE_NARG_CALL' returns the size a function call bag should have for a ** function call bag with <narg> arguments.
*/ #define FUNC_CALL(call) READ_EXPR(call, 0) #define ARGI_CALL(call,i) READ_EXPR(call, i) #define NARG_SIZE_CALL(size) (((size) / sizeof(Expr)) - 1) #define SIZE_NARG_CALL(narg) (((narg) + 1) * sizeof(Expr))
/**************************************************************************** ** *F ARGI_INFO(<info>,<i>) . . . <i>-th formal argument for an Info statement *F NARG_SIZE_INFO(<size>) . . . . number of arguments for an Info statement *F SIZE_NARG_INFO(<narg>) . . . . . . size of the bag for an Info statement ** ** 'ARGI_INFO' returns the expression that evaluates to the <i>-th actual ** argument for the Info statement <info>. This is a legal left value, so ** it can be used to set the expression too. ** ** 'NARG_SIZE_INFO' returns the number of arguments in a function call from ** the size <size> of the function call bag (as returned by 'SIZE_STAT'). ** ** 'SIZE_NARG_INFO' returns the size a function call bag should have for a ** function call bag with <narg> arguments.
*/ #define ARGI_INFO(info,i) READ_STAT(info, (i) - 1) #define NARG_SIZE_INFO(size) ((size) / sizeof(Expr)) #define SIZE_NARG_INFO(narg) ((narg) * sizeof(Expr))
/**************************************************************************** ** *F CodeBegin() . . . . . . . . . . . . . . . . . . . . . . . start the coder *F CodeEnd(<error>) . . . . . . . . . . . . . . . . . . . . stop the coder ** ** 'CodeBegin' starts the coder. It is called from the immediate ** interpreter when he encounters a construct that it cannot immediately ** interpret. ** ** 'CodeEnd' stops the coder. It is called from the immediate interpreter ** when he is done with the construct that it cannot immediately interpret. ** If <error> is non-zero, a syntax error was detected by the reader, and ** the coder should only clean up. Otherwise, returns the newly coded ** function. ** ** ...only function expressions in between...
*/ void CodeBegin(CodeState * cs);
Obj CodeEnd(CodeState * cs, UInt error);
/**************************************************************************** ** *F CodeFuncCallBegin() . . . . . . . . . . . . . . code function call, begin *F CodeFuncCallEnd(<funccall>,<options>, <nr>) . code function call, end ** ** 'CodeFuncCallBegin' is an action to code a function call. It is called ** by the reader when it encounters the parenthesis '(', i.e., *after* the ** function expression is read. ** ** 'CodeFuncCallEnd' is an action to code a function call. It is called by ** the reader when it encounters the parenthesis ')', i.e., *after* the ** argument expressions are read. <funccall> is 1 if this is a function ** call, and 0 if this is a procedure call. <nr> is the number of ** arguments. <options> is 1 if options were present after the ':' in which ** case the options have been read already.
*/ void CodeFuncCallBegin(CodeState * cs);
/**************************************************************************** ** *F CodeFuncExprBegin(<narg>,<nloc>,<nams>,<gapnameid>,<startLine>) ** . . code function expression, begin *F CodeFuncExprEnd(<nr>,<pushExpr>,<endLine>) ** . . . code function expression, end ** ** 'CodeFuncExprBegin' is an action to code a function expression. It is ** called when the reader encounters the beginning of a function expression. ** <narg> is the number of arguments (-1 if the function takes a variable ** number of arguments), <nloc> is the number of locals, <nams> is a list of ** local variable names. ** ** 'CodeFuncExprEnd' is an action to code a function expression. It is ** called when the reader encounters the end of a function expression. <nr> ** is the number of statements in the body of the function. If <pushExpr> is ** set, the current function expression is pushed on the expression stack.
*/ void CodeFuncExprBegin(CodeState * cs, Int narg, Int nloc,
Obj nams,
UInt gapnameid, Int startLine);
Expr CodeFuncExprEnd(CodeState * cs, UInt nr, BOOL pushExpr, Int endLine);
/**************************************************************************** ** *F AddValueToBody( <val> ) . . . . . . . . . . . store value in values list ** ** 'AddValueToBody' adds a value into the value list of the body of the ** function currently being coded, and returns the index at which the value ** was inserted. This function must only be called while coding a function.
*/ Int AddValueToBody(CodeState * cs, Obj val);
/**************************************************************************** ** *F CodeFuncCallOptionsBegin() . . . . . . . . . . . . . code options, begin *F CodeFuncCallOptionsBeginElmName(<rnam>). . . code options, begin element *F CodeFuncCallOptionsBeginElmExpr() . .. . . . .code options, begin element *F CodeFuncCallOptionsEndElm() . . .. . . . . . . code options, end element *F CodeFuncCallOptionsEndElmEmpty() .. . . . . . .code options, end element *F CodeFuncCallOptionsEnd(<nr>) . . . . . . . . . . . . . code options, end ** ** The net effect of all of these is to leave a record expression on the ** stack containing the options record. It will be picked up by ** CodeFuncCallEnd(). **
*/ void CodeFuncCallOptionsBegin(CodeState * cs);
/**************************************************************************** ** *F CodeIfBegin() . . . . . . . . . . . code if-statement, begin of statement *F CodeIfElif() . . . . . . . . . . code if-statement, begin of elif-branch *F CodeIfElse() . . . . . . . . . . code if-statement, begin of else-branch *F CodeIfBeginBody() . . . . . . . . . . . code if-statement, begin of body *F CodeIfEndBody(<nr>) . . . . . . . . . . . code if-statement, end of body *F CodeIfEnd(<nr>) . . . . . . . . . . . code if-statement, end of statement ** ** 'CodeIfBegin' is an action to code an if-statement. It is called when ** the reader encounters the 'if', i.e., *before* the condition is read. ** ** 'CodeIfElif' is an action to code an if-statement. It is called when the ** reader encounters an 'elif', i.e., *before* the condition is read. ** ** 'CodeIfElse' is an action to code an if-statement. It is called when the ** reader encounters an 'else'. ** ** 'CodeIfBeginBody' is an action to code an if-statement. It is called ** when the reader encounters the beginning of the statement body of an ** 'if', 'elif', or 'else' branch, i.e., *after* the condition is read. ** ** 'CodeIfEndBody' is an action to code an if-statement. It is called when ** the reader encounters the end of the statements body of an 'if', 'elif', ** or 'else' branch. <nr> is the number of statements in the body. ** ** 'CodeIfEnd' is an action to code an if-statement. It is called when the ** reader encounters the end of the statement. <nr> is the number of 'if', ** 'elif', or 'else' branches.
*/ void CodeIfBegin(CodeState * cs);
void CodeIfElif(CodeState * cs);
void CodeIfElse(CodeState * cs);
Int CodeIfBeginBody(CodeState * cs);
Int CodeIfEndBody(CodeState * cs, UInt nr);
void CodeIfEnd(CodeState * cs, UInt nr);
/**************************************************************************** ** *F CodeForBegin() . . . . . . . . . code for-statement, begin of statement *F CodeForIn() . . . . . . . . . . . . . . . . code for-statement, 'in' read *F CodeForBeginBody() . . . . . . . . . . code for-statement, begin of body *F CodeForEndBody(<nr>) . . . . . . . . . . code for-statement, end of body *F CodeForEnd() . . . . . . . . . . . code for-statement, end of statement ** ** 'CodeForBegin' is an action to code a for-statement. It is called when ** the reader encounters the 'for', i.e., *before* the variable is read. ** ** 'CodeForIn' is an action to code a for-statement. It is called when the ** reader encounters the 'in', i.e., *after* the variable is read, but ** *before* the list expression is read. ** ** 'CodeForBeginBody' is an action to code a for-statement. It is called ** when the reader encounters the beginning of the statement body, i.e., ** *after* the list expression is read. ** ** 'CodeForEndBody' is an action to code a for-statement. It is called when ** the reader encounters the end of the statement body. <nr> is the number ** of statements in the body. ** ** 'CodeForEnd' is an action to code a for-statement. It is called when the ** reader encounters the end of the statement, i.e., immediately after ** 'CodeForEndBody'.
*/ void CodeForBegin(CodeState * cs);
void CodeForIn(CodeState * cs);
void CodeForBeginBody(CodeState * cs);
void CodeForEndBody(CodeState * cs, UInt nr);
void CodeForEnd(CodeState * cs);
/**************************************************************************** ** *F CodeAtomicBegin() . . . . . . . code atomic-statement, begin of statement *F CodeAtomicBeginBody() . . . . . . . code atomic-statement, begin of body *F CodeAtomicEndBody(<nr>) . . . . . . . code atomic-statement, end of body *F CodeAtomicEnd() . . . . . . . . . code atomic-statement, end of statement ** ** 'CodeAtomicBegin' is an action to code an atomic-statement. It is called ** when the reader encounters the 'atomic', i.e., *before* the condition is ** read. ** ** 'CodeAtomicBeginBody' is an action to code an atomic-statement. It is ** called when the reader encounters the beginning of the statement body, ** i.e., *after* the condition is read. ** ** 'CodeAtomicEndBody' is an action to code an atomic-statement. It is called ** when the reader encounters the end of the statement body. <nr> is the ** number of statements in the body. ** ** 'CodeAtomicEnd' is an action to code an atomic-statement. It is called ** when the reader encounters the end of the statement, i.e., immediately ** after 'CodeAtomicEndBody'.
*/
/**************************************************************************** ** *F CodeQualifiedExprBegin(<qual>) . code readonly/readwrite expression start *F CodeQualifiedExprEnd() . . . . . . code readonly/readwrite expression end ** ** These functions code the beginning and end of the readonly/readwrite ** qualified expressions of an atomic statement.
*/ void CodeQualifiedExprBegin(CodeState * cs, UInt qual);
void CodeQualifiedExprEnd(CodeState * cs);
/**************************************************************************** ** *F CodeWhileBegin() . . . . . . . code while-statement, begin of statement *F CodeWhileBeginBody() . . . . . . . . code while-statement, begin of body *F CodeWhileEndBody(<nr>) . . . . . . . . code while-statement, end of body *F CodeWhileEnd() . . . . . . . . . code while-statement, end of statement ** ** 'CodeWhileBegin' is an action to code a while-statement. It is called ** when the reader encounters the 'while', i.e., *before* the condition is ** read. ** ** 'CodeWhileBeginBody' is an action to code a while-statement. It is ** called when the reader encounters the beginning of the statement body, ** i.e., *after* the condition is read. ** ** 'CodeWhileEndBody' is an action to code a while-statement. It is called ** when the reader encounters the end of the statement body. <nr> is the ** number of statements in the body. ** ** 'CodeWhileEnd' is an action to code a while-statement. It is called when ** the reader encounters the end of the statement, i.e., immediate after ** 'CodeWhileEndBody'.
*/ void CodeWhileBegin(CodeState * cs);
void CodeWhileBeginBody(CodeState * cs);
void CodeWhileEndBody(CodeState * cs, UInt nr);
void CodeWhileEnd(CodeState * cs);
/**************************************************************************** ** *F CodeRepeatBegin() . . . . . . . code repeat-statement, begin of statement *F CodeRepeatBeginBody() . . . . . . . code repeat-statement, begin of body *F CodeRepeatEndBody(<nr>) . . . . . . . code repeat-statement, end of body *F CodeRepeatEnd() . . . . . . . . . code repeat-statement, end of statement ** ** 'CodeRepeatBegin' is an action to code a repeat-statement. It is called ** when the reader encounters the 'repeat'. ** ** 'CodeRepeatBeginBody' is an action to code a repeat-statement. It is ** called when the reader encounters the beginning of the statement body, ** i.e., immediately after 'CodeRepeatBegin'. ** ** 'CodeRepeatEndBody' is an action to code a repeat-statement. It is ** called when the reader encounters the end of the statement body, i.e., ** *before* the condition is read. <nr> is the number of statements in the ** body. ** ** 'CodeRepeatEnd' is an action to code a repeat-statement. It is called ** when the reader encounters the end of the statement, i.e., *after* the ** condition is read.
*/ void CodeRepeatBegin(CodeState * cs);
void CodeRepeatBeginBody(CodeState * cs);
void CodeRepeatEndBody(CodeState * cs, UInt nr);
void CodeRepeatEnd(CodeState * cs);
/**************************************************************************** ** *F CodeBreak() . . . . . . . . . . . . . . . . . . . . code break-statement ** ** 'CodeBreak' is the action to code a break-statement. It is called when ** the reader encounters a 'break;'.
*/ void CodeBreak(CodeState * cs);
/**************************************************************************** ** *F CodeContinue() . . . . . . . . . . . . . . . . . code continue-statement ** ** 'CodeContinue' is the action to code a continue-statement. It is called ** when the reader encounters a 'continue;'.
*/ void CodeContinue(CodeState * cs);
/**************************************************************************** ** *F CodeReturnObj() . . . . . . . . . . . . . . . code return-value-statement ** ** 'CodeReturnObj' is the action to code a return-value-statement. It is ** called when the reader encounters a 'return <expr>;', but *after* reading ** the expression <expr>.
*/ void CodeReturnObj(CodeState * cs);
/**************************************************************************** ** *F CodeReturnVoid() . . . . . . . . . . . . . . code return-void-statement ** ** 'CodeReturnVoid' is the action to code a return-void-statement. It is ** called when the reader encounters a 'return;'. ** ** 'CodeReturnVoidWhichIsNotProfiled' creates a return which will not ** be tracked by profiling. This is used for the implicit return put ** at the end of functions.
*/ void CodeReturnVoid(CodeState * cs); void CodeReturnVoidWhichIsNotProfiled(CodeState * cs);
/**************************************************************************** ** *F CodeIntExpr(<val>) . . . . . . . . . . . code literal integer expression ** ** 'CodeIntExpr' is the action to code a literal integer expression. <val> ** is the integer as a GAP object.
*/ void CodeIntExpr(CodeState * cs, Obj val);
/**************************************************************************** ** *F CodeTildeExpr() . . . . . . . . . . . . . . code tilde expression ** ** 'CodeTildeExpr' is the action to code a tilde expression.
*/ void CodeTildeExpr(CodeState * cs);
/**************************************************************************** ** *F CodeTrueExpr() . . . . . . . . . . . . . . code literal true expression ** ** 'CodeTrueExpr' is the action to code a literal true expression.
*/ void CodeTrueExpr(CodeState * cs);
/**************************************************************************** ** *F CodeFalseExpr() . . . . . . . . . . . . . . code literal false expression ** ** 'CodeFalseExpr' is the action to code a literal false expression.
*/ void CodeFalseExpr(CodeState * cs);
/**************************************************************************** ** *F CodeCharExpr(<chr>) . . . . . . . . . . code literal character expression ** ** 'CodeCharExpr' is the action to code a literal character expression. ** <chr> is the C character.
*/ void CodeCharExpr(CodeState * cs, Char chr);
/**************************************************************************** ** *F CodePermCycle(<nrx>,<nrc>) . . . . . code literal permutation expression *F CodePerm(<nrc>) . . . . . . . . . . . code literal permutation expression ** ** 'CodePermCycle' is an action to code a literal permutation expression. ** It is called when one cycles is read completely. <nrc> is the number of ** elements in that cycle. <nrx> is the number of that cycles (i.e., 1 for ** the first cycle, 2 for the second, and so on). ** ** 'CodePerm' is an action to code a literal permutation expression. It is ** called when the permutation is read completely. <nrc> is the number of ** cycles.
*/ void CodePermCycle(CodeState * cs, UInt nrx, UInt nrc);
void CodePerm(CodeState * cs, UInt nrc);
/**************************************************************************** ** *F CodeListExprBegin(<top>) . . . . . . . . . . code list expression, begin *F CodeListExprBeginElm(<pos>) . . . . . code list expression, begin element *F CodeListExprEndElm() . . . . . . . . . code list expression, end element *F CodeListExprEnd(<nr>,<range>,<top>,<tilde>) . . code list expression, end
*/ void CodeListExprBegin(CodeState * cs, UInt top);
/**************************************************************************** ** *F CodeAssLVar(<lvar>) . . . . . . . . . . . . . . code assignment to local ** ** 'CodeAssLVar' is the action to code an assignment to the local variable ** <lvar> (given by its index). It is called by the reader *after* the ** right hand side expression is read. ** ** An assignment to a local variable is represented by a bag with two ** subexpressions. The *first* is the local variable, the *second* is the ** right hand side expression.
*/ void CodeAssLVar(CodeState * cs, UInt lvar);
void CodeUnbLVar(CodeState * cs, UInt lvar);
/**************************************************************************** ** *F CodeRefLVar(<lvar>) . . . . . . . . . . . . . . . code reference to local ** ** 'CodeRefLVar' is the action to code a reference to the local variable ** <lvar> (given by its index). It is called by the reader when it ** encounters a local variable. ** ** A reference to a local variable is represented immediately (see ** 'REF_LVAR_LVAR').
*/ void CodeRefLVar(CodeState * cs, UInt lvar);
void CodeIsbLVar(CodeState * cs, UInt lvar);
/**************************************************************************** ** *F CodeAssHVar(<hvar>) . . . . . . . . . . . . . . code assignment to higher ** ** 'CodeAssHVar' is the action to code an assignment to the higher variable ** <hvar> (given by its level and index). It is called by the reader ** *after* the right hand side expression is read. ** ** An assignment to a higher variable is represented by a statement bag with ** two subexpressions. The *first* is the higher variable, the *second* is ** the right hand side expression.
*/ void CodeAssHVar(CodeState * cs, UInt hvar);
void CodeUnbHVar(CodeState * cs, UInt hvar);
/**************************************************************************** ** *F CodeRefHVar(<hvar>) . . . . . . . . . . . . . . code reference to higher ** ** 'CodeRefHVar' is the action to code a reference to the higher variable ** <hvar> (given by its level and index). It is called by the reader when ** it encounters a higher variable. ** ** A reference to a higher variable is represented by an expression bag with ** one subexpression. This is the higher variable.
*/ void CodeRefHVar(CodeState * cs, UInt hvar);
void CodeIsbHVar(CodeState * cs, UInt hvar);
/**************************************************************************** ** *F CodeAssGVar(<gvar>) . . . . . . . . . . . . . . code assignment to global ** ** 'CodeAssGVar' is the action to code an assignment to the global variable ** <gvar>. It is called by the reader *after* the right hand side ** expression is read. ** ** An assignment to a global variable is represented by a statement bag with ** two subexpressions. The *first* is the global variable, the *second* is ** the right hand side expression.
*/ void CodeAssGVar(CodeState * cs, UInt gvar);
void CodeUnbGVar(CodeState * cs, UInt gvar);
/**************************************************************************** ** *F CodeRefGVar(<gvar>) . . . . . . . . . . . . . . code reference to global ** ** 'CodeRefGVar' is the action to code a reference to the global variable ** <gvar>. It is called by the reader when it encounters a global variable. ** ** A reference to a global variable is represented by an expression bag with ** one subexpression. This is the global variable.
*/ void CodeRefGVar(CodeState * cs, UInt gvar);
void CodeIsbGVar(CodeState * cs, UInt gvar);
/**************************************************************************** ** *F CodeAssList() . . . . . . . . . . . . . . . . . code assignment to a list *F CodeAsssList() . . . . . . . . . . . code multiple assignment to a list *F CodeAssListLevel(<level>) . . . . . . . code assignment to several lists *F CodeAsssListLevel(<level>) . . code multiple assignment to several lists
*/ void CodeAssList(CodeState * cs, Int narg);
void CodeAsssList(CodeState * cs);
void CodeAssListLevel(CodeState * cs, Int narg, UInt level);
/**************************************************************************** ** *F CodeInfoBegin() . . . . . . . . . . . . . start coding of Info statement *F CodeInfoMiddle() . . . . . . . . . shift to coding printable arguments *F CodeInfoEnd( <narg> ) . . Info statement complete, <narg> things to print ** ** These actions deal with the Info statement, which is coded specially, ** because not all of its arguments are always evaluated.
*/ void CodeInfoBegin(CodeState * cs);
void CodeInfoMiddle(CodeState * cs);
void CodeInfoEnd(CodeState * cs, UInt narg);
/**************************************************************************** ** *F CodeAssertBegin() . . . . . . . start interpretation of Assert statement *F CodeAsseerAfterLevel() . . called after the first argument has been read *F CodeAssertAfterCondition() called after the second argument has been read *F CodeAssertEnd2Args() . . . . called after reading the closing parenthesis *F CodeAssertEnd3Args() . . . . called after reading the closing parenthesis
*/ void CodeAssertBegin(CodeState * cs);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.