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: c71486b)
raw | patch | inline | side by side (parent: c71486b)
author | Doni Pracner <quinnuendo@gmail.com> | |
Sat, 26 Jul 2014 18:52:21 +0000 (20:52 +0200) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Sat, 26 Jul 2014 18:52:21 +0000 (20:52 +0200) |
src/mjc2wsl.java | patch | blob | history |
diff --git a/src/mjc2wsl.java b/src/mjc2wsl.java
index 14cc9e415809c6cc591e4b4bc8e187e72d1e282e..4723e4d7188758aa7fec99484ac4b818de92abc2 100644 (file)
--- a/src/mjc2wsl.java
+++ b/src/mjc2wsl.java
* @author Doni Pracner, http://perun.dmi.rs/pracner http://quemaster.com
*/
public class mjc2wsl{
- public static String versionN = "0.1.7";
+ //default version name, used if the file is not found
+ private static String versionN = "0.1.x";
+ private String versionFile = "version.properties";
+
private TransMessages messages = new TransMessages();
private boolean genPauseAfterEachAddress=false,
return opMap;
}
+ private Properties versionData;
+
+ private String getVersion() {
+ if (versionData == null) {
+ versionData = new Properties();
+ try {
+ versionData.load(getClass().getResourceAsStream(versionFile));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ String ver = versionData.getProperty("version");
+ if (ver != null)
+ return ver;
+ else
+ return versionN;
+ }
+
public String getOpString(int op) {
return getOpMap().get(op);
}
public String createStandardStart(int numWords){
StringBuilder ret = new StringBuilder(
"C:\" This file automatically converted from microjava bytecode\";\n"
- +"C:\" with mjc2wsl v "+versionN+"\";\n");
+ +"C:\" with mjc2wsl v "+getVersion()+"\";\n");
ret.append("\nBEGIN");
ret.append("\nVAR <\n\t");
}
public void printVersion() {
- System.out.println("MicroJava bytecode to WSL converter. v " + versionN
+ System.out.println("MicroJava bytecode to WSL converter. v " + getVersion()
+ ", by Doni Pracner");
}