Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346/****************************************************************************1**2*W exprs.h GAP source Martin Schönert3**4**5*Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany6*Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland7*Y Copyright (C) 2002 The GAP Group8**9** This file declares the functions of the expressions package.10**11** The expressions package is the part of the interpreter that evaluates12** expressions to their values and prints expressions.13*/1415#ifndef GAP_EXPRS_H16#define GAP_EXPRS_H171819/****************************************************************************20**21*F OBJ_REFLVAR(<expr>) . . . . . . . . . . . value of a reference to a local22**23** 'OBJ_REFLVAR' returns the value of the reference to a local variable24** <expr>.25*/26#ifdef NO_LVAR_CHECKS27#define OBJ_REFLVAR(expr) \28OBJ_LVAR( LVAR_REFLVAR( (expr) ) )29#endif30#ifndef NO_LVAR_CHECKS3132#ifdef SYS_IS_64_BIT33#define OFFSET_REFLVAR(expr) (((expr)*2)+10)34#else35#define OFFSET_REFLVAR(expr) ((expr) + 5)36#endif3738#define OBJ_REFLVAR(expr) \39(*(Obj*)(((char*)TLS(PtrLVars))+OFFSET_REFLVAR(expr)) != 0 ? \40*(Obj*)(((char*)TLS(PtrLVars))+OFFSET_REFLVAR(expr)) : \41ObjLVar( LVAR_REFLVAR( expr ) ) )42#endif434445/****************************************************************************46**47*F OBJ_INTEXPR(<expr>) . . . . . . . . . . . value of an integer expression48**49** 'OBJ_INTEXPR' returns the (immediate) integer value of the (immediate)50** integer expression <expr>.51**52** 'OBJ_INTEXPR(<expr>)' should be 'OBJ_INT(INT_INTEXPR(<expr>))', but for53** performance reasons we implement it as '(Obj)(<expr>)'. This is of54** course highly dependent on (immediate) integer expressions and55** (immediate) integer values having the same representation.56*/5758#ifndef SYS_IS_64_BIT59#define OBJ_INTEXPR(expr) \60((Obj)(Int)(Int4)(expr))61#else62#define OBJ_INTEXPR(expr) \63(INTOBJ_INT(INT_INTEXPR((expr))))64#endif6566/****************************************************************************67**68*F EVAL_EXPR(<expr>) . . . . . . . . . . . . . . . . evaluate an expression69**70** 'EVAL_EXPR' evaluates the expression <expr>.71**72** 'EVAL_EXPR' returns the value of <expr>.73**74** 'EVAL_EXPR' causes the evaluation of <expr> by dispatching to the75** evaluator, i.e., to the function that evaluates expressions of the type76** of <expr>.77**78** Note that 'EVAL_EXPR' does not use 'TNUM_EXPR', since it also handles the79** two special cases that 'TNUM_EXPR' handles.80*/81#define EVAL_EXPR(expr) \82(IS_REFLVAR(expr) ? OBJ_REFLVAR(expr) : \83(IS_INTEXPR(expr) ? OBJ_INTEXPR(expr) : \84(*EvalExprFuncs[ TNUM_STAT(expr) ])( expr ) ))858687/****************************************************************************88**89*V EvalExprFuncs[<type>] . . . . . evaluator for expressions of type <type>90**91** 'EvalExprFuncs' is the dispatch table that contains for every type of92** expressions a pointer to the evaluator for expressions of this type,93** i.e., the function that should be called to evaluate expressions of this94** type.95*/96extern Obj (* EvalExprFuncs [256]) ( Expr expr );979899/****************************************************************************100**101*F EVAL_BOOL_EXPR(<expr>) . . . . evaluate an expression to a boolean value102**103** 'EVAL_BOOL_EXPR' evaluates the expression <expr> and checks that the104** value is either 'true' or 'false'. If the expression does not evaluate105** to 'true' or 'false', then an error is signalled.106**107** 'EVAL_BOOL_EXPR' returns the value of <expr> (which is either 'true' or108** 'false').109*/110#define EVAL_BOOL_EXPR(expr) \111( (*EvalBoolFuncs[ TNUM_EXPR( expr ) ])( expr ) )112113114/****************************************************************************115**116*V EvalBoolFuncs[<type>] . . boolean evaluator for expression of type <type>117**118** 'EvalBoolFuncs' is the dispatch table that contains for every type of119** expression a pointer to a boolean evaluator for expressions of this type,120** i.e., a pointer to a function which is guaranteed to return a boolean121** value that should be called to evaluate expressions of this type.122*/123extern Obj (* EvalBoolFuncs [256]) ( Expr expr );124125126/****************************************************************************127**128*F PrintExpr(<expr>) . . . . . . . . . . . . . . . . . . print an expression129**130** 'PrintExpr' prints the expression <expr>.131*/132extern void PrintExpr (133Expr expr );134135136extern void PrintRecExpr1 ( Expr expr ); /* needed for printing137function calls with options */138139/****************************************************************************140**141*V PrintExprFuncs[<type>] . . printing function for objects of type <type>142**143** 'PrintExprFuncs' is the dispatching table that contains for every type of144** expressions a pointer to the printer for expressions of this type, i.e.,145** the function that should be called to print expressions of this type.146*/147extern void (* PrintExprFuncs [256] ) ( Expr expr );148149150/****************************************************************************151**152153*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *154*/155156157/****************************************************************************158**159160*F InitInfoExprs() . . . . . . . . . . . . . . . . . table of init functions161*/162StructInitInfo * InitInfoExprs ( void );163164165#endif // GAP_EXPRS_H166167/****************************************************************************168**169170*E exprs.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here171*/172173174