X-Git-Url: http://svarog.pmf.uns.ac.rs/gitweb/?p=mjc2wsl.git;a=blobdiff_plain;f=src%2Fcom%2Fquemaster%2Ftransformations%2Fmjc2wsl%2FMicroJavaInput.java;h=3dd6157bad20e90693c44a6941816ad31c760d55;hp=4f5e45accea689d7ddd85ab8a1bda57965e8d0a7;hb=8684ef3ea2d843b29bf54b2078d2e0d17498f0f3;hpb=215cc953e6fd7896f0876c66d0de1428d8d1ba7b diff --git a/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java b/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java index 4f5e45a..3dd6157 100644 --- a/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java +++ b/src/com/quemaster/transformations/mjc2wsl/MicroJavaInput.java @@ -1,7 +1,7 @@ package com.quemaster.transformations.mjc2wsl; /* - Copyright (C) 2014 Doni Pracner + Copyright (C) 2014,2015,2018 Doni Pracner This file is part of mjc2wsl. @@ -35,8 +35,9 @@ public class MicroJavaInput { int numberOfWords; private int codesize; - public MicroJavaInput() { - + public MicroJavaInput(InputStream input) throws Exception { + mainIn = input; + processHeader(); } public int get() { @@ -60,19 +61,16 @@ public class MicroJavaInput { 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; @@ -82,22 +80,14 @@ public class MicroJavaInput { 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: