]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
editable comment style
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / ModuleReader.java
index ad50952ec844591a1976059bb0d103fcba646205..bc3fd75cb21e97f78de05a0031302891c674f28c 100644 (file)
@@ -27,22 +27,26 @@ public final class ModuleReader {
        \r
        public static final void ModuleScan(ModuleInfo m) throws Exception {\r
                mi = m;\r
-               \r
+\r
                Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);\r
-               \r
+\r
                String filename = null;\r
                if (mi.msaorinf.isEmpty()) {\r
-                       ModuleInfo.ui.println("No INF nor MSA file found!");\r
+                       MigrationTool.ui.println("No INF nor MSA file found!");\r
                        System.exit(0);\r
                } else {\r
-                       filename = ModuleInfo.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
+                       if (mi.msaorinf.size() == 1) {\r
+                               filename = (String)mi.msaorinf.toArray()[0];\r
+                       } else {\r
+                               filename = MigrationTool.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
+                       }\r
                }\r
                if (filename.contains(".inf")) {\r
                        readInf(filename);\r
                } else if (filename.contains(".msa")) {\r
                        readMsa(filename);\r
                }\r
-               \r
+\r
                CommentOutNonLocalHFile();\r
                parsePreProcessedSourceCode();\r
 \r
@@ -100,7 +104,7 @@ public final class ModuleReader {
                                        }\r
                                        if (mtrinfequation.group(1).matches("DPX_SOURCE")) {\r
                                                if (!mi.localmodulesources.contains(mtrinfequation.group(2))) {\r
-                                                       ModuleInfo.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
+                                                       MigrationTool.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
                                                }\r
                                        }\r
                                }\r
@@ -109,7 +113,7 @@ public final class ModuleReader {
                                mtrfilename = ptnfilename.matcher(mtrsection.group(2));\r
                                while (mtrfilename.find()) {\r
                                        if (!mi.localmodulesources.contains(mtrfilename.group())) {\r
-                                               ModuleInfo.ui.println("Source File Missing! : " + mtrfilename.group());\r
+                                               MigrationTool.ui.println("Source File Missing! : " + mtrfilename.group());\r
                                        }\r
                                }\r
                        }\r
@@ -132,18 +136,29 @@ public final class ModuleReader {
                        rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + curFile));\r
                        Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + curFile);\r
                        outfile = new PrintWriter(new BufferedWriter(new FileWriter(mi.modulepath + File.separator + "temp" + File.separator + curFile)));\r
+                       \r
+                       /*\r
+                       if (curFile.contains(".dxs")) {\r
+                               if (mi.moduletype.contains("PEI")) {\r
+                                       \r
+                               } else {\r
+                                       \r
+                               }\r
+                       }\r
+                       */\r
                        while ((line = rd.readLine()) != null) {\r
                                if (line.contains("#include")) {\r
                                        mtrinclude = ptninclude.matcher(line);\r
                                        if (mtrinclude.find() && mi.localmodulesources.contains(mtrinclude.group(1))) {\r
                                        } else {\r
-                                               line = ModuleInfo.migrationcomment + line;\r
+                                               line = MigrationTool.MIGRATIONCOMMENT + line;\r
                                        }\r
                                }\r
                                outfile.append(line + '\n');\r
                        }\r
                        outfile.flush();\r
                        outfile.close();\r
+                       \r
                }\r
        }\r
 \r
@@ -204,7 +219,7 @@ public final class ModuleReader {
                        matguid = Guid.ptnguid.matcher(line);                                                                           // several ways to implement this , which one is faster ? :\r
                        while (matguid.find()) {                                                                                                        // 1.currently , find once , then call to identify which is it\r
                                if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) {                            // 2.use 3 different matchers , search 3 times to find each\r
-                                       //matguid.appendReplacement(result, ModuleInfo.db.getR9Guidname(temp));         // search the database for all 3 kinds of guids , high cost\r
+                                       //matguid.appendReplacement(result, MigrationTool.db.getR9Guidname(temp));              // search the database for all 3 kinds of guids , high cost\r
                                }\r
                        }\r
                        //matguid.appendTail(result);\r
@@ -221,8 +236,8 @@ public final class ModuleReader {
                        matfuncc = Func.ptnfuncc.matcher(line);\r
                        while (matfuncc.find()) {\r
                                if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) {\r
-                                       //ModuleInfo.ui.println(ifile + "  dofunc  " + temp);\r
-                                       //matfuncc.appendReplacement(result, ModuleInfo.db.getR9Func(temp));\r
+                                       //MigrationTool.ui.println(ifile + "  dofunc  " + temp);\r
+                                       //matfuncc.appendReplacement(result, MigrationTool.db.getR9Func(temp));\r
                                }\r
                        }\r
                        //matfuncc.appendTail(result);\r