import java.util.regex.Matcher;\r
import java.util.regex.Pattern;\r
\r
-import org.apache.xmlbeans.XmlNormalizedString;\r
import org.apache.xmlbeans.XmlObject;\r
import org.apache.xmlbeans.XmlString;\r
import org.tianocore.BuildOptionsDocument;\r
-import org.tianocore.DataIdDocument;\r
+import org.tianocore.CNameType;\r
import org.tianocore.ExternsDocument;\r
import org.tianocore.FileNameConvention;\r
-import org.tianocore.FvAttributeDocument;\r
import org.tianocore.FvImagesDocument;\r
-import org.tianocore.FvOptionDocument;\r
import org.tianocore.GuidDeclarationsDocument;\r
import org.tianocore.GuidsDocument;\r
import org.tianocore.LibrariesDocument;\r
import org.tianocore.PPIsDocument;\r
import org.tianocore.PackageDependenciesDocument;\r
import org.tianocore.PackageHeadersDocument;\r
+import org.tianocore.PcdCodedDocument;\r
import org.tianocore.PlatformDefinitionsDocument;\r
+import org.tianocore.PlatformHeaderDocument;\r
import org.tianocore.PpiDeclarationsDocument;\r
import org.tianocore.ProtocolDeclarationsDocument;\r
+import org.tianocore.Sentence;\r
import org.tianocore.SpdHeaderDocument;\r
-import org.tianocore.SupportedArchitectures;\r
+import org.tianocore.UserExtensionsDocument;\r
import org.tianocore.FilenameDocument.Filename;\r
import org.tianocore.MsaHeaderDocument.MsaHeader;\r
import org.tianocore.ProtocolsDocument.Protocols.Protocol;\r
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;\r
-import org.tianocore.PlatformHeaderDocument;\r
import org.tianocore.build.id.FpdModuleIdentification;\r
import org.tianocore.build.id.ModuleIdentification;\r
import org.tianocore.build.id.PackageIdentification;\r
import org.tianocore.build.id.PlatformIdentification;\r
import org.tianocore.build.toolchain.ToolChainInfo;\r
+import org.tianocore.logger.EdkLog;\r
+import org.w3c.dom.Node;\r
\r
/**\r
* SurfaceAreaQuery class is used to query Surface Area information from msa,\r
String[] xPath;\r
Object[] returns;\r
\r
- if (arch == null || arch.equals("")) {\r
- xPath = new String[] { "/Filename" };\r
- } else {\r
- xPath = new String[] { "/Filename[not(@SupArchList) or @SupArchList='"\r
- + arch + "']" };\r
- }\r
+ xPath = new String[] { "/Filename" };\r
\r
returns = get("SourceFiles", xPath);\r
\r
}\r
\r
Filename[] sourceFileNames = (Filename[]) returns;\r
- String[][] outputString = new String[sourceFileNames.length][2];\r
+ List<String[]> outputList = new ArrayList<String[]>();\r
for (int i = 0; i < sourceFileNames.length; i++) {\r
- outputString[i][0] = sourceFileNames[i].getToolCode();\r
- outputString[i][1] = sourceFileNames[i].getStringValue();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = sourceFileNames[i].getSupArchList();\r
+ if (arch == null || arch.equalsIgnoreCase("") || archList == null || archList.contains(arch)) {\r
+ outputList.add(new String[] {sourceFileNames[i].getToolCode(),sourceFileNames[i].getStringValue()});\r
+ }\r
+ }\r
+ \r
+ String[][] outputString = new String[outputList.size()][2];\r
+ for (int index = 0; index < outputList.size(); index++) {\r
+ outputString[index][0] = outputList.get(index)[0];\r
+ outputString[index][1] = outputList.get(index)[1];\r
}\r
return outputString;\r
}\r
}\r
\r
archList = new ArrayList<String>();\r
+ @SuppressWarnings("unchecked")\r
List<String> archEnumList = option.getSupArchList(); \r
if (archEnumList == null) {\r
archList.add(null);\r
String packageGuid = null;\r
String packageVersion = null;\r
\r
- if (arch == null || arch.equals("")) {\r
- xPath = new String[] { "/Package" };\r
- } else {\r
- xPath = new String[] { "/Package[not(@SupArchList) or @SupArchList='"\r
- + arch + "']" };\r
- }\r
-\r
+ \r
+ xPath = new String[] { "/Package" };\r
+ \r
Object[] returns = get("PackageDependencies", xPath);\r
if (returns == null) {\r
return new PackageIdentification[0];\r
PackageIdentification[] packageIdList = new PackageIdentification[returns.length];\r
for (int i = 0; i < returns.length; i++) {\r
PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];\r
- packageGuid = item.getPackageGuid();\r
- packageVersion = item.getPackageVersion();\r
- packageIdList[i] = (new PackageIdentification(null, packageGuid,\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = item.getSupArchList();\r
+ if (arch == null || archList == null || archList.contains(arch)) {\r
+ packageGuid = item.getPackageGuid();\r
+ packageVersion = item.getPackageVersion();\r
+ packageIdList[i] = (new PackageIdentification(null, packageGuid,\r
packageVersion));\r
+ }\r
}\r
return packageIdList;\r
}\r
String[] entryPoints = new String[returns.length];\r
\r
for (int i = 0; i < returns.length; ++i) {\r
- entryPoints[i] = ((XmlNormalizedString) returns[i])\r
- .getStringValue();\r
+ entryPoints[i] = ((CNameType) returns[i]).getStringValue();\r
}\r
\r
return entryPoints;\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- archXpath = "/Protocol[@SupArchList='" + arch + "']";\r
+ archXpath = "/Protocol";\r
if (usage != null && !usage.equals("")) {\r
usageXpath = "/Protocol[@Usage='" + usage + "']";\r
xPath = new String[] { usageXpath, archXpath };\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- xPath = new String[] { "/Protocol[@SupArchList='" + arch + "']" };\r
+ xPath = new String[] { "/Protocol" };\r
}\r
\r
Object[] returns = get("Protocols", xPath);\r
if (returns == null) {\r
return new String[0];\r
}\r
- Protocol[] protocolList = (Protocol[]) returns;\r
+ Protocol[] returnlList = (Protocol[]) returns;\r
\r
- String[] protocolArray = new String[returns.length];\r
+ List<String> protocolList = new ArrayList<String>();\r
+ \r
for (int i = 0; i < returns.length; i++) {\r
- protocolArray[i] = protocolList[i].getProtocolCName();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = returnlList[i].getSupArchList();\r
+ if (archList == null || archList.contains(arch)){\r
+ protocolList.add(returnlList[i].getProtocolCName());\r
+ }\r
+ }\r
+ String[] protocolArray = new String[protocolList.size()];\r
+ for (int i = 0; i < protocolList.size(); i++) {\r
+ protocolArray[i] = protocolList.get(i);\r
}\r
return protocolArray;\r
}\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- xPath = new String[] { "/ProtocolNotify[@SupArchList='" + arch\r
- + "']" };\r
+ xPath = new String[] { "/ProtocolNotify" };\r
}\r
\r
Object[] returns = get("Protocols", xPath);\r
return new String[0];\r
}\r
\r
- String[] protocolNotifyList = new String[returns.length];\r
+ List<String> protocolNotifyList = new ArrayList<String>();\r
+ \r
for (int i = 0; i < returns.length; i++) {\r
- protocolNotifyList[i] = ((ProtocolNotify) returns[i]).getProtocolNotifyCName();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = ((ProtocolNotify) returns[i]).getSupArchList();\r
+ if (archList == null || archList.contains(arch)){\r
+ protocolNotifyList.add(((ProtocolNotify) returns[i]).getProtocolNotifyCName());\r
+ }\r
+ \r
}\r
-\r
- return protocolNotifyList;\r
+ String[] protocolNotifyArray = new String[protocolNotifyList.size()];\r
+ for (int i = 0; i < protocolNotifyList.size(); i++) {\r
+ protocolNotifyArray[i] = protocolNotifyList.get(i);\r
+ }\r
+ return protocolNotifyArray;\r
}\r
\r
/**\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- archXpath = "/ProtocolNotify[@SupArchList='" + arch + "']";\r
+ archXpath = "/ProtocolNotify";\r
if (usage != null && !usage.equals("")) {\r
usageXpath = "/ProtocolNotify[@Usage='" + arch + "']";\r
xPath = new String[] { archXpath, usageXpath };\r
Object[] returns = get("Externs", xPath);\r
if (returns != null && returns.length > 0) {\r
String[] stringArray = new String[returns.length];\r
- XmlNormalizedString[] doc = (XmlNormalizedString[]) returns;\r
+ CNameType[] doc = (CNameType[]) returns;\r
\r
for (int i = 0; i < returns.length; ++i) {\r
stringArray[i] = doc[i].getStringValue();\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- xPath = new String[] { "/PpiNotify[@SupArchList='" + arch + "']" };\r
+ xPath = new String[] { "/PpiNotify" };\r
}\r
\r
Object[] returns = get("PPIs", xPath);\r
return new String[0];\r
}\r
\r
- String[] ppiNotifyList = new String[returns.length];\r
+ \r
+ List<String> ppiNotifyList = new ArrayList<String>();\r
for (int i = 0; i < returns.length; i++) {\r
- ppiNotifyList[i] = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = ((PPIsDocument.PPIs.PpiNotify) returns[i]).getSupArchList();\r
+ if (archList == null || archList.contains(arch)){\r
+ ppiNotifyList.add(((PPIsDocument.PPIs.PpiNotify) returns[i]).getPpiNotifyCName()); \r
+ }\r
+ \r
+ }\r
+ String[] ppiNotifyArray = new String[ppiNotifyList.size()];\r
+ for (int i = 0; i < ppiNotifyList.size(); i++) {\r
+ ppiNotifyArray[i] = ppiNotifyList.get(i);\r
}\r
\r
- return ppiNotifyList;\r
+ return ppiNotifyArray;\r
}\r
\r
/**\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- archXpath = "/PpiNotify[@SupArchList='" + arch + "']";\r
+ archXpath = "/PpiNotify";\r
if (usage != null && !usage.equals("")) {\r
usageXpath = "/PpiNotify[@Usage='" + arch + "']";\r
xPath = new String[] { archXpath, usageXpath };\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- xPath = new String[] { "/Ppi[@SupArchList='" + arch + "']" };\r
+ xPath = new String[] { "/Ppi" };\r
}\r
\r
Object[] returns = get("PPIs", xPath);\r
return new String[0];\r
}\r
\r
- String[] ppiList = new String[returns.length];\r
+ List<String> ppiList = new ArrayList<String>();\r
for (int i = 0; i < returns.length; i++) {\r
- ppiList[i] = ((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = ((PPIsDocument.PPIs.Ppi) returns[i]).getSupArchList();\r
+ if (archList == null || archList.contains(arch)){\r
+ ppiList.add(((PPIsDocument.PPIs.Ppi) returns[i]).getPpiCName()); \r
+ }\r
+ \r
}\r
- return ppiList;\r
+ String[] ppiArray = new String[ppiList.size()];\r
+ for (int i = 0; i < ppiList.size(); i++) {\r
+ ppiArray[i] = ppiList.get(i);\r
+ }\r
+ return ppiArray;\r
}\r
\r
/**\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- archXpath = "/Ppi[@SupArchList='" + arch + "']";\r
+ archXpath = "/Ppi";\r
if (usage != null && !usage.equals("")) {\r
usageXpath = "/Ppi[@Usage='" + arch + "']";\r
xPath = new String[] { archXpath, usageXpath };\r
String[] xPath;\r
\r
if (arch == null || arch.equals("")) {\r
- xPath = new String[] { "/GuidName" };\r
+ xPath = new String[] { "/GuidCNames" };\r
} else {\r
- xPath = new String[] { "/GuidName[@SupArchList='" + arch + "']" };\r
+ xPath = new String[] { "/GuidCNames" };\r
}\r
\r
Object[] returns = get("Guids", xPath);\r
if (returns == null) {\r
return new String[0];\r
}\r
- String[] guidList = new String[returns.length];\r
+\r
+ List<String> guidList = new ArrayList<String>();\r
for (int i = 0; i < returns.length; i++) {\r
- guidList[i] = ((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName();\r
+ @SuppressWarnings("unchecked")\r
+ List<String> archList = ((GuidsDocument.Guids.GuidCNames) returns[i]).getSupArchList();\r
+ if (archList == null || archList.contains(arch)){\r
+ guidList.add(((GuidsDocument.Guids.GuidCNames) returns[i]).getGuidCName()); \r
+ }\r
+ \r
}\r
- return guidList;\r
+ String[] guidArray = new String[guidList.size()];\r
+ for (int i = 0; i < guidList.size(); i++) {\r
+ guidArray[i] = guidList.get(i);\r
+ }\r
+ return guidArray;\r
\r
}\r
\r
if (arch == null || arch.equals("")) {\r
return new String[0];\r
} else {\r
- archXpath = "/GuidEntry[@SupArchList='" + arch + "']";\r
+ archXpath = "/GuidEntry";\r
if (usage != null && !usage.equals("")) {\r
usageXpath = "/GuidEntry[@Usage='" + arch + "']";\r
xPath = new String[] { archXpath, usageXpath };\r
if (arch == null || arch.equalsIgnoreCase("")) {\r
xPath = new String[] { "/Instance" };\r
} else {\r
+ //\r
+ // Since Schema don't have SupArchList now, so the follow Xpath is \r
+ // equal to "/Instance" and [not(@SupArchList) or @SupArchList= arch]\r
+ // don't have effect.\r
+ //\r
xPath = new String[] { "/Instance[not(@SupArchList) or @SupArchList='"\r
+ arch + "']" };\r
}\r
String[] strings = new String[returns.length];\r
for (int i = 0; i < returns.length; ++i) {\r
// TBD\r
- // strings[i] = ((CName) returns[i]).getStringValue();\r
+ strings[i] = ((CNameType) returns[i]).getStringValue();\r
}\r
\r
return strings;\r
\r
Object[] returns = get("Externs", xPath);\r
if (returns != null && returns.length > 0) {\r
- // CName constructor = (CName) returns[0];\r
- // return constructor.getStringValue();\r
+ CNameType constructor = ((CNameType) returns[0]);\r
+ return constructor.getStringValue();\r
}\r
\r
return null;\r
\r
Object[] returns = get("Externs", xPath);\r
if (returns != null && returns.length > 0) {\r
- // CName destructor = (CName) returns[0];\r
- // return destructor.getStringValue();\r
+ //\r
+ // Only support one Destructor function.\r
+ //\r
+ CNameType destructor = (CNameType) returns[0];\r
+ return destructor.getStringValue();\r
}\r
\r
return null;\r
return result;\r
}\r
\r
- public static XmlObject getFpdUserExtension() {\r
- String[] xPath = new String[] { "" };\r
+ public static Node getFpdUserExtension() {\r
+ String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore']" }; \r
\r
Object[] queryResult = get("PlatformSurfaceArea", xPath);\r
- if (queryResult == null) {\r
+ if (queryResult == null || queryResult.length == 0) {\r
return null;\r
}\r
- return null;\r
+ UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];\r
+ \r
+ return a.getDomNode();\r
}\r
\r
/**\r
\r
String[] specificationList = new String[queryResult.length];\r
for (int i = 0; i < queryResult.length; i++) {\r
- // specificationList[i] = ((SpecificationDocument.Specification)\r
- // queryResult[i])\r
- // .getStringValue();\r
+ specificationList[i] = ((Sentence)queryResult[i])\r
+ .getStringValue();\r
}\r
return specificationList;\r
}\r
guidPair[0] = entry.getCName();\r
guidPair[1] = entry.getGuidValue();\r
guidDeclMap.put(entry.getName(), guidPair);\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[0]);\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, guidPair[1]);\r
}\r
return guidDeclMap;\r
}\r
protocolPair[0] = entry.getCName();\r
protocolPair[1] = entry.getGuidValue();\r
protoclMap.put(entry.getName(), protocolPair);\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, entry.getName());\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[0]);\r
+ EdkLog.log(EdkLog.EDK_VERBOSE, protocolPair[1]);\r
}\r
return protoclMap;\r
}\r
return new ModuleSADocument.ModuleSA[0];\r
\r
}\r
+ /**\r
+ Get name array of PCD in a module. In one module, token space\r
+ is same, and token name should not be conflicted.\r
+ \r
+ @return String[]\r
+ **/\r
+ public static String[] getModulePcdEntryNameArray() {\r
+ PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;\r
+ String[] results;\r
+ int index;\r
+ String[] xPath = new String[] {"/PcdEntry"};\r
+ Object[] returns = get ("PcdCoded", xPath);\r
+ \r
+ if (returns == null) {\r
+ return new String[0];\r
+ }\r
+ \r
+ pcdEntries = (PcdCodedDocument.PcdCoded.PcdEntry[])returns;\r
+ results = new String[pcdEntries.length];\r
+ \r
+ for (index = 0; index < pcdEntries.length; index ++) {\r
+ results[index] = pcdEntries[index].getCName();\r
+ }\r
+ return results;\r
+ }\r
}\r