]> git.mdlowis.com Git - proto/obnc.git/commitdiff
ABS to Abs
authormike lowis <mike@mdlowis.com>
Sat, 10 Apr 2021 00:36:05 +0000 (20:36 -0400)
committermike lowis <mike@mdlowis.com>
Sat, 10 Apr 2021 00:36:05 +0000 (20:36 -0400)
lib/obnc/FilesTest.obn
lib/obnc/MathTest.obn
src/Oberon.y
src/Table.c
src/y.tab.c
tests/obnc/passing/T4Expressions.obn
tests/obnc/passing/T5Statements.obn
tests/obnc/passing/T7Modules.obn

index 2388e2c0750d85337ff69d4ed17c4cdcc1f53edd..65e0a7546f4e9114995c8f8ba26cba5249c76475 100644 (file)
@@ -272,10 +272,10 @@ module FilesTest;
                Files.SetPos(r, f, 0);
                Files.ReadReal(r, x);
                Assert(~r.eof);
-               Assert(ABS(x - 3.14) < 1.0E-6);
+               Assert(Abs(x - 3.14) < 1.0E-6);
                Files.ReadReal(r, x);
                Assert(~r.eof);
-               Assert(ABS(x - (-3.14)) < 1.0E-6);
+               Assert(Abs(x - (-3.14)) < 1.0E-6);
                Files.ReadReal(r, x);
                Assert(r.eof)
        end TestReadWriteReal;
index d192ffd338043a350472211cc6e475f4d0ccb03a..3058518186417f962c4c985efc1a15bfca113a95 100644 (file)
@@ -23,72 +23,72 @@ module MathTest;
                eps = 0.01;
 
 begin
-       Assert(ABS(Math.sqrt(1.0) - 1.0) < eps);
-       Assert(ABS(Math.sqrt(4.0) - 2.0) < eps);
+       Assert(Abs(Math.sqrt(1.0) - 1.0) < eps);
+       Assert(Abs(Math.sqrt(4.0) - 2.0) < eps);
 
-       Assert(ABS(Math.power(0.0, 1.0) - 0.0) < eps);
-       Assert(ABS(Math.power(1.0, 0.0) - 1.0) < eps);
-       Assert(ABS(Math.power(2.0, 3.0) - 8.0) < eps);
-       Assert(ABS(Math.power(2.0, -3.0) - 1.0 / 8.0) < eps);
+       Assert(Abs(Math.power(0.0, 1.0) - 0.0) < eps);
+       Assert(Abs(Math.power(1.0, 0.0) - 1.0) < eps);
+       Assert(Abs(Math.power(2.0, 3.0) - 8.0) < eps);
+       Assert(Abs(Math.power(2.0, -3.0) - 1.0 / 8.0) < eps);
 
-       Assert(ABS(Math.exp(0.0) - 1.0) < eps);
-       Assert(ABS(Math.exp(1.0) - Math.e) < eps);
-       Assert(ABS(Math.exp(2.0) - Math.e * Math.e) < eps);
-       Assert(ABS(Math.exp(-2.0) - 1.0 / Math.e / Math.e) < eps);
+       Assert(Abs(Math.exp(0.0) - 1.0) < eps);
+       Assert(Abs(Math.exp(1.0) - Math.e) < eps);
+       Assert(Abs(Math.exp(2.0) - Math.e * Math.e) < eps);
+       Assert(Abs(Math.exp(-2.0) - 1.0 / Math.e / Math.e) < eps);
 
-       Assert(ABS(Math.ln(1.0) - 0.0) < eps);
-       Assert(ABS(Math.ln(Math.e) - 1.0) < eps);
-       Assert(ABS(Math.ln(Math.e * Math.e) - 2.0) < eps);
+       Assert(Abs(Math.ln(1.0) - 0.0) < eps);
+       Assert(Abs(Math.ln(Math.e) - 1.0) < eps);
+       Assert(Abs(Math.ln(Math.e * Math.e) - 2.0) < eps);
 
