mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 09:52:24 +00:00
Uppercase internal SYSTEM.H types address, int*, uint*. Completed.
This commit is contained in:
parent
baeb2db81f
commit
a17c087a41
56 changed files with 299 additions and 379 deletions
|
|
@ -73,7 +73,7 @@ MODULE Files; (* J. Templ 1.12. 89/12.4.95 Oberon files mapped onto Unix files
|
|||
|
||||
|
||||
PROCEDURE -IdxTrap "__HALT(-1)";
|
||||
PROCEDURE -ToAdr(x: SYSTEM.INT64): SYSTEM.ADDRESS "(address)x";
|
||||
PROCEDURE -ToAdr(x: SYSTEM.INT64): SYSTEM.ADDRESS "(ADDRESS)x";
|
||||
|
||||
PROCEDURE^ Finalize(o: SYSTEM.PTR);
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ MODULE Heap;
|
|||
END INCREF;
|
||||
|
||||
|
||||
PROCEDURE -ExternPlatformOSAllocate "extern address Platform_OSAllocate(address size);";
|
||||
PROCEDURE -ExternPlatformOSAllocate "extern ADDRESS Platform_OSAllocate(ADDRESS size);";
|
||||
PROCEDURE -OSAllocate(size: S.ADDRESS): S.ADDRESS "Platform_OSAllocate(size)";
|
||||
|
||||
PROCEDURE NewChunk(blksz: S.ADDRESS): S.ADDRESS;
|
||||
|
|
@ -317,25 +317,25 @@ MODULE Heap;
|
|||
VAR p, tag, offset, fld, n, tagbits: S.ADDRESS;
|
||||
BEGIN
|
||||
IF q # 0 THEN
|
||||
S.GET(q - SZA, tagbits); (* Load the tag for the record at q *)
|
||||
IF ~ODD(tagbits) THEN (* If it has not already been marked *)
|
||||
S.GET(q - SZA, tagbits); (* Load the tag for the record at q *)
|
||||
IF ~ODD(tagbits) THEN (* If it has not already been marked *)
|
||||
S.PUT(q - SZA, tagbits + 1); (* Mark it *)
|
||||
p := 0;
|
||||
tag := tagbits + SZA; (* Tag addresses first offset *)
|
||||
tag := tagbits + SZA; (* Tag addresses first offset *)
|
||||
LOOP
|
||||
S.GET(tag, offset); (* Get next ptr field offset *)
|
||||
IF offset < 0 THEN (* Sentinel reached: Value is -8*(#fields+1) *)
|
||||
IF offset < 0 THEN (* Sentinel reached: Value is -8*(#fields+1) *)
|
||||
S.PUT(q - SZA, tag + offset + 1); (* Rotate base ptr into tag *)
|
||||
IF p = 0 THEN EXIT END ;
|
||||
n := q; q := p;
|
||||
S.GET(q - SZA, tag); DEC(tag, 1);
|
||||
S.GET(tag, offset); fld := q + offset;
|
||||
S.GET(fld, p); S.PUT(fld, S.VAL(S.PTR, n))
|
||||
ELSE (* offset references a ptr field *)
|
||||
fld := q + offset; (* S.ADDRESS the pointer *)
|
||||
S.GET(fld, n); (* Load the pointer *)
|
||||
IF n # 0 THEN (* If pointer is not NIL *)
|
||||
S.GET(n - SZA, tagbits); (* Consider record pointed to by this field *)
|
||||
ELSE (* offset references a ptr field *)
|
||||
fld := q + offset; (* S.ADDRESS the pointer *)
|
||||
S.GET(fld, n); (* Load the pointer *)
|
||||
IF n # 0 THEN (* If pointer is not NIL *)
|
||||
S.GET(n - SZA, tagbits); (* Consider record pointed to by this field *)
|
||||
IF ~ODD(tagbits) THEN
|
||||
S.PUT(n - SZA, tagbits + 1);
|
||||
S.PUT(q - SZA, tag + 1);
|
||||
|
|
@ -483,7 +483,7 @@ MODULE Heap;
|
|||
END
|
||||
END FINALL;
|
||||
|
||||
PROCEDURE -ExternMainStackFrame "extern address Platform_MainStackFrame;";
|
||||
PROCEDURE -ExternMainStackFrame "extern ADDRESS Platform_MainStackFrame;";
|
||||
PROCEDURE -PlatformMainStackFrame(): S.ADDRESS "Platform_MainStackFrame";
|
||||
|
||||
PROCEDURE MarkStack(n: S.ADDRESS; VAR cand: ARRAY OF S.ADDRESS);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ BEGIN r := 1.0D0; power := 1.0D1;
|
|||
RETURN r
|
||||
END Ten;
|
||||
|
||||
PROCEDURE -Entier64(x: LONGREAL): SYSTEM.INT64 "(int64)(x)";
|
||||
PROCEDURE -Entier64(x: LONGREAL): SYSTEM.INT64 "(INT64)(x)";
|
||||
|
||||
PROCEDURE RealP(x: LONGREAL; n: INTEGER; long: BOOLEAN);
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ PROCEDURE -structstats "struct stat s";
|
|||
PROCEDURE -statdev(): LONGINT "(LONGINT)s.st_dev";
|
||||
PROCEDURE -statino(): LONGINT "(LONGINT)s.st_ino";
|
||||
PROCEDURE -statmtime(): LONGINT "(LONGINT)s.st_mtime";
|
||||
PROCEDURE -statsize(): LONGINT "(address)s.st_size";
|
||||
PROCEDURE -statsize(): LONGINT "(ADDRESS)s.st_size";
|
||||
|
||||
PROCEDURE Identify*(h: FileHandle; VAR identity: FileIdentity): ErrorCode;
|
||||
BEGIN
|
||||
|
|
|
|||
|
|
@ -86,20 +86,6 @@ typedef void* SYSTEM_PTR;
|
|||
#endif
|
||||
|
||||
|
||||
// Temporary build support - which changing lowercase int* and address to uppercase
|
||||
|
||||
#define int8 INT8
|
||||
#define int16 INT16
|
||||
#define int32 INT32
|
||||
#define int64 INT64
|
||||
#define uint8 UINT8
|
||||
#define uint16 UINT16
|
||||
#define uint32 UINT32
|
||||
#define uint64 UINT64
|
||||
#define address ADDRESS
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------
|
||||
|
|
@ -179,12 +165,12 @@ static inline int __str_cmp(CHAR *x, CHAR *y){
|
|||
#define __GET(a, x, t) x=*(t*)(ADDRESS)(a)
|
||||
#define __PUT(a, x, t) *(t*)(ADDRESS)(a)=x
|
||||
|
||||
#define __LSHL(x, n, s) ((int##s)((uint##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((int##s)((uint##s)(x)>>(n)))
|
||||
#define __LSHL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)))
|
||||
#define __LSHR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)))
|
||||
#define __LSH(x, n, s) ((n)>=0? __LSHL(x, n, s): __LSHR(x, -(n), s))
|
||||
|
||||
#define __ROTL(x, n, s) ((int##s)((uint##s)(x)<<(n)|(uint##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((int##s)((uint##s)(x)>>(n)|(uint##s)(x)<<(s-(n))))
|
||||
#define __ROTL(x, n, s) ((INT##s)((UINT##s)(x)<<(n)|(UINT##s)(x)>>(s-(n))))
|
||||
#define __ROTR(x, n, s) ((INT##s)((UINT##s)(x)>>(n)|(UINT##s)(x)<<(s-(n))))
|
||||
#define __ROT(x, n, s) ((n)>=0? __ROTL(x, n, s): __ROTR(x, -(n), s))
|
||||
|
||||
#define __ASHL(x, n) ((INT64)(x)<<(n))
|
||||
|
|
@ -222,10 +208,10 @@ static inline double SYSTEM_ABSD(double i) {return i >= 0.0 ? i : -i;}
|
|||
#define __CAP(ch) ((CHAR)((ch)&0x5f))
|
||||
#define __ODD(x) ((x)&1)
|
||||
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((uint##size)(s))>>(x))&1))
|
||||
#define __IN(x, s, size) (((unsigned int)(x))<size && ((((UINT##size)(s))>>(x))&1))
|
||||
// todo tested versions of SETOF and SETRNG: check that x, l and h fit size
|
||||
#define __SETOF(x, size) ((uint##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(uint##size)0<<(l))&~(uint##size)0>>(size-1-(h)))
|
||||
#define __SETOF(x, size) ((UINT##size)1<<(x))
|
||||
#define __SETRNG(l, h, size) ((~(UINT##size)0<<(l))&~(UINT##size)0>>(size-1-(h)))
|
||||
|
||||
#define __MASK(x, m) ((x)&~(m))
|
||||
#define __BIT(x, n) (*(UINT64*)(x)>>(n)&1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue