PrintWriter outfile;\r
String outname = null;\r
String inname = null;\r
- if (ui.yesOrNo("Change Source Code is to be doing . See details ?")) {\r
+ if (ui.yesOrNo("Changes will be made to the Source Code. View details?")) {\r
showdetails = true;\r
}\r
\r
} else {\r
outname = inname;\r
}\r
- ui.println("\nModifying file : " + inname);\r
- mi.ensureDir(modulepath + File.separator + "result" + File.separator + outname);\r
+ ui.println("\nModifying file: " + inname);\r
+ Common.ensureDir(modulepath + File.separator + "result" + File.separator + outname);\r
outfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + outname)));\r
outfile.append(sourcefilereplace(modulepath + File.separator + "temp" + File.separator + inname));\r
outfile.flush();\r
} else {\r
outname = inname;\r
}\r
- ui.println("\nCopying file : " + inname);\r
- mi.ensureDir(modulepath + File.separator + "result" + File.separator + outname);\r
+ ui.println("\nCopying file: " + inname);\r
+ Common.ensureDir(modulepath + File.separator + "result" + File.separator + outname);\r
outfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + outname)));\r
- outfile.append(sourcefiletostring(modulepath + File.separator + "temp" + File.separator + inname));\r
+ outfile.append(Common.sourcefiletostring(modulepath + File.separator + "temp" + File.separator + inname));\r
outfile.flush();\r
outfile.close();\r
}\r
\r
private void addr8only() throws Exception {\r
String paragraph = null;\r
- String line = sourcefiletostring(Database.defaultpath + File.separator + "R8Lib.c");\r
- mi.ensureDir(modulepath + File.separator + "result" + File.separator + "R8Lib.c");\r
+ String line = Common.sourcefiletostring(Database.defaultpath + File.separator + "R8Lib.c");\r
+ Common.ensureDir(modulepath + File.separator + "result" + File.separator + "R8Lib.c");\r
PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + "R8Lib.c")));\r
PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + "R8Lib.h")));\r
Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(\\w*).*?////~", Pattern.DOTALL);\r
mi.localmodulesources.add("R8Lib.c");\r
}\r
\r
- private String sourcefiletostring(String filename) throws Exception {\r
- BufferedReader rd = new BufferedReader(new FileReader(filename));\r
- StringBuffer wholefile = new StringBuffer();\r
- String line;\r
- while ((line = rd.readLine()) != null) {\r
- wholefile.append(line + "\n");\r
- }\r
- return wholefile.toString();\r
- }\r
- \r
// Caution : if there is @ in file , it will be replaced with \n , so is you use Doxygen ... God Bless you!\r
private String sourcefilereplace(String filename) throws Exception {\r
BufferedReader rd = new BufferedReader(new FileReader(filename));\r
// replace BS -> gBS , RT -> gRT\r
Matcher mat = pat.matcher(line);\r
if (mat.find()) { // add a library here\r
- ui.println("Converting all BS->gBS,RT->gRT");\r
+ ui.println("Converting all BS->gBS, RT->gRT");\r
line = mat.replaceAll("g$1$2$3"); //unknown correctiveness\r
}\r
mat.reset();\r