mirror of https://github.com/acidanthera/audk.git
modify r8onlylib generate
add Element git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1473 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2887f99b7c
commit
7ab9a5e580
|
@ -192,4 +192,19 @@ public final class Common {
|
|||
|
||||
public abstract String namechange(String oldname);
|
||||
}
|
||||
|
||||
public static interface Element {
|
||||
|
||||
// public int replace = 0;
|
||||
// public int type = 1;
|
||||
|
||||
public String getReplace(String key);
|
||||
|
||||
// public void getType(String key);
|
||||
//
|
||||
// public void setReplace(int num);
|
||||
//
|
||||
// public void setType(int num);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.regex.*;
|
|||
import java.io.*;
|
||||
|
||||
public final class Critic {
|
||||
public static final Pattern PTN_NEW_HEAD_COMMENT = Pattern.compile("^\\/\\*\\*.*?\\*\\*\\/",Pattern.DOTALL);
|
||||
private static final Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);
|
||||
private static final Pattern ptnfunccomment = Pattern.compile("([\\};\\/\">]\\s*)([\\w\\s]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)([\\{;])",Pattern.DOTALL); // find function with {;">/ , may be unsafe
|
||||
//private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);
|
||||
|
|
|
@ -281,12 +281,21 @@ public final class SourceFileReplacer implements Common.ForDoAll {
|
|||
String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");
|
||||
PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c")));
|
||||
PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.h")));
|
||||
Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(\\w*).*?////~", Pattern.DOTALL);
|
||||
Pattern ptnr8only = Pattern.compile("////#?(\\w*)?(.*?R8_(\\w*).*?)////~", Pattern.DOTALL);
|
||||
Matcher mtrr8only = ptnr8only.matcher(line);
|
||||
Matcher mtrr8onlyhead;
|
||||
|
||||
//add head comment
|
||||
Matcher mtrr8onlyheadcomment = Critic.PTN_NEW_HEAD_COMMENT.matcher(line);
|
||||
if (mtrr8onlyheadcomment.find()) {
|
||||
outfile1.append(mtrr8onlyheadcomment.group() + "\n\n");
|
||||
outfile2.append(mtrr8onlyheadcomment.group() + "\n\n");
|
||||
}
|
||||
|
||||
//add functions body
|
||||
while (mtrr8only.find()) {
|
||||
if (mi.hashr8only.contains(mtrr8only.group(2))) {
|
||||
paragraph = mtrr8only.group();
|
||||
if (mi.hashr8only.contains(mtrr8only.group(3))) {
|
||||
paragraph = mtrr8only.group(2);
|
||||
outfile1.append(paragraph + "\n\n");
|
||||
if (mtrr8only.group(1).length() != 0) {
|
||||
mi.hashrequiredr9libs.add(mtrr8only.group(1));
|
||||
|
|
Loading…
Reference in New Issue