mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 11:02: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
|
|
@ -39,7 +39,7 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
|||
VAR
|
||||
indentLevel: INTEGER;
|
||||
hashtab: ARRAY 105 OF SHORTINT;
|
||||
keytab: ARRAY 60 (*50*), 9 OF CHAR;
|
||||
keytab: ARRAY 50, 9 OF CHAR;
|
||||
GlbPtrs: BOOLEAN;
|
||||
BodyNameExt: ARRAY 13 OF CHAR;
|
||||
|
||||
|
|
@ -1275,16 +1275,6 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
|||
Enter("UINT64"); (* pseudo keyword used by voc *)
|
||||
Enter("UINT8"); (* pseudo keyword used by voc *)
|
||||
|
||||
Enter("address"); (* pseudo keyword used by voc *)
|
||||
Enter("int16"); (* pseudo keyword used by voc *)
|
||||
Enter("int32"); (* pseudo keyword used by voc *)
|
||||
Enter("int64"); (* pseudo keyword used by voc *)
|
||||
Enter("int8"); (* pseudo keyword used by voc *)
|
||||
Enter("uint16"); (* pseudo keyword used by voc *)
|
||||
Enter("uint32"); (* pseudo keyword used by voc *)
|
||||
Enter("uint64"); (* pseudo keyword used by voc *)
|
||||
Enter("uint8"); (* pseudo keyword used by voc *)
|
||||
|
||||
Enter("asm");
|
||||
Enter("auto");
|
||||
Enter("break");
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.cap: OPM.WriteString("__CAP("); expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.odd: OPM.WriteString("__ODD("); expr(l, MinPrec); OPM.Write(CloseParen)
|
||||
| OPT.adr: OPM.WriteString("(address)"); (*SYSTEM*)
|
||||
| OPT.adr: OPM.WriteString("(ADDRESS)"); (*SYSTEM*)
|
||||
IF l^.class = OPT.Nvarpar THEN OPC.CompleteIdent(l^.obj)
|
||||
ELSE
|
||||
IF (l^.typ^.form # OPT.String) & ~(l^.typ^.comp IN {OPT.Array, OPT.DynArr}) THEN OPM.Write("&") END ;
|
||||
|
|
@ -515,7 +515,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
THEN
|
||||
OPM.Write(OpenParen); OPC.Ident(n^.typ^.strobj); OPM.Write(CloseParen);
|
||||
IF (n^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) OR (l^.typ^.form IN {OPT.Pointer, OPT.ProcTyp}) THEN
|
||||
OPM.WriteString("(address)")
|
||||
OPM.WriteString("(ADDRESS)")
|
||||
END;
|
||||
expr(l, exprPrec)
|
||||
ELSE
|
||||
|
|
@ -736,7 +736,7 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
IF typ^.comp = OPT.DynArr THEN
|
||||
IF x^.class = OPT.Nconst THEN
|
||||
OPC.IntLiteral(x.conval.intval, OPM.AddressSize)
|
||||
ELSE OPM.WriteString("((address)("); expr(x, 10); OPM.WriteString("))")
|
||||
ELSE OPM.WriteString("((ADDRESS)("); expr(x, 10); OPM.WriteString("))")
|
||||
END ;
|
||||
x := x^.link
|
||||
ELSE
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -430,10 +430,10 @@ void writeConfigurationMod() {
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
// Make sure SYSTEM.h has set up our core data types correctly.
|
||||
assert(sizeof(int8) == 1, "sizeof(int8) is not 1.");
|
||||
assert(sizeof(int16) == 2, "sizeof(int16) is not 2.");
|
||||
assert(sizeof(int32) == 4, "sizeof(int32) is not 4.");
|
||||
assert(sizeof(int64) == 8, "sizeof(int64) is not 8.");
|
||||
assert(sizeof(INT8) == 1, "sizeof(INT8) is not 1.");
|
||||
assert(sizeof(INT16) == 2, "sizeof(INT16) is not 2.");
|
||||
assert(sizeof(INT32) == 4, "sizeof(INT32) is not 4.");
|
||||
assert(sizeof(INT64) == 8, "sizeof(INT64) is not 8.");
|
||||
|
||||
oname = getenv("ONAME"); if (!oname) oname = macrotostring(O_NAME);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ OPM_ResourceDir
|
|||
__MOVE.* cmd,
|
||||
OPM_(IntSize|PointerSize|Alignment) =
|
||||
Strings_Append.+void\*\)(cmd|OPM_OBERON|extTools_comp)
|
||||
__COPY\("(gcc|clang|msc|i686-w64-mingw)
|
||||
__COPY\("(gcc|clang|msc|i686-w64-mingw|x86_64-w64-mingw)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue