Fix a bug in HobLib migration.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1837 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2006-10-25 08:36:35 +00:00
parent 2679d84f24
commit 4c5f3cc94c
1 changed files with 13 additions and 6 deletions

View File

@ -261,12 +261,19 @@ public final class SourceFileReplacer implements Common.ForDoAll {
Matcher mtrhobstatus;
String templine = wholeline;
for (int i = 0; i < specialhoblibfunc.length; i++) {
ptnhobstatus = Pattern.compile("(Status\\s*=\\s*)?" + specialhoblibfunc[i] + "(.*?\\)\\s*;)", Pattern.DOTALL);
do {
ptnhobstatus = Pattern.compile("((?:\t| )*)(\\w(?:\\w|\\d)*)\\s*=\\s*" + specialhoblibfunc[i] + "(.*?;)", Pattern.DOTALL);
mtrhobstatus = ptnhobstatus.matcher(templine);
if (mtrhobstatus.find()) {
templine = mtrhobstatus.replaceAll(specialhoblibfunc[i] + mtrhobstatus.group(2) + "\n " +
MigrationTool.MIGRATIONCOMMENT + "R9 Hob-building library functions will assert if build failure.\n Status = EFI_SUCCESS;");
if (!mtrhobstatus.find()) {
break;
}
String captureIndent = mtrhobstatus.group(1);
String captureStatus = mtrhobstatus.group(2);
String replaceString = captureIndent + specialhoblibfunc[i] + mtrhobstatus.group(3) + "\n";
replaceString += captureIndent + MigrationTool.MIGRATIONCOMMENT + "R9 Hob-building library functions will assert if build failure.\n";
replaceString += captureIndent + captureStatus + " = EFI_SUCCESS;";
templine = mtrhobstatus.replaceFirst(replaceString);
} while (true);
}
return templine;
}