From 469fd633206fe0f9bf6b39715bd42803c5fc70c3 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Sat, 28 Apr 2018 13:00:20 +0200 Subject: [PATCH] Renamed modulus to modulo --- src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java | 2 +- .../operators/{OperatorModulus.java => OperatorModulo.java} | 6 +++--- .../java/dk/camelot64/kickc/model/operators/Operators.java | 4 ++-- .../dk/camelot64/kickc/passes/Pass3AssertNoMulDivMod.java | 6 +++--- src/test/java/dk/camelot64/kickc/test/TestPrograms.java | 4 ++-- .../java/dk/camelot64/kickc/test/kc/c64dtv-gfxexplorer.kc | 4 ++-- .../kickc/test/kc/{no-rem-runtime.kc => no-mod-runtime.kc} | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/dk/camelot64/kickc/model/operators/{OperatorModulus.java => OperatorModulo.java} (90%) rename src/test/java/dk/camelot64/kickc/test/kc/{no-rem-runtime.kc => no-mod-runtime.kc} (64%) diff --git a/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java b/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java index a0283cdc7..ad1f264dd 100644 --- a/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java +++ b/src/main/java/dk/camelot64/kickc/fragment/AsmFormat.java @@ -70,7 +70,7 @@ public class AsmFormat { * @return */ private static String getAsmConstantBinary(Program program, ConstantValue left, OperatorBinary operator, ConstantValue right, ScopeRef codeScope) { - if(Operators.MODULUS.equals(operator)) { + if(Operators.MODULO.equals(operator)) { // Remainder operator % not supported by KickAss - use modulo function instead return "mod("+ getAsmConstant(program, left, operator.getPrecedence(), codeScope) + diff --git a/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulus.java b/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java similarity index 90% rename from src/main/java/dk/camelot64/kickc/model/operators/OperatorModulus.java rename to src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java index 4ae7c361d..c26e36089 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulus.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/OperatorModulo.java @@ -6,10 +6,10 @@ import dk.camelot64.kickc.model.values.ConstantInteger; import dk.camelot64.kickc.model.values.ConstantLiteral; import dk.camelot64.kickc.model.values.ConstantPointer; -/** Numeric modulus operator ie. remainder after division ( x % y ) */ -public class OperatorModulus extends OperatorBinary { +/** Numeric modulo operator ie. remainder after division ( x % y ) */ +public class OperatorModulo extends OperatorBinary { - public OperatorModulus(int precedence) { + public OperatorModulo(int precedence) { super("%", "_mod_", precedence); } diff --git a/src/main/java/dk/camelot64/kickc/model/operators/Operators.java b/src/main/java/dk/camelot64/kickc/model/operators/Operators.java index 1c2dbe441..94aba1916 100644 --- a/src/main/java/dk/camelot64/kickc/model/operators/Operators.java +++ b/src/main/java/dk/camelot64/kickc/model/operators/Operators.java @@ -30,7 +30,7 @@ public class Operators { public static final OperatorUnary CAST_BOOL= new OperatorCastBool(2); public static final OperatorBinary MULTIPLY = new OperatorMultiply(3); public static final OperatorBinary DIVIDE = new OperatorDivide(3); - public static final OperatorBinary MODULUS = new OperatorModulus(3); + public static final OperatorBinary MODULO = new OperatorModulo(3); public static final OperatorBinary PLUS = new OperatorPlus(4); public static final OperatorBinary MINUS = new OperatorMinus(4); public static final OperatorBinary SHIFT_LEFT = new OperatorShiftLeft(5); @@ -60,7 +60,7 @@ public class Operators { case "/": return DIVIDE; case "%": - return MODULUS; + return MODULO; case "==": return EQ; case "!=": diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass3AssertNoMulDivMod.java b/src/main/java/dk/camelot64/kickc/passes/Pass3AssertNoMulDivMod.java index 81120abda..f45b2d330 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass3AssertNoMulDivMod.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass3AssertNoMulDivMod.java @@ -8,7 +8,7 @@ import dk.camelot64.kickc.model.statements.Statement; import dk.camelot64.kickc.model.statements.StatementAssignment; /** - * Assert that no the code has no multiply/divide/modulus operators left. + * Assert that no the code has no multiply/divide/modulo operators left. */ public class Pass3AssertNoMulDivMod extends Pass2SsaAssertion { @@ -28,8 +28,8 @@ public class Pass3AssertNoMulDivMod extends Pass2SsaAssertion { if(Operators.DIVIDE.equals(assignment.getOperator())) { throw new CompileError("ERROR! Runtime division not supported. "+statement.toString(getProgram(), false)); } - if(Operators.MODULUS.equals(assignment.getOperator())) { - throw new CompileError("ERROR! Runtime modulus not supported. "+statement.toString(getProgram(), false)); + if(Operators.MODULO.equals(assignment.getOperator())) { + throw new CompileError("ERROR! Runtime modulo not supported. "+statement.toString(getProgram(), false)); } } diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index a3c6ed55c..6c40e126b 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -800,8 +800,8 @@ public class TestPrograms { } @Test - public void testNoRemRuntime() throws IOException, URISyntaxException { - assertError("no-rem-runtime", "Runtime modulus not supported"); + public void testNoModRuntime() throws IOException, URISyntaxException { + assertError("no-mod-runtime", "Runtime modulo not supported"); } diff --git a/src/test/java/dk/camelot64/kickc/test/kc/c64dtv-gfxexplorer.kc b/src/test/java/dk/camelot64/kickc/test/kc/c64dtv-gfxexplorer.kc index 39b6e692d..c115160fe 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/c64dtv-gfxexplorer.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/c64dtv-gfxexplorer.kc @@ -123,13 +123,13 @@ byte[] FORM_TEXT = " bmm 0 pattern p0 screen s0 @" + " mcm 0 start 00 gfx g0 @" + " ecm 0 step 00 colors c0 @" + - " hicolor 0 modulus 00 @" + + " hicolor 0 modulo 00 @" + " linear 0 COLORS @" + " color off 0 PLANE B palet 0 @" + " chunky 0 pattern p0 bgcol0 00 @" + " border off 0 start 00 bgcol1 00 @" + " overscan 0 step 00 bgcol2 00 @" + - " modulus 00 bgcol3 00 @" + + " modulo 00 bgcol3 00 @" + "@" ; byte[] FORM_COLS = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@" + diff --git a/src/test/java/dk/camelot64/kickc/test/kc/no-rem-runtime.kc b/src/test/java/dk/camelot64/kickc/test/kc/no-mod-runtime.kc similarity index 64% rename from src/test/java/dk/camelot64/kickc/test/kc/no-rem-runtime.kc rename to src/test/java/dk/camelot64/kickc/test/kc/no-mod-runtime.kc index c3812f1e1..0b651022e 100644 --- a/src/test/java/dk/camelot64/kickc/test/kc/no-rem-runtime.kc +++ b/src/test/java/dk/camelot64/kickc/test/kc/no-mod-runtime.kc @@ -1,4 +1,4 @@ -// Test that remainder at runtime gives a proper error +// Test that modulo at runtime gives a proper error void main() { byte* screen = $400;