gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mjc2wsl - shr and shl added
authorDoni Pracner <quinnuendo@gmail.com>
Mon, 20 Jan 2014 21:54:05 +0000 (22:54 +0100)
committerDoni Pracner <quinnuendo@gmail.com>
Mon, 20 Jan 2014 21:54:05 +0000 (22:54 +0100)
src/mjc2wsl.java

index 274bb7e448cd0d90f883ecab19e0093b868ac04a..1682978fd688923fab5f6962073fe3dc93bc377f 100644 (file)
@@ -437,8 +437,24 @@ public class mjc2wsl{
                                prl(cmdToEStack("-tempa"));
                                break;
                        }                       
-                       //TODO shl, shr
-                       
+
+                       case shl  : {
+                               prl(getTopTwo());
+                               prl("VAR <tempres :=tempb, i:=1 >:");
+                               prl("\tFOR i:=1 TO tempa STEP 1 DO tempres := tempres * 2 OD;");
+                               prl(cmdToEStack("tempres"));
+                               prl("ENDVAR;");
+                               break;
+                       }
+                       case shr  : {
+                               prl(getTopTwo());
+                               prl("VAR <tempres :=tempb, i:=1 >:");
+                               prl("\tFOR i:=1 TO tempa STEP 1 DO tempres := tempres DIV 2 OD;");
+                               prl(cmdToEStack("tempres"));
+                               prl("ENDVAR;");
+                               break;
+                       }
+
                        case inc  : {
                                int b1 = get(), b2 = get();
                                prl(loc(b1)+" := " +loc(b1)+" + "+b2+";");
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner