"EfiLibInstallAllDriverProtocols " +\r
"EfiLibCompareLanguage " +\r
"BufToHexString " +\r
- "EfiStrTrim " +\r
+ "EfiStrTrim " + //is the r8only lib going to be enlarged???? Caution !!!!\r
"EfiValueToHexStr " +\r
"HexStringToBuf " +\r
"IsHexDigit " +\r
\r
public void flush() throws Exception {\r
PrintWriter outfile;\r
- String temp = null;\r
- if (ui.yesOrNo("Change Source Code is to be doing . See details ?")) {\r
+ String outname = null;\r
+ String inname = null;\r
+ if (ui.yesOrNo("Changes will be made to the Source Code. View details?")) {\r
showdetails = true;\r
}\r
- File tempdir = new File(modulepath + File.separator + "result" + File.separator);\r
- if (!tempdir.exists()) tempdir.mkdir();\r
- String[] list = new File(modulepath + File.separator + "temp").list(); //what I change is the non-local .h commented-out files\r
- for (int i = 0 ; i < list.length ; i++) {\r
- if (list[i].contains(".c")) {\r
- ui.println("\nModifying file : " + list[i]);\r
- outfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + list[i])));\r
- outfile.append(sourcefilereplace(modulepath + File.separator + "temp" + File.separator + list[i]));\r
+ \r
+ Iterator<String> di = mi.localmodulesources.iterator();\r
+ while (di.hasNext()) {\r
+ inname = di.next();\r
+ if (inname.contains(".c") || inname.contains(".C")) {\r
+ if (inname.contains(".C")) {\r
+ outname = inname.replaceFirst(".C", ".c");\r
+ } else {\r
+ outname = inname;\r
+ }\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
outfile.close();\r
- } else {\r
- if (list[i].contains(".h")) {\r
- temp = list[i];\r
- } else if (list[i].contains(".C")) {\r
- temp = list[i].replaceFirst(".C", ".c");\r
- } else if (list[i].contains(".H")) {\r
- temp = list[i].replaceFirst(".H", ".h");\r
+ } else if (inname.contains(".h") || inname.contains(".H") || inname.contains(".dxs") || inname.contains(".uni")) {\r
+ if (inname.contains(".H")) {\r
+ outname = inname.replaceFirst(".H", ".h");\r
} else {\r
- continue;\r
+ outname = inname;\r
}\r
- ui.println("\nCopying file : " + temp);\r
- outfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "result" + File.separator + temp)));\r
- outfile.append(sourcefiletostring(modulepath + File.separator + "temp" + File.separator + list[i]));\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(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
+ 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
- //outfile1.append("#include \"R8Lib.h\"\n\n");\r
- //outfile2.append("#include \"R8Lib.h\"\n\n");\r
Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(\\w*).*?////~", Pattern.DOTALL);\r
Matcher mtrr8only = ptnr8only.matcher(line);\r
Matcher mtrr8onlyhead;\r
outfile1.close();\r
outfile2.flush();\r
outfile2.close();\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
+ mi.localmodulesources.add("R8Lib.h");\r
+ mi.localmodulesources.add("R8Lib.c");\r
}\r
\r
// Caution : if there is @ in file , it will be replaced with \n , so is you use Doxygen ... God Bless you!\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
while (rt.hasNext()) {\r
temp = rt.next();\r
if (r8only.contains(temp.r8thing)) {\r
- mi.localmodulesources.add("R8Lib.h");\r
- mi.localmodulesources.add("R8Lib.c");\r
filer8only.add(r8thing);\r
mi.hashr8only.add(r8thing);\r
addr8 = true;\r
fileppi.clear();\r
fileprotocol.clear();\r
filer8only.clear();\r
- \r
+\r
return line;\r
}\r
\r