mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
enhance hoblib function convert
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1496 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
af22c12f37
commit
274a3dbda1
@ -30,6 +30,16 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||||||
private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();
|
private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();
|
||||||
private static final Set<String> filer8only = new HashSet<String>();
|
private static final Set<String> filer8only = new HashSet<String>();
|
||||||
|
|
||||||
|
private static final String[] specialhoblibfunc = {
|
||||||
|
"BuildModuleHob",
|
||||||
|
"BuildResourceDescriptorHob",
|
||||||
|
"BuildFvHob",
|
||||||
|
"BuildCpuHob",
|
||||||
|
"BuildStackHob",
|
||||||
|
"BuildBspStoreHob",
|
||||||
|
"BuildMemoryAllocationHob"
|
||||||
|
};
|
||||||
|
|
||||||
//---------------------------------------inner classes---------------------------------------//
|
//---------------------------------------inner classes---------------------------------------//
|
||||||
private static class r8tor9 {
|
private static class r8tor9 {
|
||||||
r8tor9(String r8, String r9) {
|
r8tor9(String r8, String r9) {
|
||||||
@ -163,7 +173,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||||||
// Converting Pei
|
// Converting Pei
|
||||||
// First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%
|
// First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%
|
||||||
Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);
|
Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);
|
||||||
if (mi.moduletype.contains("PEIM")) {
|
if (mi.getModuleType().matches("PEIM")) {
|
||||||
|
//if (mi.moduletype.contains("PEIM")) {
|
||||||
Matcher mtrpei = ptnpei.matcher(wholeline);
|
Matcher mtrpei = ptnpei.matcher(wholeline);
|
||||||
while (mtrpei.find()) { // ! add a library here !
|
while (mtrpei.find()) { // ! add a library here !
|
||||||
wholeline = mtrpei.replaceAll("PeiServices$1#%$2");
|
wholeline = mtrpei.replaceAll("PeiServices$1#%$2");
|
||||||
@ -187,6 +198,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wholeline = hobLibFuncDropStatus(wholeline);
|
||||||
|
|
||||||
Matcher mtrmac;
|
Matcher mtrmac;
|
||||||
mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);
|
mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);
|
||||||
if (mtrmac.find()) {
|
if (mtrmac.find()) {
|
||||||
@ -277,6 +290,20 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final String hobLibFuncDropStatus(String wholeline) { // or use regex to find pattern "Status = ..."
|
||||||
|
Pattern ptnhobstatus;
|
||||||
|
Matcher mtrhobstatus;
|
||||||
|
String templine = wholeline;
|
||||||
|
for (int i = 0; i < specialhoblibfunc.length; i++) {
|
||||||
|
ptnhobstatus = Pattern.compile("(Status\\s*=\\s*)?" + specialhoblibfunc[i] + "(.*?\\)\\s*;)", Pattern.DOTALL);
|
||||||
|
mtrhobstatus = ptnhobstatus.matcher(templine);
|
||||||
|
if (mtrhobstatus.find()) {
|
||||||
|
templine = mtrhobstatus.replaceAll(specialhoblibfunc[i] + mtrhobstatus.group(2) + "\n //Migration comments: R9 Hob-building library functions will assert if build failure.\n Status = EFI_SUCCESS;");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return templine;
|
||||||
|
}
|
||||||
|
|
||||||
private final void addr8only() throws Exception {
|
private final void addr8only() throws Exception {
|
||||||
String paragraph = null;
|
String paragraph = null;
|
||||||
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");
|
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user