summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/MigrationTools
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-12 10:31:02 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-12 10:31:02 +0000
commit49324055442ba901c0baf751963452cac7e8542a (patch)
treef090502b8e402fd7a486b749c7044ed3db90f395 /Tools/Java/Source/MigrationTools
parent6ceb38158a4f04f11cf0a0607a00ae8cda9e9d66 (diff)
downloadedk2-49324055442ba901c0baf751963452cac7e8542a.zip
edk2-49324055442ba901c0baf751963452cac7e8542a.tar.gz
edk2-49324055442ba901c0baf751963452cac7e8542a.tar.bz2
Fix several bugs & enhancement.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1731 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source/MigrationTools')
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java2
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java2
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java18
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java6
4 files changed, 20 insertions, 8 deletions
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
index bd10b5a..57c85d9 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
@@ -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";
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
index 7880f2b..09d4262 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
@@ -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);
}
}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
index 3db2507..132d6c3 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
@@ -70,11 +70,20 @@ 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;
-
+
if (mi.modulename != null) {
msaheader.setModuleName(mi.modulename);
} else {
@@ -173,7 +182,8 @@ public class MsaWriter {
lc.setUsage(UsageTypes.ALWAYS_CONSUMED);
}
}
-
+ addWrapper();
+ msadoc.setModuleSurfaceArea(msa);
return msadoc;
}
@@ -184,7 +194,7 @@ public class MsaWriter {
options.setSavePrettyPrint();
options.setSavePrettyPrintIndent(2);
options.setUseDefaultNamespace();
-
+
BufferedWriter bw = new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + mi.modulename + ".msa"));
fulfillMsadoc().save(bw, options);
//MsaTreeEditor.init(mi, ui, msadoc);
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
index 01678a3..e37f7f4 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
@@ -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));
}
}