Loading tools/TestMacroProcessor/src/TestMacroProcessor.java +10 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ import java.util.Collections; import java.util.Properties; public class TestMacroProcessor { private static final String CRNL = "\r\n"; private static final String MACRO_PREFIX = "//#"; private File macroFolder = new File("macros"); Loading Loading @@ -59,19 +61,19 @@ public class TestMacroProcessor { // generate main module for force macro generation if (forceMacroGeneration != null) { // if (forceMacroGeneration != null) { String importModule = "ImportAllGeneratedModules"; File importAllModule = new File(outputPath, importModule+".ttcn3"); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(importAllModule), "UTF-8")); bw.write("module "+importModule+" {"); bw.write("\r\n"); bw.write(CRNL); for (String moduleName : processedModules) { bw.write(" import from "+moduleName+" all;"); bw.write("\r\n"); bw.write(CRNL); } bw.write("}"); bw.close(); } // } } public void runForFile(File inputFile, File inputPath, File outputPath) throws IOException { Loading Loading @@ -120,7 +122,7 @@ public class TestMacroProcessor { endIndex = line.length(); } String macro = line.substring(beginIndex, endIndex).trim(); bw.write("\r\n"); bw.write(CRNL); String moduleName = inputFile.getName(); moduleName = moduleName.substring(0, moduleName.lastIndexOf('.')); if (forceMacroGeneration != null) { Loading @@ -130,7 +132,7 @@ public class TestMacroProcessor { writeMacro(macro, bw, moduleName, inputFile); } else { bw.write(line); bw.write("\r\n"); bw.write(CRNL); } } } finally { Loading @@ -152,7 +154,7 @@ public class TestMacroProcessor { StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { sb.append(line).append("\r\n"); sb.append(line).append(CRNL); } return sb.toString(); } Loading Loading @@ -180,7 +182,7 @@ public class TestMacroProcessor { xsdFileList.append(" }"); macroString = macroString.replace("${xsdFileList}", xsdFileList); bw.write(macroString); bw.write("\r\n"); bw.write(CRNL); try { br.close(); } catch (Exception e) { Loading Loading
tools/TestMacroProcessor/src/TestMacroProcessor.java +10 −8 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ import java.util.Collections; import java.util.Properties; public class TestMacroProcessor { private static final String CRNL = "\r\n"; private static final String MACRO_PREFIX = "//#"; private File macroFolder = new File("macros"); Loading Loading @@ -59,19 +61,19 @@ public class TestMacroProcessor { // generate main module for force macro generation if (forceMacroGeneration != null) { // if (forceMacroGeneration != null) { String importModule = "ImportAllGeneratedModules"; File importAllModule = new File(outputPath, importModule+".ttcn3"); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(importAllModule), "UTF-8")); bw.write("module "+importModule+" {"); bw.write("\r\n"); bw.write(CRNL); for (String moduleName : processedModules) { bw.write(" import from "+moduleName+" all;"); bw.write("\r\n"); bw.write(CRNL); } bw.write("}"); bw.close(); } // } } public void runForFile(File inputFile, File inputPath, File outputPath) throws IOException { Loading Loading @@ -120,7 +122,7 @@ public class TestMacroProcessor { endIndex = line.length(); } String macro = line.substring(beginIndex, endIndex).trim(); bw.write("\r\n"); bw.write(CRNL); String moduleName = inputFile.getName(); moduleName = moduleName.substring(0, moduleName.lastIndexOf('.')); if (forceMacroGeneration != null) { Loading @@ -130,7 +132,7 @@ public class TestMacroProcessor { writeMacro(macro, bw, moduleName, inputFile); } else { bw.write(line); bw.write("\r\n"); bw.write(CRNL); } } } finally { Loading @@ -152,7 +154,7 @@ public class TestMacroProcessor { StringBuilder sb = new StringBuilder(); String line; while ((line = br.readLine()) != null) { sb.append(line).append("\r\n"); sb.append(line).append(CRNL); } return sb.toString(); } Loading Loading @@ -180,7 +182,7 @@ public class TestMacroProcessor { xsdFileList.append(" }"); macroString = macroString.replace("${xsdFileList}", xsdFileList); bw.write(macroString); bw.write("\r\n"); bw.write(CRNL); try { br.close(); } catch (Exception e) { Loading