Sfoglia il codice sorgente

synchronized with original

Alexander Shiryaev 8 anni fa
parent
commit
90db716cd6

+ 3 - 2
BlackBox/Po/Files/ORB.Mod.txt

@@ -1,4 +1,4 @@
-MODULE ORB;   (*NW 25.6.2014  / 17.9.2016  in Oberon-07*)
+MODULE ORB;   (*NW 25.6.2014  / 4.4.2017  in Oberon-07*)
   IMPORT Files, ORS;
   (*Definition of data types Object and Type, which together form the data structure
     called "symbol table". Contains procedures for creation of Objects, and for search:
@@ -22,8 +22,9 @@ MODULE ORB;   (*NW 25.6.2014  / 17.9.2016  in Oberon-07*)
     Type* = POINTER TO TypeDesc;
 
     ObjDesc*= RECORD
-      class*, lev*, exno*: INTEGER;
+      class*, exno*: BYTE;
       expo*, rdo*: BOOLEAN;   (*exported / read-only*)
+      lev*: INTEGER;
       next*, dsc*: Object;
       type*: Type;
       name*: ORS.Ident;

+ 1 - 1
BlackBox/Po/Files/ORG.Mod.txt

@@ -1,4 +1,4 @@
-MODULE ORG; (* NW  18.4.2016 / 17.9.2016  code generator in Oberon-07 for RISC*)
+MODULE ORG; (* NW  18.4.2016 / 4.4.2017  code generator in Oberon-07 for RISC*)
   IMPORT SYSTEM, Files, ORS, ORB;
   (*Code generator for Oberon compiler for RISC processor.
      Procedural interface to Parser OSAP; result in array "code".

+ 24 - 26
BlackBox/Po/Files/ORP.Mod.txt

@@ -1,4 +1,4 @@
-MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-07*)
+MODULE ORP; (*N. Wirth 1.7.97 / 4.4.2017  Oberon compiler for RISC in Oberon-07*)
   IMPORT Texts, Oberon, ORS, ORB, ORG;
   (*Author: Niklaus Wirth, 2014.
     Parser of Oberon-RISC compiler. Uses Scanner ORS to obtain symbols (tokens),
@@ -161,29 +161,28 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
     END
   END selector;
 
-  PROCEDURE CompTypes(t0, t1: ORB.Type; varpar: BOOLEAN): BOOLEAN;
-
-    PROCEDURE EqualSignatures(t0, t1: ORB.Type): BOOLEAN;
-      VAR p0, p1: ORB.Object; com: BOOLEAN;
-    BEGIN com := TRUE;
-      IF (t0.base = t1.base) & (t0.nofpar = t1.nofpar) THEN
-        p0 := t0.dsc; p1 := t1.dsc;
-        WHILE p0 # NIL DO
-          IF (p0.class = p1.class) &  (p0.rdo = p1.rdo) &
-            ((p0.type = p1.type) OR
-            (p0.type.form = ORB.Array) & (p1.type.form = ORB.Array) & (p0.type.len = p1.type.len) & (p0.type.base = p1.type.base) OR
-            (p0.type.form = ORB.Proc) & (p1.type.form = ORB.Proc) & EqualSignatures(p0.type, p1.type))
-          THEN p0 := p0.next; p1 := p1.next
-          ELSE p0 := NIL; com := FALSE
-          END
+  PROCEDURE EqualSignatures(t0, t1: ORB.Type): BOOLEAN;
+    VAR p0, p1: ORB.Object; com: BOOLEAN;
+  BEGIN com := TRUE;
+    IF (t0.base = t1.base) & (t0.nofpar = t1.nofpar) THEN
+      p0 := t0.dsc; p1 := t1.dsc;
+      WHILE p0 # NIL DO
+        IF (p0.class = p1.class) &  (p0.rdo = p1.rdo) &
+          ((p0.type = p1.type) OR
+          (p0.type.form = ORB.Array) & (p1.type.form = ORB.Array) & (p0.type.len = p1.type.len) & (p0.type.base = p1.type.base) OR
+          (p0.type.form = ORB.Proc) & (p1.type.form = ORB.Proc) & EqualSignatures(p0.type, p1.type))
+        THEN p0 := p0.next; p1 := p1.next
+        ELSE p0 := NIL; com := FALSE
         END
-      ELSE com := FALSE
-      END ;
-      RETURN com
-    END EqualSignatures;
+      END
+    ELSE com := FALSE
+    END ;
+    RETURN com
+  END EqualSignatures;
   
+  PROCEDURE CompTypes(t0, t1: ORB.Type; varpar: BOOLEAN): BOOLEAN;
   BEGIN (*check for assignment compatibility*)
-    RETURN (t0 = t1)
+    RETURN (t0 = t1)    (*openarray assignment disallowed in ORG*)
       OR (t0.form = ORB.Array) & (t1.form = ORB.Array) & (t0.base =  t1.base) & (t0.len = t1.len)
       OR (t0.form = ORB.Record) & (t1.form = ORB.Record)  & IsExtension(t0, t1)
       OR ~varpar &
@@ -213,7 +212,7 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
       ELSIF (x.type.form = ORB.String) & (x.b = 2) & (par.class = ORB.Var) & (par.type.form = ORB.Char) THEN
         ORG.StrToChar(x); ORG.ValueParam(x)
       ELSIF (par.type.form = ORB.Array) & (par.type.base = ORB.byteType) & 
-          (par.type.len > 0) & (par.type.size = x.type.size) THEN
+          (par.type.len >= 0) & (par.type.size = x.type.size) THEN
         ORG.VarParam(x, par.type)
       ELSE ORS.Mark("incompatible parameters")
       END
@@ -398,7 +397,8 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
           OR (yf IN {ORB.Pointer, ORB.Proc}) & (xf = ORB.NilTyp) THEN
         IF rel <= ORS.neq THEN ORG.IntRelation(rel, x,  y) ELSE ORS.Mark("only = or #") END
       ELSIF (xf = ORB.Pointer) & (yf = ORB.Pointer) &
-          (IsExtension(x.type.base, y.type.base) OR IsExtension(y.type.base, x.type.base)) THEN
+          (IsExtension(x.type.base, y.type.base) OR IsExtension(y.type.base, x.type.base))
+          OR (xf = ORB.Proc) & (yf = ORB.Proc) & EqualSignatures(x.type, y.type) THEN
         IF rel <= ORS.neq THEN ORG.IntRelation(rel,  x, y) ELSE ORS.Mark("only = or #") END
       ELSIF (xf = ORB.Array) & (x.type.base.form = ORB.Char) &
             ((yf = ORB.String) OR (yf = ORB.Array) & (y.type.base.form = ORB.Char))
@@ -893,7 +893,6 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
 
   PROCEDURE Module;
     VAR key: LONGINT;
-      obj: ORB.Object;
       impid, impid1: ORS.Ident;
   BEGIN Texts.WriteString(W, "  compiling "); ORS.Get(sym);
     IF sym = ORS.module THEN
@@ -924,7 +923,6 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
         END ;
         Check(ORS.semicolon, "no ;")
       END ;
-      obj := ORB.topScope.next;
       ORG.Open(version); Declarations(dc); ORG.SetDataSize((dc + 3) DIV 4 * 4);
       WHILE sym = ORS.procedure DO ProcedureDecl; Check(ORS.semicolon, "no ;") END ;
       ORG.Header;
@@ -991,7 +989,7 @@ MODULE ORP; (*N. Wirth 1.7.97 / 17.10.2016  Oberon compiler for RISC in Oberon-0
     Oberon.Collect(0)
   END Compile;
 
-BEGIN Texts.OpenWriter(W); Texts.WriteString(W, "OR Compiler  17.9.2016");
+BEGIN Texts.OpenWriter(W); Texts.WriteString(W, "OR Compiler  4.4.2017");
   Texts.WriteLn(W); Texts.Append(Oberon.Log, W.buf);
   NEW(dummy); dummy.class := ORB.Var; dummy.type := ORB.intType;
   expression := expression0; Type := Type0; FormalType := FormalType0

+ 2 - 2
BlackBox/Po/Files/ORS.Mod.txt

@@ -1,4 +1,4 @@
-MODULE ORS; (* NW 19.9.93 / 15.2.2016  Scanner in Oberon-07*)
+MODULE ORS; (* NW 19.9.93 / 20.3.2017  Scanner in Oberon-07*)
   IMPORT SYSTEM, Texts, Oberon;
 
 (* Oberon Scanner does lexical analysis. Input is Oberon-Text, output is
@@ -96,7 +96,7 @@ MODULE ORS; (* NW 19.9.93 / 15.2.2016  Scanner in Oberon-07*)
     VAR i, m, n: INTEGER;
   BEGIN i := 0; Texts.Read(R, ch);
     WHILE ~R.eot & (ch # "$") DO
-      WHILE (ch = " ") OR (ch = 9X) OR (ch = 0DX) DO Texts.Read(R, ch) END ;  (*skip*)
+      WHILE ~R.eot & (ch <= " ") DO Texts.Read(R, ch) END ;  (*skip*)
       IF ("0" <= ch) & (ch <= "9") THEN m := ORD(ch) - 30H
       ELSIF ("A" <= ch) & (ch <= "F") THEN m := ORD(ch) - 37H
       ELSE m := 0; Mark("hexdig expected")

+ 2 - 2
BlackBox/Po/Files/Texts.Mod.txt

@@ -1,4 +1,4 @@
-MODULE Texts; (*JG 21.11.90 / NW 11.7.90 / 24.12.95 / 22.11.10 / 18.11.2014*)
+MODULE Texts; (*JG 21.11.90 / NW 11.7.90 / 24.12.95 / 22.11.10 / 20.3.2017*)
   IMPORT Files, Fonts;
 
   CONST (*scanner symbol classes*)
@@ -338,7 +338,7 @@ MODULE Texts; (*JG 21.11.90 / NW 11.7.90 / 24.12.95 / 22.11.10 / 18.11.2014*)
       k: LONGINT;
       x: REAL;
   BEGIN ch := S.nextCh; i := 0;
-    WHILE (ch = " ") OR (ch = TAB) OR (ch = CR) DO
+    WHILE ~S.eot & (ch <= " ") DO
       IF ch = CR THEN INC(S.line) END ;
       Read(S, ch)
     END ;

BIN
BlackBox/Po/Mod/ORB.odc


BIN
BlackBox/Po/Mod/ORB3.odc


BIN
BlackBox/Po/Mod/ORG.odc


BIN
BlackBox/Po/Mod/ORG3.odc


BIN
BlackBox/Po/Mod/ORP.odc


BIN
BlackBox/Po/Mod/ORP3.odc


BIN
BlackBox/Po/Mod/ORS.odc


BIN
BlackBox/Po/Mod/ORS3.odc


BIN
BlackBox/Po/Mod/Texts.odc


BIN
BlackBox/Po/Mod/Texts2.odc