gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mjc2wsl, correct 'not equal' symbol for WSL
[mjc2wsl.git] / src / mjc2wsl.java
index 521be05..b807bc8 100644 (file)
@@ -189,7 +189,7 @@ public class mjc2wsl{
        private String getRelationFor(int opcode) throws Exception {
                        switch (opcode) {
                                        case jeq: return "=";
-                                       case jne: return "#";
+                                       case jne: return "<>";
                                        case jlt: return "<";
                                        case jle: return "<=";
                                        case jgt: return ">";
@@ -273,9 +273,29 @@ public class mjc2wsl{
                                prl(cmdToEStack("tempres"));
                                break;
                        }
+                       case sub: {
+                               prl(getTopTwo());
+                               prl("tempres := tempb - tempa;");
+                               prl(cmdToEStack("tempres"));
+                               break;
+                       }
+                       case mul: {
+                               prl(getTopTwo());
+                               prl("tempres := tempb * tempa;");
+                               prl(cmdToEStack("tempres"));
+                               break;
+                       }
                        case div: {
                                prl(getTopTwo());
-                               prl("tempres := tempb / tempa;");
+                               prl("IF tempa = 0 THEN ERROR(\"division by zero\") FI;");
+                               prl("tempres := tempb DIV tempa;");
+                               prl(cmdToEStack("tempres"));
+                               break;
+                       }
+                       case rem: {
+                               prl(getTopTwo());
+                               prl("IF tempa = 0 THEN ERROR(\"division by zero\") FI;");
+                               prl("tempres := tempb MOD tempa;");
                                prl(cmdToEStack("tempres"));
                                break;
                        }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner