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: eedb339)
raw | patch | inline | side by side (parent: eedb339)
author | Doni Pracner <quinnuendo@gmail.com> | |
Mon, 23 Dec 2013 14:38:47 +0000 (15:38 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Mon, 23 Dec 2013 14:38:47 +0000 (15:38 +0100) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index b7edf0bec3d47fd6718b2dff997ae57c90e01bb8..ee36c5188cf5d9f791352cd67249c4083c0dc43b 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
private boolean originalInComments = false;
+ private HashMap<Integer,String> opMap = null;
+
+ private String opCodeFile = "mj-bytecodes.properties";
+
+ private HashMap<Integer,String> getOpMap() {
+ if (opMap==null) {
+ opMap = new HashMap<Integer, String> (60, 0.98f);
+ try{
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(getClass().getResourceAsStream(opCodeFile)));
+ String str = in.readLine();
+ while (str != null) {
+ String[] ss = str.split("=");
+ opMap.put(Integer.parseInt(ss[0]),ss[1]);
+ str = in.readLine();
+ }
+ in.close();
+ }catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ return opMap;
+ }
+
+ public String getOpString(int op) {
+ return getOpMap().get(op);
+ }
+
+ public String describeOpCode(int op) {
+ return op + " (" + getOpString(op) + ")";
+ }
+
private InputStream mainIn;
private PrintWriter out = null;
private int counter = -1;
int op = get();
while (op >= 0) {
if (originalInComments)
- prl(createComment("" + op, C_OC));
+ prl(createComment(describeOpCode(op), C_OC));
prl("a" + counter + " == ");
switch (op) {
case load: {