-       Assert(ABS(Math.log(1.0, 2.0) - 0.0) < eps);
-       Assert(ABS(Math.log(Math.e, Math.e) - 1.0) < eps);
-       Assert(ABS(Math.log(100.0, 10.0) - 2.0) < eps);
+       Assert(Abs(Math.log(1.0, 2.0) - 0.0) < eps);
+       Assert(Abs(Math.log(Math.e, Math.e) - 1.0) < eps);
+       Assert(Abs(Math.log(100.0, 10.0) - 2.0) < eps);
 
-       Assert(ABS(Math.round(0.4) - 0.0) < eps);
-       Assert(ABS(Math.round(-0.4) - 0.0) < eps);
-       Assert(ABS(Math.round(0.6) - 1.0) < eps);
-       Assert(ABS(Math.round(-0.6) - (-1.0)) < eps);
+       Assert(Abs(Math.round(0.4) - 0.0) < eps);
+       Assert(Abs(Math.round(-0.4) - 0.0) < eps);
+       Assert(Abs(Math.round(0.6) - 1.0) < eps);
+       Assert(Abs(Math.round(-0.6) - (-1.0)) < eps);
 
-       Assert(ABS(Math.sin(0.0) - 0.0) < eps);
-       Assert(ABS(Math.sin(Math.pi / 6.0) - 0.5) < eps);
-       Assert(ABS(Math.sin(Math.pi / 2.0) - 1.0) < eps);
+       Assert(Abs(Math.sin(0.0) - 0.0) < eps);
+       Assert(Abs(Math.sin(Math.pi / 6.0) - 0.5) < eps);
+       Assert(Abs(Math.sin(Math.pi / 2.0) - 1.0) < eps);
 
-       Assert(ABS(Math.cos(0.0) - 1.0) < eps);
-       Assert(ABS(Math.cos(Math.pi / 3.0) - 0.5) < eps);
-       Assert(ABS(Math.cos(Math.pi / 2.0) - 0.0) < eps);
+       Assert(Abs(Math.cos(0.0) - 1.0) < eps);
+       Assert(Abs(Math.cos(Math.pi / 3.0) - 0.5) < eps);
+       Assert(Abs(Math.cos(Math.pi / 2.0) - 0.0) < eps);
 
-       Assert(ABS(Math.tan(0.0) - 0.0) < eps);
-       Assert(ABS(Math.tan(Math.pi / 4.0) - 1.0) < eps);
+       Assert(Abs(Math.tan(0.0) - 0.0) < eps);
+       Assert(Abs(Math.tan(Math.pi / 4.0) - 1.0) < eps);
 
-       Assert(ABS(Math.arcsin(0.0) - 0.0) < eps);
-       Assert(ABS(Math.arcsin(0.5) - Math.pi / 6.0) < eps);
-       Assert(ABS(Math.arcsin(1.0) - Math.pi / 2.0) < eps);
+       Assert(Abs(Math.arcsin(0.0) - 0.0) < eps);
+       Assert(Abs(Math.arcsin(0.5) - Math.pi / 6.0) < eps);
+       Assert(Abs(Math.arcsin(1.0) - Math.pi / 2.0) < eps);
 
-       Assert(ABS(Math.arccos(1.0) - 0.0) < eps);
-       Assert(ABS(Math.arccos(0.5) - Math.pi / 3.0) < eps);
-       Assert(ABS(Math.arccos(0.0) - Math.pi / 2.0) < eps);
+       Assert(Abs(Math.arccos(1.0) - 0.0) < eps);
+       Assert(Abs(Math.arccos(0.5) - Math.pi / 3.0) < eps);
+       Assert(Abs(Math.arccos(0.0) - Math.pi / 2.0) < eps);
 
-       Assert(ABS(Math.arctan(0.0) - 0.0) < eps);
-       Assert(ABS(Math.arctan(1.0) - Math.pi / 4.0) < eps);
+       Assert(Abs(Math.arctan(0.0) - 0.0) < eps);
+       Assert(Abs(Math.arctan(1.0) - Math.pi / 4.0) < eps);
 
