gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control systemdiff --git a/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java b/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java
int numberOfWords;
private int codesize;
- public MicroJavaInput() {
-
+ public MicroJavaInput(InputStream input) throws Exception {
+ mainIn = input;
+ processHeader();
}
public int get() {
return (get2() << 16) + (get2() << 16 >>> 16);
}
- public void processHeader(mjc2wsl mjc2wsl) throws Exception {
+ public void processHeader() throws Exception {
byte m = (byte) get();
byte j = (byte) get();
if (m != 'M' || j != 'J')
throw new Exception("Wrong start of bytecode file");
codesize = get4();
- setNumberOfWords(get4());
- setMainAdr(get4());
+ this.numberOfWords = get4();
+ this.mainAdr = get4();
}
- public void setStream(InputStream ins) {
- mainIn = ins;
- }
public int getCounter() {
return counter;
return codesize;
}
- public int getMainAdr(mjc2wsl mjc2wsl) {
+ public int getMainAdr() {
return mainAdr;
}
- public int getNumberOfWords(mjc2wsl mjc2wsl) {
+ public int getNumberOfWords() {
return numberOfWords;
}
- void setNumberOfWords(int numberOfWords) {
- this.numberOfWords = numberOfWords;
- }
-
- void setMainAdr(int mainAdr) {
- this.mainAdr = mainAdr;
- }
-
String getRelationFor(int opcode) throws Exception {
switch (opcode) {
- case mjc2wsl.jeq:
+ case Mjc2wsl.jeq:
return "=";
- case mjc2wsl.jne:
+ case Mjc2wsl.jne:
return "<>";
- case mjc2wsl.jlt:
+ case Mjc2wsl.jlt:
return "<";
- case mjc2wsl.jle:
+ case Mjc2wsl.jle:
return "<=";
- case mjc2wsl.jgt:
+ case Mjc2wsl.jgt:
return ">";
- case mjc2wsl.jge:
+ case Mjc2wsl.jge:
return ">=";
}
throw new Exception("Wrong opcode for a relation");
}
boolean isJumpCode(int opcode) {
- return (opcode >= mjc2wsl.jmp) && (opcode <= mjc2wsl.jge);
+ return (opcode >= Mjc2wsl.jmp) && (opcode <= Mjc2wsl.jge);
}
private HashMap<Integer, String> getOpMap() {