gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e5a96da)
raw | patch | inline | side by side (parent: e5a96da)
author | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 12 Feb 2014 17:40:19 +0000 (18:40 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 12 Feb 2014 17:40:19 +0000 (18:40 +0100) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index 129cebf91bf2cf79e947116ec09abeaf44a4e694..8ee7852c13a9ff67570e5db945b44caeca8fa0b9 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
"C:\" This file automatically converted from microjava bytecode\";\n"
+"C:\" with mjc2wsl v "+versionN+"\";\n");
+ ret.append("BEGIN ");
ret.append("VAR < tempa := 0, tempb := 0, tempres :=0,\n\t");
ret.append("mjvm_locals := ARRAY(1,0), ");
ret.append("\n\tmjvm_statics := ARRAY("+numWords+",0), ");
}
public String createStandardEnd(){
- return "SKIP\nENDVAR";
+ StringBuilder ret = new StringBuilder("SKIP\nENDVAR");
+ ret.append("\nWHERE\n");
+
+ ret.append("\nPROC Print_MJ(val, format VAR)==\n");
+ ret.append(createComment("print spacing", C_SPEC));
+
+ ret.append("\n\tIF format>1 THEN\n\t\tFOR i:=2 TO ");
+ ret.append("format STEP 1 DO PRINFLUSH(\" \") OD\n");
+ ret.append("\tFI;\n\tPRINFLUSH(val)\nEND\n");
+
+ ret.append("\nEND\n");
+
+ return ret.toString();
}
private String createLocal(int i) {
case print: {
// TODO printing numbers needs different lengths of spacing
prl(createTopTwoEStack());
- pr(createComment("print spacing", C_SPEC));
- prl("IF tempa>1 THEN FOR i:=2 TO tempa STEP 1 DO PRINFLUSH(\" \") OD FI;");
- prl("PRINFLUSH(tempb);");
+ prl("Print_MJ(tempb,tempa);");
break;
}