-       Assert(ABS(Math.arctan2(0.0, 2.0) - 0.0) < eps);
-       Assert(ABS(Math.arctan2(2.0, 2.0) - Math.pi / 4.0) < eps);
+       Assert(Abs(Math.arctan2(0.0, 2.0) - 0.0) < eps);
+       Assert(Abs(Math.arctan2(2.0, 2.0) - Math.pi / 4.0) < eps);
 
-       Assert(ABS(Math.sinh(0.0) - 0.0) < eps);
-       Assert(ABS(Math.sinh(1.0) - (Math.e - 1.0 / Math.e) / 2.0) < eps);
+       Assert(Abs(Math.sinh(0.0) - 0.0) < eps);
+       Assert(Abs(Math.sinh(1.0) - (Math.e - 1.0 / Math.e) / 2.0) < eps);
 
-       Assert(ABS(Math.cosh(0.0) - 1.0) < eps);
-       Assert(ABS(Math.cosh(1.0) - (Math.e + 1.0 / Math.e) / 2.0) < eps);
+       Assert(Abs(Math.cosh(0.0) - 1.0) < eps);
+       Assert(Abs(Math.cosh(1.0) - (Math.e + 1.0 / Math.e) / 2.0) < eps);
 
-       Assert(ABS(Math.tanh(0.0) - 0.0) < eps);
-       Assert(ABS(Math.tanh(1.0) - (Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) < eps);
+       Assert(Abs(Math.tanh(0.0) - 0.0) < eps);
+       Assert(Abs(Math.tanh(1.0) - (Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) < eps);
 
-       Assert(ABS(Math.arcsinh(0.0) - 0.0) < eps);
-       Assert(ABS(Math.arcsinh((Math.e - 1.0 / Math.e) / 2.0) - 1.0) < eps);
+       Assert(Abs(Math.arcsinh(0.0) - 0.0) < eps);
+       Assert(Abs(Math.arcsinh((Math.e - 1.0 / Math.e) / 2.0) - 1.0) < eps);
 
-       Assert(ABS(Math.arccosh(1.0) - 0.0) < eps);
-       Assert(ABS(Math.arccosh((Math.e + 1.0 / Math.e) / 2.0) - 1.0) < eps);
+       Assert(Abs(Math.arccosh(1.0) - 0.0) < eps);
+       Assert(Abs(Math.arccosh((Math.e + 1.0 / Math.e) / 2.0) - 1.0) < eps);
 
-       Assert(ABS(Math.arctanh(0.0) - 0.0) < eps);
-       Assert(ABS(Math.arctanh((Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) - 1.0) < eps)
+       Assert(Abs(Math.arctanh(0.0) - 0.0) < eps);
+       Assert(Abs(Math.arctanh((Math.e - 1.0 / Math.e) / (Math.e + 1.0 / Math.e)) - 1.0) < eps)
 end MathTest.
index f917c26bfef45b2c0db7eb8d08deceb7c87535c4..9da65dc52447e6c6f6e69b628ffa4a65c89a5b4f 100644 (file)
@@ -3588,7 +3588,7 @@ static OBNC_INTEGER TypeSize(Trees_Node type)
 static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expList, int isFunctionCall)
 {
        static const struct { const char *name; int symbol; } symbols[] = {
-               {"ABS", TREES_ABS_PROC},
+               {"Abs", TREES_ABS_PROC},
                {"AsChar", TREES_CHR_PROC},
                {"AsInt", TREES_ORD_PROC},
                {"AsReal", TREES_FLT_PROC},
index d11e94c70d10417fc3cb059d81766d454edcd07b..a52d1029acbd3a65cb7796152b52d4e3ba3f18ad 100644 (file)
@@ -87,7 +87,7 @@ void Table_Init(void)
 
 */
        static const struct { const char *name; int kind, type; } predecIdents[] = {
-               {"ABS", TREES_PROCEDURE_KIND, TREES_ABS_PROC},       /* Remove */
+               {"Abs", TREES_PROCEDURE_KIND, TREES_ABS_PROC},       /* Remove */
                {"AsChar", TREES_PROCEDURE_KIND, TREES_CHR_PROC},
                {"AsInt", TREES_PROCEDURE_KIND, TREES_ORD_PROC},
                {"AsReal", TREES_PROCEDURE_KIND, TREES_FLT_PROC},
index 2843ea3ee970380c6f202def0df6db6522e399ff..eedbf5478792608adac4edcd4bc9df0b498ff98c 100644 (file)
@@ -5566,7 +5566,7 @@ static OBNC_INTEGER TypeSize(Trees_Node type)
 static Trees_Node PredeclaredProcedureAST(const char procName[], Trees_Node expList, int isFunctionCall)
 {
        static const struct { const char *name; int symbol; } symbols[] = {
-               {"ABS", TREES_ABS_PROC},
+               {"Abs", TREES_ABS_PROC},
                {"AsChar", TREES_CHR_PROC},
                {"AsInt", TREES_ORD_PROC},
                {"AsReal", TREES_FLT_PROC},
index b4835e8c00ba8091dd2dc843d67f1f3e16960f82..cfd2d8e617bf0a216e7bea50c50b37272f7f60f3 100644 (file)
@@ -54,7 +54,7 @@ module T4Expressions;
                Assert(A[1, 2] = A[1][2]);
                i := 0;
                j := 0;
-               A[0, 0] := ABS(A[IncReturnZero(i), IncReturnZero(j)]);
+               A[0, 0] := Abs(A[IncReturnZero(i), IncReturnZero(j)]);
                Assert(i = 1);
                Assert(j = 1);
 
@@ -378,7 +378,7 @@ Out.Integer(AsInt({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln;
        procedure TestPredeclaredFunctionProcedures;
                const eps = 0.01;
                        (*make sure function procedures with constant parameters are constant expressions*)
-                       absConst = ABS(0);
+                       absConst = Abs(0);
                        floorConst = Floor(eps);
                        fltConst = AsReal(0);
                        ordConst = AsInt(true);
@@ -392,14 +392,14 @@ Out.Integer(AsInt({1, 2, a, 5, b, 8} = {1, 2, a..b, 8}), 0); Out.Ln;
                        x: Byte;
                        s: Set;
        begin
-               Assert(ABS(-1) = 1);
-               Assert(ABS(0) = 0);
-               Assert(ABS(1) = 1);
-               Assert(ABS(-1.0) = 1.0);
-               Assert(ABS(0.0) = 0.0);
-               Assert(ABS(1.0) = 1.0);
+               Assert(Abs(-1) = 1);
+               Assert(Abs(0) = 0);
+               Assert(Abs(1) = 1);
+               Assert(Abs(-1.0) = 1.0);
+               Assert(Abs(0.0) = 0.0);
+               Assert(Abs(1.0) = 1.0);
                i := 0;
-               j := ABS(IncReturnZero(i) - 1);
+               j := Abs(IncReturnZero(i) - 1);
                Assert(j = 1);
                Assert(i = 1);
 
index 7c99899e3e1b703f57d828c1d83a777bd3538e53..510a632f99c1dd46ae7dd3b398bdca8e825afd3f 100644 (file)
@@ -159,7 +159,7 @@ module T5Statements;
                s.y := 0.0;
                r.x := 0.0;
                P(c);
-               Assert(ABS(c.r - 1.0) < eps);
+               Assert(Abs(c.r - 1.0) < eps);
 
                r.x := 1.0;
                s := r;
index d780e15903c3e4a729c4446a067025516abb5651..af82bb26c3834248c5fa4d66a430e371e8f53ea6 100644 (file)
@@ -57,7 +57,7 @@ begin
        Assert(A.boolVar = A.boolConst);
        Assert(A.charVar = A.charConst);
        Assert(A.intVar = A.intConst);
-       Assert(ABS(A.realVar - A.realConst) < 1.0E-6);
+       Assert(Abs(A.realVar - A.realConst) < 1.0E-6);
        Assert(A.strVar = A.strConst);
        Assert(A.setVar = A.setConst);
        Assert(A.recVar.f = 1);