/usr/include/gap/vars.h is in gap-dev 4r6p5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | /****************************************************************************
**
*W vars.h GAP source Martin Schönert
**
**
*Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany
*Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
*Y Copyright (C) 2002 The GAP Group
**
** This file declares the functions of variables package.
**
** The variables package is the part of the interpreter that executes
** assignments to variables and evaluates references to variables.
**
** There are five kinds of variables, local variables (i.e., arguments and
** locals), higher variables (i.e., local variables of enclosing functions),
** global variables, list elements, and record elements.
*/
#ifndef GAP_VARS_H
#define GAP_VARS_H
/****************************************************************************
**
*S T_LVARS . . . . . . . . . . . . . . . . symbolic name for lvars bag type
**
** 'T_LVARS' is the type of bags used to store values of local variables.
#define T_LVARS 174
*/
/****************************************************************************
**
*V CurrLVars . . . . . . . . . . . . . . . . . . . . . local variables bag
**
** 'CurrLVars' is the bag containing the values of the local variables of
** the currently executing interpreted function.
**
** Assignments to the local variables change this bag. We do not call
** 'CHANGED_BAG' for each of such change. Instead we wait until a garbage
** collection begins and then call 'CHANGED_BAG' in 'BeginCollectBags'.
*/
extern Bag CurrLVars;
/****************************************************************************
**
*V BottomLVars . . . . . . . . . . . . . . . . . bottom local variables bag
**
** 'BottomLVars' is the local variables bag at the bottom of the call stack.
** Without such a dummy frame at the bottom, 'SWITCH_TO_NEW_LVARS' would
** have to check for the bottom, slowing it down.
**
*/
extern Bag BottomLVars;
/****************************************************************************
**
*V PtrLVars . . . . . . . . . . . . . . . . pointer to local variables bag
**
** 'PtrLVars' is a pointer to the 'CurrLVars' bag. This makes it faster to
** access local variables.
**
** Since a garbage collection may move this bag around, the pointer
** 'PtrLVars' must be recalculated afterwards in 'VarsAfterCollectBags'.
*/
extern Obj * PtrLVars;
/****************************************************************************
**
*F CURR_FUNC . . . . . . . . . . . . . . . . . . . . . . . current function
**
** 'CURR_FUNC' is the function that is currently executing.
**
** This is in this package, because it is stored along with the local
** variables in the local variables bag.
*/
#define CURR_FUNC (PtrLVars[0])
/****************************************************************************
**
*F BRK_CALL_TO() . . . . . . . . . expr. which was called from current frame
*F SET_BRK_CALL_TO(expr) . . . set expr. which was called from current frame
*/
#ifdef TRACEFRAMES
extern Obj STEVES_TRACING;
extern Obj True;
#include <stdio.h>
static inline void SetBrkCallTo( Expr expr, char * file, int line ) {
if (STEVES_TRACING == True) {
fprintf(stderr,"SBCT: %i %x %s %i\n",
(int)expr, (int)CurrLVars, file, line);
}
(PtrLVars[1] = (Obj)(Int)(expr));
}
#else
#define SetBrkCallTo(expr, file, line) (PtrLVars[1] = (Obj)(Int)(expr))
#endif
#ifndef NO_BRK_CALLS
#define BRK_CALL_TO() ((Expr)(Int)(PtrLVars[1]))
#define SET_BRK_CALL_TO(expr) SetBrkCallTo(expr, __FILE__, __LINE__)
#endif
#ifdef NO_BRK_CALLS
#define BRK_CALL_TO() /* do nothing */
#define SET_BRK_CALL_TO(expr) /* do nothing */
#endif
/****************************************************************************
**
*F BRK_CALL_FROM() . . . . . . . . . frame from which this frame was called
*F SET_BRK_CALL_FROM(lvars) . . set frame from which this frame was called
*/
#ifndef NO_BRK_CALLS
#define BRK_CALL_FROM() (PtrLVars[2])
#define SET_BRK_CALL_FROM(lvars) (PtrLVars[2] = (lvars))
#endif
#ifdef NO_BRK_CALLS
#define BRK_CALL_FROM() /* do nothing */
#define SET_BRK_CALL_FROM(lvars) /* do nothing */
#endif
/****************************************************************************
**
*F SWITCH_TO_NEW_LVARS( <func>, <narg>, <nloc>, <old> ) . . . . . new local
**
** 'SWITCH_TO_NEW_LVARS' creates and switches to a new local variabes bag,
** for the function <func>, with <narg> arguments and <nloc> local
** variables. The old local variables bag is saved in <old>.
*/
extern Obj STEVES_TRACING;
extern Obj True;
#include <stdio.h>
static inline Obj SwitchToNewLvars(Obj func, UInt narg, UInt nloc
#ifdef TRACEFRAMES
, char * file, int line
#endif
)
{
Obj old = CurrLVars;
CHANGED_BAG( old );
CurrLVars = NewBag( T_LVARS,
sizeof(Obj)*(3+narg+nloc) );
PtrLVars = PTR_BAG( CurrLVars );
CURR_FUNC = func;
PtrBody = (Stat*)PTR_BAG(BODY_FUNC(CURR_FUNC));
SET_BRK_CALL_FROM( old );
#ifdef TRACEFRAMES
if (STEVES_TRACING == True) {
Obj n = NAME_FUNC(func);
Char *s = ((UInt)n) ? (Char *)CHARS_STRING(n) : (Char *)"nameless";
fprintf(stderr,"STNL: %s %i\n func %lx narg %i nloc %i function name %s\n old lvars %lx new lvars %lx\n",
file, line, (UInt) func, (int)narg, (int)nloc,s,(UInt)old, (UInt)CurrLVars);
}
#endif
return old;
}
#ifdef TRACEFRAMES
#define SWITCH_TO_NEW_LVARS(func, narg, nloc, old) (old) = SwitchToNewLvars((func), (narg), (nloc), __FILE__, __LINE__)
#else
#define SWITCH_TO_NEW_LVARS(func, narg, nloc, old) (old) = SwitchToNewLvars((func), (narg), (nloc))
#endif
/****************************************************************************
**
*F SWITCH_TO_OLD_LVARS( <old> ) . . . switch to an old local variables bag
**
** 'SWITCH_TO_OLD_LVARS' switches back to the old local variables bag <old>.
*/
static inline void SwitchToOldLVars( Obj old
#ifdef TRACEFRAMES
, char *file, int line
#endif
)
{
#ifdef TRACEFRAMES
if (STEVES_TRACING == True) {
fprintf(stderr,"STOL: %s %i old lvars %lx new lvars %lx\n",
file, line, (UInt)CurrLVars,(UInt)old);
}
#endif
CHANGED_BAG( CurrLVars );
CurrLVars = (old);
PtrLVars = PTR_BAG( CurrLVars );
PtrBody = (Stat*)PTR_BAG(BODY_FUNC(CURR_FUNC));
}
#ifdef TRACEFRAMES
#define SWITCH_TO_OLD_LVARS(old) SwitchToOldLVars((old), __FILE__,__LINE__)
#else
#define SWITCH_TO_OLD_LVARS(old) SwitchToOldLVars((old))
#endif
/****************************************************************************
**
*F ASS_LVAR( <lvar>, <val> ) . . . . . . . . . . . assign to local variable
**
** 'ASS_LVAR' assigns the value <val> to the local variable <lvar>.
*/
#define ASS_LVAR(lvar,val) (PtrLVars[(lvar)+2] = (val))
/****************************************************************************
**
*F OBJ_LVAR( <lvar> ) . . . . . . . . . . . . . . . value of local variable
**
** 'OBJ_LVAR' returns the value of the local variable <lvar>.
*/
#define OBJ_LVAR(lvar) (PtrLVars[(lvar)+2])
/****************************************************************************
**
*F NAME_LVAR( <lvar> ) . . . . . . . . . . . . . . . name of local variable
**
** 'NAME_LVAR' returns the name of the local variable <lvar> as a C string.
*/
#define NAME_LVAR(lvar) NAMI_FUNC( CURR_FUNC, lvar )
/****************************************************************************
**
*F ObjLVar(<lvar>) . . . . . . . . . . . . . . . . value of a local variable
**
** 'ObjLVar' returns the value of the local variable <lvar>.
*/
extern Obj ObjLVar (
UInt lvar );
/****************************************************************************
**
*F ASS_HVAR(<hvar>,<val>) . . . . . . . . . . . assign to a higher variable
*F OBJ_HVAR(<hvar>) . . . . . . . . . . . . . . value of a higher variable
*F NAME_HVAR(<hvar>) . . . . . . . . . . . . . . . name of a higher variable
**
** 'ASS_HVAR' assigns the value <val> to the higher variable <hvar>.
**
** 'OBJ_HVAR' returns the value of the higher variable <hvar>.
**
** 'NAME_HVAR' returns the name of the higher variable <hvar> as a C string.
*/
extern void ASS_HVAR (
UInt hvar,
Obj val );
extern Obj OBJ_HVAR (
UInt hvar );
extern Char * NAME_HVAR (
UInt hvar );
/****************************************************************************
**
*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *
*/
/****************************************************************************
**
*F InitInfoVars() . . . . . . . . . . . . . . . . . table of init functions
*/
StructInitInfo * InitInfoVars ( void );
#endif // GAP_VARS_H
/****************************************************************************
**
*E vars.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
*/
|