From: mike lowis Date: Fri, 9 Apr 2021 16:38:49 +0000 (-0400) Subject: changed case of some builtin types X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=cd6a9e3ee781f03621c82aad7add9a4b04c789e3;p=proto%2Fobnc.git changed case of some builtin types --- diff --git a/.gitignore b/.gitignore index a081f0e..d58198e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ MapsTest TableTest UtilTest lex.yyTest +tags diff --git a/lib/obnc/In.c b/lib/obnc/In.c index a69e83c..5865538 100644 --- a/lib/obnc/In.c +++ b/lib/obnc/In.c @@ -22,7 +22,7 @@ void In__Open_(void) } -void In__Char_(char *ch) +void In__Character_(char *ch) { int d; @@ -35,7 +35,7 @@ void In__Char_(char *ch) } -void In__Int_(OBNC_INTEGER *x) +void In__Integer_(OBNC_INTEGER *x) { int ch, i, n; char buf[(CHAR_BIT * sizeof (OBNC_INTEGER) / 3) + 3]; @@ -81,7 +81,7 @@ void In__Int_(OBNC_INTEGER *x) } -void In__Real_(OBNC_REAL *x) +void In__RealNum_(OBNC_REAL *x) { int scanCount; diff --git a/lib/obnc/In.obn b/lib/obnc/In.obn index 608d1c0..4ae284f 100644 --- a/lib/obnc/In.obn +++ b/lib/obnc/In.obn @@ -18,27 +18,27 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Open; - procedure Char*(var ch: Char); + procedure Character*(var ch: Char); (**returns in ch the character at the current position*) - end Char; + end Character; - procedure Int*(var i: Int); + procedure Integer*(var i: Int); (**returns in i the integer constant at the current position according to the format integer = digit {digit} | digit {hexDigit} "H". hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F". *) - end Int; + end Integer; - procedure Real*(var x: Real); + procedure RealNum*(var x: Real); (**returns in x the real constant at the current position according to the format real = digit {digit} "." {digit} [ScaleFactor]. ScaleFactor = "E" ["+" | "-"] digit {digit}. *) - end Real; + end RealNum; procedure String*(var str: array of Char); diff --git a/lib/obnc/InTest.obn b/lib/obnc/InTest.obn index 1c148eb..23581b7 100644 --- a/lib/obnc/InTest.obn +++ b/lib/obnc/InTest.obn @@ -29,19 +29,19 @@ module InTest; s: array 12 of Char; begin - In.Char(ch); + In.Character(ch); ASSERT(In.Done); ASSERT(ch = "a"); - In.Int(n); + In.Integer(n); ASSERT(In.Done); ASSERT(n = 37); - In.Int(n); + In.Integer(n); ASSERT(In.Done); ASSERT(n = 37H); - In.Real(x); + In.RealNum(x); ASSERT(In.Done); ASSERT(x >= 3.14 - eps); ASSERT(x <= 3.14 + eps); diff --git a/lib/obnc/Out.c b/lib/obnc/Out.c index 93614e0..bd57774 100644 --- a/lib/obnc/Out.c +++ b/lib/obnc/Out.c @@ -14,7 +14,7 @@ void Out__Open_(void) } -void Out__Char_(char ch) +void Out__Character_(char ch) { putchar(ch); } @@ -32,7 +32,7 @@ void Out__String_(const char s[], OBNC_INTEGER sLen) } -void Out__Int_(OBNC_INTEGER i, OBNC_INTEGER n) +void Out__Integer_(OBNC_INTEGER i, OBNC_INTEGER n) { OBNC_WriteInt(i, n, stdout); } @@ -44,7 +44,7 @@ void Out__Hex_(OBNC_INTEGER i) } -void Out__Real_(OBNC_REAL x, OBNC_INTEGER n) +void Out__RealNum_(OBNC_REAL x, OBNC_INTEGER n) { printf("%*" OBNC_REAL_MOD_W "E", (int) n, x); } diff --git a/lib/obnc/Out.obn b/lib/obnc/Out.obn index 56f205c..3b5e809 100644 --- a/lib/obnc/Out.obn +++ b/lib/obnc/Out.obn @@ -16,9 +16,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Open; - procedure Char*(ch: Char); + procedure Character*(ch: Char); (**writes the character ch to the end of the output stream*) - end Char; + end Character; procedure String*(s: array of Char); @@ -26,9 +26,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end String; - procedure Int*(i, n: Int); + procedure Integer*(i, n: Int); (**writes the integer i to the end of the output stream. If the textual representation of i requires m characters, i is right adjusted in a field of Max(n, m) characters padded with blanks at the left end. A plus sign is not written.*) - end Int; + end Integer; procedure Hex*(i: Int); @@ -36,9 +36,9 @@ Implements the basic library module from "The Oakwood Guidelines for Oberon-2 Co end Hex; - procedure Real*(x: Real; n: Int); + procedure RealNum*(x: Real; n: Int); (**writes the real number x to the end of the output stream using an exponential form. If the textual representation of x requires m characters (including a two-digit signed exponent), x is right adjusted in a field of Max(n, m) characters padded with blanks at the left end. A plus sign of the mantissa is not written.*) - end Real; + end RealNum; procedure Ln*; diff --git a/lib/obnc/OutTest.obn b/lib/obnc/OutTest.obn index d5777ae..becc087 100644 --- a/lib/obnc/OutTest.obn +++ b/lib/obnc/OutTest.obn @@ -20,22 +20,22 @@ module OutTest; import Out; begin - Out.Char("a"); Out.Ln; + Out.Character("a"); Out.Ln; Out.String("abc"); Out.Ln; - Out.Int(-07FFFH - 1, 0); Out.Ln; (*minimum 16-bit integer*) - Out.Int(-1, 0); Out.Ln; - Out.Int(-1, 3); Out.Ln; - Out.Int(0, 0); Out.Ln; - Out.Int(1, 0); Out.Ln; - Out.Int(37, 0); Out.Ln; - Out.Int(07FFFH, 0); Out.Ln; (*maximum 16-bit integer*) + Out.Integer(-07FFFH - 1, 0); Out.Ln; (*minimum 16-bit integer*) + Out.Integer(-1, 0); Out.Ln; + Out.Integer(-1, 3); Out.Ln; + Out.Integer(0, 0); Out.Ln; + Out.Integer(1, 0); Out.Ln; + Out.Integer(37, 0); Out.Ln; + Out.Integer(07FFFH, 0); Out.Ln; (*maximum 16-bit integer*) Out.Hex(0); Out.Ln; Out.Hex(1); Out.Ln; Out.Hex(0BEEFH); Out.Ln; - Out.Real(-1.0, 0); Out.Ln; - Out.Real(0.0, 0); Out.Ln; - Out.Real(0.0, 14); Out.Ln; - Out.Real(1.0, 0); Out.Ln; - Out.Real(37.0, 0); Out.Ln; - Out.Real(0.37, 0); Out.Ln + Out.RealNum(-1.0, 0); Out.Ln; + Out.RealNum(0.0, 0); Out.Ln; + Out.RealNum(0.0, 14); Out.Ln; + Out.RealNum(1.0, 0); Out.Ln; + Out.RealNum(37.0, 0); Out.Ln; + Out.RealNum(0.37, 0); Out.Ln end OutTest. diff --git a/src/Table.c b/src/Table.c index 48104b5..d09e36e 100644 --- a/src/Table.c +++ b/src/Table.c @@ -84,8 +84,8 @@ void Table_Init(void) {"ASSERT", TREES_PROCEDURE_KIND, TREES_ASSERT_PROC}, {"Bool", TREES_TYPE_KIND, TREES_BOOLEAN_TYPE}, {"Byte", TREES_TYPE_KIND, TREES_BYTE_TYPE}, - {"Char", TREES_TYPE_KIND, TREES_CHAR_TYPE}, {"CHR", TREES_PROCEDURE_KIND, TREES_CHR_PROC}, + {"Char", TREES_TYPE_KIND, TREES_CHAR_TYPE}, {"DEC", TREES_PROCEDURE_KIND, TREES_DEC_PROC}, {"EXCL", TREES_PROCEDURE_KIND, TREES_EXCL_PROC}, {"FLOOR", TREES_PROCEDURE_KIND, TREES_FLOOR_PROC}, @@ -99,10 +99,11 @@ void Table_Init(void) {"ODD", TREES_PROCEDURE_KIND, TREES_ODD_PROC}, {"ORD", TREES_PROCEDURE_KIND, TREES_ORD_PROC}, {"PACK", TREES_PROCEDURE_KIND, TREES_PACK_PROC}, - {"Real", TREES_TYPE_KIND, TREES_REAL_TYPE}, {"ROR", TREES_PROCEDURE_KIND, TREES_ROR_PROC}, + {"Real", TREES_TYPE_KIND, TREES_REAL_TYPE}, {"SET", TREES_TYPE_KIND, TREES_SET_TYPE}, - {"UNPK", TREES_PROCEDURE_KIND, TREES_UNPK_PROC}}; + {"UNPK", TREES_PROCEDURE_KIND, TREES_UNPK_PROC} + }; int i; Trees_Node node; diff --git a/src/y.tab.c b/src/y.tab.c index 47c2449..c754de4 100644 --- a/src/y.tab.c +++ b/src/y.tab.c @@ -4408,9 +4408,7 @@ static Trees_Node ResolvedType(Trees_Node type, int isTypeDecl) result = NULL; if (Trees_Symbol(type) == IDENT) { name = Trees_Name(type); - fprintf(stderr,"%s\n", name); identDef = Table_At(name); - fprintf(stderr,"%p\n", identDef); if (identDef != NULL) { if (Trees_Kind(identDef) == TREES_TYPE_KIND) { typeStruct = Types_Structure(identDef); diff --git a/tests/obnc/passing/T4Expressions.obn b/tests/obnc/passing/T4Expressions.obn index c89eb11..366080d 100644 --- a/tests/obnc/passing/T4Expressions.obn +++ b/tests/obnc/passing/T4Expressions.obn @@ -73,9 +73,9 @@ module T4Expressions; begin a := 4; b := 6; -Out.Int(ORD({1, 2, a, 5, b, 8}), 0); Out.Ln; -Out.Int(ORD({1, 2, a..b, 8}), 0); Out.Ln; -Out.Int(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; +Out.Integer(ORD({1, 2, a, 5, b, 8}), 0); Out.Ln; +Out.Integer(ORD({1, 2, a..b, 8}), 0); Out.Ln; +Out.Integer(ORD({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln; ASSERT({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}); i := 0; j := 0;