/usr/include/gap/compiled.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 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | /****************************************************************************
**
*W compiled.h GAP source Martin Schönert
**
** This package defines macros and functions that are used by compiled code.
** Those macros and functions should go into the appropriate packages.
*/
#ifndef GAP_COMPILED_H
#define GAP_COMPILED_H
#include "system.h" /* system dependent part */
#include "gasman.h" /* garbage collector */
#include "objects.h" /* objects */
#include "scanner.h" /* scanner */
#include "gap.h" /* error handling, initialisation */
#include "read.h" /* reader */
#include "gvars.h" /* global variables */
#include "calls.h" /* generic call mechanism */
#include "opers.h" /* generic operations */
#include "ariths.h" /* basic arithmetic */
#include "integer.h" /* integers */
#include "rational.h" /* rationals */
#include "cyclotom.h" /* cyclotomics */
#include "finfield.h" /* finite fields and ff elements */
#include "macfloat.h" /* machine floats */
#include "bool.h" /* booleans */
#include "permutat.h" /* permutations */
#include "records.h" /* generic records */
#include "precord.h" /* plain records */
#include "lists.h" /* generic lists */
#include "listoper.h" /* operations for generic lists */
#include "listfunc.h" /* functions for generic lists */
#include "plist.h" /* plain lists */
#include "set.h" /* plain sets */
#include "vector.h" /* functions for plain vectors */
#include "blister.h" /* boolean lists */
#include "range.h" /* ranges */
#include "string.h" /* strings */
#include "objfgelm.h" /* objects of free groups */
#include "objpcgel.h" /* objects of polycyclic groups */
#include "objscoll.h" /* single collector */
#include "objcftl.h" /* from the left collect */
#include "dt.h" /* deep thought */
#include "dteval.h" /* deep though evaluation */
#include "sctable.h" /* structure constant table */
#include "costab.h" /* coset table */
#include "tietze.h" /* tietze helper functions */
#include "code.h" /* coder */
#include "vars.h" /* variables */
#include "exprs.h" /* expressions */
#include "stats.h" /* statements */
#include "funcs.h" /* functions */
#include "intrprtr.h" /* interpreter */
#include "compiler.h" /* compiler */
#include "compstat.h" /* statically linked modules */
#include "saveload.h" /* saving and loading */
#include "streams.h" /* streams package */
#include "sysfiles.h" /* file input/output */
#include "weakptr.h" /* weak pointers */
extern Obj InfoDecision;
extern Obj InfoDoPrint;
extern Obj CurrentAssertionLevel;
extern Obj NewAndFilter (
Obj oper1,
Obj oper2 );
/* types, should go into 'gvars.c' and 'records.c' * * * * * * * * * * * * */
typedef UInt GVar;
typedef UInt RNam;
/* checks, should go into 'gap.c' * * * * * * * * * * * * * * * * * * * * */
#define CHECK_BOUND(obj,name) \
if ( obj == 0 ) ErrorQuitBound(name);
#define CHECK_FUNC_RESULT(obj) \
if ( obj == 0 ) ErrorQuitFuncResult();
#define CHECK_INT_SMALL(obj) \
if ( ! IS_INTOBJ(obj) ) ErrorQuitIntSmall(obj);
#define CHECK_INT_SMALL_POS(obj) \
if ( ! IS_INTOBJ(obj) || INT_INTOBJ(obj) <= 0 ) ErrorQuitIntSmallPos(obj);
#define CHECK_INT_POS(obj) \
if ( TNUM_OBJ(obj) != T_INTPOS && (! IS_INTOBJ(obj) || INT_INTOBJ(obj) <= 0) ) ErrorQuitIntPos(obj);
#define CHECK_BOOL(obj) \
if ( obj != True && obj != False ) ErrorQuitBool(obj);
#define CHECK_FUNC(obj) \
if ( TNUM_OBJ(obj) != T_FUNCTION ) ErrorQuitFunc(obj);
#define CHECK_NR_ARGS(narg,args) \
if ( narg != LEN_PLIST(args) ) ErrorQuitNrArgs(narg,args);
/* higher variables, should go into 'vars.c' * * * * * * * * * * * * * * * */
#define SWITCH_TO_NEW_FRAME SWITCH_TO_NEW_LVARS
#define SWITCH_TO_OLD_FRAME SWITCH_TO_OLD_LVARS
#define CURR_FRAME CurrLVars
#define CURR_FRAME_1UP ENVI_FUNC( PTR_BAG( CURR_FRAME )[0] )
#define CURR_FRAME_2UP ENVI_FUNC( PTR_BAG( CURR_FRAME_1UP )[0] )
#define CURR_FRAME_3UP ENVI_FUNC( PTR_BAG( CURR_FRAME_2UP )[0] )
#define CURR_FRAME_4UP ENVI_FUNC( PTR_BAG( CURR_FRAME_3UP )[0] )
#define CURR_FRAME_5UP ENVI_FUNC( PTR_BAG( CURR_FRAME_4UP )[0] )
#define CURR_FRAME_6UP ENVI_FUNC( PTR_BAG( CURR_FRAME_5UP )[0] )
#define CURR_FRAME_7UP ENVI_FUNC( PTR_BAG( CURR_FRAME_6UP )[0] )
/* #define OBJ_LVAR(lvar) PtrLVars[(lvar)+2] */
#define OBJ_LVAR_0UP(lvar) \
OBJ_LVAR(lvar)
#define OBJ_LVAR_1UP(lvar) \
PTR_BAG(CURR_FRAME_1UP)[(lvar)+2]
#define OBJ_LVAR_2UP(lvar) \
PTR_BAG(CURR_FRAME_2UP)[(lvar)+2]
#define OBJ_LVAR_3UP(lvar) \
PTR_BAG(CURR_FRAME_3UP)[(lvar)+2]
#define OBJ_LVAR_4UP(lvar) \
PTR_BAG(CURR_FRAME_4UP)[(lvar)+2]
#define OBJ_LVAR_5UP(lvar) \
PTR_BAG(CURR_FRAME_5UP)[(lvar)+2]
#define OBJ_LVAR_6UP(lvar) \
PTR_BAG(CURR_FRAME_6UP)[(lvar)+2]
#define OBJ_LVAR_7UP(lvar) \
PTR_BAG(CURR_FRAME_7UP)[(lvar)+2]
#define OBJ_LVAR_8UP(lvar) \
PTR_BAG(CURR_FRAME_8UP)[(lvar)+2]
/* #define ASS_LVAR(lvar,obj) do { PtrLVars[(lvar)+2] = (obj); } while ( 0 ) */
#define ASS_LVAR_0UP(lvar,obj) \
ASS_LVAR(lvar,obj)
#define ASS_LVAR_1UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_1UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_1UP); } while ( 0 )
#define ASS_LVAR_2UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_2UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_2UP); } while ( 0 )
#define ASS_LVAR_3UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_3UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_3UP); } while ( 0 )
#define ASS_LVAR_4UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_4UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_4UP); } while ( 0 )
#define ASS_LVAR_5UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_5UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_5UP); } while ( 0 )
#define ASS_LVAR_6UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_6UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_6UP); } while ( 0 )
#define ASS_LVAR_7UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_7UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_7UP); } while ( 0 )
#define ASS_LVAR_8UP(lvar,obj) \
do { PTR_BAG(CURR_FRAME_8UP)[(lvar)+2] = (obj); CHANGED_BAG(CURR_FRAME_8UP); } while ( 0 )
/* objects, should into 'objects.c' * * * * * * * * * * * * * * * * * * * */
/* there should be a function for C_ELM_POSOBJ */
#define C_ELM_POSOBJ( elm, list, pos ) NOT_READY_YET
#define C_ELM_POSOBJ_NLE( elm, list, pos ) \
if ( TNUM_OBJ(list) == T_POSOBJ ) { \
elm = ELM_PLIST( list, pos ); \
} \
else { \
elm = ELMW_LIST( list, pos ); \
}
#define C_ASS_POSOBJ_INTOBJ( list, pos, elm ) \
if ( TNUM_OBJ(list) == T_POSOBJ ) { \
if ( SIZE_OBJ(list)/sizeof(Obj)-1 < pos ) { \
ResizeBag( list, (pos+1)*sizeof(Obj) ); \
} \
SET_ELM_PLIST( list, pos, elm ); \
} \
else { \
ASS_LIST( list, pos, elm ); \
}
#define C_ASS_POSOBJ( list, pos, elm ) \
if ( TNUM_OBJ(list) == T_POSOBJ ) { \
if ( SIZE_OBJ(list)/sizeof(Obj)-1 < pos ) { \
ResizeBag( list, (pos+1)*sizeof(Obj) ); \
} \
SET_ELM_PLIST( list, pos, elm ); \
CHANGED_BAG(list); \
} \
else { \
ASS_LIST( list, pos, elm ); \
}
/* lists, should go into 'lists.c' * * * * * * * * * * * * * * * * * * * * */
#define C_LEN_LIST(len,list) \
len = LENGTH(list);
#define C_LEN_LIST_FPL(len,list) \
if ( IS_PLIST(list) ) { \
len = INTOBJ_INT( LEN_PLIST(list) ); \
} \
else { \
len = LENGTH(list); \
}
#define C_ELM_LIST(elm,list,p) \
elm = IS_INTOBJ(p) ? ELM_LIST( list, INT_INTOBJ(p) ) : ELMB_LIST(list, p);
#define C_ELM_LIST_NLE(elm,list,p) \
elm = IS_INTOBJ(p) ? ELMW_LIST( list, INT_INTOBJ(p) ) : ELMB_LIST(list, p);
#define C_ELM_LIST_FPL(elm,list,p) \
if ( IS_INTOBJ(p) && IS_PLIST(list) ) { \
if ( INT_INTOBJ(p) <= LEN_PLIST(list) ) { \
elm = ELM_PLIST( list, INT_INTOBJ(p) ); \
if ( elm == 0 ) elm = ELM_LIST( list, INT_INTOBJ(p) ); \
} else elm = ELM_LIST( list, INT_INTOBJ(p) ); \
} else C_ELM_LIST( elm, list, p )
#define C_ELM_LIST_NLE_FPL(elm,list,p) \
if ( IS_INTOBJ(p) && IS_PLIST(list) ) { \
elm = ELM_PLIST( list, INT_INTOBJ(p) ); \
} else C_ELM_LIST_NLE(elm, list, p)
#define C_ASS_LIST(list,p,rhs) \
if (IS_INTOBJ(p)) ASS_LIST( list, INT_INTOBJ(p), rhs ); \
else ASSB_LIST(list, p, rhs);
#define C_ASS_LIST_FPL(list,p,rhs) \
if ( IS_INTOBJ(p) && TNUM_OBJ(list) == T_PLIST ) { \
if ( LEN_PLIST(list) < INT_INTOBJ(p) ) { \
GROW_PLIST( list, (UInt)INT_INTOBJ(p) ); \
SET_LEN_PLIST( list, INT_INTOBJ(p) ); \
} \
SET_ELM_PLIST( list, INT_INTOBJ(p), rhs ); \
CHANGED_BAG( list ); \
} \
else { \
C_ASS_LIST( list, p, rhs ) \
}
#define C_ASS_LIST_FPL_INTOBJ(list,p,rhs) \
if ( IS_INTOBJ(p) && TNUM_OBJ(list) == T_PLIST) { \
if ( LEN_PLIST(list) < INT_INTOBJ(p) ) { \
GROW_PLIST( list, (UInt)INT_INTOBJ(p) ); \
SET_LEN_PLIST( list, INT_INTOBJ(p) ); \
} \
SET_ELM_PLIST( list, INT_INTOBJ(p), rhs ); \
} \
else { \
C_ASS_LIST( list, p, rhs ) \
}
#define C_ISB_LIST( list, pos) \
((IS_INTOBJ(pos) ? ISB_LIST(list, INT_INTOBJ(pos)) : ISBB_LIST( list, pos)) ? True : False)
#define C_UNB_LIST( list, pos) \
if (IS_INTOBJ(pos)) UNB_LIST(list, INT_INTOBJ(pos)); else UNBB_LIST(list, pos);
extern void AddList (
Obj list,
Obj obj );
extern void AddPlist (
Obj list,
Obj obj );
#define C_ADD_LIST(list,obj) \
AddList( list, obj );
#define C_ADD_LIST_FPL(list,obj) \
if ( TNUM_OBJ(list) == T_PLIST) { \
AddPlist( list, obj ); \
} \
else { \
AddList( list, obj ); \
}
#define GF_ITERATOR ITERATOR
#define GF_IS_DONE_ITER IS_DONE_ITER
#define GF_NEXT_ITER NEXT_ITER
extern Obj GF_ITERATOR;
extern Obj GF_IS_DONE_ITER;
extern Obj GF_NEXT_ITER;
/* More or less all of this will get inlined away */
/* Allocate a bag suitable for a size-byte integer of type type.
The allocation may need to be bigger than size bytes
due to limb size or other aspects of the representation */
static inline Obj C_MAKE_INTEGER_BAG( UInt size, UInt type) {
/* Round size up to nearest multiple of INTEGER_ALLOCATION_SIZE */
return NewBag(type,INTEGER_ALLOCATION_SIZE*
((size + INTEGER_ALLOCATION_SIZE-1)/INTEGER_ALLOCATION_SIZE));
}
/* Set 2 bytes of data in an integer */
static inline void C_SET_LIMB2(Obj bag, UInt limbnumber, UInt2 value) {
#if INTEGER_UNIT_SIZE == 2
((UInt2 *)ADDR_OBJ(bag))[limbnumber] = value;
#else
#if INTEGER_UNIT_SIZE == 4
UInt4 *p;
if (limbnumber % 2) {
p = ((UInt4 *)ADDR_OBJ(bag)) + (limbnumber-1) / 2;
*p = (*p & 0xFFFFUL) | ((UInt4)value << 16);
} else {
p = ((UInt4 *)ADDR_OBJ(bag)) + limbnumber / 2;
*p = (*p & 0xFFFF0000UL) | (UInt4)value;
}
#else
UInt8 *p;
p = ((UInt8 *)ADDR_OBJ(bag)) + limbnumber/4;
switch(limbnumber %4) {
case 0:
*p = (*p & 0xFFFFFFFFFFFF0000UL) | (UInt8)value;
break;
case 1:
*p = (*p & 0xFFFFFFFF0000FFFFUL) | ((UInt8)value << 16);
break;
case 2:
*p = (*p & 0xFFFF0000FFFFFFFFUL) | ((UInt8)value << 32);
break;
case 3:
*p = (*p & 0xFFFFFFFFFFFFUL) | ((UInt8)value << 48);
break;
}
#endif
#endif
}
static inline void C_SET_LIMB4(Obj bag, UInt limbnumber, UInt4 value) {
#if INTEGER_UNIT_SIZE == 4
((UInt4 *)ADDR_OBJ(bag))[limbnumber] = value;
#else
#if INTEGER_UNIT_SIZE == 8
UInt8 *p;
if (limbnumber % 2) {
p = ((UInt8*)ADDR_OBJ(bag)) + (limbnumber-1) / 2;
*p = (*p & 0xFFFFFFFFUL) | ((UInt8)value << 32);
} else {
p = ((UInt8 *)ADDR_OBJ(bag)) + limbnumber / 2;
*p = (*p & 0xFFFFFFFF00000000UL) | (UInt8)value;
}
#else
((UInt2 *)ADDR_OBJ(bag))[2*limbnumber] = (UInt2)(value & 0xFFFFUL);
((UInt2 *)ADDR_OBJ(bag))[2*limbnumber+1] = (UInt2)(value >>16);
#endif
#endif
}
static inline void C_SET_LIMB8(Obj bag, UInt limbnumber, UInt8 value) {
#if INTEGER_UNIT_SIZE == 8
((UInt8 *)ADDR_OBJ(bag))[limbnumber] = value;
#else
#if INTEGER_UNIT_SIZE == 4
((UInt4 *)ADDR_OBJ(bag))[2*limbnumber] = (UInt4)(value & 0xFFFFFFFFUL);
((UInt4 *)ADDR_OBJ(bag))[2*limbnumber+1] = (UInt4)(value >>32);
#else
((UInt2 *)ADDR_OBJ(bag))[4*limbnumber] = (UInt2)(value & 0xFFFFULL);
((UInt2 *)ADDR_OBJ(bag))[4*limbnumber+1] = (UInt2)((value & 0xFFFF0000ULL) >>16);
((UInt2 *)ADDR_OBJ(bag))[4*limbnumber+2] = (UInt2)((value & 0xFFFF00000000ULL) >>32);
((UInt2 *)ADDR_OBJ(bag))[4*limbnumber+3] = (UInt2)(value >>48);
#endif
#endif
}
/* C_MAKE_MED_INT handles numbers between 2^28 and 2^60 in magnitude,
and is used in code compiled on 64 bit systems. If the target system
is 64 bit an immediate integer is constructed. If the target is 32 bits then
an 8-byte large integer is constructed using the representation-neutral
macros above
C_NORMALIZE_64BIT is called when a large integer has been
constructed (because the literal was large on the compiling system)
and might be small on the target system. */
#ifdef SYS_IS_64_BIT
static inline Obj C_MAKE_MED_INT( Int8 value ) {
return INTOBJ_INT(value);
}
static inline Obj C_NORMALIZE_64BIT(Obj o) {
Int value = *(Int *)ADDR_OBJ(o);
if (value < 0)
return o;
if (TNUM_OBJ(o) == T_INTNEG)
value = -value;
if (-(1L << 60) <= value && value < (1L << 60))
return INTOBJ_INT(value);
else
return o;
}
#else
static inline Obj C_MAKE_MED_INT( Int8 value ) {
Obj x;
UInt type;
if (value < 0) {
type = T_INTNEG;
value = -value;
} else
type = T_INTPOS;
x = C_MAKE_INTEGER_BAG(8,type);
C_SET_LIMB8(x,0,(UInt8)value);
return x;
}
static inline Obj C_NORMALIZE_64BIT( Obj o) {
return o;
}
#endif
#endif // GAP_COMPILED_H
/****************************************************************************
**
*E compiled.h . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
*/
|