diff options
author | alfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-07 09:08:23 +0000 |
---|---|---|
committer | alfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-09-07 09:08:23 +0000 |
commit | 274a3dbda1669a493a3307eb54991e516e5d09c5 (patch) | |
tree | 30f04de9f77812eb8b03a68113e50c92a6fbbe0c | |
parent | af22c12f37324026609f5349421cf216a9f38fca (diff) | |
download | edk2-platforms-274a3dbda1669a493a3307eb54991e516e5d09c5.tar.xz |
enhance hoblib function convert
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1496 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java index a2bc6c37fa..25edc44e35 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java @@ -30,6 +30,16 @@ public final class SourceFileReplacer implements Common.ForDoAll { private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();
private static final Set<String> filer8only = new HashSet<String>();
+ private static final String[] specialhoblibfunc = {
+ "BuildModuleHob",
+ "BuildResourceDescriptorHob",
+ "BuildFvHob",
+ "BuildCpuHob",
+ "BuildStackHob",
+ "BuildBspStoreHob",
+ "BuildMemoryAllocationHob"
+ };
+
//---------------------------------------inner classes---------------------------------------//
private static class r8tor9 {
r8tor9(String r8, String r9) {
@@ -163,7 +173,8 @@ public final class SourceFileReplacer implements Common.ForDoAll { // Converting Pei
// 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);
- if (mi.moduletype.contains("PEIM")) {
+ if (mi.getModuleType().matches("PEIM")) {
+ //if (mi.moduletype.contains("PEIM")) {
Matcher mtrpei = ptnpei.matcher(wholeline);
while (mtrpei.find()) { // ! add a library here !
wholeline = mtrpei.replaceAll("PeiServices$1#%$2");
@@ -187,6 +198,8 @@ public final class SourceFileReplacer implements Common.ForDoAll { }
}
+ wholeline = hobLibFuncDropStatus(wholeline);
+
Matcher mtrmac;
mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);
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 {
String paragraph = null;
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");
|