]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enhance recognizing Macro/Type defined in Library.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Sep 2006 07:00:19 +0000 (07:00 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Sep 2006 07:00:19 +0000 (07:00 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1525 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Conf/Migration/Library.csv
Tools/Source/MigrationTools/org/tianocore/migration/Macro.java
Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java

index f1b30c9574a2223c03d2c9b352f390dde4cbd39d..fcb0f12cc622e5a8c257739ab87cfa22fd720879 100644 (file)
@@ -41,8 +41,8 @@ EfiDriverLib,EfiLibReportStatusCode,ReportStatusCode,ReportStatusCodeLib,MdePkg
 EfiDriverLib,ReportStatusCodeWithDevicePath,ReportStatusCodeWithDevicePath,ReportStatusCodeLib,MdePkg\r
 EfiDriverLib,EFI_FIELD_OFFSET,EFI_FIELD_OFFSET,BaseLib,MdePkg\r
 EfiDriverLib,EFI_LIST,LIST_ENTRY,BaseLib,MdePkg\r
-EfiDriverLib,EFI_LIST_ENTRY,LIST_ENTRY,BaseLib,MdePkg\r
-EfiDriverLib,EFI_LIST_NODE,LIST_ENTRY,BaseLib,MdePkg\r
+EfiDriverLib,EFI_LIST_ENTRY,LIST_ENTRY    ,BaseLib,MdePkg\r
+EfiDriverLib,EFI_LIST_NODE,LIST_ENTRY    ,BaseLib,MdePkg\r
 EfiDriverLib,FLOCK,EFI_LOCK,UefiLib,MdePkg\r
 EfiDriverLib,GetFirstNode,GetFirstNode,BaseLib,MdePkg\r
 EfiDriverLib,GetNextNode,GetNextNode,BaseLib,MdePkg\r
index b58e5903c53437f350915194dd036cc148cf10b8..bd10b5a251b80129730d89c06d4bef2966f422f0 100644 (file)
@@ -35,6 +35,7 @@ public class Macro {
         String temp = null;\r
         \r
         temp = mtr.group();\r
+        mi.hashmacro.add(temp);\r
         if (MigrationTool.db.hasMacro(temp)) {                    // only changed macros registered, because the database of macro has only changed ones\r
             if (!unmacro.contains(temp)) {\r
                 mi.hashnonlocalmacro.add(temp);\r
index 19c0dfedd11c1edd205e99919ff802d48a627881..791ccd23fa720538779255d1202d2ef6cca1b17a 100644 (file)
@@ -41,6 +41,7 @@ public final class ModuleInfo {
     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
+    public final Set<String> hashmacro = new HashSet<String>();\r
     \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
index 678dbcb275d8acf5888052faa735679e4e1b8777..3325f150449fea6fe7ab075ffc003fb9fd9bf040 100644 (file)
@@ -53,7 +53,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
     \r
     private class IdleLaplace extends Common.Laplace {\r
         public String operation(String wholeline) {\r
-            return wholeline;\r
+            return replaceLibrary (wholeline, mi.hashmacro);\r
         }\r
         \r
         public boolean recognize(String filename) {\r
@@ -105,51 +105,11 @@ public final class SourceFileReplacer implements Common.ForDoAll {
             if (Common.find (wholeline, "\\bgDS\\b")) {\r
                 mi.hashrequiredr9libs.add ("DxeServicesTableLib");\r
             }\r
-            // start replacing names\r
-            String r8thing;\r
-            String r9thing;\r
-            Iterator<String> it;\r
-            // Converting non-locla function\r
-            it = mi.hashnonlocalfunc.iterator();\r
-            while (it.hasNext()) {\r
-                r8thing = it.next();\r
-                mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                // add a library here\r
\r
-                r8tor9 temp;\r
-                if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
-                    if (!r8thing.equals(r9thing)) {\r
-                        if (wholeline.contains(r8thing)) {\r
-                            wholeline = wholeline.replaceAll(r8thing, r9thing);\r
-                            filefunc.add(new r8tor9(r8thing, r9thing));\r
-                            Iterator<r8tor9> rt = filefunc.iterator();\r
-                            while (rt.hasNext()) {\r
-                                temp = rt.next();\r
-                                if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
-                                    filer8only.add(r8thing);\r
-                                    mi.hashr8only.add(r8thing);\r
-                                    addr8 = true;\r
-                                }\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-            }                                                            //is any of the guids changed?\r
-            if (addr8 == true) {\r
-                wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
-            }\r
-            \r
+\r
+            wholeline = replaceLibrary (wholeline, mi.hashnonlocalfunc);\r
+            wholeline = replaceLibrary (wholeline, mi.hashmacro);\r
             // Converting macro\r
-            it = mi.hashnonlocalmacro.iterator();\r
-            while (it.hasNext()) {                        //macros are all assumed MdePkg currently\r
-                r8thing = it.next();\r
-                //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
-                        filemacro.add(new r8tor9(r8thing, r9thing));\r
-                    }\r
-                }\r
-            }\r
+            wholeline = replaceMacro (wholeline, mi.hashnonlocalmacro);\r
 \r
             // Converting guid\r
             replaceGuid(wholeline, mi.guid, "guid", fileguid);\r
@@ -289,7 +249,64 @@ public final class SourceFileReplacer implements Common.ForDoAll {
         }\r
         return templine;\r
     }\r
-    \r
+\r
+    private final String replaceMacro (String wholeline, Set<String> symbolSet) {\r
+        String r8thing;\r
+        String r9thing;\r
+        Iterator<String> it;\r
+\r
+        it = symbolSet.iterator();\r
+        while (it.hasNext()) {                        //macros are all assumed MdePkg currently\r
+            r8thing = it.next();\r
+            System.out.println (r8thing);\r
+            //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
+                    filemacro.add(new r8tor9(r8thing, r9thing));\r
+                }\r
+            }\r
+        }\r
+        return wholeline;\r
+    }\r
+\r
+    private final String replaceLibrary (String wholeline, Set<String> symbolSet) {\r
+        boolean addr8 = false;\r
+        // start replacing names\r
+        String r8thing;\r
+        String r9thing;\r
+        Iterator<String> it;\r
+        // Converting non-locla function\r
+        it = symbolSet.iterator();\r
+        while (it.hasNext()) {\r
+            r8thing = it.next();\r
+            mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                // add a library here\r
\r
+            r8tor9 temp;\r
+            if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
+                if (!r8thing.equals(r9thing)) {\r
+                    if (wholeline.contains(r8thing)) {\r
+                        wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                        filefunc.add(new r8tor9(r8thing, r9thing));\r
+                        Iterator<r8tor9> rt = filefunc.iterator();\r
+                        while (rt.hasNext()) {\r
+                            temp = rt.next();\r
+                            if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
+                                filer8only.add(r8thing);\r
+                                mi.hashr8only.add(r8thing);\r
+                                addr8 = true;\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }                                                            //is any of the guids changed?\r
+        if (addr8 == true) {\r
+            wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
+        }\r
+        return wholeline;\r
+    }\r
+\r
     private final void addr8only() throws Exception {\r
         String paragraph = null;\r
         String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");\r