\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
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
}\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
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
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