]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/Database.java
r8lib in database
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Database.java
index a4b0d47872f374c599e8dc69b8eb2b5e6d167fab..8b088c9cbb2135cad003c583c4d2b2f4d29e33cd 100644 (file)
@@ -14,6 +14,7 @@ package org.tianocore.migration;
 \r
 import java.io.*;\r
 import java.util.*;\r
+import java.util.regex.*;\r
 \r
 public final class Database {\r
        Database(String path) throws Exception {\r
@@ -24,17 +25,19 @@ public final class Database {
                importDBGuid("Ppi.csv", "Ppi");\r
                importDBGuid("Protocol.csv", "Protocol");\r
                importDBMacro("Macro.csv");\r
+               importListR8Only();\r
        }\r
        \r
-       public static String defaultpath = "C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration";\r
-       \r
        public String DatabasePath;\r
        public Set<String> error = new HashSet<String>();\r
+       public Set<String> r8only = new HashSet<String>();\r
        \r
        private Map<String,Guid> hashguid = new HashMap<String,Guid>();\r
        private Map<String,Func> hashfunc = new HashMap<String,Func>();\r
        private Map<String,Macro> hashmacro = new HashMap<String,Macro>();\r
        \r
+       //-------------------------------------import------------------------------------------//\r
+       \r
        private void importDBLib(String filename) throws Exception {\r
                BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
                String line;\r
@@ -88,7 +91,21 @@ public final class Database {
                        }\r
                }\r
        }\r
+\r
+       private void importListR8Only() throws Exception {\r
+               Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(.*?)\\s*\\(.*?////~", Pattern.DOTALL);\r
+               String wholeline = Common.file2string(DatabasePath + File.separator + "R8Lib.c");\r
+               System.out.println("Found " + "R8Lib.c" + ", Importing R8Lib Database.");\r
+               Matcher mtrr8only = ptnr8only.matcher(wholeline);\r
+               while (mtrr8only.find()) {\r
+                       r8only.add(mtrr8only.group(2));\r
+               }\r
+       }\r
        \r
+       //-------------------------------------import------------------------------------------//\r
+\r
+       //-------------------------------------get------------------------------------------//\r
+\r
        public String getR9Lib(String r8funcname) {\r
                String temp = null;\r
                if (hashfunc.containsKey(r8funcname)) {\r
@@ -105,18 +122,6 @@ public final class Database {
                return temp;\r
        }\r
        \r
-       public boolean hasFunc(String r8lib) {\r
-               return hashfunc.containsKey(r8lib);\r
-       }\r
-\r
-       public boolean hasGuid(String r8guid) {\r
-               return hashguid.containsKey(r8guid);\r
-       }\r
-\r
-       public boolean hasMacro(String r8macro) {\r
-               return hashmacro.containsKey(r8macro);\r
-       }\r
-       \r
        public String getR9Macro(String r8macro) {\r
                return hashmacro.get(r8macro).r9name;                   // the verification job of if the macro exists in the database is done when registering it\r
        }\r
@@ -141,6 +146,26 @@ public final class Database {
                return temp;\r
        }\r
 \r
+       //-------------------------------------get------------------------------------------//\r
+\r
+       //-------------------------------------has------------------------------------------//\r
+\r
+       public boolean hasFunc(String r8lib) {\r
+               return hashfunc.containsKey(r8lib);\r
+       }\r
+\r
+       public boolean hasGuid(String r8guid) {\r
+               return hashguid.containsKey(r8guid);\r
+       }\r
+\r
+       public boolean hasMacro(String r8macro) {\r
+               return hashmacro.containsKey(r8macro);\r
+       }\r
+       \r
+       //-------------------------------------has------------------------------------------//\r
+       \r
+       //-------------------------------------init------------------------------------------//\r
+       \r
        public static Database init() throws Exception {\r
                if (System.getenv("WORKSPACE") == null) {\r
                        return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r