Skip to content
Snippets Groups Projects
Commit 67618352 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

more minor refactoring

parent 69cb93b4
Branches
Tags
No related merge requests found
...@@ -273,12 +273,12 @@ public class LabComm { ...@@ -273,12 +273,12 @@ public class LabComm {
cIncludes.add(hFile); cIncludes.add(hFile);
} }
if (cFile != null) { if (cFile != null) {
if (verbose) { System.err.println("Generating C: " + cFile); } printStatus("C: " , cFile);
genC(ast, cFile, cIncludes, coreName, cPrefix, ver); genC(ast, cFile, cIncludes, coreName, cPrefix, ver);
wroteFile = true; wroteFile = true;
} }
if (hFile != null) { if (hFile != null) {
if (verbose) { System.err.println("Generating H: " + hFile); } printStatus("H: " , hFile);
genH(ast, hFile, hIncludes, coreName, cPrefix, ver); genH(ast, hFile, hIncludes, coreName, cPrefix, ver);
wroteFile = true; wroteFile = true;
} }
...@@ -288,7 +288,7 @@ public class LabComm { ...@@ -288,7 +288,7 @@ public class LabComm {
boolean generateCS(Program ast) { boolean generateCS(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (csFile != null) { if (csFile != null) {
if (verbose) { System.err.println("Generating C#: " + csFile); } printStatus("C#: " , csFile);
genCS(ast, csFile, csNamespace, ver); genCS(ast, csFile, csNamespace, ver);
wroteFile = true; wroteFile = true;
} }
...@@ -298,7 +298,7 @@ public class LabComm { ...@@ -298,7 +298,7 @@ public class LabComm {
boolean generateJava(Program ast) { boolean generateJava(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (javaDir != null) { if (javaDir != null) {
if (verbose) { System.err.println("Generating Java: " + javaDir); } printStatus("Java: " , javaDir);
genJava(ast, javaDir, javaPackage, ver); genJava(ast, javaDir, javaPackage, ver);
wroteFile = true; wroteFile = true;
} }
...@@ -308,9 +308,7 @@ public class LabComm { ...@@ -308,9 +308,7 @@ public class LabComm {
boolean generatePython(Program ast) { boolean generatePython(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (pythonFile != null) { if (pythonFile != null) {
if (verbose) { printStatus("Python: " , pythonFile);
System.err.println("Generating Python: " + pythonFile);
}
genPython(ast, pythonFile, prefix, ver); genPython(ast, pythonFile, prefix, ver);
wroteFile = true; wroteFile = true;
} }
...@@ -320,9 +318,7 @@ public class LabComm { ...@@ -320,9 +318,7 @@ public class LabComm {
boolean generateRAPID(Program ast) { boolean generateRAPID(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (rapidFile != null) { if (rapidFile != null) {
if (verbose) { printStatus("RAPID: " , rapidFile);
System.err.println("Generating RAPID: " + rapidFile);
}
genRAPID(ast, rapidFile, coreName, ver); genRAPID(ast, rapidFile, coreName, ver);
wroteFile = true; wroteFile = true;
} }
...@@ -331,9 +327,7 @@ public class LabComm { ...@@ -331,9 +327,7 @@ public class LabComm {
boolean generatePrettyPrint(Program ast) { boolean generatePrettyPrint(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (prettyFile != null) { if (prettyFile != null) {
if (verbose) { printStatus("Pretty: " , prettyFile);
System.err.println("Generating Pretty: " + prettyFile);
}
try { try {
FileOutputStream f = new FileOutputStream(prettyFile); FileOutputStream f = new FileOutputStream(prettyFile);
PrintStream out = new PrintStream(f); PrintStream out = new PrintStream(f);
...@@ -350,9 +344,7 @@ public class LabComm { ...@@ -350,9 +344,7 @@ public class LabComm {
boolean generateTypeinfo(Program ast) { boolean generateTypeinfo(Program ast) {
boolean wroteFile = false; boolean wroteFile = false;
if (typeinfoFile != null) { if (typeinfoFile != null) {
if (verbose) { printStatus("TypeInfo: " , typeinfoFile);
System.err.println("Generating TypeInfo: " + typeinfoFile);
}
try { try {
FileOutputStream f = new FileOutputStream(typeinfoFile); FileOutputStream f = new FileOutputStream(typeinfoFile);
PrintStream out = new PrintStream(f); PrintStream out = new PrintStream(f);
...@@ -366,6 +358,12 @@ public class LabComm { ...@@ -366,6 +358,12 @@ public class LabComm {
} }
return wroteFile; return wroteFile;
} }
private void printStatus(String kind, String filename){
if (verbose) {
System.err.println("Generating "+kind+": " + filename);
}
}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment