This commit is contained in:
rusefi 2017-08-03 21:09:56 -04:00
parent a3ac4547bd
commit 4ccb1ba0fc
1 changed files with 7 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import java.util.List;
* 1/19/2017 * 1/19/2017
*/ */
public class CompileTool { public class CompileTool {
private static String NEWLINE = "\n";
public static void run(List<String> args) throws IOException { public static void run(List<String> args) throws IOException {
System.out.println("Params " + args); System.out.println("Params " + args);
@ -28,9 +29,9 @@ public class CompileTool {
BufferedReader br = new BufferedReader(new FileReader(inputFileName)); BufferedReader br = new BufferedReader(new FileReader(inputFileName));
try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputFileName))) { try (BufferedWriter bw = new BufferedWriter(new FileWriter(outputFileName))) {
bw.write("// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically\r\n"); bw.write("// this https://en.wikipedia.org/wiki/Reverse_Polish_notation is generated automatically" + NEWLINE);
bw.write("// from " + inputFileName + "\r\n"); bw.write("// from " + inputFileName + NEWLINE);
bw.write("// on " + FileLog.getDate() + "\r\n//\r\n"); bw.write("// on " + FileLog.getDate() + NEWLINE + "//" + NEWLINE);
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
@ -48,7 +49,7 @@ public class CompileTool {
return; return;
if (line.charAt(0) == '#') { if (line.charAt(0) == '#') {
// forwarding comment into the output // forwarding comment into the output
bw.write("//" + line.substring(1) + "\r\n"); bw.write("//" + line.substring(1) + NEWLINE);
return; return;
} }
@ -70,8 +71,8 @@ public class CompileTool {
} catch (Throwable e) { } catch (Throwable e) {
throw new IllegalStateException("For " + expression, e); throw new IllegalStateException("For " + expression, e);
} }
bw.write("\n// Human-readable: " + expression + "\r\n"); bw.write(NEWLINE + "// Human-readable: " + expression + NEWLINE);
bw.write("#define " + name + " \"" + rpn + "\"\r\n"); bw.write("#define " + name + " \"" + rpn + "\"" + NEWLINE);
} }
} }