Add SYSTEM types INT8 through INT64. Define LINT as derived type of SYSTEM.INT64.

This commit is contained in:
David Brown 2016-08-26 18:59:50 +01:00
parent b6385f8b8c
commit 7df022d94e
29 changed files with 344 additions and 192 deletions

View file

@ -128,6 +128,10 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
OPM.Write('_')
ELSIF (obj = OPT.sysptrtyp^.strobj)
OR (obj = OPT.ainttyp^.strobj)
OR (obj = OPT.int8typ^.strobj)
OR (obj = OPT.int16typ^.strobj)
OR (obj = OPT.int32typ^.strobj)
OR (obj = OPT.int64typ^.strobj)
OR (obj = OPT.bytetyp^.strobj) THEN
OPM.WriteString("SYSTEM_")
END;

View file

@ -156,9 +156,12 @@ VAR
bytetyp*, booltyp*, chartyp*,
sinttyp*, inttyp*, linttyp*,
ainttyp*,
int8typ*, int16typ*, int32typ*, int64typ*,
realtyp*, lrltyp*, settyp*, stringtyp*,
niltyp*, notyp*, sysptrtyp*: Struct;
LIntObj: Object;
nofGmod*: SHORTINT; (*nof imports*)
GlbMod*: ARRAY maxImps OF Object; (* ^.right = first object, ^.name = module import name (not alias) *)
@ -1135,6 +1138,13 @@ END Import;
typ^.idfp := form; typ^.idfpdone := TRUE; res := typ
END EnterTyp;
PROCEDURE EnterDerivedType(name: OPS.Name; typ: Struct; VAR obj: Object);
BEGIN
Insert(name, obj);
obj.mode := Typ;
obj.typ := typ;
END EnterDerivedType;
PROCEDURE EnterProc(name: OPS.Name; num: INTEGER);
VAR obj: Object;
BEGIN Insert(name, obj);
@ -1142,14 +1152,19 @@ END Import;
END EnterProc;
BEGIN topScope := NIL; OpenScope(0, NIL); OPM.errpos := 0;
InitStruct(undftyp, Undef); InitStruct(notyp, NoTyp);
InitStruct(stringtyp, String); InitStruct(niltyp, NilTyp);
undftyp^.BaseTyp := undftyp;
InitStruct(undftyp, Undef); undftyp^.BaseTyp := undftyp;
InitStruct(notyp, NoTyp);
InitStruct(stringtyp, String);
InitStruct(niltyp, NilTyp);
(*initialization of module SYSTEM*)
EnterTyp("BYTE", Byte, OPM.ByteSize, bytetyp);
EnterTyp("PTR", Pointer, OPM.PointerSize, sysptrtyp);
EnterTyp("ADRINT", Int, OPM.LIntSize, ainttyp);
EnterTyp("BYTE", Byte, OPM.ByteSize, bytetyp);
EnterTyp("PTR", Pointer, OPM.PointerSize, sysptrtyp);
EnterTyp("ADRINT", Int, OPM.LIntSize, ainttyp);
EnterTyp("INT8", Int, 1, int8typ);
EnterTyp("INT16", Int, 2, int16typ);
EnterTyp("INT32", Int, 4, int32typ);
EnterTyp("INT64", Int, 8, int64typ);
EnterProc("ADR", adrfn);
EnterProc("CC", ccfn);
EnterProc("LSH", lshfn);
@ -1174,6 +1189,10 @@ BEGIN topScope := NIL; OpenScope(0, NIL); OPM.errpos := 0;
EnterTyp("LONGREAL", LReal, OPM.LRealSize, lrltyp);
EnterTyp("SHORTINT", SInt, OPM.SIntSize, sinttyp);
(* Create LINT type as TYPE LINT = SYSTEM.INT64 *)
EnterDerivedType("LINT", int64typ, LIntObj);
EnterBoolConst("FALSE", 0); (* 0 and 1 are compiler internal representation only *)
EnterBoolConst("TRUE", 1);

View file

@ -206,6 +206,10 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
OPT.inttyp^.strobj^.linkadr := PredefinedType;
OPT.linttyp^.strobj^.linkadr := PredefinedType;
OPT.ainttyp^.strobj^.linkadr := PredefinedType;
OPT.int8typ^.strobj^.linkadr := PredefinedType;
OPT.int16typ^.strobj^.linkadr := PredefinedType;
OPT.int32typ^.strobj^.linkadr := PredefinedType;
OPT.int64typ^.strobj^.linkadr := PredefinedType;
OPT.lrltyp^.strobj^.linkadr := PredefinedType;
OPT.sinttyp^.strobj^.linkadr := PredefinedType;
OPT.booltyp^.strobj^.linkadr := PredefinedType;

View file

@ -58,7 +58,7 @@ MODULE Vishap; (* J. Templ 3.2.95 *)
OPT.realtyp.size := OPM.RealSize;
OPT.inttyp.size := OPM.IntSize;
OPT.linttyp.size := OPM.LIntSize;
OPT.ainttyp.size := OPM.LIntSize;
OPT.ainttyp.size := OPM.PointerSize;
OPT.lrltyp.size := OPM.LRealSize;
OPT.sinttyp.size := OPM.SIntSize;
OPT.booltyp.size := OPM.BoolSize;