Class ModuleInfo is built for scanning the source files, it contains all the needed\r
information and all the temporary data.\r
*/\r
-public class ModuleInfo {\r
+public final class ModuleInfo {\r
ModuleInfo(String modulepath) throws Exception {\r
this.modulepath = modulepath;\r
\r
- MigrationTool.ui.println("Choose where to place the result");\r
- if ((outputpath = MigrationTool.ui.getFilepath()) == null) {\r
- outputpath = modulepath; \r
+ if (MigrationTool.defaultoutput) {\r
+ this.outputpath = this.modulepath.replaceAll(Common.strseparate, "$1");\r
+ } else {\r
+ MigrationTool.ui.println("Choose where to place the result");\r
+ if ((outputpath = MigrationTool.ui.getFilepath("Please choose where to place the output module")) == null) {\r
+ outputpath = modulepath; \r
+ }\r
+ MigrationTool.ui.println("Output to: " + outputpath);\r
}\r
- MigrationTool.ui.println(outputpath);\r
- \r
- mainFlow();\r
}\r
\r
- public String modulepath = null;\r
+ public final String modulepath;\r
\r
public String outputpath = null;\r
\r
public String moduletype = null;\r
public String entrypoint = null;\r
\r
- public Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h\r
- public Set<String> preprocessedccodes = new HashSet<String>();\r
- public Set<String> msaorinf = new HashSet<String>(); //only a little, hash may be too big for this\r
- \r
- public Set<String> hashfuncc = new HashSet<String>();\r
- public Set<String> hashfuncd = new HashSet<String>();\r
- public Set<String> hashnonlocalfunc = new HashSet<String>();\r
- public Set<String> hashnonlocalmacro = new HashSet<String>();\r
- public Set<String> hashEFIcall = new HashSet<String>();\r
- public Set<String> hashr8only = new HashSet<String>();\r
+ public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h\r
+ public final Set<String> preprocessedccodes = new HashSet<String>();\r
+ public final Set<String> msaorinf = new HashSet<String>(); //only a little, hash may be too big for this\r
\r
- public Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs is now all added in SourceFileReplacer \r
- public Set<String> guid = new HashSet<String>();\r
- public Set<String> protocol = new HashSet<String>();\r
- public Set<String> ppi = new HashSet<String>();\r
+ public final Set<String> hashfuncc = new HashSet<String>();\r
+ public final Set<String> hashfuncd = new HashSet<String>();\r
+ public final Set<String> hashnonlocalfunc = new HashSet<String>();\r
+ public final Set<String> hashnonlocalmacro = new HashSet<String>();\r
+ public final Set<String> hashEFIcall = new HashSet<String>();\r
+ public final Set<String> hashr8only = new HashSet<String>();\r
\r
- private void mainFlow() throws Exception {\r
- \r
- ModuleReader.ModuleScan(this);\r
- \r
- SourceFileReplacer.flush(this); // some adding library actions are taken here,so it must be put before "MsaWriter"\r
- \r
- // show result\r
- if (MigrationTool.printModuleInfo) {\r
- MigrationTool.ui.println("\nModule Information : ");\r
- MigrationTool.ui.println("Entrypoint : " + entrypoint);\r
- show(protocol, "Protocol : ");\r
- show(ppi, "Ppi : ");\r
- show(guid, "Guid : ");\r
- show(hashfuncc, "call : ");\r
- show(hashfuncd, "def : ");\r
- show(hashEFIcall, "EFIcall : ");\r
- show(hashnonlocalmacro, "macro : ");\r
- show(hashnonlocalfunc, "nonlocal : ");\r
- show(hashr8only, "hashr8only : ");\r
- }\r
- \r
- new MsaWriter(this).flush();\r
+ public final Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs is now all added in SourceFileReplacer \r
+ public final Set<String> guid = new HashSet<String>();\r
+ public final Set<String> protocol = new HashSet<String>();\r
+ public final Set<String> ppi = new HashSet<String>();\r
\r
- if (MigrationTool.doCritic) {\r
- Critic.fireAt(outputpath + File.separator + "Migration_" + modulename);\r
- }\r
- \r
- Common.deleteDir(modulepath + File.separator + "temp");\r
- \r
- MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);\r
- MigrationTool.ui.println("Complete!");\r
- MigrationTool.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");\r
- MigrationTool.ui.println("Your logfile was placed here: " + modulepath);\r
- }\r
- \r
- private void show(Set<String> hash, String show) {\r
- MigrationTool.ui.println(show + hash.size());\r
- MigrationTool.ui.println(hash);\r
- }\r
- \r
public final void enroll(String filepath) throws Exception {\r
- String[] temp;\r
if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
- temp = filepath.split("\\\\");\r
- localmodulesources.add(temp[temp.length - 1]);\r
+ localmodulesources.add(filepath.replace(modulepath + "\\", ""));\r
} else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
- temp = filepath.split("\\\\");\r
- msaorinf.add(temp[temp.length - 1]);\r
+ msaorinf.add(filepath.replace(modulepath + "\\", ""));\r
}\r
}\r
\r
- public static final void seekModule(String filepath) throws Exception {\r
- if (isModule(filepath)) {\r
- new ModuleInfo(filepath);\r
- }\r
- }\r
-\r
- private static final boolean isModule(String path) {\r
+ public static final boolean isModule(String path) {\r
String[] list = new File(path).list();\r
for (int i = 0 ; i < list.length ; i++) {\r
if (!new File(list[i]).isDirectory()) {\r
}\r
return false;\r
}\r
-\r
- public static final void triger(String path) throws Exception {\r
- MigrationTool.ui.println("Project Migration");\r
- MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
- Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
- }\r
}
\ No newline at end of file