diff --git a/makefile b/makefile index 6f6b0f09..e667be40 100644 --- a/makefile +++ b/makefile @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.armv6j b/makefile.gnuc.armv6j index 9cb3cdb9..e212ac1d 100644 --- a/makefile.gnuc.armv6j +++ b/makefile.gnuc.armv6j @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.armv6j_hardfp b/makefile.gnuc.armv6j_hardfp index a7e8df93..ef57a36b 100644 --- a/makefile.gnuc.armv6j_hardfp +++ b/makefile.gnuc.armv6j_hardfp @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.armv7a_hardfp b/makefile.gnuc.armv7a_hardfp index 9306f887..bc4681d7 100644 --- a/makefile.gnuc.armv7a_hardfp +++ b/makefile.gnuc.armv7a_hardfp @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.powerpc b/makefile.gnuc.powerpc index 68be6eb8..6c9da101 100644 --- a/makefile.gnuc.powerpc +++ b/makefile.gnuc.powerpc @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.x86 b/makefile.gnuc.x86 index 702ca755..520913a9 100644 --- a/makefile.gnuc.x86 +++ b/makefile.gnuc.x86 @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/makefile.gnuc.x86_64 b/makefile.gnuc.x86_64 index a3ada00b..4f53f59f 100644 --- a/makefile.gnuc.x86_64 +++ b/makefile.gnuc.x86_64 @@ -120,6 +120,7 @@ stage6: $(VOCSTATIC) -sP Printer.Mod $(VOCSTATIC) -sP Strings.Mod $(VOCSTATIC) -sP Sets.Mod + $(VOCSTATIC) -sP Sets0.Mod #ooc libs $(VOCSTATIC) -sP oocAscii.Mod diff --git a/src/lib/ooc/armv6j/C.Mod b/src/lib/ooc/armv6j/C.Mod new file mode 100644 index 00000000..e314295b --- /dev/null +++ b/src/lib/ooc/armv6j/C.Mod @@ -0,0 +1,71 @@ +(* $Id: C.Mod,v 1.9 1999/10/03 11:46:01 ooc-devel Exp $ *) +MODULE C; +(* Basic data types for interfacing to C code. + Copyright (C) 1997-1998 Michael van Acken + + This module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This module is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OOC. If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*) + +IMPORT + SYSTEM; + +(* +These types are intended to be equivalent to their C counterparts. +They may vary depending on your system, but as long as you stick to a 32 Bit +Unix they should be fairly safe. +*) + +TYPE + char* = CHAR; + signedchar* = SHORTINT; (* signed char *) + shortint* = INTEGER; (* short int *) + int* = LONGINT; + set* = SET; (* unsigned int, used as set *) + longint* = LONGINT; (* long int *) + (*longset* = SYSTEM.SET64; *) (* unsigned long, used as set *) + address* = LONGINT; + float* = REAL; + double* = LONGREAL; + + enum1* = int; + enum2* = int; + enum4* = int; + + (* if your C compiler uses short enumerations, you'll have to replace the + declarations above with + enum1* = SHORTINT; + enum2* = INTEGER; + enum4* = LONGINT; + *) + + FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) + sizet* = longint; + uidt* = int; + gidt* = int; + + +TYPE (* some commonly used C array types *) + charPtr1d* = POINTER TO ARRAY OF char; + charPtr2d* = POINTER TO ARRAY OF charPtr1d; + intPtr1d* = POINTER TO ARRAY OF int; + +TYPE (* C string type, assignment compatible with character arrays and + string constants *) + string* = POINTER TO ARRAY OF char; + +TYPE + Proc* = PROCEDURE; + +END C. diff --git a/src/lib/ooc/armv6j_hardfp/C.Mod b/src/lib/ooc/armv6j_hardfp/C.Mod new file mode 100644 index 00000000..e314295b --- /dev/null +++ b/src/lib/ooc/armv6j_hardfp/C.Mod @@ -0,0 +1,71 @@ +(* $Id: C.Mod,v 1.9 1999/10/03 11:46:01 ooc-devel Exp $ *) +MODULE C; +(* Basic data types for interfacing to C code. + Copyright (C) 1997-1998 Michael van Acken + + This module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This module is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OOC. If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*) + +IMPORT + SYSTEM; + +(* +These types are intended to be equivalent to their C counterparts. +They may vary depending on your system, but as long as you stick to a 32 Bit +Unix they should be fairly safe. +*) + +TYPE + char* = CHAR; + signedchar* = SHORTINT; (* signed char *) + shortint* = INTEGER; (* short int *) + int* = LONGINT; + set* = SET; (* unsigned int, used as set *) + longint* = LONGINT; (* long int *) + (*longset* = SYSTEM.SET64; *) (* unsigned long, used as set *) + address* = LONGINT; + float* = REAL; + double* = LONGREAL; + + enum1* = int; + enum2* = int; + enum4* = int; + + (* if your C compiler uses short enumerations, you'll have to replace the + declarations above with + enum1* = SHORTINT; + enum2* = INTEGER; + enum4* = LONGINT; + *) + + FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) + sizet* = longint; + uidt* = int; + gidt* = int; + + +TYPE (* some commonly used C array types *) + charPtr1d* = POINTER TO ARRAY OF char; + charPtr2d* = POINTER TO ARRAY OF charPtr1d; + intPtr1d* = POINTER TO ARRAY OF int; + +TYPE (* C string type, assignment compatible with character arrays and + string constants *) + string* = POINTER TO ARRAY OF char; + +TYPE + Proc* = PROCEDURE; + +END C. diff --git a/src/lib/ooc/powerpc/C.Mod b/src/lib/ooc/powerpc/C.Mod new file mode 100644 index 00000000..e314295b --- /dev/null +++ b/src/lib/ooc/powerpc/C.Mod @@ -0,0 +1,71 @@ +(* $Id: C.Mod,v 1.9 1999/10/03 11:46:01 ooc-devel Exp $ *) +MODULE C; +(* Basic data types for interfacing to C code. + Copyright (C) 1997-1998 Michael van Acken + + This module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This module is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OOC. If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*) + +IMPORT + SYSTEM; + +(* +These types are intended to be equivalent to their C counterparts. +They may vary depending on your system, but as long as you stick to a 32 Bit +Unix they should be fairly safe. +*) + +TYPE + char* = CHAR; + signedchar* = SHORTINT; (* signed char *) + shortint* = INTEGER; (* short int *) + int* = LONGINT; + set* = SET; (* unsigned int, used as set *) + longint* = LONGINT; (* long int *) + (*longset* = SYSTEM.SET64; *) (* unsigned long, used as set *) + address* = LONGINT; + float* = REAL; + double* = LONGREAL; + + enum1* = int; + enum2* = int; + enum4* = int; + + (* if your C compiler uses short enumerations, you'll have to replace the + declarations above with + enum1* = SHORTINT; + enum2* = INTEGER; + enum4* = LONGINT; + *) + + FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) + sizet* = longint; + uidt* = int; + gidt* = int; + + +TYPE (* some commonly used C array types *) + charPtr1d* = POINTER TO ARRAY OF char; + charPtr2d* = POINTER TO ARRAY OF charPtr1d; + intPtr1d* = POINTER TO ARRAY OF int; + +TYPE (* C string type, assignment compatible with character arrays and + string constants *) + string* = POINTER TO ARRAY OF char; + +TYPE + Proc* = PROCEDURE; + +END C. diff --git a/src/lib/ooc/x86/C.Mod b/src/lib/ooc/x86/C.Mod new file mode 100644 index 00000000..e314295b --- /dev/null +++ b/src/lib/ooc/x86/C.Mod @@ -0,0 +1,71 @@ +(* $Id: C.Mod,v 1.9 1999/10/03 11:46:01 ooc-devel Exp $ *) +MODULE C; +(* Basic data types for interfacing to C code. + Copyright (C) 1997-1998 Michael van Acken + + This module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This module is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OOC. If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*) + +IMPORT + SYSTEM; + +(* +These types are intended to be equivalent to their C counterparts. +They may vary depending on your system, but as long as you stick to a 32 Bit +Unix they should be fairly safe. +*) + +TYPE + char* = CHAR; + signedchar* = SHORTINT; (* signed char *) + shortint* = INTEGER; (* short int *) + int* = LONGINT; + set* = SET; (* unsigned int, used as set *) + longint* = LONGINT; (* long int *) + (*longset* = SYSTEM.SET64; *) (* unsigned long, used as set *) + address* = LONGINT; + float* = REAL; + double* = LONGREAL; + + enum1* = int; + enum2* = int; + enum4* = int; + + (* if your C compiler uses short enumerations, you'll have to replace the + declarations above with + enum1* = SHORTINT; + enum2* = INTEGER; + enum4* = LONGINT; + *) + + FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) + sizet* = longint; + uidt* = int; + gidt* = int; + + +TYPE (* some commonly used C array types *) + charPtr1d* = POINTER TO ARRAY OF char; + charPtr2d* = POINTER TO ARRAY OF charPtr1d; + intPtr1d* = POINTER TO ARRAY OF int; + +TYPE (* C string type, assignment compatible with character arrays and + string constants *) + string* = POINTER TO ARRAY OF char; + +TYPE + Proc* = PROCEDURE; + +END C. diff --git a/src/lib/ooc/x86_64/C.Mod b/src/lib/ooc/x86_64/C.Mod new file mode 100644 index 00000000..325bcb32 --- /dev/null +++ b/src/lib/ooc/x86_64/C.Mod @@ -0,0 +1,71 @@ +(* $Id: C.Mod,v 1.9 1999/10/03 11:46:01 ooc-devel Exp $ *) +MODULE C; +(* Basic data types for interfacing to C code. + Copyright (C) 1997-1998 Michael van Acken + + This module is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License + as published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This module is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OOC. If not, write to the Free Software Foundation, + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*) + +IMPORT + SYSTEM; + +(* +These types are intended to be equivalent to their C counterparts. +They may vary depending on your system, but as long as you stick to a 32 Bit +Unix they should be fairly safe. +*) + +TYPE + char* = CHAR; + signedchar* = SHORTINT; (* signed char *) + (*shortint* = INTEGER;*) (* 2 bytes on x64_64 *) (* short int *) + int* = INTEGER; + set* = SET; (* unsigned int, used as set *) + longint* = LONGINT; (* long int *) + (*longset* = SYSTEM.SET64; *) (* unsigned long, used as set *) + address* = LONGINT; (*SYSTEM.ADDRESS;*) + float* = REAL; + double* = LONGREAL; + + enum1* = int; + enum2* = int; + enum4* = int; + + (* if your C compiler uses short enumerations, you'll have to replace the + declarations above with + enum1* = SHORTINT; + enum2* = INTEGER; + enum4* = LONGINT; + *) + + FILE* = address; (* this is acually a replacement for `FILE*', i.e., for a pointer type *) + sizet* = longint; + uidt* = int; + gidt* = int; + + +TYPE (* some commonly used C array types *) + charPtr1d* = POINTER TO ARRAY OF char; + charPtr2d* = POINTER TO ARRAY OF charPtr1d; + intPtr1d* = POINTER TO ARRAY OF int; + +TYPE (* C string type, assignment compatible with character arrays and + string constants *) + string* = POINTER (*[CSTRING]*) TO ARRAY OF char; + +TYPE + Proc* = PROCEDURE; + +END C. diff --git a/src/lib/v4/Sets0.Mod b/src/lib/v4/Sets0.Mod new file mode 100644 index 00000000..f5251990 --- /dev/null +++ b/src/lib/v4/Sets0.Mod @@ -0,0 +1,159 @@ +MODULE Sets0; + +IMPORT Out := Console; + +CONST (*size* = 32;*) + size* = MAX(SET) + 1; + +PROCEDURE Clear*(VAR s: ARRAY OF SET); + VAR i: INTEGER; +BEGIN + i := 0; WHILE i < LEN(s) DO s[i] := {}; INC(i) END +END Clear; + + +PROCEDURE Fill*(VAR s: ARRAY OF SET); + VAR i: INTEGER; +BEGIN + i := 0; WHILE i < LEN(s) DO s[i] := {0 .. size-1}; INC(i) END +END Fill; + + +PROCEDURE Incl*(VAR s: ARRAY OF SET; x: INTEGER); +BEGIN INCL(s[x DIV size], x MOD size) +END Incl; + + +PROCEDURE Excl*(VAR s: ARRAY OF SET; x: INTEGER); +BEGIN EXCL(s[x DIV size], x MOD size) +END Excl; + + +PROCEDURE In*(VAR s: ARRAY OF SET; x: INTEGER): BOOLEAN; +BEGIN RETURN x MOD size IN s[x DIV size] +END In; + + +PROCEDURE Includes*(VAR s1, s2: ARRAY OF SET): BOOLEAN; + VAR i: INTEGER; +BEGIN + i := 0; + WHILE i < LEN(s1) DO + IF s1[i] + s2[i] # s1[i] THEN RETURN FALSE END ; + INC(i) + END ; + RETURN TRUE; +END Includes; + + +PROCEDURE Elements*(VAR s: ARRAY OF SET; VAR lastElem: INTEGER): INTEGER; + VAR i, n, max: INTEGER; +BEGIN + i := 0; n := 0; max := SHORT(LEN(s)) * size; + WHILE i < max DO + IF (i MOD size) IN s[i DIV size] THEN INC(n); lastElem := i END ; + INC(i) + END ; + RETURN n +END Elements; + + +PROCEDURE Empty*(VAR s: ARRAY OF SET): BOOLEAN; + VAR i: INTEGER; +BEGIN + i := 0; + WHILE i < LEN(s) DO + IF s[i] # {} THEN RETURN FALSE END ; + INC(i) + END ; + RETURN TRUE +END Empty; + + +PROCEDURE Equal*(VAR s1, s2: ARRAY OF SET): BOOLEAN; + VAR i: INTEGER; +BEGIN + i := 0; + WHILE i < LEN(s1) DO + IF s1[i] # s2[i] THEN RETURN FALSE END ; + INC(i) + END ; + RETURN TRUE +END Equal; + + +PROCEDURE Different*(VAR s1, s2: ARRAY OF SET): BOOLEAN; + VAR i: INTEGER; +BEGIN + i := 0; + WHILE i < LEN(s1) DO + IF s1[i] * s2[i] # {} THEN RETURN FALSE END ; + INC(i) + END ; + RETURN TRUE +END Different; + + +PROCEDURE Unite*(VAR s1, s2: ARRAY OF SET); + VAR i: INTEGER; s: SET; +BEGIN + i := 0; WHILE i < LEN(s1) DO s := s1[i] + s2[i]; s1[i] := s; INC(i) END +END Unite; + + +PROCEDURE Differ*(VAR s1, s2: ARRAY OF SET); + VAR i: INTEGER; s: SET; +BEGIN + i := 0; WHILE i < LEN(s1) DO s := s1[i] - s2[i]; s1[i] := s; INC(i) END +END Differ; + + +PROCEDURE Intersect*(VAR s1, s2, s3: ARRAY OF SET); + VAR i: INTEGER; s: SET; +BEGIN + i := 0; WHILE i < LEN(s1) DO s := s1[i] * s2[i]; s3[i] := s; INC(i) END +END Intersect; + +(* +PROCEDURE Print*(VAR f: Texts.Writer; s: ARRAY OF SET; w, indent: INTEGER); + VAR col, i, max: INTEGER; +BEGIN + i := 0; col := indent; max := SHORT(LEN(s)) * size; + Texts.Write(f, "{"); + WHILE i < max DO + IF In(s, i) THEN + IF col + 4 > w THEN + Texts.WriteLn(f); + col := 0; WHILE col < indent DO Texts.Write(f, " "); INC(col) END + END ; + Texts.WriteInt(f, i, 3); Texts.Write(f, ","); + INC(col, 4) + END ; + INC(i) + END ; + Texts.Write(f, "}") +END Print; +*) + +PROCEDURE Write*(s: ARRAY OF SET; w, indent: INTEGER); + VAR col, i, max: INTEGER; +BEGIN + i := 0; col := indent; max := SHORT(LEN(s)) * size; + Out.Char("{"); + WHILE i < max DO + IF In(s, i) THEN + IF col + 4 > w THEN + Out.Ln; + col := 0; WHILE col < indent DO Out.Char(" "); INC(col) END + END ; + Out.Int(i, 3); Out.Char(","); + INC(col, 4) + END ; + INC(i) + END ; + Out.Char("}") +END Write; + + + +END Sets0. diff --git a/src/tools/coco/CRA.Mod b/src/tools/coco/CRA.Mod index 40ea2451..9fc93cf1 100644 --- a/src/tools/coco/CRA.Mod +++ b/src/tools/coco/CRA.Mod @@ -8,7 +8,7 @@ END*) MODULE CRA; (* handles the DFA *) -IMPORT Oberon, Texts, Sets, CRS, CRT; +IMPORT Out := Console, (*Oberon,*) Texts := CmdlnTexts, Sets := Sets0, CRS, CRT; CONST maxStates = 300; @@ -72,22 +72,37 @@ BEGIN CRS.Error(200+nr, CRS.pos) END SemErr; PROCEDURE Put(ch: CHAR); -BEGIN Texts.Write(out, ch) END Put; +BEGIN + (*Texts.Write(out, ch)*) + Out.Char(ch) +END Put; PROCEDURE PutS(s: ARRAY OF CHAR); VAR i: INTEGER; BEGIN i := 0; WHILE (i < LEN(s)) & (s[i] # 0X) DO - IF s[i] = "$" THEN Texts.WriteLn(out) ELSE Texts.Write(out, s[i]) END; + IF s[i] = "$" THEN + (*Texts.WriteLn(out)*) + Out.Ln + ELSE + (*Texts.Write(out, s[i])*) + Out.Char(s[i]) + END; INC(i) END END PutS; PROCEDURE PutI(i: INTEGER); -BEGIN Texts.WriteInt(out, i, 0) END PutI; +BEGIN + (*Texts.WriteInt(out, i, 0)*) + Out.Int(i, 0) +END PutI; PROCEDURE PutI2(i, n: INTEGER); -BEGIN Texts.WriteInt(out, i, n) END PutI2; +BEGIN +(*Texts.WriteInt(out, i, n) *) +Out.Int(i, n) +END PutI2; PROCEDURE PutC(ch: CHAR); BEGIN @@ -611,7 +626,7 @@ BEGIN END; action := action^.next END; - Texts.Append(Oberon.Log, out.buf) + (*Texts.Append(Oberon.Log, out.buf)*) END MeltStates; PROCEDURE MakeDeterministic*(VAR correct: BOOLEAN); @@ -688,10 +703,11 @@ BEGIN i := 0; WHILE i <= CRT.maxC DO CRT.GetClass(i, set); CRT.GetClassName(i, name); PutS(name); PutS(": "); - Sets.Print(out, set, 80, 13); Texts.WriteLn(out); + (*Sets.Print(out, set, 80, 13); Texts.WriteLn(out);*) + Sets.Write(set, 80, 13); Out.Ln; INC(i) END; - Texts.Append(Oberon.Log, out.buf) + (*Texts.Append(Oberon.Log, out.buf)*) END PrintStates; @@ -763,8 +779,16 @@ BEGIN Texts.Read (fram, ch); INC(i); UNTIL ch # stopStr[i]; (*stopStr[0..i-1] found; 1 unrecognized character*) - j := 0; WHILE j < i DO Texts.Write(out, stopStr[j]); INC(j) END - ELSE Texts.Write (out, ch); Texts.Read(fram, ch) + j := 0; + WHILE j < i DO + (*Texts.Write(out, stopStr[j]);*) + Out.Char(stopStr[j]); + INC(j) + END + ELSE + (*Texts.Write (out, ch);*) + Out.Char (ch); + Texts.Read(fram, ch) END END END CopyFramePart; @@ -891,10 +915,11 @@ BEGIN COPY(sn.name, scanner); l := Length(scanner); scanner[l] := "S"; scanner[l+1] := 0X; NEW(t); Texts.Open(t, "Scanner.FRM"); Texts.OpenReader(fram, t, 0); IF t.len = 0 THEN - Texts.WriteString(out, "Scanner.FRM not found"); Texts.WriteLn(out); - Texts.Append(Oberon.Log, out.buf); HALT(99) + (*Texts.WriteString(out, "Scanner.FRM not found"); Texts.WriteLn(out);*) + Out.String("Scanner.FRM not found"); Out.Ln; + (*Texts.Append(Oberon.Log, out.buf);*) HALT(99) END; - Texts.Append(Oberon.Log, out.buf); + (*Texts.Append(Oberon.Log, out.buf);*) (*------- *S.MOD -------*) CopyFramePart("-->modulename"); PutS(scanner); @@ -930,12 +955,13 @@ BEGIN PutS("start["); PutI(4*i+j); PutS("]:="); PutI(startTab[4*i+j]); PutS("; "); INC(j) END; - Texts.WriteLn(out); + (*Texts.WriteLn(out); *) + Out.Ln; INC(i) END; CopyFramePart("-->modulename"); PutS(scanner); Put("."); - NEW(t); t.notify := Show; Texts.Open(t, ""); Texts.Append(t, out.buf); + NEW(t); (*t.notify := Show;*) Texts.Open(t, ""); Texts.Append(t, out.buf); l := Length(scanner); scanner[l] := "."; scanner[l+1] := "M"; scanner[l+2] := "o"; scanner[l+3] := "d"; scanner[l+4] := 0X; Texts.Close(t, scanner) END WriteScanner; diff --git a/src/tools/coco/CRP.Mod b/src/tools/coco/CRP.Mod index fe38ac12..0a589a4b 100644 --- a/src/tools/coco/CRP.Mod +++ b/src/tools/coco/CRP.Mod @@ -1,7 +1,7 @@ (* parser module generated by Coco-R *) MODULE CRP; -IMPORT CRS, CRT, CRA, CRX, Sets, Texts, Oberon; +IMPORT CRS, CRT, CRA, CRX, Sets := Sets0, Texts := CmdlnTexts, Out := Console (*Oberon*); CONST maxP = 42; @@ -591,7 +591,8 @@ BEGIN CRS.GetName(CRS.pos, CRS.len, name); IF name # gramName THEN SemErr(17) END; IF CRS.errors = 0 THEN - Texts.WriteString(w, " checking"); Texts.Append(Oberon.Log, w.buf); + (*Texts.WriteString(w, " checking"); Texts.Append(Oberon.Log, w.buf);*) + Out.String(" checking"); CRT.CompSymbolSets; IF ok THEN CRT.TestCompleteness(ok) END; IF ok THEN @@ -602,12 +603,14 @@ BEGIN IF CRT.ddt[0] THEN CRA.PrintStates END; IF CRT.ddt[7] THEN CRT.XRef END; IF ok THEN - Texts.WriteString(w, " +parser"); - Texts.Append(Oberon.Log, w.buf); + (*Texts.WriteString(w, " +parser");*) + Out.String(" +parser"); + (*Texts.Append(Oberon.Log, w.buf);*) CRX.GenCompiler; IF genScanner THEN - Texts.WriteString(w, " +scanner"); - Texts.Append(Oberon.Log, w.buf); + (*Texts.WriteString(w, " +scanner");*) + Out.String(" +scanner"); + (*Texts.Append(Oberon.Log, w.buf);*) CRA.WriteScanner(ok) END; IF CRT.ddt[8] THEN CRX.WriteStatistics END @@ -615,8 +618,11 @@ BEGIN ELSE ok := FALSE END; IF CRT.ddt[6] THEN CRT.PrintSymbolTable END; - IF ok THEN Texts.WriteString(w, " done") END; - Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf) ; + IF ok THEN + (*Texts.WriteString(w, " done") END;*) + Out.String(" done") END; + (*Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf) ;*) + Out.Ln; Expect(10); END CR; diff --git a/src/tools/coco/CRT.Mod b/src/tools/coco/CRT.Mod index d43a456a..33d6ce53 100644 --- a/src/tools/coco/CRT.Mod +++ b/src/tools/coco/CRT.Mod @@ -1,6 +1,6 @@ MODULE CRT; (* Cocol-R Tables *) -IMPORT Texts := CmdlnTexts, Out := Console, (*Oberon,*) Sets; +IMPORT Texts := CmdlnTexts, Out := Console, (*Oberon,*) Sets := Sets0; CONST maxSymbols* = 300; (*max nr of t, nt, and pragmas*) diff --git a/src/tools/coco/CRX.Mod b/src/tools/coco/CRX.Mod index 48969adb..315f8042 100644 --- a/src/tools/coco/CRX.Mod +++ b/src/tools/coco/CRX.Mod @@ -1,6 +1,6 @@ MODULE CRX; -IMPORT Oberon, Texts, Sets, CRS, CRT, SYSTEM; +IMPORT Out := Console, (*Oberon,*) Texts := CmdlnTexts, Sets := Sets0, CRS, CRT, SYSTEM; CONST symSetSize = 100; @@ -23,8 +23,10 @@ VAR PROCEDURE Restriction(n: INTEGER); BEGIN - Texts.WriteLn(w); Texts.WriteString(w, "Restriction "); - Texts.WriteInt(w, n, 0); Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf); + (*Texts.WriteLn(w); Texts.WriteString(w, "Restriction ");*) + Out.Ln; Out.String("Restriction "); + (*Texts.WriteInt(w, n, 0); Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf);*) + Out.Int(n, 0); Out.Ln; HALT(99) END Restriction; @@ -415,8 +417,9 @@ BEGIN NEW(t); Texts.Open(t, "Parser.FRM"); Texts.OpenReader(fram, t, 0); IF t.len = 0 THEN - Texts.WriteString(w, "Parser.FRM not found"); Texts.WriteLn(w); - Texts.Append(Oberon.Log, w.buf); HALT(99) + (*Texts.WriteString(w, "Parser.FRM not found"); Texts.WriteLn(w);*) + Out.String("Parser.FRM not found"); Out.Ln; + (*Texts.Append(Oberon.Log, w.buf);*) HALT(99) END ; Texts.OpenWriter(err); Texts.WriteLn(err); @@ -425,7 +428,9 @@ BEGIN (*----- write *P.Mod -----*) Texts.OpenWriter(syn); - NEW(t); t.notify := Show; Texts.Open(t, ""); + NEW(t); + (*t.notify := Show; *) + Texts.Open(t, ""); CopyFramePart("-->modulename"); PutS(parser); CopyFramePart("-->scanner"); PutS(scanner); IF CRT.importPos.beg >= 0 THEN PutS(", "); CopySourcePart(CRT.importPos, 0) END ; @@ -457,11 +462,16 @@ END GenCompiler; PROCEDURE WriteStatistics*; BEGIN - Texts.WriteInt (w, CRT.maxT + 1, 0); Texts.WriteString(w, " t, "); + (*Texts.WriteInt (w, CRT.maxT + 1, 0); Texts.WriteString(w, " t, ");*) + Out.Int (CRT.maxT + 1, 0); Out.String(" t, "); Texts.WriteInt (w, CRT.maxSymbols - CRT.firstNt + CRT.maxT + 1, 0); Texts.WriteString(w, " syms, "); - Texts.WriteInt (w, CRT.nNodes, 0); Texts.WriteString(w, " nodes, "); - Texts.WriteInt (w, maxSS, 0); Texts.WriteString(w, "sets"); - Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf) + (*Texts.WriteInt (w, CRT.nNodes, 0); Texts.WriteString(w, " nodes, ");*) + Out.Int (CRT.nNodes, 0); Out.String(" nodes, "); + (*Texts.WriteInt (w, maxSS, 0); Texts.WriteString(w, "sets");*) + Out.Int (maxSS, 0); Out.String("sets"); + (*Texts.WriteLn(w); *) + Out.Ln; + (*Texts.Append(Oberon.Log, w.buf)*) END WriteStatistics; PROCEDURE Init*; diff --git a/src/tools/coco/Coco.Mod b/src/tools/coco/Coco.Mod index ff84d65e..79d978a5 100644 --- a/src/tools/coco/Coco.Mod +++ b/src/tools/coco/Coco.Mod @@ -19,7 +19,7 @@ ==========================================================================*) MODULE Coco; -IMPORT Oberon, TextFrames, Texts, Viewers, CRS, CRP, CRT; +IMPORT (*Oberon, TextFrames,*) Texts := CmdlnTexts,(* Viewers,*) CRS, CRP, CRT, Out := Console; CONST minErrDist = 8; @@ -29,7 +29,9 @@ VAR w: Texts.Writer; lastErrPos: LONGINT; PROCEDURE Error (n: INTEGER; pos: LONGINT); PROCEDURE Msg (s: ARRAY OF CHAR); - BEGIN Texts.WriteString(w, s) + BEGIN + (*Texts.WriteString(w, s)*) + Out.String(s); END Msg; BEGIN @@ -95,7 +97,8 @@ BEGIN | 53: Msg("invalid Declaration") | 54: Msg("this symbol not expected in CR") | 55: Msg("invalid CR") - ELSE Texts.WriteString(w, "error "); Texts.WriteInt(w, n, 0) + ELSE (*Texts.WriteString(w, "error "); Texts.WriteInt(w, n, 0)*) + Out.String("error "); Out.Int(n, 0) END ELSE CASE n OF @@ -125,10 +128,12 @@ BEGIN | 224: Msg("tokens must not contain blanks") | 225: Msg("comment delimiter must not exceed 2 characters") | 226: Msg("character set contains more than one character") - ELSE Texts.WriteString(w, "error "); Texts.WriteInt(w, n, 0) + ELSE (*Texts.WriteString(w, "error "); Texts.WriteInt(w, n, 0)*) + Out.String("error "); Out.Int(n, 0); END END; -Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf) +(*Texts.WriteLn(w); Texts.Append(Oberon.Log, w.buf)*) +Out.Ln END Error; PROCEDURE Options(VAR s: Texts.Scanner); @@ -146,6 +151,21 @@ BEGIN END; END Options; +PROCEDURE Options0(VAR s: ARRAY OF CHAR); + VAR i: INTEGER; +BEGIN + IF s.nextCh = "\" THEN Texts.Scan(s); Texts.Scan(s); + IF s.class = Texts.Name THEN i := 0; + WHILE s.s[i] # 0X DO + IF CAP(s.s[i]) = "X" THEN CRT.ddt[7] := TRUE + ELSIF CAP(s.s[i]) = "S" THEN CRT.ddt[1] := TRUE + END; + INC(i) + END + END + END; +END Options; + PROCEDURE Compile*; VAR v: Viewers.Viewer; f: TextFrames.Frame; s: Texts.Scanner; src, t: Texts.Text;