/usr/include/gap/gvars.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 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | /****************************************************************************
**
*W gvars.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 the global variables package.
**
** The global variables package is the part of the kernel that manages
** global variables, i.e., the global namespace. A global variable binds an
** identifier to a value.
**
** A global variable can be automatic. That means that the global variable
** binds the identifier to a function and an argument. When the value of
** the global variable is needed, the function is called with the argument.
** This function call should, as a side-effect, execute an assignment of a
** value to the global variable, otherwise an error is signalled.
**
** A global variable can have a number of internal copies, i.e., C variables
** that always reference the same value as the global variable. In fact the
** internal copies are only used for functions, i.e., the internal copies
** only reference the same value as the global variable if it is a function.
** Otherwise the internal copies reference functions that signal an error.
*/
#ifndef GAP_GVARS_H
#define GAP_GVARS_H
/****************************************************************************
**
*V ValGVars . . . . . . . . . . . . . . . . . . values of global variables
*V PtrGVars . . . . . . . . . . . . . pointer to values of global variables
**
** 'ValGVars' is the bag containing the values of the global variables.
**
** 'PtrGVars' is a pointer to the 'ValGVars' bag. This makes it faster to
** access global variables.
*/
extern Obj ValGVars;
extern Obj * PtrGVars;
/****************************************************************************
**
*F VAL_GVAR(<gvar>) . . . . . . . . . . . . . . . value of global variable
**
** 'VAL_GVAR' returns the value of the global variable <gvar>. If <gvar>
** has no assigned value, 'VAL_GVAR' returns 0. In this case <gvar> might
** be an automatic global variable, and one should call 'ValAutoGVar', which
** will return the value of <gvar> after evaluating <gvar>-s expression, or
** 0 if <gvar> was not an automatic variable.
*/
#define VAL_GVAR(gvar) PtrGVars[ (gvar) ]
/****************************************************************************
**
*V WriteGVars . . . . . . . . . . . . . writable flags of global variables
*/
extern Obj WriteGVars;
/****************************************************************************
**
*V ErrorMustEvalToFuncFunc . . . . . . . . . function that signals an error
**
** 'ErrorMustEvalToFuncFunc' is a (variable number of args) function that
** signals the error ``Function: <func> be a function''.
*/
extern Obj ErrorMustEvalToFuncFunc;
/****************************************************************************
**
*V ErrorMustHaveAssObjFunc . . . . . . . . . function that signals an error
**
** 'ErrorMustHaveAssObjFunc' is a (variable number of args) function that
** signals the error ``Variable: <<unknown>> must have an assigned value''.
*/
extern Obj ErrorMustHaveAssObjFunc;
/****************************************************************************
**
*F AssGVar(<gvar>,<val>) . . . . . . . . . . . . assign to a global variable
**
** 'AssGVar' assigns the value <val> to the global variable <gvar>.
*/
extern void AssGVar (
UInt gvar,
Obj val );
/****************************************************************************
**
*F ValAutoGVar(<gvar>) . . . . . . . . value of a automatic global variable
**
** 'ValAutoGVar' returns the value of the global variable <gvar>. This will
** be 0 if <gvar> has no assigned value. It will also cause a function
** call, if <gvar> is automatic.
*/
extern Obj ValAutoGVar (
UInt gvar );
/****************************************************************************
**
*F NameGVar(<gvar>) . . . . . . . . . . . . . . . name of a global variable
**
** 'NameGVar' returns the name of the global variable <gvar> as a C string.
*/
extern Char * NameGVar (
UInt gvar );
/****************************************************************************
**
*F GVarName(<name>) . . . . . . . . . . . . . . global variable for a name
**
** 'GVarName' returns the global variable with the name <name>.
*/
extern UInt GVarName (
const Char * name );
/****************************************************************************
**
*V Tilde . . . . . . . . . . . . . . . . . . . . . . . . global variable '~'
**
** 'Tilde' is the identifier for the global variable '~', the one used in
** expressions such as '[ [ 1, 2 ], ~[1] ]'.
**
** Actually when such expressions appear in functions, one should probably
** use a local variable. But for now this is good enough.
*/
extern UInt Tilde;
/****************************************************************************
**
*F iscomplete_gvar( <name>, <len> ) . . . . . . . . . . . . . check <name>
*/
extern UInt iscomplete_gvar (
Char * name,
UInt len );
/****************************************************************************
**
*F completion_gvar( <name>, <len> ) . . . . . . . . . . . . find completion
*/
extern UInt completion_gvar (
Char * name,
UInt len );
/****************************************************************************
**
*F MakeReadOnlyGVar( <gvar> ) . . . . . . make a global variable read only
*F MakeReadWriteGVar( <gvar> ) . . . . . . make a global variable read-write
*/
extern void MakeReadOnlyGVar (
UInt gvar );
extern void MakeReadWriteGVar (
UInt gvar );
extern Int IsReadOnlyGVar (
UInt gvar );
/****************************************************************************
**
*F * * * * * * * * * * * * * copies and fopies * * * * * * * * * * * * * * *
*/
/****************************************************************************
**
*F InitCopyGVar( <name>, <copy> ) . . declare C variable as copy of global
**
** 'InitCopyGVar' makes the C variable <cvar> at address <copy> a copy of
** the global variable named <name> (which must be a kernel string).
**
** The function only registers the information in <CopyAndFopyGVars>. At a
** latter stage one has to call 'UpdateCopyFopyInfo' to actually enter the
** information stored in <CopyAndFopyGVars> into a plain list.
**
** This is OK for garbage collection, but a real problem for saving in any
** event, this information does not really want to be saved because it is
** kernel centred rather than workspace centred.
**
** Accordingly we provide two functions `RemoveCopyFopyInfo' and
** `RestoreCopyFopyInfo' to remove or restore the information from the
** workspace. The Restore function is also intended to be used after
** loading a saved workspace
*/
extern void InitCopyGVar (
const Char * name ,
Obj * copy );
/****************************************************************************
**
*F InitFopyGVar( <name>, <copy> ) . . declare C variable as copy of global
**
** 'InitFopyGVar' makes the C variable <cvar> at address <copy> a (function)
** copy of the global variable <gvar>, whose name is <name>. That means
** that whenever the value of <gvar> is a function, then <cvar> will
** reference the same value (i.e., will hold the same bag identifier). When
** the value of <gvar> is not a function, then <cvar> will reference a
** function that signals the error ``<func> must be a function''. When
** <gvar> has no assigned value, then <cvar> will reference a function that
** signals the error ``<gvar> must have an assigned value''.
*/
extern void InitFopyGVar (
const Char * name,
Obj * copy );
/****************************************************************************
**
*F UpdateCopyFopyInfo() . . . . . . . . . . convert kernel info into plist
*/
extern void UpdateCopyFopyInfo ( void );
/****************************************************************************
**
*F RemoveCopyFopyInfo() . . . remove the info about copies of gvars from ws
*/
extern void RemoveCopyFopyInfo( void );
/****************************************************************************
**
*F RestoreCopyFopyInfo() . . . restore the info from the copy in the kernel
*/
extern void RestoreCopyFopyInfo( void );
/****************************************************************************
**
*F * * * * * * * * * * * * * create a new gvars * * * * * * * * * * * * * *
*/
/****************************************************************************
**
*F C_NEW_GVAR_FUNC( <name>, <nargs>, <nams>, <hdlr>, <cookie> )
*/
#define C_NEW_GVAR_FUNC( name, nargs, nams, hdlr, cookie ) \
do { \
InitHandlerFunc( hdlr, cookie ); \
if ( ! SyRestoring ) \
AssGVar( GVarName(name), NewFunctionC( name, nargs, nams, hdlr ) ); \
MakeReadOnlyGVar( GVarName(name) ); \
} while (0)
/****************************************************************************
**
*F C_NEW_GVAR_ATTR( <name>, <nams>, <attr>, <hdlr>, <cookie> )
**
** WARNING: <attr> must *always* be a global C variable never a local one.
*/
#define C_NEW_GVAR_ATTR( name, nams, attr, hdlr, cookie ) \
do { \
InitHandlerFunc( hdlr, cookie ); \
InitFopyGVar( name, &attr ); \
if ( ! SyRestoring ) \
AssGVar( GVarName(name), NewAttributeC( name, 1L, nams, hdlr ) ); \
MakeReadOnlyGVar( GVarName(name) ); \
} while (0)
/****************************************************************************
**
*F C_NEW_GVAR_PROP( <name>, <nams>, <prop>, <hdlr>, <cookie> )
**
** WARNING: <prop> must *always* be a global C variable never a local one.
*/
#define C_NEW_GVAR_PROP( name, nams, attr, hdlr, cookie ) \
do { \
InitHandlerFunc( hdlr, cookie ); \
InitFopyGVar( name, &attr ); \
if ( ! SyRestoring ) \
AssGVar( GVarName(name), NewPropertyC( name, 1L, nams, hdlr ) ); \
MakeReadOnlyGVar( GVarName(name) ); \
} while (0)
/****************************************************************************
**
*F C_NEW_GVAR_OPER( <name>, <nargs>, <nams>, <oper>, <hdlr>, <cookie> )
**
** WARNING: <oper> must *always* be a global C variable never a local one.
*/
#define C_NEW_GVAR_OPER( name, nargs, nams, oper, hdlr, cookie ) \
do { \
InitHandlerFunc( hdlr, cookie ); \
InitFopyGVar( name, &oper ); \
if ( ! SyRestoring ) \
AssGVar( GVarName(name), NewOperationC( name, nargs, nams, hdlr ) ); \
MakeReadOnlyGVar( GVarName(name) ); \
} while (0)
/****************************************************************************
**
*F C_NEW_GVAR_FILT( <name>, <nams>, <filt>, <hdlr>, <cookie> )
*/
#define C_NEW_GVAR_FILT( name, nams, filt, hdlr, cookie ) \
do { \
InitHandlerFunc( hdlr, cookie ); \
InitFopyGVar( name, &filt ); \
if ( ! SyRestoring ) \
AssGVar( GVarName(name), NewFilterC( name, 1L, nams, hdlr ) ); \
MakeReadOnlyGVar( GVarName(name) ); \
} while (0)
/****************************************************************************
**
*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *
*/
/****************************************************************************
**
*F InitInfoGVars() . . . . . . . . . . . . . . . . . table of init functions
*/
StructInitInfo * InitInfoGVars ( void );
#endif // GAP_GVARS_H
/****************************************************************************
**
*E gvars.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
*/
|