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: 187580f)
raw | patch | inline | side by side (parent: 187580f)
author | Doni Pracner <quinnuendo@gmail.com> | |
Tue, 26 Nov 2013 19:47:20 +0000 (20:47 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Tue, 26 Nov 2013 19:47:20 +0000 (20:47 +0100) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index 4a30186c26ffc1c0526f291014591f44b40118d7..521be052fffd8f23a56a4537793fc4a85227245d 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
private String getTop() {
return cmdFromEStack("tempa");
}
+
+ private String getRelationFor(int opcode) throws Exception {
+ switch (opcode) {
+ case jeq: return "=";
+ case jne: return "#";
+ case jlt: return "<";
+ case jle: return "<=";
+ case jgt: return ">";
+ case jge: return ">=";
+ }
+ throw new Exception("Wrong opcode for a relation");
+ }
- public void convertStream(InputStream ins){
+ public void convertStream(InputStream ins) throws Exception{
mainIn = ins;
//skip start TODO make better
for (int i = 0; i < 14; i++)
case jgt:
case jge: {
prl(getTopTwo());
- prl("IF tempb >= tempa THEN CALL a" + (counter + get2())
+ prl("IF tempb "+ getRelationFor(op)
+ +" tempa THEN CALL a" + (counter + get2())
+ " FI;");
break;
}