Fix several bugs & enhancement.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1731 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2006-10-12 10:31:02 +00:00
parent 6ceb38158a
commit 4932405544
4 changed files with 20 additions and 8 deletions

View File

@ -27,7 +27,7 @@ public class Macro {
public String r8name;
public String r9name;
public static Pattern ptntmacro = Pattern.compile("\\b[A-Z_]+\\s*?\\(?\\b",Pattern.MULTILINE);
public static Pattern ptntmacro = Pattern.compile("\\b\\w(\\w|\\d)*",Pattern.MULTILINE);
private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";

View File

@ -185,7 +185,7 @@ public final class ModuleReader implements Common.ForDoAll {
Iterator<String> ii = mi.localmodulesources.iterator();
while (ii.hasNext()) {
temp = ii.next();
if (temp.contains(".c")) {
if (temp.contains(".c") || temp.contains(".dxs")) {
mi.preprocessedccodes.add(temp);
}
}

View File

@ -70,7 +70,16 @@ public class MsaWriter {
filename.setSupArchList(arch);
}
}
private void addWrapper() {
XmlCursor cursor = msa.newCursor();
String uri = "http://www.TianoCore.org/2006/Edk2.0";
cursor.push();
cursor.toNextToken();
cursor.insertNamespace("", uri);
cursor.insertNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
cursor.pop();
msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)cursor.getObject();
}
private ModuleSurfaceAreaDocument fulfillMsadoc() throws Exception {
Iterator<String> it;
String temp;
@ -173,7 +182,8 @@ public class MsaWriter {
lc.setUsage(UsageTypes.ALWAYS_CONSUMED);
}
}
addWrapper();
msadoc.setModuleSurfaceArea(msa);
return msadoc;
}

View File

@ -86,6 +86,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
}
private class DxsLaplace extends Common.Laplace {
public String operation(String wholeline) {
wholeline = replaceMacro(wholeline, mi.hashnonlocalmacro);
if (mi.getModuleType().equals("PEIM")) {
return addincludefile(wholeline, "\\<PeimDepex.h\\>");
} else {
@ -105,7 +106,7 @@ public final class SourceFileReplacer implements Common.ForDoAll {
private class CLaplace extends Common.Laplace {
public String operation(String wholeline) {
// remove EFI_DRIVER_ENTRY_POINT
wholeline = wholeline.replaceAll("(EFI_[A-Z]+_ENTRY_POINT\\s*\\(\\s*" + mi.entrypoint + "\\s*\\)\\s*;)", MigrationTool.MIGRATIONCOMMENT + " $1");
wholeline = wholeline.replaceAll("(EFI_[A-Z]+_ENTRY_POINT\\s*\\(\\s*\\w(\\w|\\d)*\\s*\\))", MigrationTool.MIGRATIONCOMMENT + " $1");
// redefine module entry point for some self-relocated modules
wholeline = wholeline.replaceAll (mi.entrypoint + "([^{]*?})", "_ModuleEntryPoint" + "$1");
// remove R8 library contractor
@ -277,7 +278,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
//mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));
if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {
if (wholeline.contains(r8thing)) {
wholeline = wholeline.replaceAll(r8thing, r9thing);
String findString = "(?<!(?:\\d|\\w))" + r8thing + "(?!(?:\\d|\\w))";
wholeline = wholeline.replaceAll(findString, r9thing);
filemacro.add(new r8tor9(r8thing, r9thing));
}
}