Remove the special case handling of EfiInitializeDriverLib & DxeIntializeDriverLib

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1511 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2006-09-11 09:53:28 +00:00
parent 2e39c71883
commit 06d1ff5b98
3 changed files with 19 additions and 32 deletions

View File

@ -2,8 +2,6 @@ R8.5LibClass,R8.5Lib,R9Lib,R9LibClass,Package
EfiDriverLib,EfiCopyMem,CopyMem,BaseMemoryLib,MdePkg
EfiDriverLib,EfiSetMem,SetMem,BaseMemoryLib,MdePkg
EfiDriverLib,EfiZeroMem,ZeroMem,BaseMemoryLib,MdePkg
EfiDriverLib,EfiInitializeDriverLib,//EfiInitializeDriverLib,UefiBootServicesTableLib; UefiRuntimeServicesTableLib,MdePkg
EfiDriverLib,DxeInitializeDriverLib,//DxeInitializeDriverLib,UefiBootServicesTableLib; UefiRuntimeServicesTableLib; DxeServicesTableLib,MdePkg
EfiDriverLib,EfiLibInstallDriverBinding,R8_EfiLibInstallDriverBinding,%,MdePkg
EfiDriverLib,EfiLibInstallAllDriverProtocols,R8_EfiLibInstallAllDriverProtocols,%,MdePkg
EfiDriverLib,EfiLibCompareLanguage,R8_EfiLibCompareLanguage,%,MdePkg

1 R8.5LibClass R8.5Lib R9Lib R9LibClass Package
2 EfiDriverLib EfiCopyMem CopyMem BaseMemoryLib MdePkg
3 EfiDriverLib EfiSetMem SetMem BaseMemoryLib MdePkg
4 EfiDriverLib EfiZeroMem ZeroMem BaseMemoryLib MdePkg
EfiDriverLib EfiInitializeDriverLib //EfiInitializeDriverLib UefiBootServicesTableLib; UefiRuntimeServicesTableLib MdePkg
EfiDriverLib DxeInitializeDriverLib //DxeInitializeDriverLib UefiBootServicesTableLib; UefiRuntimeServicesTableLib; DxeServicesTableLib MdePkg
5 EfiDriverLib EfiLibInstallDriverBinding R8_EfiLibInstallDriverBinding % MdePkg
6 EfiDriverLib EfiLibInstallAllDriverProtocols R8_EfiLibInstallAllDriverProtocols % MdePkg
7 EfiDriverLib EfiLibCompareLanguage R8_EfiLibCompareLanguage % MdePkg

View File

@ -37,6 +37,11 @@ public final class Common {
return line;
}
public static final boolean find (String line, String regex) {
Pattern ptn = Pattern.compile(regex);
return ptn.matcher (line).find ();
}
//-------------------------------------regex------------------------------------------//
//-----------------------------------file&string---------------------------------------//

View File

@ -89,27 +89,20 @@ public final class SourceFileReplacer implements Common.ForDoAll {
public String operation(String wholeline) {
boolean addr8 = false;
Pattern pat = Pattern.compile("g?(BS|RT)(\\s*->\\s*)([a-zA-Z_]\\w*)", Pattern.MULTILINE); // ! only two level () bracket allowed !
//Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*[#$]*)(\\s*\\(([^\\(\\)]*(\\([^\\(\\)]*\\))?[^\\(\\)]*)*\\))", Pattern.MULTILINE);
// replace BS -> gBS , RT -> gRT
Matcher mat = pat.matcher(wholeline);
if (mat.find()) { // add a library here
MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");
wholeline = mat.replaceAll("g$1$2$3"); //unknown correctiveness
}
mat.reset();
while (mat.find()) {
if (mat.group(1).matches("BS")) {
mi.hashrequiredr9libs.add("UefiBootServicesTableLib");
}
if (mat.group(1).matches("RT")) {
mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");
}
}
// remove EFI_DRIVER_ENTRY_POINT
wholeline = wholeline.replaceAll("(EFI_\\w+_ENTRY_POINT)", MigrationTool.MIGRATIONCOMMENT + " $1");
// remove R8 library contractor
wholeline = wholeline.replaceAll ("(\\b(?:Efi|Dxe)InitializeDriverLib\\b)", MigrationTool.MIGRATIONCOMMENT + " $1");
// Add Library Class for potential reference of gBS, gRT & gDS.
if (Common.find (wholeline, "\\bg?BS\\b")) {
mi.hashrequiredr9libs.add("UefiBootServicesTableLib");
}
if (Common.find (wholeline, "\\bg?RT\\b")) {
mi.hashrequiredr9libs.add ("UefiRuntimeServicesTableLib");
}
if (Common.find (wholeline, "\\bgDS\\b")) {
mi.hashrequiredr9libs.add ("DxeServicesTableLib");
}
// start replacing names
String r8thing;
String r9thing;
@ -118,16 +111,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
it = mi.hashnonlocalfunc.iterator();
while (it.hasNext()) {
r8thing = it.next();
if (r8thing.matches("EfiInitializeDriverLib")) { //s
mi.hashrequiredr9libs.add("UefiBootServicesTableLib"); //p
mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib"); //e
} else if (r8thing.matches("DxeInitializeDriverLib")) { //c
mi.hashrequiredr9libs.add("UefiBootServicesTableLib"); //i
mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib"); //a
mi.hashrequiredr9libs.add("DxeServicesTableLib"); //l
} else { //
mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here
}
r8tor9 temp;
if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {