]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
functions in moduleinfo 2 migrationtool
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / ModuleInfo.java
index aa6e7a2ba0bac74ca5ade28c5768e760e49c5199..9e58ed914ae3e3bafabfcab6e18808d092ce2e13 100644 (file)
@@ -23,13 +23,11 @@ public class ModuleInfo {
        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
+               ModuleInfo.ui.println("Choose where to place the result");\r
+               if ((outputpath = ModuleInfo.ui.getFilepath()) == null) {\r
                        outputpath = modulepath; \r
                }\r
-               MigrationTool.ui.println(outputpath);\r
-               \r
-               mainFlow();\r
+               ModuleInfo.ui.println(outputpath);\r
        }\r
 \r
        public String modulepath = null;\r
@@ -56,47 +54,7 @@ public class ModuleInfo {
        public Set<String> guid = new HashSet<String>();\r
        public Set<String> protocol = new HashSet<String>();\r
        public Set<String> ppi = 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
 \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
@@ -109,12 +67,6 @@ public class ModuleInfo {
                }\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
                String[] list = new File(path).list();\r
                for (int i = 0 ; i < list.length ; i++) {\r
@@ -127,9 +79,70 @@ public class ModuleInfo {
                return false;\r
        }\r
 \r
+       //---------------------------------------------------------------------------//\r
+       \r
+       private static final void manipulate(ModuleInfo mi) throws Exception {\r
+               \r
+               ModuleReader.ModuleScan(mi);\r
+               \r
+               SourceFileReplacer.flush(mi);   // some adding library actions are taken here,so it must be put before "MsaWriter"\r
+               \r
+               // show result\r
+               if (ModuleInfo.printModuleInfo) {\r
+                       ModuleInfo.ui.println("\nModule Information : ");\r
+                       ModuleInfo.ui.println("Entrypoint : " + mi.entrypoint);\r
+                       show(mi.protocol, "Protocol : ");\r
+                       show(mi.ppi, "Ppi : ");\r
+                       show(mi.guid, "Guid : ");\r
+                       show(mi.hashfuncc, "call : ");\r
+                       show(mi.hashfuncd, "def : ");\r
+                       show(mi.hashEFIcall, "EFIcall : ");\r
+                       show(mi.hashnonlocalmacro, "macro : ");\r
+                       show(mi.hashnonlocalfunc, "nonlocal : ");\r
+                       show(mi.hashr8only, "hashr8only : ");\r
+               }\r
+               \r
+               new MsaWriter(mi).flush();\r
+\r
+               if (ModuleInfo.doCritic) {\r
+               Critic.fireAt(mi.outputpath + File.separator + "Migration_" + mi.modulename);\r
+               }\r
+               \r
+               Common.deleteDir(mi.modulepath + File.separator + "temp");\r
+               \r
+               ModuleInfo.ui.println("Errors Left : " + ModuleInfo.db.error);\r
+               ModuleInfo.ui.println("Complete!");\r
+               ModuleInfo.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");\r
+               ModuleInfo.ui.println("Your logfile was placed here: " + mi.modulepath);\r
+       }\r
+       \r
+       private static final void show(Set<String> hash, String show) {\r
+               ModuleInfo.ui.println(show + hash.size());\r
+               ModuleInfo.ui.println(hash);\r
+       }\r
+       \r
+       public static final void seekModule(String filepath) throws Exception {\r
+               if (ModuleInfo.isModule(filepath)) {\r
+                       manipulate(new ModuleInfo(filepath));\r
+               }\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
+               ModuleInfo.ui.println("Project Migration");\r
+               ModuleInfo.ui.println("Copyright (c) 2006, Intel Corporation");\r
                Common.toDoAll(path, ModuleInfo.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
        }\r
+       \r
+       public static UI ui = null;\r
+       public static Database db = null;\r
+       \r
+       public static final String migrationcomment = "//%$//";\r
+       \r
+       public static boolean printModuleInfo = false;\r
+       public static boolean doCritic = false;\r
+       \r
+       public static void main(String[] args) throws Exception {\r
+               ui = FirstPanel.init();\r
+               db = Database.init();\r
+       }\r
 }
\ No newline at end of file