Fix several bugs & enhancement.
[mirror_edk2.git] / Tools / Java / Source / MigrationTools / org / tianocore / migration / SourceFileReplacer.java
index 01678a3d0283e17bbeeb55eaab9dcff0581f0a49..e37f7f46b243ede6a5a45d8634153414ac9616d8 100644 (file)
@@ -86,6 +86,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
     }\r
     private class DxsLaplace extends Common.Laplace {\r
         public String operation(String wholeline) {\r
+            wholeline = replaceMacro(wholeline, mi.hashnonlocalmacro);\r
             if (mi.getModuleType().equals("PEIM")) {\r
                 return addincludefile(wholeline, "\\<PeimDepex.h\\>");\r
             } else {\r
@@ -105,7 +106,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
     private class CLaplace extends Common.Laplace {\r
         public  String operation(String wholeline) {\r
             // remove EFI_DRIVER_ENTRY_POINT\r
-            wholeline = wholeline.replaceAll("(EFI_[A-Z]+_ENTRY_POINT\\s*\\(\\s*" + mi.entrypoint + "\\s*\\)\\s*;)", MigrationTool.MIGRATIONCOMMENT + " $1");\r
+            wholeline = wholeline.replaceAll("(EFI_[A-Z]+_ENTRY_POINT\\s*\\(\\s*\\w(\\w|\\d)*\\s*\\))", MigrationTool.MIGRATIONCOMMENT + " $1");\r
             // redefine module entry point for some self-relocated modules\r
             wholeline = wholeline.replaceAll (mi.entrypoint + "([^{]*?})", "_ModuleEntryPoint" + "$1");\r
             // remove R8 library contractor\r
@@ -277,7 +278,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
             //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));        \r
             if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
                 if (wholeline.contains(r8thing)) {\r
-                    wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                    String findString = "(?<!(?:\\d|\\w))" + r8thing + "(?!(?:\\d|\\w))";\r
+                    wholeline = wholeline.replaceAll(findString, r9thing);\r
                     filemacro.add(new r8tor9(r8thing, r9thing));\r
                 }\r
             }\r