modify r8onlylib generate
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Sep 2006 05:40:02 +0000 (05:40 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 6 Sep 2006 05:40:02 +0000 (05:40 +0000)
add Element

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1473 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/MigrationTools/org/tianocore/migration/Common.java
Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java

index a7154b6129a6cc406222256c0fc90aaa35193529..da560ec10b1cd9a9ca6bcdcbcaccc52a851d8c72 100644 (file)
@@ -192,4 +192,19 @@ public final class Common {
                \r
                public abstract String namechange(String oldname);\r
        }\r
+       \r
+       public static interface Element {\r
+               \r
+//             public int replace = 0;\r
+//             public int type = 1;\r
+               \r
+               public String getReplace(String key);\r
+               \r
+//             public void getType(String key);\r
+//             \r
+//             public void setReplace(int num);\r
+//             \r
+//             public void setType(int num);\r
+               \r
+       }\r
 }\r
index 95e95e9dd4cd5b2a456be65442e0c39ad9ce467b..49c13bfa948b1bd35f067a4981b631a5b46f3e75 100644 (file)
@@ -16,6 +16,7 @@ import java.util.regex.*;
 import java.io.*;\r
 \r
 public final class Critic {\r
+       public static final Pattern PTN_NEW_HEAD_COMMENT = Pattern.compile("^\\/\\*\\*.*?\\*\\*\\/",Pattern.DOTALL);\r
        private static final Pattern ptnheadcomment = Pattern.compile("^\\/\\*\\+\\+(.*?)\\-\\-\\*\\/",Pattern.DOTALL);\r
        private static final Pattern ptnfunccomment = Pattern.compile("([\\};\\/\">]\\s*)([\\w\\s]*?[_\\w][_\\w\\d]*\\s*\\([^\\)\\(]*\\)\\s*)\\/\\*\\+\\+(.*?)\\-\\-\\*\\/(\\s*.*?)([\\{;])",Pattern.DOTALL);           // find function with {;">/ , may be unsafe\r
        //private static Pattern ptncommentstructure = Pattern.compile("\\/\\*\\+\\+\\s*Routine Description:\\s*(.*?)\\s*Arguments:\\s*(.*?)\\s*Returns:\\s*(.*?)\\s*\\-\\-\\*\\/",Pattern.DOTALL);\r
index 5fb102091c2ca13c630eb435215ef872c077d9c5..07f93cecadc85bbde1560a87ab6384e8846a7296 100644 (file)
@@ -281,12 +281,21 @@ public final class SourceFileReplacer implements Common.ForDoAll {
                String line = Common.file2string(MigrationTool.db.DatabasePath + File.separator + "R8Lib.c");\r
                PrintWriter outfile1 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.c")));\r
                PrintWriter outfile2 = new PrintWriter(new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + "R8Lib.h")));\r
-               Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(\\w*).*?////~", Pattern.DOTALL);\r
+               Pattern ptnr8only = Pattern.compile("////#?(\\w*)?(.*?R8_(\\w*).*?)////~", Pattern.DOTALL);\r
                Matcher mtrr8only = ptnr8only.matcher(line);\r
                Matcher mtrr8onlyhead;\r
+               \r
+               //add head comment\r
+               Matcher mtrr8onlyheadcomment = Critic.PTN_NEW_HEAD_COMMENT.matcher(line);\r
+               if (mtrr8onlyheadcomment.find()) {\r
+                       outfile1.append(mtrr8onlyheadcomment.group() + "\n\n");\r
+                       outfile2.append(mtrr8onlyheadcomment.group() + "\n\n");\r
+               }\r
+               \r
+               //add functions body\r
                while (mtrr8only.find()) {\r
-                       if (mi.hashr8only.contains(mtrr8only.group(2))) {\r
-                               paragraph = mtrr8only.group();\r
+                       if (mi.hashr8only.contains(mtrr8only.group(3))) {\r
+                               paragraph = mtrr8only.group(2);\r
                                outfile1.append(paragraph + "\n\n");\r
                                if (mtrr8only.group(1).length() != 0) {\r
                                        mi.hashrequiredr9libs.add(mtrr8only.group(1));\r