mirror of https://github.com/acidanthera/audk.git
Enhance recognizing Macro/Type defined in Library.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1525 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8cc59d2c51
commit
9f98dbb76f
|
@ -41,8 +41,8 @@ EfiDriverLib,EfiLibReportStatusCode,ReportStatusCode,ReportStatusCodeLib,MdePkg
|
|||
EfiDriverLib,ReportStatusCodeWithDevicePath,ReportStatusCodeWithDevicePath,ReportStatusCodeLib,MdePkg
|
||||
EfiDriverLib,EFI_FIELD_OFFSET,EFI_FIELD_OFFSET,BaseLib,MdePkg
|
||||
EfiDriverLib,EFI_LIST,LIST_ENTRY,BaseLib,MdePkg
|
||||
EfiDriverLib,EFI_LIST_ENTRY,LIST_ENTRY,BaseLib,MdePkg
|
||||
EfiDriverLib,EFI_LIST_NODE,LIST_ENTRY,BaseLib,MdePkg
|
||||
EfiDriverLib,EFI_LIST_ENTRY,LIST_ENTRY ,BaseLib,MdePkg
|
||||
EfiDriverLib,EFI_LIST_NODE,LIST_ENTRY ,BaseLib,MdePkg
|
||||
EfiDriverLib,FLOCK,EFI_LOCK,UefiLib,MdePkg
|
||||
EfiDriverLib,GetFirstNode,GetFirstNode,BaseLib,MdePkg
|
||||
EfiDriverLib,GetNextNode,GetNextNode,BaseLib,MdePkg
|
||||
|
|
|
|
@ -35,6 +35,7 @@ public class Macro {
|
|||
String temp = null;
|
||||
|
||||
temp = mtr.group();
|
||||
mi.hashmacro.add(temp);
|
||||
if (MigrationTool.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones
|
||||
if (!unmacro.contains(temp)) {
|
||||
mi.hashnonlocalmacro.add(temp);
|
||||
|
|
|
@ -41,6 +41,7 @@ public final class ModuleInfo {
|
|||
public final Set<String> hashnonlocalmacro = new HashSet<String>();
|
||||
public final Set<String> hashEFIcall = new HashSet<String>();
|
||||
public final Set<String> hashr8only = new HashSet<String>();
|
||||
public final Set<String> hashmacro = new HashSet<String>();
|
||||
|
||||
public final Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs is now all added in SourceFileReplacer
|
||||
public final Set<String> guid = new HashSet<String>();
|
||||
|
|
|
@ -53,7 +53,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||
|
||||
private class IdleLaplace extends Common.Laplace {
|
||||
public String operation(String wholeline) {
|
||||
return wholeline;
|
||||
return replaceLibrary (wholeline, mi.hashmacro);
|
||||
}
|
||||
|
||||
public boolean recognize(String filename) {
|
||||
|
@ -105,51 +105,11 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||
if (Common.find (wholeline, "\\bgDS\\b")) {
|
||||
mi.hashrequiredr9libs.add ("DxeServicesTableLib");
|
||||
}
|
||||
// start replacing names
|
||||
String r8thing;
|
||||
String r9thing;
|
||||
Iterator<String> it;
|
||||
// Converting non-locla function
|
||||
it = mi.hashnonlocalfunc.iterator();
|
||||
while (it.hasNext()) {
|
||||
r8thing = it.next();
|
||||
mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here
|
||||
|
||||
r8tor9 temp;
|
||||
if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {
|
||||
if (!r8thing.equals(r9thing)) {
|
||||
if (wholeline.contains(r8thing)) {
|
||||
wholeline = wholeline.replaceAll(r8thing, r9thing);
|
||||
filefunc.add(new r8tor9(r8thing, r9thing));
|
||||
Iterator<r8tor9> rt = filefunc.iterator();
|
||||
while (rt.hasNext()) {
|
||||
temp = rt.next();
|
||||
if (MigrationTool.db.r8only.contains(temp.r8thing)) {
|
||||
filer8only.add(r8thing);
|
||||
mi.hashr8only.add(r8thing);
|
||||
addr8 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //is any of the guids changed?
|
||||
if (addr8 == true) {
|
||||
wholeline = addincludefile(wholeline, "\"R8Lib.h\"");
|
||||
}
|
||||
|
||||
|
||||
wholeline = replaceLibrary (wholeline, mi.hashnonlocalfunc);
|
||||
wholeline = replaceLibrary (wholeline, mi.hashmacro);
|
||||
// Converting macro
|
||||
it = mi.hashnonlocalmacro.iterator();
|
||||
while (it.hasNext()) { //macros are all assumed MdePkg currently
|
||||
r8thing = it.next();
|
||||
//mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));
|
||||
if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {
|
||||
if (wholeline.contains(r8thing)) {
|
||||
wholeline = wholeline.replaceAll(r8thing, r9thing);
|
||||
filemacro.add(new r8tor9(r8thing, r9thing));
|
||||
}
|
||||
}
|
||||
}
|
||||
wholeline = replaceMacro (wholeline, mi.hashnonlocalmacro);
|
||||
|
||||
// Converting guid
|
||||
replaceGuid(wholeline, mi.guid, "guid", fileguid);
|
||||
|
@ -289,7 +249,64 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||
}
|
||||
return templine;
|
||||
}
|
||||
|
||||
|
||||
private final String replaceMacro (String wholeline, Set<String> symbolSet) {
|
||||
String r8thing;
|
||||
String r9thing;
|
||||
Iterator<String> it;
|
||||
|
||||
it = symbolSet.iterator();
|
||||
while (it.hasNext()) { //macros are all assumed MdePkg currently
|
||||
r8thing = it.next();
|
||||
System.out.println (r8thing);
|
||||
//mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));
|
||||
if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {
|
||||
if (wholeline.contains(r8thing)) {
|
||||
wholeline = wholeline.replaceAll(r8thing, r9thing);
|
||||
filemacro.add(new r8tor9(r8thing, r9thing));
|
||||
}
|
||||
}
|
||||
}
|
||||
return wholeline;
|
||||
}
|
||||
|
||||
private final String replaceLibrary (String wholeline, Set<String> symbolSet) {
|
||||
boolean addr8 = false;
|
||||
// start replacing names
|
||||
String r8thing;
|
||||
String r9thing;
|
||||
Iterator<String> it;
|
||||
// Converting non-locla function
|
||||
it = symbolSet.iterator();
|
||||
while (it.hasNext()) {
|
||||
r8thing = it.next();
|
||||
mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here
|
||||
|
||||
r8tor9 temp;
|
||||
if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {
|
||||
if (!r8thing.equals(r9thing)) {
|
||||
if (wholeline.contains(r8thing)) {
|
||||
wholeline = wholeline.replaceAll(r8thing, r9thing);
|
||||
filefunc.add(new r8tor9(r8thing, r9thing));
|
||||
Iterator<r8tor9> rt = filefunc.iterator();
|
||||
while (rt.hasNext()) {
|
||||
temp = rt.next();
|
||||
if (MigrationTool.db.r8only.contains(temp.r8thing)) {
|
||||
filer8only.add(r8thing);
|
||||
mi.hashr8only.add(r8thing);
|
||||
addr8 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} //is any of the guids changed?
|
||||
if (addr8 == true) {
|
||||
wholeline = addincludefile(wholeline, "\"R8Lib.h\"");
|
||||
}
|
||||
return wholeline;
|
||||
}
|
||||
|
||||
private final void addr8only() throws Exception {
|
||||
String paragraph = null;
|
||||
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");
|
||||
|
|
Loading…
Reference in New Issue