From 23e3b888dd452900c1b3808e1d28b79f28a152bd Mon Sep 17 00:00:00 2001 From: alfred Date: Wed, 23 Aug 2006 01:24:55 +0000 Subject: [PATCH] functions in moduleinfo 2 migrationtool git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1356 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/migration/ModuleInfo.java | 96 +++++++++---------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java index 9a097872e5..9e58ed914a 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java @@ -28,8 +28,6 @@ public class ModuleInfo { outputpath = modulepath; } ModuleInfo.ui.println(outputpath); - - mainFlow(); } public String modulepath = null; @@ -56,75 +54,77 @@ public class ModuleInfo { public Set guid = new HashSet(); public Set protocol = new HashSet(); public Set ppi = new HashSet(); + + public final void enroll(String filepath) throws Exception { + String[] temp; + if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || + filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) { + temp = filepath.split("\\\\"); + localmodulesources.add(temp[temp.length - 1]); + } else if (filepath.contains(".inf") || filepath.contains(".msa")) { + temp = filepath.split("\\\\"); + msaorinf.add(temp[temp.length - 1]); + } + } + + private static final boolean isModule(String path) { + String[] list = new File(path).list(); + for (int i = 0 ; i < list.length ; i++) { + if (!new File(list[i]).isDirectory()) { + if (list[i].contains(".inf") || list[i].contains(".msa")) { + return true; + } + } + } + return false; + } + + //---------------------------------------------------------------------------// - private void mainFlow() throws Exception { + private static final void manipulate(ModuleInfo mi) throws Exception { - ModuleReader.ModuleScan(this); + ModuleReader.ModuleScan(mi); - SourceFileReplacer.flush(this); // some adding library actions are taken here,so it must be put before "MsaWriter" + SourceFileReplacer.flush(mi); // some adding library actions are taken here,so it must be put before "MsaWriter" // show result if (ModuleInfo.printModuleInfo) { ModuleInfo.ui.println("\nModule Information : "); - ModuleInfo.ui.println("Entrypoint : " + entrypoint); - show(protocol, "Protocol : "); - show(ppi, "Ppi : "); - show(guid, "Guid : "); - show(hashfuncc, "call : "); - show(hashfuncd, "def : "); - show(hashEFIcall, "EFIcall : "); - show(hashnonlocalmacro, "macro : "); - show(hashnonlocalfunc, "nonlocal : "); - show(hashr8only, "hashr8only : "); + ModuleInfo.ui.println("Entrypoint : " + mi.entrypoint); + show(mi.protocol, "Protocol : "); + show(mi.ppi, "Ppi : "); + show(mi.guid, "Guid : "); + show(mi.hashfuncc, "call : "); + show(mi.hashfuncd, "def : "); + show(mi.hashEFIcall, "EFIcall : "); + show(mi.hashnonlocalmacro, "macro : "); + show(mi.hashnonlocalfunc, "nonlocal : "); + show(mi.hashr8only, "hashr8only : "); } - new MsaWriter(this).flush(); + new MsaWriter(mi).flush(); if (ModuleInfo.doCritic) { - Critic.fireAt(outputpath + File.separator + "Migration_" + modulename); + Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename); } - Common.deleteDir(modulepath + File.separator + "temp"); + Common.deleteDir(mi.modulepath + File.separator + "temp"); ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error); ModuleInfo.ui.println("Complete!"); - ModuleInfo.ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result"); - ModuleInfo.ui.println("Your logfile was placed here: " + modulepath); + ModuleInfo.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result"); + ModuleInfo.ui.println("Your logfile was placed here: " + mi.modulepath); } - private void show(Set hash, String show) { + private static final void show(Set hash, String show) { ModuleInfo.ui.println(show + hash.size()); ModuleInfo.ui.println(hash); } - public final void enroll(String filepath) throws Exception { - String[] temp; - if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || - filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) { - temp = filepath.split("\\\\"); - localmodulesources.add(temp[temp.length - 1]); - } else if (filepath.contains(".inf") || filepath.contains(".msa")) { - temp = filepath.split("\\\\"); - msaorinf.add(temp[temp.length - 1]); - } - } - public static final void seekModule(String filepath) throws Exception { - if (isModule(filepath)) { - new ModuleInfo(filepath); - } - } - - private static final boolean isModule(String path) { - String[] list = new File(path).list(); - for (int i = 0 ; i < list.length ; i++) { - if (!new File(list[i]).isDirectory()) { - if (list[i].contains(".inf") || list[i].contains(".msa")) { - return true; - } - } + if (ModuleInfo.isModule(filepath)) { + manipulate(new ModuleInfo(filepath)); } - return false; } public static final void triger(String path) throws Exception { @@ -133,8 +133,6 @@ public class ModuleInfo { Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR); } - //---------------------------------------------------------------------------// - public static UI ui = null; public static Database db = null; -- 2.39.2