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: 8283489)
raw | patch | inline | side by side (parent: 8283489)
author | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 8 Jan 2014 21:31:08 +0000 (22:31 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 8 Jan 2014 21:31:08 +0000 (22:31 +0100) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index 1b31bbae3bdcdb92af2861b96a0b75d4e5730775..d098bd8e2069d97e23df332a754c6e835aa487b8 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
+"C:\" with mjc2wsl v "+versionN+"\";\n");
ret.append("VAR < tempa := 0, tempb := 0, tempres :=0,\n\t");
- for (int i = 0; i <= 3; i++)
- ret.append(loc(i) + " := 0, ");
+ ret.append("mjvm_locals := ARRAY(1,0), ");
ret.append("\n mjvm_estack := < >, mjvm_mstack := < >, ");
ret.append("\n mjvm_fp := 0, mjvm_sp := 0,");
ret.append("\n t_e_m_p := 0 > :");
}
private String loc(int i){
- return "mjvm_loc" + i;
+ //arrays start at 1 in WSL, so we need an offset
+ return "mjvm_locals[" + (i+1)+"]";
}
/**
break;
}
case enter: {
- prl(createComment("enter not fully procesed yet"));
- message("enter not fully procesed yet", M_WAR);
int parameters = get();
- get();
+ int locals = get();
+ prl(cmdToMStack("mjvm_locals"));
+ prl("mjvm_locals := ARRAY("+locals+",0);");
for (int i = parameters-1; i >= 0; i--)
prl(cmdFromEStack(loc(i)));
break;
}
case exit: {
- prl(createComment("exit not fully procesed yet"));
- message("exit not fully procesed yet", M_WAR);
+ prl(cmdFromMStack("mjvm_locals"));
break;
}