]> git.proxmox.com Git - mirror_edk2.git/commitdiff
\t 2 \ \ \ \
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Sep 2006 01:00:36 +0000 (01:00 +0000)
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 8 Sep 2006 01:00:36 +0000 (01:00 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1499 6f19259b-4bc3-4df7-8a09-765794883524

15 files changed:
Tools/Source/MigrationTools/org/tianocore/migration/Common.java
Tools/Source/MigrationTools/org/tianocore/migration/Critic.java
Tools/Source/MigrationTools/org/tianocore/migration/Database.java
Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
Tools/Source/MigrationTools/org/tianocore/migration/Func.java
Tools/Source/MigrationTools/org/tianocore/migration/Guid.java
Tools/Source/MigrationTools/org/tianocore/migration/Macro.java
Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
Tools/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
Tools/Source/MigrationTools/org/tianocore/migration/MsaTreeEditor.java
Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
Tools/Source/MigrationTools/org/tianocore/migration/PathIterator.java
Tools/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
Tools/Source/MigrationTools/org/tianocore/migration/UI.java

index 5c8629c6448742b0d5ed9a735bb7c2bf9d1bfb58..23e2319dcf41f2e6da6992dfafb0abb058ba1d03 100644 (file)
@@ -18,191 +18,191 @@ import java.util.*;
 import java.lang.reflect.*;\r
 \r
 public final class Common {\r
-       public static final int BOTH = 0;\r
-       public static final int FILE = 1;\r
-       public static final int DIR = 2;\r
-       \r
-       public static final String strseparate = "(.*)\\\\([^\\\\]*)";\r
-       public static final Pattern ptnseparate = Pattern.compile("(.*)\\\\([^\\\\]*)");\r
+    public static final int BOTH = 0;\r
+    public static final int FILE = 1;\r
+    public static final int DIR = 2;\r
+    \r
+    public static final String strseparate = "(.*)\\\\([^\\\\]*)";\r
+    public static final Pattern ptnseparate = Pattern.compile("(.*)\\\\([^\\\\]*)");\r
 \r
-       //-------------------------------------regex------------------------------------------//\r
-       \r
-       public static final String replaceAll(String line, Pattern ptn, String des) {\r
-               Matcher mtr = ptn.matcher(line);\r
+    //-------------------------------------regex------------------------------------------//\r
+    \r
+    public static final String replaceAll(String line, Pattern ptn, String des) {\r
+        Matcher mtr = ptn.matcher(line);\r
 \r
-               if (mtr.find()) {\r
-                        return mtr.replaceAll(des);\r
-               }\r
-               \r
-               return line;\r
-       }\r
+        if (mtr.find()) {\r
+             return mtr.replaceAll(des);\r
+        }\r
+        \r
+        return line;\r
+    }\r
 \r
-       //-------------------------------------regex------------------------------------------//\r
-       \r
-       //-----------------------------------file&string---------------------------------------//\r
-       \r
-       public static final String file2string(String filename) throws Exception {\r
-               BufferedReader rd = new BufferedReader(new FileReader(filename));\r
-               StringBuffer wholefile = new StringBuffer();\r
-               String line;\r
-               while ((line = rd.readLine()) != null) {\r
-                       wholefile.append(line + "\n");\r
-               }\r
-               return wholefile.toString();\r
-       }\r
+    //-------------------------------------regex------------------------------------------//\r
+    \r
+    //-----------------------------------file&string---------------------------------------//\r
+    \r
+    public static final String file2string(String filename) throws Exception {\r
+        BufferedReader rd = new BufferedReader(new FileReader(filename));\r
+        StringBuffer wholefile = new StringBuffer();\r
+        String line;\r
+        while ((line = rd.readLine()) != null) {\r
+            wholefile.append(line + "\n");\r
+        }\r
+        return wholefile.toString();\r
+    }\r
 \r
-       public static final void string2file(String content, String filename) throws Exception {\r
-               ensureDir(filename);\r
-               PrintWriter outfile = new PrintWriter(new BufferedWriter(new FileWriter(filename)));\r
-               outfile.append(content);\r
-               outfile.flush();\r
-               outfile.close();\r
-       }\r
+    public static final void string2file(String content, String filename) throws Exception {\r
+        ensureDir(filename);\r
+        PrintWriter outfile = new PrintWriter(new BufferedWriter(new FileWriter(filename)));\r
+        outfile.append(content);\r
+        outfile.flush();\r
+        outfile.close();\r
+    }\r
 \r
-       //-----------------------------------file&string---------------------------------------//\r
+    //-----------------------------------file&string---------------------------------------//\r
 \r
-       //--------------------------------------dir--------------------------------------------//\r
-       /*\r
-       public static final HashSet<String> walkDir(String path, int mode) throws Exception {\r
-               HashSet<String> pathlist = new HashSet<String>();\r
-               Common.toDoAll(path, Common.class.getMethod("walkDir", String.class), null, null, mode);\r
-               return pathlist;\r
-       }\r
-       */\r
-       public static final void ensureDir(String objFileWhole) {\r
-               File tempdir;\r
-               Matcher mtrseparate = ptnseparate.matcher(objFileWhole);\r
-               if (mtrseparate.find()) {\r
-                       tempdir = new File(mtrseparate.group(1));\r
-                       if (!tempdir.exists()) tempdir.mkdirs();\r
-               }\r
-       }\r
-       \r
-       public static final void deleteDir(String objFileWhole) {\r
-               String[] list = new File(objFileWhole).list();\r
-               File temp;\r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       temp = new File(objFileWhole + File.separator + list[i]);\r
-                       if (temp.isDirectory()) {\r
-                               deleteDir(objFileWhole + File.separator + list[i]);\r
-                       } else {\r
-                               temp.delete();\r
-                       }\r
-               }\r
-               new File(objFileWhole).delete();\r
-       }\r
-       \r
-       public static final String dirCopy_(String src) throws Exception {\r
-               Matcher mtrseparate = Common.ptnseparate.matcher(src);\r
-               if (mtrseparate.find()) {\r
-                       dirCopy(src, mtrseparate.group(1) + File.separator + "_" + mtrseparate.group(2));\r
-               }\r
-               return mtrseparate.group(1) + File.separator + "_" + mtrseparate.group(2);\r
-       }\r
-       \r
-       public static final void dirCopy(String src, String des) throws Exception {\r
-               String[] list = new File(src).list();\r
-               File test;\r
+    //--------------------------------------dir--------------------------------------------//\r
+    /*\r
+    public static final HashSet<String> walkDir(String path, int mode) throws Exception {\r
+        HashSet<String> pathlist = new HashSet<String>();\r
+        Common.toDoAll(path, Common.class.getMethod("walkDir", String.class), null, null, mode);\r
+        return pathlist;\r
+    }\r
+    */\r
+    public static final void ensureDir(String objFileWhole) {\r
+        File tempdir;\r
+        Matcher mtrseparate = ptnseparate.matcher(objFileWhole);\r
+        if (mtrseparate.find()) {\r
+            tempdir = new File(mtrseparate.group(1));\r
+            if (!tempdir.exists()) tempdir.mkdirs();\r
+        }\r
+    }\r
+    \r
+    public static final void deleteDir(String objFileWhole) {\r
+        String[] list = new File(objFileWhole).list();\r
+        File temp;\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            temp = new File(objFileWhole + File.separator + list[i]);\r
+            if (temp.isDirectory()) {\r
+                deleteDir(objFileWhole + File.separator + list[i]);\r
+            } else {\r
+                temp.delete();\r
+            }\r
+        }\r
+        new File(objFileWhole).delete();\r
+    }\r
+    \r
+    public static final String dirCopy_(String src) throws Exception {\r
+        Matcher mtrseparate = Common.ptnseparate.matcher(src);\r
+        if (mtrseparate.find()) {\r
+            dirCopy(src, mtrseparate.group(1) + File.separator + "_" + mtrseparate.group(2));\r
+        }\r
+        return mtrseparate.group(1) + File.separator + "_" + mtrseparate.group(2);\r
+    }\r
+    \r
+    public static final void dirCopy(String src, String des) throws Exception {\r
+        String[] list = new File(src).list();\r
+        File test;\r
 \r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       test = new File(src + File.separator + list[i]);\r
-                       if (test.isDirectory()) {\r
-                               dirCopy(src + File.separator + list[i], des + File.separator + list[i]);\r
-                       } else {\r
-                               ensureDir(des + File.separator + list[i]);\r
-                               string2file(file2string(src + File.separator + list[i]), des + File.separator + list[i]);\r
-                       }\r
-               }\r
-       }\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            test = new File(src + File.separator + list[i]);\r
+            if (test.isDirectory()) {\r
+                dirCopy(src + File.separator + list[i], des + File.separator + list[i]);\r
+            } else {\r
+                ensureDir(des + File.separator + list[i]);\r
+                string2file(file2string(src + File.separator + list[i]), des + File.separator + list[i]);\r
+            }\r
+        }\r
+    }\r
 \r
-       //--------------------------------------dir--------------------------------------------//\r
+    //--------------------------------------dir--------------------------------------------//\r
 \r
-       //-------------------------------like python walk-----------------------------------------//\r
-       \r
-       public static final void toDoAll(String path, Method md, Object obj, Object[] args, int type) throws Exception {\r
-               String[] list = new File(path).list();\r
-               ArrayList<Object> _args = new ArrayList<Object>();\r
-               \r
-               _args.add(path);\r
-               if (args != null) {\r
-                       for (int i = 0; i < args.length; i++) {\r
-                               _args.add(args[i]);\r
-                       }\r
-               }\r
+    //-------------------------------like python walk-----------------------------------------//\r
+    \r
+    public static final void toDoAll(String path, Method md, Object obj, Object[] args, int type) throws Exception {\r
+        String[] list = new File(path).list();\r
+        ArrayList<Object> _args = new ArrayList<Object>();\r
+        \r
+        _args.add(path);\r
+        if (args != null) {\r
+            for (int i = 0; i < args.length; i++) {\r
+                _args.add(args[i]);\r
+            }\r
+        }\r
 \r
-               if (type == DIR || type == BOTH) {\r
-                       md.invoke(obj, _args.toArray());\r
-               }\r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       if (new File(path + File.separator + list[i]).isDirectory()) {\r
-                               toDoAll(path + File.separator + list[i], md, obj, args, type);\r
-                       } else {\r
-                               if (type == FILE || type == BOTH) {\r
-                                       _args.set(0, path + File.separator + list[i]);\r
-                                       md.invoke(obj, _args.toArray());\r
-                               }\r
-                       }\r
-               }\r
-       }\r
+        if (type == DIR || type == BOTH) {\r
+            md.invoke(obj, _args.toArray());\r
+        }\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            if (new File(path + File.separator + list[i]).isDirectory()) {\r
+                toDoAll(path + File.separator + list[i], md, obj, args, type);\r
+            } else {\r
+                if (type == FILE || type == BOTH) {\r
+                    _args.set(0, path + File.separator + list[i]);\r
+                    md.invoke(obj, _args.toArray());\r
+                }\r
+            }\r
+        }\r
+    }\r
 \r
-       public static final void toDoAll(Set<String> set, ForDoAll fda) throws Exception {\r
-               Iterator<String> di = set.iterator();\r
-               while (di.hasNext()) {\r
-                       fda.run(di.next());\r
-               }\r
-       }\r
-       \r
-       public static final void toDoAll(String path, ForDoAll fda, int type) throws Exception { // filter of file type can be done in toDo\r
-               String[] list = new File(path).list();\r
-               File test;\r
+    public static final void toDoAll(Set<String> set, ForDoAll fda) throws Exception {\r
+        Iterator<String> di = set.iterator();\r
+        while (di.hasNext()) {\r
+            fda.run(di.next());\r
+        }\r
+    }\r
+    \r
+    public static final void toDoAll(String path, ForDoAll fda, int type) throws Exception { // filter of file type can be done in toDo\r
+        String[] list = new File(path).list();\r
+        File test;\r
 \r
-               if (type == DIR || type == BOTH) {\r
-                       fda.run(path);\r
-               }\r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       test = new File(path + File.separator + list[i]);\r
-                       if (test.isDirectory()) {\r
-                               if (fda.filter(test)) {\r
-                                       toDoAll(path + File.separator + list[i], fda, type);\r
-                               }\r
-                       } else {\r
-                               if (type == FILE || type == BOTH) {\r
-                                       fda.run(path + File.separator + list[i]);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       \r
-       public static interface ForDoAll {\r
-               public void run(String filepath) throws Exception;\r
-               \r
-               public boolean filter(File dir);\r
-       }\r
-       \r
-       public static abstract class Laplace {\r
-               public void transform(String src, String des) throws Exception {\r
-                       Common.string2file(operation(Common.file2string(src)), des);\r
-               }\r
-               \r
-               public abstract String operation(String wholeline);\r
-               \r
-               public abstract boolean recognize(String filename);\r
-               \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
+        if (type == DIR || type == BOTH) {\r
+            fda.run(path);\r
+        }\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            test = new File(path + File.separator + list[i]);\r
+            if (test.isDirectory()) {\r
+                if (fda.filter(test)) {\r
+                    toDoAll(path + File.separator + list[i], fda, type);\r
+                }\r
+            } else {\r
+                if (type == FILE || type == BOTH) {\r
+                    fda.run(path + File.separator + list[i]);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    \r
+    public static interface ForDoAll {\r
+        public void run(String filepath) throws Exception;\r
+        \r
+        public boolean filter(File dir);\r
+    }\r
+    \r
+    public static abstract class Laplace {\r
+        public void transform(String src, String des) throws Exception {\r
+            Common.string2file(operation(Common.file2string(src)), des);\r
+        }\r
+        \r
+        public abstract String operation(String wholeline);\r
+        \r
+        public abstract boolean recognize(String filename);\r
+        \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 c987b9fe87c89548fb558e96ad2a431fc6e085e1..45670d94c2be9e5c3aa37f762322234ad9485e08 100644 (file)
@@ -16,192 +16,192 @@ 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
-       private static final Pattern ptncommentequation = Pattern.compile("([^\\s]*)\\s+-\\s+(.*)\\s*");\r
-       private static Matcher mtrcommentequation;\r
-       private static final Pattern ptnnewcomment = Pattern.compile("(\\s*@(param|retval)\\s+[^\\s]+)\\s+(.*)");\r
-       private static Matcher mtrnewcomment;\r
-       \r
-       private static final int totallinelength = 82;\r
-       \r
-       public static final void run(String filepath) throws Exception {\r
-               if (MigrationTool.doCritic) {                                   // this is left here to set an example for future structure\r
-                       critic(filepath);\r
-               }\r
-       }\r
-       \r
-       private static final void critic(String filepath) throws Exception {\r
-               if (filepath.contains(".c") || filepath.contains(".h")) {\r
-                       BufferedReader rd = null;\r
-                       String line = null;\r
-                       StringBuffer templine = new StringBuffer();\r
-                       boolean incomment = false;\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
+    private static final Pattern ptncommentequation = Pattern.compile("([^\\s]*)\\s+-\\s+(.*)\\s*");\r
+    private static Matcher mtrcommentequation;\r
+    private static final Pattern ptnnewcomment = Pattern.compile("(\\s*@(param|retval)\\s+[^\\s]+)\\s+(.*)");\r
+    private static Matcher mtrnewcomment;\r
+    \r
+    private static final int totallinelength = 82;\r
+    \r
+    public static final void run(String filepath) throws Exception {\r
+        if (MigrationTool.doCritic) {                    // this is left here to set an example for future structure\r
+            critic(filepath);\r
+        }\r
+    }\r
+    \r
+    private static final void critic(String filepath) throws Exception {\r
+        if (filepath.contains(".c") || filepath.contains(".h")) {\r
+            BufferedReader rd = null;\r
+            String line = null;\r
+            StringBuffer templine = new StringBuffer();\r
+            boolean incomment = false;\r
 \r
-                       System.out.println("Criticing   " + filepath);\r
-                       String wholeline = Common.file2string(filepath);\r
+            System.out.println("Criticing   " + filepath);\r
+            String wholeline = Common.file2string(filepath);\r
 \r
-                       wholeline = wholeline.replaceAll("\t", "  ");\r
-                       wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");\r
-                       wholeline = Common.replaceAll(wholeline, ptnfunccomment, "$1/**$3**/$4$2");\r
-                       //wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");\r
+            wholeline = wholeline.replaceAll("\t", "  ");\r
+            wholeline = Common.replaceAll(wholeline, ptnheadcomment, "/** @file$1**/");\r
+            wholeline = Common.replaceAll(wholeline, ptnfunccomment, "$1/**$3**/$4$2");\r
+            //wholeline = Common.replaceAll(wholeline, ptncommentstructure, "/**\n#%\n$1\n%#\n#%%\n$2\n%%#\n#%%%\n$3\n%%%#\n**/");\r
 \r
-                       // first scan\r
-                       boolean description = false;\r
-                       boolean arguments = false;\r
-                       boolean returns = false;\r
-                       boolean inequation = false;\r
-                       rd = new BufferedReader(new StringReader(wholeline));\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.matches("\\/\\*\\*")) {\r
-                                       incomment = true;\r
-                                       description = false;\r
-                                       arguments = false;\r
-                                       returns = false;\r
-                                       templine.append(line + "\n");\r
-                               } else if (line.matches("\\*\\*\\/")) {\r
-                                       incomment = false;\r
-                                       templine.append("\n" + line + "\n");\r
-                               } else if (incomment) {\r
-                                       if (line.contains("Routine Description:")) {\r
-                                               description = true;\r
-                                               arguments = false;\r
-                                               returns = false;\r
-                                       } else if (line.contains("Arguments:")) {\r
-                                               description = false;\r
-                                               arguments = true;\r
-                                               returns = false;\r
-                                               templine.append("\n");\r
-                                       } else if (line.contains("Returns:")) {\r
-                                               description = false;\r
-                                               arguments = false;\r
-                                               returns = true;\r
-                                               templine.append("\n");\r
-                                       } else if (description) {\r
-                                               if (line.trim().length() != 0) {\r
-                                                       templine.append("  " + line.trim() + "\n");\r
-                                               }\r
-                                       } else if (arguments) {\r
-                                               mtrcommentequation = ptncommentequation.matcher(line);\r
-                                               if (mtrcommentequation.find()) {\r
-                                                       inequation = true;\r
-                                                       templine.append("  @param  " + mtrcommentequation.group(1) + "     " + mtrcommentequation.group(2) + "\n");\r
-                                               } else if (inequation && line.trim().length() == 0) {\r
-                                                       inequation = false;\r
-                                               } else if (inequation && line.trim().length() != 0) {\r
-                                                       templine.append("#%#%" + line + "\n");\r
-                                               } else {\r
-                                                       if (line.trim().length() != 0) {\r
-                                                               templine.append("  " + line.trim() + "\n");\r
-                                                       }\r
-                                               }\r
-                                       } else if (returns) {\r
-                                               mtrcommentequation = ptncommentequation.matcher(line);\r
-                                               if (mtrcommentequation.find()) {\r
-                                                       inequation = true;\r
-                                                       templine.append("  @retval " + mtrcommentequation.group(1) + "     " + mtrcommentequation.group(2) + "\n");\r
-                                               } else if (inequation && line.trim().length() == 0) {\r
-                                                       inequation = false;\r
-                                               } else if (inequation && line.trim().length() != 0) {\r
-                                                       templine.append("#%#%" + line + "\n");\r
-                                               } else {\r
-                                                       if (line.trim().length() != 0) {\r
-                                                               templine.append("  @return " + line.trim() + "\n");\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               } else {\r
-                                       templine.append(line + "\n");\r
-                               }\r
-                       }\r
-                       wholeline = templine.toString();\r
-                       wholeline = wholeline.replaceAll("\n#%#%\\s*", " ");\r
-                       //\r
-                       \r
-                       // secend scan\r
-                       int startmax = 0;\r
-                       rd = new BufferedReader(new StringReader(wholeline));\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.matches("\\/\\*\\*")) {\r
-                                       incomment = true;\r
-                                       templine.append(line + "\n");\r
-                               } else if (line.matches("\\*\\*\\/")) {\r
-                                       incomment = false;\r
-                                       templine.append(line + "\n");\r
-                               } else if (incomment) {\r
-                                       mtrnewcomment = ptnnewcomment.matcher(line);\r
-                                       if (mtrnewcomment.find()) {\r
-                                               startmax = mtrnewcomment.group(1).length() > startmax ? mtrnewcomment.group(1).length() : startmax;\r
-                                       }\r
-                               }\r
-                       }\r
-                       startmax++;\r
-                       //\r
-                       \r
-                       // third scan\r
-                       int n = 0;\r
-                       String temp = null;\r
-                       String[] tempcont = null;\r
-                       int count = 0;\r
-                       templine = new StringBuffer();\r
-                       rd = new BufferedReader(new StringReader(wholeline));\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.matches("\\/\\*\\*")) {\r
-                                       incomment = true;\r
-                                       templine.append(line + "\n");\r
-                               } else if (line.matches("\\*\\*\\/")) {\r
-                                       incomment = false;\r
-                                       templine.append(line + "\n");\r
-                               } else if (incomment) {\r
-                                       mtrnewcomment = ptnnewcomment.matcher(line);\r
-                                       if (mtrnewcomment.find()) {\r
-                                               n = startmax - mtrnewcomment.group(1).length();\r
-                                               templine.append(mtrnewcomment.group(1));\r
-                                               while (n-- >= 0) {\r
-                                                       templine.append(" ");\r
-                                               }\r
-                                               temp = mtrnewcomment.group(3);\r
-                                               tempcont = temp.split(" ");                                                     // use \\s+ ?\r
-                                               \r
-                                               count = 0;\r
-                                               for (int i = 0; i < tempcont.length; i++) {\r
-                                                       count += tempcont[i].length();\r
-                                                       if (count <= (totallinelength - startmax)) {\r
-                                                               templine.append(tempcont[i] + " ");\r
-                                                               count += 1;\r
-                                                       } else {\r
-                                                               templine.append("\n");\r
-                                                               n = startmax;\r
-                                                               while (n-- >= 0) {\r
-                                                                       templine.append(" ");\r
-                                                               }\r
-                                                               templine.append(tempcont[i] + " ");\r
-                                                               count = tempcont[i].length() + 1;\r
-                                                       }\r
-                                               }\r
-                                               templine.append("\n");\r
-                                       } else {\r
-                                               templine.append(line + "\n");\r
-                                       }\r
-                               } else {\r
-                                       templine.append(line + "\n");\r
-                               }\r
-                       }\r
-                       wholeline = templine.toString();\r
-                       //\r
-                       // Remove trailing blanks.\r
-                       // \r
-                       wholeline = wholeline.replaceAll (" +\n", "\n");\r
-                       Common.string2file(wholeline, filepath);\r
-               }\r
-       }\r
-       \r
-       public static final void fireAt(String path) throws Exception {\r
-               //Common.toDoAll(Common.dirCopy_(path), Critic.class.getMethod("critic", String.class), null, null, Common.FILE);\r
-               Common.toDoAll(path, Critic.class.getMethod("run", String.class), null, null, Common.FILE);\r
-               //Common.toDoAll(Common.dirCopy_(path), critic, Common.FILE);\r
-               System.out.println("Critic Done");\r
-       }\r
+            // first scan\r
+            boolean description = false;\r
+            boolean arguments = false;\r
+            boolean returns = false;\r
+            boolean inequation = false;\r
+            rd = new BufferedReader(new StringReader(wholeline));\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.matches("\\/\\*\\*")) {\r
+                    incomment = true;\r
+                    description = false;\r
+                    arguments = false;\r
+                    returns = false;\r
+                    templine.append(line + "\n");\r
+                } else if (line.matches("\\*\\*\\/")) {\r
+                    incomment = false;\r
+                    templine.append("\n" + line + "\n");\r
+                } else if (incomment) {\r
+                    if (line.contains("Routine Description:")) {\r
+                        description = true;\r
+                        arguments = false;\r
+                        returns = false;\r
+                    } else if (line.contains("Arguments:")) {\r
+                        description = false;\r
+                        arguments = true;\r
+                        returns = false;\r
+                        templine.append("\n");\r
+                    } else if (line.contains("Returns:")) {\r
+                        description = false;\r
+                        arguments = false;\r
+                        returns = true;\r
+                        templine.append("\n");\r
+                    } else if (description) {\r
+                        if (line.trim().length() != 0) {\r
+                            templine.append("  " + line.trim() + "\n");\r
+                        }\r
+                    } else if (arguments) {\r
+                        mtrcommentequation = ptncommentequation.matcher(line);\r
+                        if (mtrcommentequation.find()) {\r
+                            inequation = true;\r
+                            templine.append("  @param  " + mtrcommentequation.group(1) + "     " + mtrcommentequation.group(2) + "\n");\r
+                        } else if (inequation && line.trim().length() == 0) {\r
+                            inequation = false;\r
+                        } else if (inequation && line.trim().length() != 0) {\r
+                            templine.append("#%#%" + line + "\n");\r
+                        } else {\r
+                            if (line.trim().length() != 0) {\r
+                                templine.append("  " + line.trim() + "\n");\r
+                            }\r
+                        }\r
+                    } else if (returns) {\r
+                        mtrcommentequation = ptncommentequation.matcher(line);\r
+                        if (mtrcommentequation.find()) {\r
+                            inequation = true;\r
+                            templine.append("  @retval " + mtrcommentequation.group(1) + "     " + mtrcommentequation.group(2) + "\n");\r
+                        } else if (inequation && line.trim().length() == 0) {\r
+                            inequation = false;\r
+                        } else if (inequation && line.trim().length() != 0) {\r
+                            templine.append("#%#%" + line + "\n");\r
+                        } else {\r
+                            if (line.trim().length() != 0) {\r
+                                templine.append("  @return " + line.trim() + "\n");\r
+                            }\r
+                        }\r
+                    }\r
+                } else {\r
+                    templine.append(line + "\n");\r
+                }\r
+            }\r
+            wholeline = templine.toString();\r
+            wholeline = wholeline.replaceAll("\n#%#%\\s*", " ");\r
+            //\r
+            \r
+            // secend scan\r
+            int startmax = 0;\r
+            rd = new BufferedReader(new StringReader(wholeline));\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.matches("\\/\\*\\*")) {\r
+                    incomment = true;\r
+                    templine.append(line + "\n");\r
+                } else if (line.matches("\\*\\*\\/")) {\r
+                    incomment = false;\r
+                    templine.append(line + "\n");\r
+                } else if (incomment) {\r
+                    mtrnewcomment = ptnnewcomment.matcher(line);\r
+                    if (mtrnewcomment.find()) {\r
+                        startmax = mtrnewcomment.group(1).length() > startmax ? mtrnewcomment.group(1).length() : startmax;\r
+                    }\r
+                }\r
+            }\r
+            startmax++;\r
+            //\r
+            \r
+            // third scan\r
+            int n = 0;\r
+            String temp = null;\r
+            String[] tempcont = null;\r
+            int count = 0;\r
+            templine = new StringBuffer();\r
+            rd = new BufferedReader(new StringReader(wholeline));\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.matches("\\/\\*\\*")) {\r
+                    incomment = true;\r
+                    templine.append(line + "\n");\r
+                } else if (line.matches("\\*\\*\\/")) {\r
+                    incomment = false;\r
+                    templine.append(line + "\n");\r
+                } else if (incomment) {\r
+                    mtrnewcomment = ptnnewcomment.matcher(line);\r
+                    if (mtrnewcomment.find()) {\r
+                        n = startmax - mtrnewcomment.group(1).length();\r
+                        templine.append(mtrnewcomment.group(1));\r
+                        while (n-- >= 0) {\r
+                            templine.append(" ");\r
+                        }\r
+                        temp = mtrnewcomment.group(3);\r
+                        tempcont = temp.split(" ");                            // use \\s+ ?\r
+                        \r
+                        count = 0;\r
+                        for (int i = 0; i < tempcont.length; i++) {\r
+                            count += tempcont[i].length();\r
+                            if (count <= (totallinelength - startmax)) {\r
+                                templine.append(tempcont[i] + " ");\r
+                                count += 1;\r
+                            } else {\r
+                                templine.append("\n");\r
+                                n = startmax;\r
+                                while (n-- >= 0) {\r
+                                    templine.append(" ");\r
+                                }\r
+                                templine.append(tempcont[i] + " ");\r
+                                count = tempcont[i].length() + 1;\r
+                            }\r
+                        }\r
+                        templine.append("\n");\r
+                    } else {\r
+                        templine.append(line + "\n");\r
+                    }\r
+                } else {\r
+                    templine.append(line + "\n");\r
+                }\r
+            }\r
+            wholeline = templine.toString();\r
+            //\r
+            // Remove trailing blanks.\r
+            // \r
+            wholeline = wholeline.replaceAll (" +\n", "\n");\r
+            Common.string2file(wholeline, filepath);\r
+        }\r
+    }\r
+    \r
+    public static final void fireAt(String path) throws Exception {\r
+        //Common.toDoAll(Common.dirCopy_(path), Critic.class.getMethod("critic", String.class), null, null, Common.FILE);\r
+        Common.toDoAll(path, Critic.class.getMethod("run", String.class), null, null, Common.FILE);\r
+        //Common.toDoAll(Common.dirCopy_(path), critic, Common.FILE);\r
+        System.out.println("Critic Done");\r
+    }\r
 }
\ No newline at end of file
index c986d3b59bb8d853a9dfb571e6ccd689ca0702a4..68ddf40b3060a77380445cc722bddfa8854ce321 100644 (file)
@@ -17,170 +17,170 @@ import java.util.*;
 import java.util.regex.*;\r
 \r
 public final class Database {\r
-       private static final Database INSTANCE = Database.init();\r
-       \r
-       Database(String path) {\r
-               DatabasePath = path;\r
+    private static final Database INSTANCE = Database.init();\r
+    \r
+    Database(String path) {\r
+        DatabasePath = path;\r
 \r
-               try {\r
-                       importDBLib("Library.csv");\r
-                       importDBGuid("Guid.csv", "Guid");\r
-                       importDBGuid("Ppi.csv", "Ppi");\r
-                       importDBGuid("Protocol.csv", "Protocol");\r
-                       importDBMacro("Macro.csv");\r
-                       importListR8Only();\r
-               } catch (Exception e) {\r
-                       System.out.println(e.getMessage());\r
-               }\r
-       }\r
-       \r
-       public String DatabasePath;\r
-       public Set<String> error = new HashSet<String>();\r
-       public Set<String> r8only = new HashSet<String>();\r
-       \r
-       private Map<String,Guid> hashguid = new HashMap<String,Guid>();\r
-       private Map<String,Func> hashfunc = new HashMap<String,Func>();\r
-       private Map<String,Macro> hashmacro = new HashMap<String,Macro>();\r
-       \r
-       //-------------------------------------import------------------------------------------//\r
-       \r
-       private void importDBLib(String filename) throws Exception {\r
-               BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
-               String line;\r
-               String[] linecontext;\r
-               Func lf;\r
-               \r
-               if (rd.ready()) {\r
-                       System.out.println("Found " + filename + ", Importing Library Database.");\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.length() != 0) {\r
-                                       linecontext = line.split(",");\r
-                               lf = new Func(linecontext);\r
-                               hashfunc.put(lf.r8funcname,lf);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       \r
-       private void importDBGuid(String filename, String type) throws Exception {\r
-               BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
-               String line;\r
-               String[] linecontext;\r
-               Guid gu;\r
-               \r
-               if (rd.ready()) {\r
-                       System.out.println("Found " + filename + ", Importing " + type + " Database.");\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.length() != 0) {\r
-                                       linecontext = line.split(",");\r
-                               gu = new Guid(linecontext, type);\r
-                           hashguid.put(gu.r8name,gu);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       \r
-       private void importDBMacro(String filename) throws Exception {\r
-               BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
-               String line;\r
-               String[] linecontext;\r
-               Macro mc;\r
-               \r
-               if (rd.ready()) {\r
-                       System.out.println("Found " + filename + ", Importing Macro Database.");\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.length() != 0) {\r
-                                       linecontext = line.split(",");\r
-                               mc = new Macro(linecontext);\r
-                               hashmacro.put(mc.r8name,mc);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
+        try {\r
+            importDBLib("Library.csv");\r
+            importDBGuid("Guid.csv", "Guid");\r
+            importDBGuid("Ppi.csv", "Ppi");\r
+            importDBGuid("Protocol.csv", "Protocol");\r
+            importDBMacro("Macro.csv");\r
+            importListR8Only();\r
+        } catch (Exception e) {\r
+            System.out.println(e.getMessage());\r
+        }\r
+    }\r
+    \r
+    public String DatabasePath;\r
+    public Set<String> error = new HashSet<String>();\r
+    public Set<String> r8only = new HashSet<String>();\r
+    \r
+    private Map<String,Guid> hashguid = new HashMap<String,Guid>();\r
+    private Map<String,Func> hashfunc = new HashMap<String,Func>();\r
+    private Map<String,Macro> hashmacro = new HashMap<String,Macro>();\r
+    \r
+    //-------------------------------------import------------------------------------------//\r
+    \r
+    private void importDBLib(String filename) throws Exception {\r
+        BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
+        String line;\r
+        String[] linecontext;\r
+        Func lf;\r
+        \r
+        if (rd.ready()) {\r
+            System.out.println("Found " + filename + ", Importing Library Database.");\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.length() != 0) {\r
+                    linecontext = line.split(",");\r
+                    lf = new Func(linecontext);\r
+                    hashfunc.put(lf.r8funcname,lf);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    \r
+    private void importDBGuid(String filename, String type) throws Exception {\r
+        BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
+        String line;\r
+        String[] linecontext;\r
+        Guid gu;\r
+        \r
+        if (rd.ready()) {\r
+            System.out.println("Found " + filename + ", Importing " + type + " Database.");\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.length() != 0) {\r
+                    linecontext = line.split(",");\r
+                    gu = new Guid(linecontext, type);\r
+                    hashguid.put(gu.r8name,gu);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    \r
+    private void importDBMacro(String filename) throws Exception {\r
+        BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
+        String line;\r
+        String[] linecontext;\r
+        Macro mc;\r
+        \r
+        if (rd.ready()) {\r
+            System.out.println("Found " + filename + ", Importing Macro Database.");\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.length() != 0) {\r
+                    linecontext = line.split(",");\r
+                    mc = new Macro(linecontext);\r
+                    hashmacro.put(mc.r8name,mc);\r
+                }\r
+            }\r
+        }\r
+    }\r
 \r
-       private void importListR8Only() throws Exception {\r
-               Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(.*?)\\s*\\(.*?////~", Pattern.DOTALL);\r
-               String wholeline = Common.file2string(DatabasePath + File.separator + "R8Lib.c");\r
-               System.out.println("Found " + "R8Lib.c" + ", Importing R8Lib Database.");\r
-               Matcher mtrr8only = ptnr8only.matcher(wholeline);\r
-               while (mtrr8only.find()) {\r
-                       r8only.add(mtrr8only.group(2));\r
-               }\r
-       }\r
-       \r
-       //-------------------------------------import------------------------------------------//\r
+    private void importListR8Only() throws Exception {\r
+        Pattern ptnr8only = Pattern.compile("////#?(\\w*)?.*?R8_(.*?)\\s*\\(.*?////~", Pattern.DOTALL);\r
+        String wholeline = Common.file2string(DatabasePath + File.separator + "R8Lib.c");\r
+        System.out.println("Found " + "R8Lib.c" + ", Importing R8Lib Database.");\r
+        Matcher mtrr8only = ptnr8only.matcher(wholeline);\r
+        while (mtrr8only.find()) {\r
+            r8only.add(mtrr8only.group(2));\r
+        }\r
+    }\r
+    \r
+    //-------------------------------------import------------------------------------------//\r
 \r
-       //-------------------------------------get------------------------------------------//\r
+    //-------------------------------------get------------------------------------------//\r
 \r
-       public String getR9Lib(String r8funcname) {\r
-               String temp = null;\r
-               if (hashfunc.containsKey(r8funcname)) {\r
-                       temp = hashfunc.get(r8funcname).r9libname;\r
-               }\r
-               return temp;\r
-       }\r
-       \r
-       public String getR9Func(String r8funcname) {\r
-               String temp = null;\r
-               if (hashfunc.containsKey(r8funcname)) {\r
-                       temp = hashfunc.get(r8funcname).r9funcname;\r
-               }\r
-               return temp;\r
-       }\r
-       \r
-       public String getR9Macro(String r8macro) {\r
-               return hashmacro.get(r8macro).r9name;                   // the verification job of if the macro exists in the database is done when registering it\r
-       }\r
+    public String getR9Lib(String r8funcname) {\r
+        String temp = null;\r
+        if (hashfunc.containsKey(r8funcname)) {\r
+            temp = hashfunc.get(r8funcname).r9libname;\r
+        }\r
+        return temp;\r
+    }\r
+    \r
+    public String getR9Func(String r8funcname) {\r
+        String temp = null;\r
+        if (hashfunc.containsKey(r8funcname)) {\r
+            temp = hashfunc.get(r8funcname).r9funcname;\r
+        }\r
+        return temp;\r
+    }\r
+    \r
+    public String getR9Macro(String r8macro) {\r
+        return hashmacro.get(r8macro).r9name;            // the verification job of if the macro exists in the database is done when registering it\r
+    }\r
 \r
-       public String getR9Guidname(String r8Guid) {\r
-               String temp = null;\r
-               try {\r
-                       temp = hashguid.get(r8Guid).r9name;\r
-               } catch (NullPointerException e) {\r
-                       error.add("getR9Guidname :" + r8Guid);\r
-               }\r
-               return temp;\r
-       }\r
+    public String getR9Guidname(String r8Guid) {\r
+        String temp = null;\r
+        try {\r
+            temp = hashguid.get(r8Guid).r9name;\r
+        } catch (NullPointerException e) {\r
+            error.add("getR9Guidname :" + r8Guid);\r
+        }\r
+        return temp;\r
+    }\r
 \r
-       public String getGuidType(String r8Guid) {\r
-               String temp = null;\r
-               try {\r
-                       temp =  hashguid.get(r8Guid).type;\r
-               } catch (NullPointerException e) {\r
-                       error.add("getR9Guidname :" + r8Guid);\r
-               }\r
-               return temp;\r
-       }\r
+    public String getGuidType(String r8Guid) {\r
+        String temp = null;\r
+        try {\r
+            temp =  hashguid.get(r8Guid).type;\r
+        } catch (NullPointerException e) {\r
+            error.add("getR9Guidname :" + r8Guid);\r
+        }\r
+        return temp;\r
+    }\r
 \r
-       //-------------------------------------get------------------------------------------//\r
+    //-------------------------------------get------------------------------------------//\r
 \r
-       //-------------------------------------has------------------------------------------//\r
+    //-------------------------------------has------------------------------------------//\r
 \r
-       public boolean hasFunc(String r8lib) {\r
-               return hashfunc.containsKey(r8lib);\r
-       }\r
+    public boolean hasFunc(String r8lib) {\r
+        return hashfunc.containsKey(r8lib);\r
+    }\r
 \r
-       public boolean hasGuid(String r8guid) {\r
-               return hashguid.containsKey(r8guid);\r
-       }\r
+    public boolean hasGuid(String r8guid) {\r
+        return hashguid.containsKey(r8guid);\r
+    }\r
 \r
-       public boolean hasMacro(String r8macro) {\r
-               return hashmacro.containsKey(r8macro);\r
-       }\r
-       \r
-       //-------------------------------------has------------------------------------------//\r
-       \r
-       //-------------------------------------init------------------------------------------//\r
+    public boolean hasMacro(String r8macro) {\r
+        return hashmacro.containsKey(r8macro);\r
+    }\r
+    \r
+    //-------------------------------------has------------------------------------------//\r
+    \r
+    //-------------------------------------init------------------------------------------//\r
 \r
-       private static final Database init() {\r
-               if (System.getenv("WORKSPACE") == null) {\r
-                       return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
-               } else {\r
-                       return new Database(System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
-               }\r
-       }\r
-       \r
-       public static final Database getInstance() {\r
-               return INSTANCE;\r
-       }\r
+    private static final Database init() {\r
+        if (System.getenv("WORKSPACE") == null) {\r
+            return new Database("C:" + File.separator + "tianocore" + File.separator + "edk2" + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
+        } else {\r
+            return new Database(System.getenv("WORKSPACE") + File.separator + "Tools" + File.separator + "Conf" + File.separator + "Migration");\r
+        }\r
+    }\r
+    \r
+    public static final Database getInstance() {\r
+        return INSTANCE;\r
+    }\r
 }\r
index ac0304190a98b8d734c1d5e76c5afde47c8cb82f..95266fc42f4c14896a40092ecc0fcbfaa2554b87 100644 (file)
@@ -19,66 +19,66 @@ import java.util.*;
 import javax.swing.*;\r
 \r
 public final class FirstPanel extends JPanel implements ActionListener, ItemListener, UI {\r
-       /**\r
-        *  Define class Serial Version UID\r
-        */\r
-       private static final long serialVersionUID = 207759413522910399L;\r
-       \r
-       private static final FirstPanel INSTANCE = FirstPanel.init();\r
-       \r
-       private String startpath;\r
-       \r
-       private JButton moduleButton, goButton, msaEditorButton, criticButton, specifyCommentButton;\r
-       private JTextField moduletext;\r
-       private JTextArea log;\r
-       private JFileChooser fc = new JFileChooser();\r
-       private JCheckBox filebox, screenbox, mibox, criticbox, defaultpathbox;\r
-       \r
-       private boolean tofile = true, toscreen = true;\r
-       private PrintWriter logfile;\r
+    /**\r
+     *  Define class Serial Version UID\r
+     */\r
+    private static final long serialVersionUID = 207759413522910399L;\r
+    \r
+    private static final FirstPanel INSTANCE = FirstPanel.init();\r
+    \r
+    private String startpath;\r
+    \r
+    private JButton moduleButton, goButton, msaEditorButton, criticButton, specifyCommentButton;\r
+    private JTextField moduletext;\r
+    private JTextArea log;\r
+    private JFileChooser fc = new JFileChooser();\r
+    private JCheckBox filebox, screenbox, mibox, criticbox, defaultpathbox;\r
+    \r
+    private boolean tofile = true, toscreen = true;\r
+    private PrintWriter logfile;\r
 \r
-       FirstPanel() {\r
+    FirstPanel() {\r
         GridBagLayout gridbag = new GridBagLayout();\r
         setLayout(gridbag);\r
         \r
-               GridBagConstraints cst = new GridBagConstraints();\r
-               \r
-               goButton = new JButton("Go");\r
-               goButton.addActionListener(this);\r
-               goButton.setActionCommand("go");\r
-               \r
-               moduleButton = new JButton("Choose ModulePath");\r
-               moduleButton.addActionListener(this);\r
+        GridBagConstraints cst = new GridBagConstraints();\r
+        \r
+        goButton = new JButton("Go");\r
+        goButton.addActionListener(this);\r
+        goButton.setActionCommand("go");\r
+        \r
+        moduleButton = new JButton("Choose ModulePath");\r
+        moduleButton.addActionListener(this);\r
 \r
-               msaEditorButton = new JButton("MsaEditor");\r
-               msaEditorButton.addActionListener(this);\r
-               \r
-               criticButton = new JButton("Critic");\r
-               criticButton.addActionListener(this);\r
-               \r
-               specifyCommentButton = new JButton("Comment Style");\r
-               specifyCommentButton.addActionListener(this);\r
-               \r
-               moduletext = new JTextField(30);\r
-               \r
-               filebox = new JCheckBox("Output to logfile", true);\r
-               filebox.addItemListener(this);\r
-               \r
-               screenbox = new JCheckBox("Specify logfile", false);\r
-               screenbox.addItemListener(this);\r
-               \r
-               mibox = new JCheckBox("Print ModuleInfo", false);\r
-               mibox.addItemListener(this);\r
-               MigrationTool.printModuleInfo = false;\r
-               \r
-               criticbox = new JCheckBox("Run Critic", true);\r
-               criticbox.addItemListener(this);\r
-               MigrationTool.doCritic = true;\r
-               \r
-               defaultpathbox = new JCheckBox("Use Default Output Path", true);\r
-               defaultpathbox.addItemListener(this);\r
-               MigrationTool.defaultoutput = true;\r
-               \r
+        msaEditorButton = new JButton("MsaEditor");\r
+        msaEditorButton.addActionListener(this);\r
+        \r
+        criticButton = new JButton("Critic");\r
+        criticButton.addActionListener(this);\r
+        \r
+        specifyCommentButton = new JButton("Comment Style");\r
+        specifyCommentButton.addActionListener(this);\r
+        \r
+        moduletext = new JTextField(30);\r
+        \r
+        filebox = new JCheckBox("Output to logfile", true);\r
+        filebox.addItemListener(this);\r
+        \r
+        screenbox = new JCheckBox("Specify logfile", false);\r
+        screenbox.addItemListener(this);\r
+        \r
+        mibox = new JCheckBox("Print ModuleInfo", false);\r
+        mibox.addItemListener(this);\r
+        MigrationTool.printModuleInfo = false;\r
+        \r
+        criticbox = new JCheckBox("Run Critic", true);\r
+        criticbox.addItemListener(this);\r
+        MigrationTool.doCritic = true;\r
+        \r
+        defaultpathbox = new JCheckBox("Use Default Output Path", true);\r
+        defaultpathbox.addItemListener(this);\r
+        MigrationTool.defaultoutput = true;\r
+        \r
         JPanel modulePanel = new JPanel();\r
         modulePanel.add(moduleButton);\r
         modulePanel.add(moduletext);\r
@@ -119,163 +119,163 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
         cst.fill = GridBagConstraints.BOTH;\r
         gridbag.setConstraints(logScrollPane, cst);\r
         add(logScrollPane);\r
-       }\r
-       \r
-       //---------------------------------------------------------------------------------------//\r
-       \r
-       public boolean yesOrNo(String question) {\r
-               return JOptionPane.showConfirmDialog(this, question, "Yes or No", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;\r
-       }\r
-       \r
-       public void print(String message) {\r
-               if (toscreen == true) {\r
-               log.append(message);\r
-               System.out.print(message);\r
-               }\r
-               if (tofile == true) {\r
-                       logfile.append(message);\r
-               }\r
-       }\r
-       \r
-       public void println(String message) {\r
-               print(message + "\n");\r
-       }\r
+         }\r
+    \r
+    //---------------------------------------------------------------------------------------//\r
+    \r
+    public boolean yesOrNo(String question) {\r
+        return JOptionPane.showConfirmDialog(this, question, "Yes or No", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;\r
+    }\r
+    \r
+    public void print(String message) {\r
+        if (toscreen == true) {\r
+            log.append(message);\r
+            System.out.print(message);\r
+        }\r
+        if (tofile == true) {\r
+            logfile.append(message);\r
+        }\r
+    }\r
+    \r
+    public void println(String message) {\r
+        print(message + "\n");\r
+    }\r
 \r
-       public void println(Set<String> hash) {\r
-               if (toscreen == true) {\r
-               log.append(hash + "\n");\r
-               System.out.println(hash);\r
-               }\r
-               if (tofile == true) {\r
-                       logfile.append(hash + "\n");\r
-               }\r
-       }\r
+    public void println(Set<String> hash) {\r
+        if (toscreen == true) {\r
+            log.append(hash + "\n");\r
+            System.out.println(hash);\r
+        }\r
+        if (tofile == true) {\r
+            logfile.append(hash + "\n");\r
+        }\r
+    }\r
 \r
-       public String choose(String message, Object[] choicelist) {\r
-               return (String)JOptionPane.showInputDialog(this, message,"Choose",JOptionPane.PLAIN_MESSAGE,null,choicelist,choicelist[0]);\r
-       }\r
-       \r
-       public String getInput(String message) {\r
-               return (String)JOptionPane.showInputDialog(message);\r
-       }\r
+    public String choose(String message, Object[] choicelist) {\r
+        return (String)JOptionPane.showInputDialog(this, message,"Choose",JOptionPane.PLAIN_MESSAGE,null,choicelist,choicelist[0]);\r
+    }\r
+    \r
+    public String getInput(String message) {\r
+        return (String)JOptionPane.showInputDialog(message);\r
+    }\r
 \r
-       //---------------------------------------------------------------------------------------//\r
+    //---------------------------------------------------------------------------------------//\r
 \r
-       public String getFilepath(String title, int mode) {\r
-               fc.setDialogTitle(title);\r
-               fc.setFileSelectionMode(mode);\r
-               if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {\r
-                       log.append(fc.getSelectedFile().getAbsolutePath() + "\n");\r
-                       return fc.getSelectedFile().getAbsolutePath();\r
-               }\r
-               return null;\r
-       }\r
+    public String getFilepath(String title, int mode) {\r
+        fc.setDialogTitle(title);\r
+        fc.setFileSelectionMode(mode);\r
+        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {\r
+            log.append(fc.getSelectedFile().getAbsolutePath() + "\n");\r
+            return fc.getSelectedFile().getAbsolutePath();\r
+        }\r
+        return null;\r
+    }\r
 \r
-       //---------------------------------------------------------------------------------------//\r
+    //---------------------------------------------------------------------------------------//\r
 \r
     public void actionPerformed(ActionEvent e) {\r
         if ( e.getSource() == moduleButton ) {\r
-               startpath = getFilepath("Please choose a starting path", JFileChooser.DIRECTORIES_ONLY);\r
-               moduletext.setText(startpath);\r
+            startpath = getFilepath("Please choose a starting path", JFileChooser.DIRECTORIES_ONLY);\r
+            moduletext.setText(startpath);\r
         }\r
         if ( e.getSource() == goButton ) {\r
-               try {\r
-                       logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log")));\r
-                       MigrationTool.startMigrateAll(startpath);\r
-                       logfile.flush();\r
-                       logfile.close();\r
-               } catch (Exception en) {\r
-                       println(en.getMessage());\r
-               }\r
+            try {\r
+                logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log")));\r
+                MigrationTool.startMigrateAll(startpath);\r
+                logfile.flush();\r
+                logfile.close();\r
+            } catch (Exception en) {\r
+                println(en.getMessage());\r
+            }\r
         }\r
         if ( e.getSource() == msaEditorButton) {\r
-               try {\r
-               MsaTreeEditor.init();\r
-               } catch (Exception en) {\r
-                       println(en.getMessage());\r
-               }\r
+            try {\r
+                MsaTreeEditor.init();\r
+            } catch (Exception en) {\r
+                println(en.getMessage());\r
+            }\r
         }\r
         if ( e.getSource() == criticButton) {\r
-               try {\r
-                       Critic.fireAt(startpath);\r
-               } catch (Exception en) {\r
-                       println(en.getMessage());\r
-               }\r
+            try {\r
+                Critic.fireAt(startpath);\r
+            } catch (Exception en) {\r
+                println(en.getMessage());\r
+            }\r
         }\r
         if ( e.getSource() == specifyCommentButton) {\r
-               try {                                                                                   // input examine is not imposed but should be added\r
-                       MigrationTool.MIGRATIONCOMMENT = getInput("Please type in wanted comment style used by the tool\nbe sure to start with '//', or you won't enjoy the result");\r
-                       //MsaWriter.parse("C:\\tianocore\\edk2\\MdePkg\\Library\\BaseLib\\BaseLib.msa");\r
-               } catch (Exception en) {\r
-                       println(en.getMessage());\r
-               }\r
+            try {                                            // input examine is not imposed but should be added\r
+                MigrationTool.MIGRATIONCOMMENT = getInput("Please type in wanted comment style used by the tool\nbe sure to start with '//', or you won't enjoy the result");\r
+                //MsaWriter.parse("C:\\tianocore\\edk2\\MdePkg\\Library\\BaseLib\\BaseLib.msa");\r
+            } catch (Exception en) {\r
+                println(en.getMessage());\r
+            }\r
         }\r
     }\r
     \r
     public void itemStateChanged(ItemEvent e) {\r
-       if (e.getSource() == filebox) {\r
-               if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       System.out.println("filebox DESELECTED");\r
-               } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       System.out.println("filebox SELECTED");\r
-               }\r
-       } else if (e.getSource() == screenbox) {\r
-               if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       System.out.println("screenbox DESELECTED");\r
-               } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       System.out.println("screenbox SELECTED");\r
-               }\r
-       } else if (e.getSource() == mibox) {\r
-               if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       MigrationTool.printModuleInfo = false;\r
-               } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       MigrationTool.printModuleInfo = true;\r
-               }\r
-       } else if (e.getSource() == criticbox) {\r
-               if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       MigrationTool.doCritic = false;\r
-               } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       MigrationTool.doCritic = true;\r
-               }\r
-       } else if (e.getSource() == defaultpathbox) {\r
-               if (e.getStateChange() == ItemEvent.DESELECTED) {\r
-                       MigrationTool.defaultoutput = false;\r
-               } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
-                       MigrationTool.defaultoutput = true;\r
-               }\r
-       }\r
+        if (e.getSource() == filebox) {\r
+            if (e.getStateChange() == ItemEvent.DESELECTED) {\r
+                System.out.println("filebox DESELECTED");\r
+            } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
+                System.out.println("filebox SELECTED");\r
+            }\r
+        } else if (e.getSource() == screenbox) {\r
+            if (e.getStateChange() == ItemEvent.DESELECTED) {\r
+                System.out.println("screenbox DESELECTED");\r
+            } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
+                System.out.println("screenbox SELECTED");\r
+            }\r
+        } else if (e.getSource() == mibox) {\r
+            if (e.getStateChange() == ItemEvent.DESELECTED) {\r
+                MigrationTool.printModuleInfo = false;\r
+            } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
+                MigrationTool.printModuleInfo = true;\r
+            }\r
+        } else if (e.getSource() == criticbox) {\r
+            if (e.getStateChange() == ItemEvent.DESELECTED) {\r
+                MigrationTool.doCritic = false;\r
+            } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
+                MigrationTool.doCritic = true;\r
+            }\r
+        } else if (e.getSource() == defaultpathbox) {\r
+            if (e.getStateChange() == ItemEvent.DESELECTED) {\r
+                MigrationTool.defaultoutput = false;\r
+            } else if (e.getStateChange() == ItemEvent.SELECTED) {\r
+                MigrationTool.defaultoutput = true;\r
+            }\r
+        }\r
     }\r
 \r
     //---------------------------------------------------------------------------------------//\r
     \r
     private static final FirstPanel init() {\r
-       try {\r
-               UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
-               //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());\r
-               //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");\r
-               //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");\r
-               //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");\r
-               //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");\r
-       } catch (Exception e) {\r
-               System.out.println(e.getMessage());\r
-       }\r
-       \r
-               JFrame frame = new JFrame("MigrationTools");\r
-               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
+        try {\r
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
+            //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());\r
+            //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");\r
+            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");\r
+            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");\r
+            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");\r
+        } catch (Exception e) {\r
+            System.out.println(e.getMessage());\r
+        }\r
+        \r
+        JFrame frame = new JFrame("MigrationTools");\r
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
 \r
         FirstPanel fp = new FirstPanel();\r
-               //fp.setLayout(new GridBagLayout());\r
-               //fp.setLayout(new BoxLayout(fp, BoxLayout.Y_AXIS));\r
-               fp.setOpaque(true);\r
+        //fp.setLayout(new GridBagLayout());\r
+        //fp.setLayout(new BoxLayout(fp, BoxLayout.Y_AXIS));\r
+        fp.setOpaque(true);\r
         frame.setContentPane(fp);\r
 \r
-               frame.pack();\r
-               frame.setVisible(true);\r
-               \r
-               return fp;\r
+        frame.pack();\r
+        frame.setVisible(true);\r
+        \r
+        return fp;\r
     }\r
     \r
     public static final FirstPanel getInstance() {\r
-       return INSTANCE;\r
+        return INSTANCE;\r
     }\r
 }
\ No newline at end of file
index c311f10b605186ce759ff0e94850d46c3e811f66..f00eac4e2aed9c89f34f7fb71d9b3e8bdb5fe2aa 100644 (file)
@@ -15,50 +15,50 @@ package org.tianocore.migration;
 import java.util.regex.*;\r
 \r
 public class Func {\r
-       Func(String r8func,String r8lib,String r9func,String r9lib) {\r
-               r8funcname = r8func;\r
-               r8libname = r8lib;\r
-               r9funcname = r9func;\r
-               r9libname = r9lib;\r
-       }\r
-       Func(String[] linecontext) {\r
-               r8funcname = linecontext[1];\r
-               r8libname = linecontext[0];\r
-               r9funcname = linecontext[2];\r
-               r9libname = linecontext[3];\r
-       }\r
-       public String r8funcname;\r
-       public String r8libname;\r
-       public String r9funcname;\r
-       public String r9libname;\r
+    Func(String r8func,String r8lib,String r9func,String r9lib) {\r
+        r8funcname = r8func;\r
+        r8libname = r8lib;\r
+        r9funcname = r9func;\r
+        r9libname = r9lib;\r
+    }\r
+    Func(String[] linecontext) {\r
+        r8funcname = linecontext[1];\r
+        r8libname = linecontext[0];\r
+        r9funcname = linecontext[2];\r
+        r9libname = linecontext[3];\r
+    }\r
+    public String r8funcname;\r
+    public String r8libname;\r
+    public String r9funcname;\r
+    public String r9libname;\r
 \r
-       public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r
-       //public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)",Pattern.MULTILINE);\r
-       public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\(",Pattern.MULTILINE);\r
-       public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r
-       public static Pattern ptnlowcase = Pattern.compile("[a-z]");                            // must be removed\r
-       \r
-       private static String reservedwords = "if for pack while switch return sizeof";\r
-       \r
-       public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
-               String temp = null;\r
+    public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r
+    //public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)",Pattern.MULTILINE);\r
+    public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\(",Pattern.MULTILINE);\r
+    public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r
+    public static Pattern ptnlowcase = Pattern.compile("[a-z]");                // must be removed\r
+    \r
+    private static String reservedwords = "if for pack while switch return sizeof";\r
+    \r
+    public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
+        String temp = null;\r
 \r
-               temp = mtr.group(1);                                                                    // both changed and not changed funcc are registered , for finding all the non-local function calls\r
-               Matcher mtrlowcase = ptnlowcase.matcher(temp);                  // must be removed , so the two funcs can be merged\r
-               if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r
-                       mi.hashfuncc.add(temp);\r
-               }\r
-               return temp;\r
-       }\r
-       /*\r
-       public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r
-               String temp = null;\r
+        temp = mtr.group(1);                                    // both changed and not changed funcc are registered , for finding all the non-local function calls\r
+        Matcher mtrlowcase = ptnlowcase.matcher(temp);            // must be removed , so the two funcs can be merged\r
+        if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r
+            mi.hashfuncc.add(temp);\r
+        }\r
+        return temp;\r
+    }\r
+    /*\r
+    public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r
+        String temp = null;\r
 \r
-               temp = mtr.group(1);                                                                    // both changed and not changed funcd are registered , for finding all the non-local function calls\r
-               if (!reservedwords.contains(temp)) {\r
-                       mi.hashfuncd.add(temp);\r
-               }\r
-               return temp;\r
-       }\r
-       */\r
+        temp = mtr.group(1);                                    // both changed and not changed funcd are registered , for finding all the non-local function calls\r
+        if (!reservedwords.contains(temp)) {\r
+            mi.hashfuncd.add(temp);\r
+        }\r
+        return temp;\r
+    }\r
+    */\r
 }\r
index ed6a7a77f22796827e301c3622abcb7c9cd738ff..8152e7bbd4d622b5f4a5806600f58750b1b8a8bb 100644 (file)
@@ -15,47 +15,47 @@ package org.tianocore.migration;
 import java.util.regex.*;\r
 \r
 public class Guid {\r
-       Guid (String r8, String t, String n, String r9, String gv, String p) {\r
-               r8name = r8;\r
-               type = t;\r
-               name = n;\r
-               r9name = r9;\r
-               guidvalue = gv;\r
-               pack = p;\r
-       }\r
-       Guid (String[] linecontext, String t) {\r
-               r8name = linecontext[1];\r
-               type = t;\r
-               name = linecontext[0];\r
-               r9name = linecontext[2];\r
-               guidvalue = linecontext[3];\r
-               pack = linecontext[4];\r
-       }\r
-       public String r8name;\r
-       public String type;\r
-       public String name;\r
-       public String r9name;\r
-       public String guidvalue;\r
-       public String pack;\r
+    Guid (String r8, String t, String n, String r9, String gv, String p) {\r
+        r8name = r8;\r
+        type = t;\r
+        name = n;\r
+        r9name = r9;\r
+        guidvalue = gv;\r
+        pack = p;\r
+    }\r
+    Guid (String[] linecontext, String t) {\r
+        r8name = linecontext[1];\r
+        type = t;\r
+        name = linecontext[0];\r
+        r9name = linecontext[2];\r
+        guidvalue = linecontext[3];\r
+        pack = linecontext[4];\r
+    }\r
+    public String r8name;\r
+    public String type;\r
+    public String name;\r
+    public String r9name;\r
+    public String guidvalue;\r
+    public String pack;\r
 \r
-       public static Pattern ptnguid = Pattern.compile("g\\w*Guid");\r
+    public static Pattern ptnguid = Pattern.compile("g\\w*Guid");\r
 \r
-       public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
-               String type = null;\r
-               String temp = null;\r
-               \r
-               temp = mtr.group();\r
-               if (MigrationTool.db.hasGuid(temp)) {           // only changed guids registered, because both changed and not changed guids are included in database\r
-                       type = MigrationTool.db.getGuidType(temp);\r
-                       if (type.matches("Protocol")) {\r
-                               mi.protocol.add(temp);\r
-                       } else if (type.matches("Ppi")) {\r
-                               mi.ppi.add(temp);\r
-                       } else if (type.matches("Guid")) {\r
-                               mi.guid.add(temp);\r
-                       }\r
-                       return temp;\r
-               }\r
-               return null;\r
-       }\r
+    public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
+        String type = null;\r
+        String temp = null;\r
+        \r
+        temp = mtr.group();\r
+        if (MigrationTool.db.hasGuid(temp)) {        // only changed guids registered, because both changed and not changed guids are included in database\r
+            type = MigrationTool.db.getGuidType(temp);\r
+            if (type.matches("Protocol")) {\r
+                mi.protocol.add(temp);\r
+            } else if (type.matches("Ppi")) {\r
+                mi.ppi.add(temp);\r
+            } else if (type.matches("Guid")) {\r
+                mi.guid.add(temp);\r
+            }\r
+            return temp;\r
+        }\r
+        return null;\r
+    }\r
 }
\ No newline at end of file
index 47c507baf41f4b46b65a47fe71eaa963044e9af1..b58e5903c53437f350915194dd036cc148cf10b8 100644 (file)
@@ -15,32 +15,32 @@ package org.tianocore.migration;
 import java.util.regex.*;\r
 \r
 public class Macro {\r
-       Macro(String r8, String r9) {\r
-               r8name = r8;\r
-               r9name = r9;\r
-       }\r
-       Macro(String[] linecontext) {\r
-               r8name = linecontext[0];\r
-               r9name = linecontext[1];\r
-       }\r
-       \r
-       public String r8name;\r
-       public String r9name;\r
+    Macro(String r8, String r9) {\r
+        r8name = r8;\r
+        r9name = r9;\r
+    }\r
+    Macro(String[] linecontext) {\r
+        r8name = linecontext[0];\r
+        r9name = linecontext[1];\r
+    }\r
+    \r
+    public String r8name;\r
+    public String r9name;\r
 \r
-       public static Pattern ptntmacro = Pattern.compile("\\b[A-Z_]+\\s*?\\(?\\b",Pattern.MULTILINE);\r
+    public static Pattern ptntmacro = Pattern.compile("\\b[A-Z_]+\\s*?\\(?\\b",Pattern.MULTILINE);\r
 \r
-       private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";\r
+    private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";\r
 \r
-       public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
-               String temp = null;\r
-               \r
-               temp = mtr.group();\r
-               if (MigrationTool.db.hasMacro(temp)) {                                  // only changed macros registered, because the database of macro has only changed ones\r
-                       if (!unmacro.contains(temp)) {\r
-                               mi.hashnonlocalmacro.add(temp);\r
-                       }\r
-                       return temp;\r
-               }\r
-               return null;\r
-       }\r
+    public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
+        String temp = null;\r
+        \r
+        temp = mtr.group();\r
+        if (MigrationTool.db.hasMacro(temp)) {                    // only changed macros registered, because the database of macro has only changed ones\r
+            if (!unmacro.contains(temp)) {\r
+                mi.hashnonlocalmacro.add(temp);\r
+            }\r
+            return temp;\r
+        }\r
+        return null;\r
+    }\r
 }
\ No newline at end of file
index a0ce0c21010b8ff3f5bc95035be6014027f462dc..e159c5e4ea4b7edd5fcd4f309d6d4828d8033cda 100644 (file)
@@ -18,91 +18,91 @@ import java.util.*;
 import javax.swing.JFileChooser;\r
 \r
 public class MigrationTool {\r
-       public static UI ui = null;\r
-       public static Database db = null;\r
-\r
-       public static String MIGRATIONCOMMENT = "//%@//";\r
-\r
-       public static boolean printModuleInfo = false;\r
-       public static boolean doCritic = false;\r
-       public static boolean defaultoutput = false;\r
-       \r
-       public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();\r
-\r
-       private static final void mainFlow(ModuleInfo mi) throws Exception {\r
-\r
-               ModuleReader.ModuleScan(mi);\r
-               \r
-               //MigrationTool.ui.yesOrNo("go on replace?");\r
-               SourceFileReplacer.fireAt(mi);  // some adding library actions are taken here,so it must be put before "MsaWriter"\r
-\r
-               //MigrationTool.ui.yesOrNo("go on show?");\r
-               // show result\r
-               if (MigrationTool.printModuleInfo) {\r
-                       MigrationTool.ui.println("\nModule Information : ");\r
-                       MigrationTool.ui.println("Entrypoint : " + mi.entrypoint);\r
-                       show(mi.protocol, "Protocol : ");\r
-                       show(mi.ppi, "Ppi : ");\r
-                       show(mi.guid, "Guid : ");\r
-                       show(mi.hashfuncc, "call : ");\r
-                       show(mi.hashfuncd, "def : ");\r
-                       show(mi.hashEFIcall, "EFIcall : ");\r
-                       show(mi.hashnonlocalmacro, "macro : ");\r
-                       show(mi.hashnonlocalfunc, "nonlocal : ");\r
-                       show(mi.hashr8only, "hashr8only : ");\r
-               }\r
-\r
-               //MigrationTool.ui.yesOrNo("go on msawrite?");\r
-               new MsaWriter(mi).flush();\r
-               //MigrationTool.ui.yesOrNo("go on critic?");\r
-\r
-               if (MigrationTool.doCritic) {\r
-                       Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);\r
-               }\r
-\r
-               //MigrationTool.ui.yesOrNo("go on delete?");\r
-               Common.deleteDir(mi.modulepath + File.separator + "temp");\r
-\r
-               MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);\r
-               MigrationTool.ui.println("Complete!");\r
-               //MigrationTool.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");\r
-               //MigrationTool.ui.println("Your logfile was placed here: " + mi.modulepath);\r
-       }\r
-\r
-       private static final void show(Set<String> hash, String show) {\r
-               MigrationTool.ui.println(show + hash.size());\r
-               MigrationTool.ui.println(hash);\r
-       }\r
-\r
-       private static final String assignOutPutPath(String inputpath) {\r
-               if (MigrationTool.defaultoutput) {\r
-                       return inputpath.replaceAll(Common.strseparate, "$1");\r
-               } else {\r
-                       return MigrationTool.ui.getFilepath("Please choose where to place the output module", JFileChooser.DIRECTORIES_ONLY);\r
-               }\r
-       }\r
-       \r
-       public static final void seekModule(String filepath) throws Exception {\r
-               if (ModuleInfo.isModule(filepath)) {\r
-                       ModuleInfoMap.put(new ModuleInfo(filepath), assignOutPutPath(filepath));\r
-               }\r
-       }\r
-\r
-       public static final void startMigrateAll(String path) throws Exception {\r
-               MigrationTool.ui.println("Project Migration");\r
-               MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
-               Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
-               \r
-               Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();\r
-               while (miit.hasNext()) {\r
-                       mainFlow(miit.next());\r
-               }\r
-               \r
-               ModuleInfoMap.clear();\r
-       }\r
-\r
-       public static void main(String[] args) throws Exception {\r
-               ui = FirstPanel.getInstance();\r
-               db = Database.getInstance();\r
-       }\r
+    public static UI ui = null;\r
+    public static Database db = null;\r
+\r
+    public static String MIGRATIONCOMMENT = "//%@//";\r
+\r
+    public static boolean printModuleInfo = false;\r
+    public static boolean doCritic = false;\r
+    public static boolean defaultoutput = false;\r
+    \r
+    public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();\r
+\r
+    private static final void mainFlow(ModuleInfo mi) throws Exception {\r
+\r
+        ModuleReader.ModuleScan(mi);\r
+        \r
+        //MigrationTool.ui.yesOrNo("go on replace?");\r
+        SourceFileReplacer.fireAt(mi);    // some adding library actions are taken here,so it must be put before "MsaWriter"\r
+\r
+        //MigrationTool.ui.yesOrNo("go on show?");\r
+        // show result\r
+        if (MigrationTool.printModuleInfo) {\r
+            MigrationTool.ui.println("\nModule Information : ");\r
+            MigrationTool.ui.println("Entrypoint : " + mi.entrypoint);\r
+            show(mi.protocol, "Protocol : ");\r
+            show(mi.ppi, "Ppi : ");\r
+            show(mi.guid, "Guid : ");\r
+            show(mi.hashfuncc, "call : ");\r
+            show(mi.hashfuncd, "def : ");\r
+            show(mi.hashEFIcall, "EFIcall : ");\r
+            show(mi.hashnonlocalmacro, "macro : ");\r
+            show(mi.hashnonlocalfunc, "nonlocal : ");\r
+            show(mi.hashr8only, "hashr8only : ");\r
+        }\r
+\r
+        //MigrationTool.ui.yesOrNo("go on msawrite?");\r
+        new MsaWriter(mi).flush();\r
+        //MigrationTool.ui.yesOrNo("go on critic?");\r
+\r
+        if (MigrationTool.doCritic) {\r
+            Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);\r
+        }\r
+\r
+        //MigrationTool.ui.yesOrNo("go on delete?");\r
+        Common.deleteDir(mi.modulepath + File.separator + "temp");\r
+\r
+        MigrationTool.ui.println("Errors Left : " + MigrationTool.db.error);\r
+        MigrationTool.ui.println("Complete!");\r
+        //MigrationTool.ui.println("Your R9 module was placed here: " + mi.modulepath + File.separator + "result");\r
+        //MigrationTool.ui.println("Your logfile was placed here: " + mi.modulepath);\r
+    }\r
+\r
+    private static final void show(Set<String> hash, String show) {\r
+        MigrationTool.ui.println(show + hash.size());\r
+        MigrationTool.ui.println(hash);\r
+    }\r
+\r
+    private static final String assignOutPutPath(String inputpath) {\r
+        if (MigrationTool.defaultoutput) {\r
+            return inputpath.replaceAll(Common.strseparate, "$1");\r
+        } else {\r
+            return MigrationTool.ui.getFilepath("Please choose where to place the output module", JFileChooser.DIRECTORIES_ONLY);\r
+        }\r
+    }\r
+    \r
+    public static final void seekModule(String filepath) throws Exception {\r
+        if (ModuleInfo.isModule(filepath)) {\r
+            ModuleInfoMap.put(new ModuleInfo(filepath), assignOutPutPath(filepath));\r
+        }\r
+    }\r
+\r
+    public static final void startMigrateAll(String path) throws Exception {\r
+        MigrationTool.ui.println("Project Migration");\r
+        MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
+        Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
+        \r
+        Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();\r
+        while (miit.hasNext()) {\r
+            mainFlow(miit.next());\r
+        }\r
+        \r
+        ModuleInfoMap.clear();\r
+    }\r
+\r
+    public static void main(String[] args) throws Exception {\r
+        ui = FirstPanel.getInstance();\r
+        db = Database.getInstance();\r
+    }\r
 }\r
index d53c7b93f746ce4092c7cf4417a2e1a880ee1ac3..19c0dfedd11c1edd205e99919ff802d48a627881 100644 (file)
@@ -16,67 +16,67 @@ import java.io.*;
 import java.util.*;\r
 \r
 /*\r
-       Class ModuleInfo is built for scanning the source files, it contains all the needed\r
+    Class ModuleInfo is built for scanning the source files, it contains all the needed\r
 information and all the temporary data.\r
 */\r
 public final class ModuleInfo {\r
-       ModuleInfo(String modulepath) throws Exception {\r
-               this.modulepath = modulepath;\r
-       }\r
+    ModuleInfo(String modulepath) throws Exception {\r
+        this.modulepath = modulepath;\r
+    }\r
 \r
-       public final String modulepath;\r
-       \r
-       public String modulename = null;\r
-       public String guidvalue = null;\r
-       public String moduletype = null;\r
-       public String entrypoint = null;\r
-       \r
-       public final Set<String> localmodulesources = new HashSet<String>();            //contains both .c and .h\r
-       public final Set<String> preprocessedccodes = new HashSet<String>();\r
-       public final Set<String> msaorinf = new HashSet<String>();                              //only a little, hash may be too big for this\r
-       \r
-       public final Set<String> hashfuncc = new HashSet<String>();\r
-       public final Set<String> hashfuncd = new HashSet<String>();\r
-       public final Set<String> hashnonlocalfunc = new HashSet<String>();\r
-       public final Set<String> hashnonlocalmacro = new HashSet<String>();\r
-       public final Set<String> hashEFIcall = new HashSet<String>();\r
-       public final Set<String> hashr8only = new HashSet<String>();\r
-       \r
-       public final Set<String> hashrequiredr9libs = new HashSet<String>();    // hashrequiredr9libs is now all added in SourceFileReplacer \r
-       public final Set<String> guid = new HashSet<String>();\r
-       public final Set<String> protocol = new HashSet<String>();\r
-       public final Set<String> ppi = new HashSet<String>();\r
+    public final String modulepath;\r
+    \r
+    public String modulename = null;\r
+    public String guidvalue = null;\r
+    public String moduletype = null;\r
+    public String entrypoint = null;\r
+    \r
+    public final Set<String> localmodulesources = new HashSet<String>();        //contains both .c and .h\r
+    public final Set<String> preprocessedccodes = new HashSet<String>();\r
+    public final Set<String> msaorinf = new HashSet<String>();                //only a little, hash may be too big for this\r
+    \r
+    public final Set<String> hashfuncc = new HashSet<String>();\r
+    public final Set<String> hashfuncd = new HashSet<String>();\r
+    public final Set<String> hashnonlocalfunc = new HashSet<String>();\r
+    public final Set<String> hashnonlocalmacro = new HashSet<String>();\r
+    public final Set<String> hashEFIcall = new HashSet<String>();\r
+    public final Set<String> hashr8only = new HashSet<String>();\r
+    \r
+    public final Set<String> hashrequiredr9libs = new HashSet<String>();    // hashrequiredr9libs is now all added in SourceFileReplacer \r
+    public final Set<String> guid = new HashSet<String>();\r
+    public final Set<String> protocol = new HashSet<String>();\r
+    public final Set<String> ppi = new HashSet<String>();\r
 \r
-       public final String getModuleType() {\r
-               if (moduletype.contains("PEI")) {\r
-                       return "PEIM";\r
-               } else {\r
-                       return "DXE_DRIVER";\r
-               }\r
-       }\r
-       \r
-       public final void enroll(String filepath) throws Exception {\r
-               String temp = null;\r
-               if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
-                               filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
-                       localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r
-               } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
-                       temp = filepath.replace(modulepath + File.separator, "");\r
-                       if (!temp.contains(File.separator)) {                                                   // .inf in subdirectory is not regarded\r
-                               msaorinf.add(temp);\r
-                       }\r
-               }\r
-       }\r
+    public final String getModuleType() {\r
+        if (moduletype.contains("PEI")) {\r
+            return "PEIM";\r
+        } else {\r
+            return "DXE_DRIVER";\r
+        }\r
+    }\r
+    \r
+    public final void enroll(String filepath) throws Exception {\r
+        String temp = null;\r
+        if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r
+                filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r
+            localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r
+        } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r
+            temp = filepath.replace(modulepath + File.separator, "");\r
+            if (!temp.contains(File.separator)) {                            // .inf in subdirectory is not regarded\r
+                msaorinf.add(temp);\r
+            }\r
+        }\r
+    }\r
 \r
-       public static final boolean isModule(String path) {\r
-               String[] list = new File(path).list();\r
-               for (int i = 0 ; i < list.length ; i++) {\r
-                       if (!new File(list[i]).isDirectory()) {\r
-                               if (list[i].contains(".inf") || list[i].contains(".msa")) {\r
-                                       return true;\r
-                               }\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
+    public static final boolean isModule(String path) {\r
+        String[] list = new File(path).list();\r
+        for (int i = 0 ; i < list.length ; i++) {\r
+            if (!new File(list[i]).isDirectory()) {\r
+                if (list[i].contains(".inf") || list[i].contains(".msa")) {\r
+                    return true;\r
+                }\r
+            }\r
+        }\r
+        return false;\r
+    }\r
 }
\ No newline at end of file
index b5c47c40b5a5a1e10cb8ead21ee74a7227709d10..e67b0d167bc33d23c54aa11a0bcc8cd205c7b071 100644 (file)
@@ -19,257 +19,257 @@ import java.util.regex.*;
 import org.tianocore.*;\r
 \r
 public final class ModuleReader {\r
-       private static ModuleInfo mi;\r
-       \r
-       private static final Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*=\\s*([^\\s]*)");\r
-       private static final Pattern ptnsection = Pattern.compile("\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);\r
-       private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");\r
-       \r
-       public static final void ModuleScan(ModuleInfo m) throws Exception {\r
-               mi = m;\r
+    private static ModuleInfo mi;\r
+    \r
+    private static final Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*=\\s*([^\\s]*)");\r
+    private static final Pattern ptnsection = Pattern.compile("\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);\r
+    private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");\r
+    \r
+    public static final void ModuleScan(ModuleInfo m) throws Exception {\r
+        mi = m;\r
 \r
-               Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);\r
+        Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);\r
 \r
-               String filename = null;\r
-               if (mi.msaorinf.isEmpty()) {\r
-                       MigrationTool.ui.println("No INF nor MSA file found!");\r
-                       System.exit(0);\r
-               } else {\r
-                       if (mi.msaorinf.size() == 1) {\r
-                               filename = (String)mi.msaorinf.toArray()[0];\r
-                       } else {\r
-                               filename = MigrationTool.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
-                       }\r
-               }\r
+        String filename = null;\r
+        if (mi.msaorinf.isEmpty()) {\r
+            MigrationTool.ui.println("No INF nor MSA file found!");\r
+            System.exit(0);\r
+        } else {\r
+            if (mi.msaorinf.size() == 1) {\r
+                filename = (String)mi.msaorinf.toArray()[0];\r
+            } else {\r
+                filename = MigrationTool.ui.choose("Found .inf or .msa file for module\n" + mi.modulepath + "\nChoose one Please", mi.msaorinf.toArray());\r
+            }\r
+        }\r
 \r
-               if (filename.contains(".inf")) {\r
-                       readInf(filename);\r
-               } else if (filename.contains(".msa")) {\r
-                       readMsa(filename);\r
-               }\r
+        if (filename.contains(".inf")) {\r
+            readInf(filename);\r
+        } else if (filename.contains(".msa")) {\r
+            readMsa(filename);\r
+        }\r
 \r
-               CommentOutNonLocalHFile();\r
-               parsePreProcessedSourceCode();\r
+        CommentOutNonLocalHFile();\r
+        parsePreProcessedSourceCode();\r
 \r
-       }\r
-       \r
-       private static final void readMsa(String name) throws Exception {\r
-               ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(new File(mi.modulepath + File.separator + name));\r
-               ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc.getModuleSurfaceArea();\r
-               MsaHeaderDocument.MsaHeader msaheader = msa.getMsaHeader();\r
+    }\r
+    \r
+    private static final void readMsa(String name) throws Exception {\r
+        ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(new File(mi.modulepath + File.separator + name));\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc.getModuleSurfaceArea();\r
+        MsaHeaderDocument.MsaHeader msaheader = msa.getMsaHeader();\r
 \r
-               mi.modulename = msaheader.getModuleName();\r
-               mi.guidvalue = msaheader.getGuidValue();\r
-               mi.moduletype = msaheader.getModuleType().toString();           // ???\r
+        mi.modulename = msaheader.getModuleName();\r
+        mi.guidvalue = msaheader.getGuidValue();\r
+        mi.moduletype = msaheader.getModuleType().toString();        // ???\r
 \r
-               SourceFilesDocument.SourceFiles sourcefiles = msa.getSourceFiles();\r
-               \r
-               String temp;\r
-               Iterator<FilenameDocument.Filename> li = sourcefiles.getFilenameList().iterator();\r
-               while (li.hasNext()) {\r
-                       if (!mi.localmodulesources.contains(temp = li.next().toString())) {\r
-                               System.out.println("Source File Missing! : " + temp);\r
-                       }\r
-               }\r
-       }\r
-       \r
-       private static final void readInf(String name) throws Exception {\r
-               System.out.println("\nParsing INF file: " + name);\r
-               String wholeline;\r
-               Matcher mtrinfequation;\r
-               Matcher mtrsection;\r
-               Matcher mtrfilename;\r
+        SourceFilesDocument.SourceFiles sourcefiles = msa.getSourceFiles();\r
+        \r
+        String temp;\r
+        Iterator<FilenameDocument.Filename> li = sourcefiles.getFilenameList().iterator();\r
+        while (li.hasNext()) {\r
+            if (!mi.localmodulesources.contains(temp = li.next().toString())) {\r
+                System.out.println("Source File Missing! : " + temp);\r
+            }\r
+        }\r
+    }\r
+    \r
+    private static final void readInf(String name) throws Exception {\r
+        System.out.println("\nParsing INF file: " + name);\r
+        String wholeline;\r
+        Matcher mtrinfequation;\r
+        Matcher mtrsection;\r
+        Matcher mtrfilename;\r
 \r
-               wholeline = Common.file2string(mi.modulepath + File.separator + name);\r
-               mtrsection = ptnsection.matcher(wholeline);\r
-               while (mtrsection.find()) {\r
-                       if (mtrsection.group(1).matches("defines")) {\r
-                               mtrinfequation = ptninfequation.matcher(mtrsection.group(2));\r
-                               while (mtrinfequation.find()) {\r
-                                       if (mtrinfequation.group(1).matches("BASE_NAME")) {\r
-                                               mi.modulename = mtrinfequation.group(2);\r
-                                       }\r
-                                       if (mtrinfequation.group(1).matches("FILE_GUID")) {\r
-                                               mi.guidvalue = mtrinfequation.group(2);\r
-                                       }\r
-                                       if (mtrinfequation.group(1).matches("COMPONENT_TYPE")) {\r
-                                               mi.moduletype = mtrinfequation.group(2);\r
-                                       }\r
-                               }\r
-                       }\r
-                       if (mtrsection.group(1).matches("nmake.common")) {\r
-                               mtrinfequation = ptninfequation.matcher(mtrsection.group(2));\r
-                               while (mtrinfequation.find()) {\r
-                                       if (mtrinfequation.group(1).matches("IMAGE_ENTRY_POINT")) {\r
-                                               mi.entrypoint = mtrinfequation.group(2);\r
-                                       }\r
-                                       if (mtrinfequation.group(1).matches("DPX_SOURCE")) {\r
-                                               if (!mi.localmodulesources.contains(mtrinfequation.group(2))) {\r
-                                                       MigrationTool.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }\r
-                       if (mtrsection.group(1).contains("sources.")) {\r
-                               mtrfilename = ptnfilename.matcher(mtrsection.group(2));\r
-                               while (mtrfilename.find()) {\r
-                                       if (!mi.localmodulesources.contains(mtrfilename.group())) {\r
-                                               MigrationTool.ui.println("Source File Missing! : " + mtrfilename.group());\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-       \r
-       // add '//' to all non-local include lines\r
-       private static final void CommentOutNonLocalHFile() throws IOException {\r
-               BufferedReader rd;\r
-               String line;\r
-               String curFile;\r
-               PrintWriter outfile;\r
+        wholeline = Common.file2string(mi.modulepath + File.separator + name);\r
+        mtrsection = ptnsection.matcher(wholeline);\r
+        while (mtrsection.find()) {\r
+            if (mtrsection.group(1).matches("defines")) {\r
+                mtrinfequation = ptninfequation.matcher(mtrsection.group(2));\r
+                while (mtrinfequation.find()) {\r
+                    if (mtrinfequation.group(1).matches("BASE_NAME")) {\r
+                        mi.modulename = mtrinfequation.group(2);\r
+                    }\r
+                    if (mtrinfequation.group(1).matches("FILE_GUID")) {\r
+                        mi.guidvalue = mtrinfequation.group(2);\r
+                    }\r
+                    if (mtrinfequation.group(1).matches("COMPONENT_TYPE")) {\r
+                        mi.moduletype = mtrinfequation.group(2);\r
+                    }\r
+                }\r
+            }\r
+            if (mtrsection.group(1).matches("nmake.common")) {\r
+                mtrinfequation = ptninfequation.matcher(mtrsection.group(2));\r
+                while (mtrinfequation.find()) {\r
+                    if (mtrinfequation.group(1).matches("IMAGE_ENTRY_POINT")) {\r
+                        mi.entrypoint = mtrinfequation.group(2);\r
+                    }\r
+                    if (mtrinfequation.group(1).matches("DPX_SOURCE")) {\r
+                        if (!mi.localmodulesources.contains(mtrinfequation.group(2))) {\r
+                            MigrationTool.ui.println("DPX File Missing! : " + mtrinfequation.group(2));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            if (mtrsection.group(1).contains("sources.")) {\r
+                mtrfilename = ptnfilename.matcher(mtrsection.group(2));\r
+                while (mtrfilename.find()) {\r
+                    if (!mi.localmodulesources.contains(mtrfilename.group())) {\r
+                        MigrationTool.ui.println("Source File Missing! : " + mtrfilename.group());\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
+    \r
+    // add '//' to all non-local include lines\r
+    private static final void CommentOutNonLocalHFile() throws IOException {\r
+        BufferedReader rd;\r
+        String line;\r
+        String curFile;\r
+        PrintWriter outfile;\r
 \r
-               Pattern ptninclude = Pattern.compile("[\"<](.*[.]h)[\">]");\r
-               Matcher mtrinclude;\r
+        Pattern ptninclude = Pattern.compile("[\"<](.*[.]h)[\">]");\r
+        Matcher mtrinclude;\r
 \r
-               Iterator<String> ii = mi.localmodulesources.iterator();\r
-               while ( ii.hasNext() ) {\r
-                       curFile = ii.next();\r
-                       rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + curFile));\r
-                       Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + curFile);\r
-                       outfile = new PrintWriter(new BufferedWriter(new FileWriter(mi.modulepath + File.separator + "temp" + File.separator + curFile)));\r
-                       \r
-                       /*\r
-                       if (curFile.contains(".dxs")) {\r
-                               if (mi.moduletype.contains("PEI")) {\r
-                                       \r
-                               } else {\r
-                                       \r
-                               }\r
-                       }\r
-                       */\r
-                       while ((line = rd.readLine()) != null) {\r
-                               if (line.contains("#include")) {\r
-                                       mtrinclude = ptninclude.matcher(line);\r
-                                       if (mtrinclude.find() && mi.localmodulesources.contains(mtrinclude.group(1))) {\r
-                                       } else {\r
-                                               line = MigrationTool.MIGRATIONCOMMENT + line;\r
-                                       }\r
-                               }\r
-                               outfile.append(line + '\n');\r
-                       }\r
-                       outfile.flush();\r
-                       outfile.close();\r
-                       \r
-               }\r
-       }\r
+        Iterator<String> ii = mi.localmodulesources.iterator();\r
+        while ( ii.hasNext() ) {\r
+            curFile = ii.next();\r
+            rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + curFile));\r
+            Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + curFile);\r
+            outfile = new PrintWriter(new BufferedWriter(new FileWriter(mi.modulepath + File.separator + "temp" + File.separator + curFile)));\r
+            \r
+            /*\r
+            if (curFile.contains(".dxs")) {\r
+                if (mi.moduletype.contains("PEI")) {\r
+                    \r
+                } else {\r
+                    \r
+                }\r
+            }\r
+            */\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.contains("#include")) {\r
+                    mtrinclude = ptninclude.matcher(line);\r
+                    if (mtrinclude.find() && mi.localmodulesources.contains(mtrinclude.group(1))) {\r
+                    } else {\r
+                        line = MigrationTool.MIGRATIONCOMMENT + line;\r
+                    }\r
+                }\r
+                outfile.append(line + '\n');\r
+            }\r
+            outfile.flush();\r
+            outfile.close();\r
+            \r
+        }\r
+    }\r
 \r
-       private static final void parsePreProcessedSourceCode() throws Exception {\r
-               //Cl cl = new Cl(modulepath);\r
-               //cl.execute("Fat.c");\r
-               //cl.generateAll(preprocessedccodes);\r
-               //\r
-               //System.out.println("Note!!!! The CL is not implemented now , pls do it manually!!! RUN :");\r
-               //System.out.println("cl " + modulepath + "\\temp\\*.c" + " -P");\r
-               //String[] list = new File(modulepath + File.separator + "temp").list();        // without CL , add\r
-               BufferedReader rd = null;\r
-               String ifile = null;\r
-               String line = null;\r
-               String temp = null;\r
-               \r
-               Iterator<String> ii = mi.localmodulesources.iterator();\r
-               while (ii.hasNext()) {\r
-                       temp = ii.next();\r
-                       if (temp.contains(".c")) {\r
-                               mi.preprocessedccodes.add(temp);\r
-                       }\r
-               }\r
-               \r
-               ii = mi.preprocessedccodes.iterator();\r
-               \r
-               Pattern patefifuncc = Pattern.compile("g?(BS|RT)\\s*->\\s*([a-zA-Z_]\\w*)",Pattern.MULTILINE);\r
-               Pattern patentrypoint = Pattern.compile("EFI_([A-Z]*)_ENTRY_POINT\\s*\\(([^\\(\\)]*)\\)",Pattern.MULTILINE);\r
-               Matcher matguid;\r
-               Matcher matfuncc;\r
-               Matcher matfuncd;\r
-               Matcher matenclosereplace;\r
-               Matcher matefifuncc;\r
-               Matcher matentrypoint;\r
-               Matcher matmacro;\r
-               \r
-               while (ii.hasNext()) {\r
-                       StringBuffer wholefile = new StringBuffer();\r
-                       ifile = ii.next();\r
-                       rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + "temp" + File.separator + ifile));\r
-                       while ((line = rd.readLine()) != null) {\r
-                               wholefile.append(line + '\n');\r
-                       }\r
-                       line = wholefile.toString();\r
-                       \r
-                       // if this is a Pei phase module , add these library class to .msa\r
-                       matentrypoint = patentrypoint.matcher(line);\r
-                       if (matentrypoint.find()) {\r
-                               mi.entrypoint = matentrypoint.group(2);\r
-                               if (matentrypoint.group(1).matches("PEIM")) {\r
-                                       mi.hashrequiredr9libs.add("PeimEntryPoint");\r
-                               } else {\r
-                                       mi.hashrequiredr9libs.add("UefiDriverEntryPoint");\r
-                               }\r
-                       }\r
-                       \r
-                       // find guid\r
-                       matguid = Guid.ptnguid.matcher(line);                                                                           // several ways to implement this , which one is faster ? :\r
-                       while (matguid.find()) {                                                                                                        // 1.currently , find once , then call to identify which is it\r
-                               if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) {                            // 2.use 3 different matchers , search 3 times to find each\r
-                                       //matguid.appendReplacement(result, MigrationTool.db.getR9Guidname(temp));              // search the database for all 3 kinds of guids , high cost\r
-                               }\r
-                       }\r
-                       //matguid.appendTail(result);\r
-                       //line = result.toString();\r
+    private static final void parsePreProcessedSourceCode() throws Exception {\r
+        //Cl cl = new Cl(modulepath);\r
+        //cl.execute("Fat.c");\r
+        //cl.generateAll(preprocessedccodes);\r
+        //\r
+        //System.out.println("Note!!!! The CL is not implemented now , pls do it manually!!! RUN :");\r
+        //System.out.println("cl " + modulepath + "\\temp\\*.c" + " -P");\r
+        //String[] list = new File(modulepath + File.separator + "temp").list();    // without CL , add\r
+        BufferedReader rd = null;\r
+        String ifile = null;\r
+        String line = null;\r
+        String temp = null;\r
+        \r
+        Iterator<String> ii = mi.localmodulesources.iterator();\r
+        while (ii.hasNext()) {\r
+            temp = ii.next();\r
+            if (temp.contains(".c")) {\r
+                mi.preprocessedccodes.add(temp);\r
+            }\r
+        }\r
+        \r
+        ii = mi.preprocessedccodes.iterator();\r
+        \r
+        Pattern patefifuncc = Pattern.compile("g?(BS|RT)\\s*->\\s*([a-zA-Z_]\\w*)",Pattern.MULTILINE);\r
+        Pattern patentrypoint = Pattern.compile("EFI_([A-Z]*)_ENTRY_POINT\\s*\\(([^\\(\\)]*)\\)",Pattern.MULTILINE);\r
+        Matcher matguid;\r
+        Matcher matfuncc;\r
+        Matcher matfuncd;\r
+        Matcher matenclosereplace;\r
+        Matcher matefifuncc;\r
+        Matcher matentrypoint;\r
+        Matcher matmacro;\r
+        \r
+        while (ii.hasNext()) {\r
+            StringBuffer wholefile = new StringBuffer();\r
+            ifile = ii.next();\r
+            rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + "temp" + File.separator + ifile));\r
+            while ((line = rd.readLine()) != null) {\r
+                wholefile.append(line + '\n');\r
+            }\r
+            line = wholefile.toString();\r
+            \r
+            // if this is a Pei phase module , add these library class to .msa\r
+            matentrypoint = patentrypoint.matcher(line);\r
+            if (matentrypoint.find()) {\r
+                mi.entrypoint = matentrypoint.group(2);\r
+                if (matentrypoint.group(1).matches("PEIM")) {\r
+                    mi.hashrequiredr9libs.add("PeimEntryPoint");\r
+                } else {\r
+                    mi.hashrequiredr9libs.add("UefiDriverEntryPoint");\r
+                }\r
+            }\r
+            \r
+            // find guid\r
+            matguid = Guid.ptnguid.matcher(line);                                        // several ways to implement this , which one is faster ? :\r
+            while (matguid.find()) {                                                    // 1.currently , find once , then call to identify which is it\r
+                if ((temp = Guid.register(matguid, mi, MigrationTool.db)) != null) {                // 2.use 3 different matchers , search 3 times to find each\r
+                    //matguid.appendReplacement(result, MigrationTool.db.getR9Guidname(temp));        // search the database for all 3 kinds of guids , high cost\r
+                }\r
+            }\r
+            //matguid.appendTail(result);\r
+            //line = result.toString();\r
 \r
-                       // find EFI call in form of '->' , many 'gUnicodeCollationInterface->' like things are not changed\r
-                       // This item is not simply replaced , special operation is required.\r
-                       matefifuncc = patefifuncc.matcher(line);\r
-                       while (matefifuncc.find()) {\r
-                               mi.hashEFIcall.add(matefifuncc.group(2));\r
-                       }\r
+            // find EFI call in form of '->' , many 'gUnicodeCollationInterface->' like things are not changed\r
+            // This item is not simply replaced , special operation is required.\r
+            matefifuncc = patefifuncc.matcher(line);\r
+            while (matefifuncc.find()) {\r
+                mi.hashEFIcall.add(matefifuncc.group(2));\r
+            }\r
 \r
-                       // find function call\r
-                       matfuncc = Func.ptnfuncc.matcher(line);\r
-                       while (matfuncc.find()) {\r
-                               if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) {\r
-                                       //MigrationTool.ui.println(ifile + "  dofunc  " + temp);\r
-                                       //matfuncc.appendReplacement(result, MigrationTool.db.getR9Func(temp));\r
-                               }\r
-                       }\r
-                       //matfuncc.appendTail(result);\r
-                       //line = result.toString();\r
+            // find function call\r
+            matfuncc = Func.ptnfuncc.matcher(line);\r
+            while (matfuncc.find()) {\r
+                if ((temp = Func.register(matfuncc, mi, MigrationTool.db)) != null) {\r
+                    //MigrationTool.ui.println(ifile + "  dofunc  " + temp);\r
+                    //matfuncc.appendReplacement(result, MigrationTool.db.getR9Func(temp));\r
+                }\r
+            }\r
+            //matfuncc.appendTail(result);\r
+            //line = result.toString();\r
 \r
-                       // find macro\r
-                       matmacro = Macro.ptntmacro.matcher(line);\r
-                       while (matmacro.find()) {\r
-                               if ((temp = Macro.register(matmacro, mi, MigrationTool.db)) != null) {\r
-                               }\r
-                       }\r
-                       \r
-                       // find function definition\r
-                       // replace all {} to @\r
-                       while ((matenclosereplace = Func.ptnbrace.matcher(line)).find()) {\r
-                               line = matenclosereplace.replaceAll("@");\r
-                       }\r
+            // find macro\r
+            matmacro = Macro.ptntmacro.matcher(line);\r
+            while (matmacro.find()) {\r
+                if ((temp = Macro.register(matmacro, mi, MigrationTool.db)) != null) {\r
+                }\r
+            }\r
+            \r
+            // find function definition\r
+            // replace all {} to @\r
+            while ((matenclosereplace = Func.ptnbrace.matcher(line)).find()) {\r
+                line = matenclosereplace.replaceAll("@");\r
+            }\r
 \r
-                       matfuncd = Func.ptnfuncd.matcher(line);\r
-                       while (matfuncd.find()) {\r
-                               if ((temp = Func.register(matfuncd, mi, MigrationTool.db)) != null) {\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               // op on hash\r
-               Iterator<String> funcci = mi.hashfuncc.iterator();\r
-               while (funcci.hasNext()) {\r
-                       if (!mi.hashfuncd.contains(temp = funcci.next()) && !mi.hashEFIcall.contains(temp)) {\r
-                               mi.hashnonlocalfunc.add(temp);                                  // this set contains both changed and not changed items\r
-                       }\r
-               }\r
-       }\r
+            matfuncd = Func.ptnfuncd.matcher(line);\r
+            while (matfuncd.find()) {\r
+                if ((temp = Func.register(matfuncd, mi, MigrationTool.db)) != null) {\r
+                }\r
+            }\r
+        }\r
+        \r
+        // op on hash\r
+        Iterator<String> funcci = mi.hashfuncc.iterator();\r
+        while (funcci.hasNext()) {\r
+            if (!mi.hashfuncd.contains(temp = funcci.next()) && !mi.hashEFIcall.contains(temp)) {\r
+                mi.hashnonlocalfunc.add(temp);                    // this set contains both changed and not changed items\r
+            }\r
+        }\r
+    }\r
 }\r
index 2223d22e91d6fde36824161d7e2fa6f1c0d4b605..29dfd885345418ace5515d1d312c5c049b6f297a 100644 (file)
@@ -8,19 +8,19 @@ import javax.xml.parsers.*;
 import org.w3c.dom.*;\r
 \r
 public class MsaTreeEditor extends JPanel {\r
-       /**\r
-        *  Define class Serial Version UID\r
-        */\r
-       private static final long serialVersionUID = 3169905938472150649L;\r
-       \r
-       private \r
+    /**\r
+     *  Define class Serial Version UID\r
+     */\r
+    private static final long serialVersionUID = 3169905938472150649L;\r
+    \r
+    private \r
 /*\r
-       MsaTreeEditor(ModuleInfo m, UI u, ModuleSurfaceAreaDocument md) {\r
-               mi = m;\r
-               ui = u;\r
-               msadoc = md;\r
-               \r
-               //rootNode = msadoc.getDomNode();\r
+    MsaTreeEditor(ModuleInfo m, UI u, ModuleSurfaceAreaDocument md) {\r
+        mi = m;\r
+        ui = u;\r
+        msadoc = md;\r
+        \r
+        //rootNode = msadoc.getDomNode();\r
         rootNode = new DefaultMutableTreeNode("Root Node");\r
         treeModel = new DefaultTreeModel(rootNode);\r
 \r
@@ -43,9 +43,9 @@ public class MsaTreeEditor extends JPanel {
         \r
         addNode(rootNode, "1st");\r
         addNode(rootNode, "2nd");\r
-       }\r
+    }\r
 */\r
-       MsaTreeEditor() throws Exception {\r
+    MsaTreeEditor() throws Exception {\r
         rootNode = new DefaultMutableTreeNode("Root Node");\r
         treeModel = new DefaultTreeModel(rootNode);\r
 \r
@@ -70,92 +70,92 @@ public class MsaTreeEditor extends JPanel {
         menuitemdel.addActionListener(actionListener);\r
         menuitemedit.addActionListener(actionListener);\r
 \r
-               genDomTree(MigrationTool.ui.getFilepath("Select a msa file", JFileChooser.FILES_AND_DIRECTORIES));\r
-       }\r
-       \r
-       //private ModuleSurfaceAreaDocument msadoc;\r
-       \r
-       private JTree tree;\r
-       private DefaultMutableTreeNode rootNode;\r
-       private DefaultTreeModel treeModel;\r
-       private JMenuItem menuitemadd, menuitemdel, menuitemedit;\r
-       \r
-       private JPopupMenu popupmenu;\r
-       private MouseAdapter mouseadapter = new MouseAdapter() {\r
-               public void mouseReleased(MouseEvent me) {\r
-                       if (me.getClickCount() == 1 && SwingUtilities.isRightMouseButton(me)) {\r
-                               tree.setSelectionPath(tree.getPathForLocation(me.getX(), me.getY()));\r
-                               popupmenu.show(tree, me.getX(), me.getY());\r
-                       }\r
-               }\r
-       };\r
-       private ActionListener actionListener = new ActionListener() {\r
-               public void actionPerformed(ActionEvent ae) {\r
-                       if (ae.getSource() == menuitemadd) {\r
-                               addNode();\r
-                       } else if (ae.getSource() == menuitemdel) {\r
-                               delNode();\r
-                       } else if (ae.getSource() == menuitemedit) {\r
-                               editNode();\r
-                       }\r
-               }\r
-       };\r
-       \r
-       private void editNode() {\r
-               DefaultMutableTreeNode node = (DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent());\r
-               Element element = (Element)node.getUserObject();\r
-               System.out.println(element.getTextContent());\r
-       }\r
-       \r
-       private void delNode() {\r
-               treeModel.removeNodeFromParent((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()));\r
-       }\r
-       \r
-       private void addNode() {\r
-               addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), MigrationTool.ui.getInput("Input Node Name"));\r
-       }\r
-       \r
-       private DefaultMutableTreeNode addNode(DefaultMutableTreeNode parentNode, Object child) {\r
+        genDomTree(MigrationTool.ui.getFilepath("Select a msa file", JFileChooser.FILES_AND_DIRECTORIES));\r
+    }\r
+    \r
+    //private ModuleSurfaceAreaDocument msadoc;\r
+    \r
+    private JTree tree;\r
+    private DefaultMutableTreeNode rootNode;\r
+    private DefaultTreeModel treeModel;\r
+    private JMenuItem menuitemadd, menuitemdel, menuitemedit;\r
+    \r
+    private JPopupMenu popupmenu;\r
+    private MouseAdapter mouseadapter = new MouseAdapter() {\r
+        public void mouseReleased(MouseEvent me) {\r
+            if (me.getClickCount() == 1 && SwingUtilities.isRightMouseButton(me)) {\r
+                tree.setSelectionPath(tree.getPathForLocation(me.getX(), me.getY()));\r
+                popupmenu.show(tree, me.getX(), me.getY());\r
+            }\r
+        }\r
+    };\r
+    private ActionListener actionListener = new ActionListener() {\r
+        public void actionPerformed(ActionEvent ae) {\r
+            if (ae.getSource() == menuitemadd) {\r
+                addNode();\r
+            } else if (ae.getSource() == menuitemdel) {\r
+                delNode();\r
+            } else if (ae.getSource() == menuitemedit) {\r
+                editNode();\r
+            }\r
+        }\r
+    };\r
+    \r
+    private void editNode() {\r
+        DefaultMutableTreeNode node = (DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent());\r
+        Element element = (Element)node.getUserObject();\r
+        System.out.println(element.getTextContent());\r
+    }\r
+    \r
+    private void delNode() {\r
+        treeModel.removeNodeFromParent((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()));\r
+    }\r
+    \r
+    private void addNode() {\r
+        addNode((DefaultMutableTreeNode)(tree.getSelectionPath().getLastPathComponent()), MigrationTool.ui.getInput("Input Node Name"));\r
+    }\r
+    \r
+    private DefaultMutableTreeNode addNode(DefaultMutableTreeNode parentNode, Object child) {\r
         DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);\r
         treeModel.insertNodeInto(childNode, parentNode, parentNode.getChildCount());\r
         tree.scrollPathToVisible(new TreePath(childNode.getPath()));\r
         return childNode;\r
-       }\r
+    }\r
 \r
-       private final void handleNode(Node node, DefaultMutableTreeNode parentNode) {\r
-               DefaultMutableTreeNode curNode = null;\r
-               if (node.getNodeType() == Node.ELEMENT_NODE) {\r
-                       System.out.println("elem");\r
-                       curNode = addNode(parentNode, node);\r
-               } else if (node.getNodeType() == Node.DOCUMENT_NODE){\r
-                       System.out.println("doc");\r
-                       curNode = addNode(parentNode, "MsaDocum");                      // can Docum be with Root Node?\r
-               }\r
+    private final void handleNode(Node node, DefaultMutableTreeNode parentNode) {\r
+        DefaultMutableTreeNode curNode = null;\r
+        if (node.getNodeType() == Node.ELEMENT_NODE) {\r
+            System.out.println("elem");\r
+            curNode = addNode(parentNode, node);\r
+        } else if (node.getNodeType() == Node.DOCUMENT_NODE){\r
+            System.out.println("doc");\r
+            curNode = addNode(parentNode, "MsaDocum");            // can Docum be with Root Node?\r
+        }\r
 \r
-               NodeList nodelist = node.getChildNodes();\r
-               for (int i = 0; i < nodelist.getLength(); i++) {\r
-                       handleNode(nodelist.item(i), curNode);\r
-               }\r
-       }\r
-       \r
-       private final void genDomTree(String filename) throws Exception {\r
-               DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r
-               Document document = builder.parse(filename);\r
-               handleNode(document, rootNode);\r
-       }\r
-       \r
-       public static final void init() throws Exception {\r
-       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
+        NodeList nodelist = node.getChildNodes();\r
+        for (int i = 0; i < nodelist.getLength(); i++) {\r
+            handleNode(nodelist.item(i), curNode);\r
+        }\r
+    }\r
+    \r
+    private final void genDomTree(String filename) throws Exception {\r
+        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();\r
+        Document document = builder.parse(filename);\r
+        handleNode(document, rootNode);\r
+    }\r
+    \r
+    public static final void init() throws Exception {\r
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());\r
 \r
-               JFrame frame = new JFrame("MsaTreeEditor");\r
-               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
+        JFrame frame = new JFrame("MsaTreeEditor");\r
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
 \r
-               MsaTreeEditor mte = new MsaTreeEditor();\r
-               mte.setLayout(new GridBagLayout());\r
-               mte.setOpaque(true);\r
+        MsaTreeEditor mte = new MsaTreeEditor();\r
+        mte.setLayout(new GridBagLayout());\r
+        mte.setOpaque(true);\r
         frame.setContentPane(mte);\r
 \r
-               frame.pack();\r
-               frame.setVisible(true);\r
-       }\r
+        frame.pack();\r
+        frame.setVisible(true);\r
+    }\r
 }
\ No newline at end of file
index a7b60250287aeb188a6c0d59b47790181217d71a..fa9e0074eefe795b164661acf6f74e21bb30e442 100644 (file)
@@ -20,163 +20,163 @@ import org.tianocore.SupportedArchitectures.Enum;
 import org.apache.xmlbeans.*;\r
 \r
 public class MsaWriter {\r
-       MsaWriter(ModuleInfo moduleinfo) {\r
-               mi = moduleinfo;\r
-       }\r
+    MsaWriter(ModuleInfo moduleinfo) {\r
+        mi = moduleinfo;\r
+    }\r
 \r
-       private ModuleInfo mi;\r
-       \r
-       private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r
-       \r
-       private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc.addNewModuleSurfaceArea();\r
-       private MsaHeaderDocument.MsaHeader msaheader = msa.addNewMsaHeader();\r
-       private ModuleDefinitionsDocument.ModuleDefinitions md = msa.addNewModuleDefinitions();\r
-       private SourceFilesDocument.SourceFiles sourcefiles = msa.addNewSourceFiles();  //found local .h files are not written\r
-       private GuidsDocument.Guids guids;\r
-       private ProtocolsDocument.Protocols protocols;\r
-       private PPIsDocument.PPIs ppis;\r
-       private PackageDependenciesDocument.PackageDependencies pd = msa.addNewPackageDependencies();\r
-       private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = msa.addNewLibraryClassDefinitions();\r
-       private ExternsDocument.Externs externs = msa.addNewExterns();\r
-       \r
-       private String Query (String requirement) throws Exception {\r
-               String answer;\r
-               BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\r
-               System.out.println(requirement);\r
-               while ((answer = rd.readLine()).length() == 0) ;\r
-               return answer;\r
-       }\r
-       \r
-       private void addSourceFiles (String name) {                                             // furthur modification needed\r
-               List<Enum> arch = new ArrayList<Enum>();\r
-               FilenameDocument.Filename filename;\r
-               filename = sourcefiles.addNewFilename();\r
-               filename.setStringValue(name);\r
-               \r
-               if (name.contains("x64" + File.separator)) {                            // filename ???\r
-                       arch.add(SupportedArchitectures.X_64);\r
-                       System.out.println("x64" + File.separator);\r
-                       filename.setSupArchList(arch);\r
-               } else if (name.contains("Ia32" + File.separator)) {            // filename ???\r
-                       arch.add(SupportedArchitectures.IA_32);\r
-                       System.out.println("Ia32" + File.separator);\r
-                       filename.setSupArchList(arch);\r
-               } else if (name.contains("Ipf" + File.separator)) {                     // filename ???\r
-                       arch.add(SupportedArchitectures.IPF);\r
-                       System.out.println("Ipf" + File.separator);\r
-                       filename.setSupArchList(arch);\r
-               } else if (name.contains("Ebc" + File.separator)) {                     // filename ???\r
-                       arch.add(SupportedArchitectures.EBC);\r
-                       System.out.println("Ebc" + File.separator);\r
-                       filename.setSupArchList(arch);\r
-               }\r
-       }\r
-       \r
-       private ModuleSurfaceAreaDocument fulfillMsadoc() throws Exception {\r
-               Iterator<String> it;\r
-               String temp;\r
-               \r
-               if (mi.modulename != null) {\r
-                       msaheader.setModuleName(mi.modulename);\r
-               } else {\r
-                       msaheader.setModuleName(mi.modulename = Query("Module Name Not Found!  Please Input ModuleName"));\r
-               }\r
-               if (mi.guidvalue == null) {\r
-                 mi.guidvalue = UUID.randomUUID().toString();\r
-                 MigrationTool.ui.println ("Guid value can not be retrieved from inf file. Generate " + mi.guidvalue + " at random!"); \r
-               \r
-               msaheader.setGuidValue(mi.guidvalue);\r
-               if (mi.moduletype != null) {\r
-                       msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.getModuleType()));\r
-                       /*\r
-                       if (mi.moduletype.contains("PEI")) {\r
-                               msaheader.setModuleType(ModuleTypeDef.Enum.forString("PEIM"));\r
-                       } else {\r
-                               msaheader.setModuleType(ModuleTypeDef.Enum.forString("DXE_DRIVER"));\r
-                       }\r
-                       */\r
-               } else {\r
-                       msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.moduletype = Query("Guid Value Not Found!  Please Input Guid Value")));\r
-               }\r
+    private ModuleInfo mi;\r
+    \r
+    private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r
+    \r
+    private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = msadoc.addNewModuleSurfaceArea();\r
+    private MsaHeaderDocument.MsaHeader msaheader = msa.addNewMsaHeader();\r
+    private ModuleDefinitionsDocument.ModuleDefinitions md = msa.addNewModuleDefinitions();\r
+    private SourceFilesDocument.SourceFiles sourcefiles = msa.addNewSourceFiles();    //found local .h files are not written\r
+    private GuidsDocument.Guids guids;\r
+    private ProtocolsDocument.Protocols protocols;\r
+    private PPIsDocument.PPIs ppis;\r
+    private PackageDependenciesDocument.PackageDependencies pd = msa.addNewPackageDependencies();\r
+    private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = msa.addNewLibraryClassDefinitions();\r
+    private ExternsDocument.Externs externs = msa.addNewExterns();\r
+    \r
+    private String Query (String requirement) throws Exception {\r
+        String answer;\r
+        BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));\r
+        System.out.println(requirement);\r
+        while ((answer = rd.readLine()).length() == 0) ;\r
+        return answer;\r
+    }\r
+    \r
+    private void addSourceFiles (String name) {                        // furthur modification needed\r
+        List<Enum> arch = new ArrayList<Enum>();\r
+        FilenameDocument.Filename filename;\r
+        filename = sourcefiles.addNewFilename();\r
+        filename.setStringValue(name);\r
+        \r
+        if (name.contains("x64" + File.separator)) {                // filename ???\r
+            arch.add(SupportedArchitectures.X_64);\r
+            System.out.println("x64" + File.separator);\r
+            filename.setSupArchList(arch);\r
+        } else if (name.contains("Ia32" + File.separator)) {        // filename ???\r
+            arch.add(SupportedArchitectures.IA_32);\r
+            System.out.println("Ia32" + File.separator);\r
+            filename.setSupArchList(arch);\r
+        } else if (name.contains("Ipf" + File.separator)) {            // filename ???\r
+            arch.add(SupportedArchitectures.IPF);\r
+            System.out.println("Ipf" + File.separator);\r
+            filename.setSupArchList(arch);\r
+        } else if (name.contains("Ebc" + File.separator)) {            // filename ???\r
+            arch.add(SupportedArchitectures.EBC);\r
+            System.out.println("Ebc" + File.separator);\r
+            filename.setSupArchList(arch);\r
+        }\r
+    }\r
+    \r
+    private ModuleSurfaceAreaDocument fulfillMsadoc() throws Exception {\r
+        Iterator<String> it;\r
+        String temp;\r
+        \r
+        if (mi.modulename != null) {\r
+            msaheader.setModuleName(mi.modulename);\r
+        } else {\r
+            msaheader.setModuleName(mi.modulename = Query("Module Name Not Found!  Please Input ModuleName"));\r
+        }\r
+        if (mi.guidvalue == null) {\r
+          mi.guidvalue = UUID.randomUUID().toString();\r
+          MigrationTool.ui.println ("Guid value can not be retrieved from inf file. Generate " + mi.guidvalue + " at random!"); \r
+        } \r
+        msaheader.setGuidValue(mi.guidvalue);\r
+        if (mi.moduletype != null) {\r
+            msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.getModuleType()));\r
+            /*\r
+            if (mi.moduletype.contains("PEI")) {\r
+                msaheader.setModuleType(ModuleTypeDef.Enum.forString("PEIM"));\r
+            } else {\r
+                msaheader.setModuleType(ModuleTypeDef.Enum.forString("DXE_DRIVER"));\r
+            }\r
+            */\r
+        } else {\r
+            msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.moduletype = Query("Guid Value Not Found!  Please Input Guid Value")));\r
+        }\r
 \r
-               msaheader.setCopyright("Copyright (c) 2006, Intel Corporation");\r
-               msaheader.setVersion("1.0");\r
-               msaheader.setAbstract("Component name for module " + mi.modulename);\r
-               msaheader.setDescription("FIX ME!");\r
-               msaheader.addNewLicense().setStringValue("All rights reserved.\n" +\r
-                               "      This software and associated documentation (if any) is furnished\n" +\r
-                               "      under a license and may only be used or copied in accordance\n" +\r
-                               "      with the terms of the license. Except as permitted by such\n" +\r
-                               "      license, no part of this software or documentation may be\n" +\r
-                               "      reproduced, stored in a retrieval system, or transmitted in any\n" +\r
-                               "      form or by any means without the express written consent of\n" +\r
-                               "      Intel Corporation.");\r
-               msaheader.setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052");\r
-               \r
-               List<Enum> arch = new ArrayList<Enum>();\r
-               arch.add(SupportedArchitectures.IA_32);\r
-               arch.add(SupportedArchitectures.X_64);\r
-               arch.add(SupportedArchitectures.IPF);\r
-               arch.add(SupportedArchitectures.EBC);\r
-               md.setSupportedArchitectures(arch);\r
-               md.setBinaryModule(false);\r
-               md.setOutputFileBasename(mi.modulename);\r
-               \r
-               pd.addNewPackage().setPackageGuid("5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec");\r
-               externs.addNewSpecification().setStringValue("EFI_SPECIFICATION_VERSION 0x00020000");\r
-               externs.addNewSpecification().setStringValue("EDK_RELEASE_VERSION 0x00020000");\r
-               externs.addNewExtern().setModuleEntryPoint(mi.entrypoint);\r
-               \r
-               it = mi.localmodulesources.iterator();\r
-               while (it.hasNext()) {\r
-                       addSourceFiles(it.next());\r
-               }\r
-               if (!mi.protocol.isEmpty()) {\r
-                       protocols = msa.addNewProtocols();\r
-                       it = mi.protocol.iterator();\r
-                       while (it.hasNext()) {\r
-                               if ((temp = it.next()) != null) {\r
-                                       ProtocolsDocument.Protocols.Protocol pr = protocols.addNewProtocol();\r
-                                       pr.setProtocolCName(temp);\r
-                                       pr.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
-                               }\r
-                       }\r
-               }\r
-               if (!mi.ppi.isEmpty()) {\r
-                       ppis = msa.addNewPPIs();\r
-                       it = mi.ppi.iterator();\r
-                       while (it.hasNext()) {\r
-                               if ((temp = it.next()) != null) {\r
-                                       PPIsDocument.PPIs.Ppi pp = ppis.addNewPpi();\r
-                                       pp.setPpiCName(temp);\r
-                                       pp.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
-                               }\r
-                       }\r
-               }\r
-               if (!mi.guid.isEmpty()) {\r
-                       guids = msa.addNewGuids();\r
-                       it = mi.guid.iterator();\r
-                       while (it.hasNext()) {\r
-                               if ((temp = it.next()) != null) {\r
-                                       GuidsDocument.Guids.GuidCNames gcn = guids.addNewGuidCNames();\r
-                                       gcn.setGuidCName(temp);\r
-                                       gcn.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
-                               }\r
-                       }\r
-               }\r
-               it = mi.hashrequiredr9libs.iterator();\r
-               while (it.hasNext()) {\r
-                       if ((temp = it.next()) != null && !temp.matches("%")) {\r
-                               LibraryClassDocument.LibraryClass lc = libclassdefs.addNewLibraryClass();\r
-                               lc.setKeyword(temp);\r
-                               lc.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
-                       }\r
-               }\r
-               \r
-               return msadoc;\r
-       }\r
-       \r
-       public void flush() throws Exception {\r
+        msaheader.setCopyright("Copyright (c) 2006, Intel Corporation");\r
+        msaheader.setVersion("1.0");\r
+        msaheader.setAbstract("Component name for module " + mi.modulename);\r
+        msaheader.setDescription("FIX ME!");\r
+        msaheader.addNewLicense().setStringValue("All rights reserved.\n" +\r
+                "      This software and associated documentation (if any) is furnished\n" +\r
+                "      under a license and may only be used or copied in accordance\n" +\r
+                "      with the terms of the license. Except as permitted by such\n" +\r
+                "      license, no part of this software or documentation may be\n" +\r
+                "      reproduced, stored in a retrieval system, or transmitted in any\n" +\r
+                "      form or by any means without the express written consent of\n" +\r
+                "      Intel Corporation.");\r
+        msaheader.setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052");\r
+        \r
+        List<Enum> arch = new ArrayList<Enum>();\r
+        arch.add(SupportedArchitectures.IA_32);\r
+        arch.add(SupportedArchitectures.X_64);\r
+        arch.add(SupportedArchitectures.IPF);\r
+        arch.add(SupportedArchitectures.EBC);\r
+        md.setSupportedArchitectures(arch);\r
+        md.setBinaryModule(false);\r
+        md.setOutputFileBasename(mi.modulename);\r
+        \r
+        pd.addNewPackage().setPackageGuid("5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec");\r
+        externs.addNewSpecification().setStringValue("EFI_SPECIFICATION_VERSION 0x00020000");\r
+        externs.addNewSpecification().setStringValue("EDK_RELEASE_VERSION 0x00020000");\r
+        externs.addNewExtern().setModuleEntryPoint(mi.entrypoint);\r
+        \r
+        it = mi.localmodulesources.iterator();\r
+        while (it.hasNext()) {\r
+            addSourceFiles(it.next());\r
+        }\r
+        if (!mi.protocol.isEmpty()) {\r
+            protocols = msa.addNewProtocols();\r
+            it = mi.protocol.iterator();\r
+            while (it.hasNext()) {\r
+                if ((temp = it.next()) != null) {\r
+                    ProtocolsDocument.Protocols.Protocol pr = protocols.addNewProtocol();\r
+                    pr.setProtocolCName(temp);\r
+                    pr.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
+                }\r
+            }\r
+        }\r
+        if (!mi.ppi.isEmpty()) {\r
+            ppis = msa.addNewPPIs();\r
+            it = mi.ppi.iterator();\r
+            while (it.hasNext()) {\r
+                if ((temp = it.next()) != null) {\r
+                    PPIsDocument.PPIs.Ppi pp = ppis.addNewPpi();\r
+                    pp.setPpiCName(temp);\r
+                    pp.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
+                }\r
+            }\r
+        }\r
+        if (!mi.guid.isEmpty()) {\r
+            guids = msa.addNewGuids();\r
+            it = mi.guid.iterator();\r
+            while (it.hasNext()) {\r
+                if ((temp = it.next()) != null) {\r
+                    GuidsDocument.Guids.GuidCNames gcn = guids.addNewGuidCNames();\r
+                    gcn.setGuidCName(temp);\r
+                    gcn.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
+                }\r
+            }\r
+        }\r
+        it = mi.hashrequiredr9libs.iterator();\r
+        while (it.hasNext()) {\r
+            if ((temp = it.next()) != null && !temp.matches("%")) {\r
+                LibraryClassDocument.LibraryClass lc = libclassdefs.addNewLibraryClass();\r
+                lc.setKeyword(temp);\r
+                lc.setUsage(UsageTypes.ALWAYS_CONSUMED);\r
+            }\r
+        }\r
+        \r
+        return msadoc;\r
+    }\r
+    \r
+    public void flush() throws Exception {\r
         XmlOptions options = new XmlOptions();\r
 \r
         options.setCharacterEncoding("UTF-8");\r
@@ -184,14 +184,14 @@ public class MsaWriter {
         options.setSavePrettyPrintIndent(2);\r
         options.setUseDefaultNamespace();\r
         \r
-               BufferedWriter bw = new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + mi.modulename + ".msa"));\r
-               fulfillMsadoc().save(bw, options);\r
-               //MsaTreeEditor.init(mi, ui, msadoc);\r
-               bw.flush();\r
-               bw.close();\r
-       }\r
+        BufferedWriter bw = new BufferedWriter(new FileWriter(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + mi.modulename + ".msa"));\r
+        fulfillMsadoc().save(bw, options);\r
+        //MsaTreeEditor.init(mi, ui, msadoc);\r
+        bw.flush();\r
+        bw.close();\r
+    }\r
 \r
-       private static void flush(String path, ModuleSurfaceAreaDocument msadoc) throws Exception {\r
+    private static void flush(String path, ModuleSurfaceAreaDocument msadoc) throws Exception {\r
         XmlOptions options = new XmlOptions();\r
 \r
         options.setCharacterEncoding("UTF-8");\r
@@ -199,14 +199,14 @@ public class MsaWriter {
         options.setSavePrettyPrintIndent(2);\r
         options.setUseDefaultNamespace();\r
 \r
-               BufferedWriter bw = new BufferedWriter(new FileWriter(path));\r
-               msadoc.save(bw, options);\r
-               bw.flush();\r
-               bw.close();\r
-       }\r
-       \r
-       public static final void parse(String msafile) throws Exception {\r
-               ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(msafile);\r
-               flush("c:\\temp.msa", msadoc);\r
-       }\r
+        BufferedWriter bw = new BufferedWriter(new FileWriter(path));\r
+        msadoc.save(bw, options);\r
+        bw.flush();\r
+        bw.close();\r
+    }\r
+    \r
+    public static final void parse(String msafile) throws Exception {\r
+        ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(msafile);\r
+        flush("c:\\temp.msa", msadoc);\r
+    }\r
 }\r
index 40a9805cdbc949472f3dd6efdffa3f58c2f52f6f..5a286c9b410202977c49be6099aa04f6cc4dc243 100644 (file)
@@ -16,35 +16,35 @@ import java.io.File;
 import java.util.*;\r
 \r
 public final class PathIterator implements Common.ForDoAll {\r
-//      this PathIterator is based on HashSet, an thread implementation is required.\r
-       PathIterator(String path, int md) throws Exception {\r
-               startpath = path;\r
-               mode = md;\r
-               Common.toDoAll(startpath, this, mode);\r
-               it = pathlist.iterator();\r
-       }\r
-       private String startpath = null;\r
-       private int mode;\r
-       private HashSet<String> pathlist = new HashSet<String>();\r
-       private Iterator<String> it = null;\r
+//     this PathIterator is based on HashSet, an thread implementation is required.\r
+    PathIterator(String path, int md) throws Exception {\r
+        startpath = path;\r
+        mode = md;\r
+        Common.toDoAll(startpath, this, mode);\r
+        it = pathlist.iterator();\r
+    }\r
+    private String startpath = null;\r
+    private int mode;\r
+    private HashSet<String> pathlist = new HashSet<String>();\r
+    private Iterator<String> it = null;\r
 \r
-       public final void run(String path) throws Exception {\r
-               pathlist.add(path);\r
-       }\r
+    public final void run(String path) throws Exception {\r
+        pathlist.add(path);\r
+    }\r
 \r
-       public boolean filter(File dir) {\r
-               return true;\r
-       }\r
-       \r
-       public final String next() {\r
-               return it.next();\r
-       }\r
+    public boolean filter(File dir) {\r
+        return true;\r
+    }\r
+    \r
+    public final String next() {\r
+        return it.next();\r
+    }\r
 \r
-       public final boolean hasNext() {\r
-               return it.hasNext();\r
-       }\r
+    public final boolean hasNext() {\r
+        return it.hasNext();\r
+    }\r
 \r
-       public final String toString() {\r
-               return pathlist.toString();\r
-       }\r
+    public final String toString() {\r
+        return pathlist.toString();\r
+    }\r
 }\r
index 25edc44e354e34ce3646a01dde1b762fee5daec9..3238e29df9397241f96a0f8dcaa762b0470e2e6d 100644 (file)
@@ -18,374 +18,374 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;\r
 \r
 public final class SourceFileReplacer implements Common.ForDoAll {\r
-       private static final SourceFileReplacer SFReplacer = new SourceFileReplacer();\r
-       private ModuleInfo mi;\r
-       private static final Set<Common.Laplace> Laplaces = new HashSet<Common.Laplace>();\r
+    private static final SourceFileReplacer SFReplacer = new SourceFileReplacer();\r
+    private ModuleInfo mi;\r
+    private static final Set<Common.Laplace> Laplaces = new HashSet<Common.Laplace>();\r
 \r
-       // these sets are used only for printing log of the changes in current file\r
-       private static final Set<r8tor9> filefunc = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> filemacro = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileguid = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileppi = new HashSet<r8tor9>();\r
-       private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();\r
-       private static final Set<String> filer8only = new HashSet<String>();\r
-       \r
-       private static final String[] specialhoblibfunc = {\r
-               "BuildModuleHob",\r
-               "BuildResourceDescriptorHob",\r
-               "BuildFvHob",\r
-               "BuildCpuHob",\r
-               "BuildStackHob",\r
-               "BuildBspStoreHob",\r
-               "BuildMemoryAllocationHob"\r
-               };\r
-       \r
-       //---------------------------------------inner classes---------------------------------------//\r
-       private static class r8tor9 {\r
-               r8tor9(String r8, String r9) {\r
-                       r8thing = r8;\r
-                       r9thing = r9;\r
-               }\r
-               public String r8thing;\r
-               public String r9thing;\r
-       }\r
-       \r
-       private class IdleLaplace extends Common.Laplace {\r
-               public String operation(String wholeline) {\r
-                       return wholeline;\r
-               }\r
-               \r
-               public boolean recognize(String filename) {\r
-                       return filename.contains(".h") || filename.contains(".H") || filename.contains(".uni");\r
-               }\r
+    // these sets are used only for printing log of the changes in current file\r
+    private static final Set<r8tor9> filefunc = new HashSet<r8tor9>();\r
+    private static final Set<r8tor9> filemacro = new HashSet<r8tor9>();\r
+    private static final Set<r8tor9> fileguid = new HashSet<r8tor9>();\r
+    private static final Set<r8tor9> fileppi = new HashSet<r8tor9>();\r
+    private static final Set<r8tor9> fileprotocol = new HashSet<r8tor9>();\r
+    private static final Set<String> filer8only = new HashSet<String>();\r
+    \r
+    private static final String[] specialhoblibfunc = {\r
+        "BuildModuleHob",\r
+        "BuildResourceDescriptorHob",\r
+        "BuildFvHob",\r
+        "BuildCpuHob",\r
+        "BuildStackHob",\r
+        "BuildBspStoreHob",\r
+        "BuildMemoryAllocationHob"\r
+        };\r
+    \r
+    //---------------------------------------inner classes---------------------------------------//\r
+    private static class r8tor9 {\r
+        r8tor9(String r8, String r9) {\r
+            r8thing = r8;\r
+            r9thing = r9;\r
+        }\r
+        public String r8thing;\r
+        public String r9thing;\r
+    }\r
+    \r
+    private class IdleLaplace extends Common.Laplace {\r
+        public String operation(String wholeline) {\r
+            return wholeline;\r
+        }\r
+        \r
+        public boolean recognize(String filename) {\r
+            return filename.contains(".h") || filename.contains(".H") || filename.contains(".uni");\r
+        }\r
 \r
-               public String namechange(String oldname) {\r
-                       if (oldname.contains(".H")) {\r
-                               return oldname.replaceFirst(".H", ".h");\r
-                       } else {\r
-                               return oldname;\r
-                       }\r
-               }\r
-       }\r
-       private class DxsLaplace extends Common.Laplace {\r
-               public String operation(String wholeline) {\r
-                       if (mi.getModuleType().equals("PEIM")) {\r
-                               return addincludefile(wholeline, "\\<PeimDepex.h\\>");\r
-                       } else {\r
-                               return addincludefile(wholeline, "\\<DxeDepex.h\\>");\r
-                       }\r
-               }\r
-               \r
-               public boolean recognize(String filename) {\r
-                       return filename.contains(".dxs");\r
-               }\r
+        public String namechange(String oldname) {\r
+            if (oldname.contains(".H")) {\r
+                return oldname.replaceFirst(".H", ".h");\r
+            } else {\r
+                return oldname;\r
+            }\r
+        }\r
+    }\r
+    private class DxsLaplace extends Common.Laplace {\r
+        public String operation(String wholeline) {\r
+            if (mi.getModuleType().equals("PEIM")) {\r
+                return addincludefile(wholeline, "\\<PeimDepex.h\\>");\r
+            } else {\r
+                return addincludefile(wholeline, "\\<DxeDepex.h\\>");\r
+            }\r
+        }\r
+        \r
+        public boolean recognize(String filename) {\r
+            return filename.contains(".dxs");\r
+        }\r
 \r
-               public String namechange(String oldname) {\r
-                       return oldname;\r
-               }\r
-       }\r
-       \r
-       private class CLaplace extends Common.Laplace {\r
-               public  String operation(String wholeline) {\r
-                       boolean addr8 = false;\r
+        public String namechange(String oldname) {\r
+            return oldname;\r
+        }\r
+    }\r
+    \r
+    private class CLaplace extends Common.Laplace {\r
+        public  String operation(String wholeline) {\r
+            boolean addr8 = false;\r
 \r
-                       Pattern pat = Pattern.compile("g?(BS|RT)(\\s*->\\s*)([a-zA-Z_]\\w*)", Pattern.MULTILINE);                                       // ! only two level () bracket allowed !\r
-                       //Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*[#$]*)(\\s*\\(([^\\(\\)]*(\\([^\\(\\)]*\\))?[^\\(\\)]*)*\\))", Pattern.MULTILINE);\r
+            Pattern pat = Pattern.compile("g?(BS|RT)(\\s*->\\s*)([a-zA-Z_]\\w*)", Pattern.MULTILINE);                    // ! only two level () bracket allowed !\r
+            //Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*[#$]*)(\\s*\\(([^\\(\\)]*(\\([^\\(\\)]*\\))?[^\\(\\)]*)*\\))", Pattern.MULTILINE);\r
 \r
-                       // replace BS -> gBS , RT -> gRT\r
-                       Matcher mat = pat.matcher(wholeline);\r
-                       if (mat.find()) {                                                                                               // add a library here\r
-                               MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");\r
-                               wholeline = mat.replaceAll("g$1$2$3");                                                  //unknown correctiveness\r
-                       }\r
-                       mat.reset();\r
-                       while (mat.find()) {\r
-                               if (mat.group(1).matches("BS")) {\r
-                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");\r
-                               }\r
-                               if (mat.group(1).matches("RT")) {\r
-                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");\r
-                               }\r
-                       }\r
-                       // remove EFI_DRIVER_ENTRY_POINT\r
-                       wholeline = wholeline.replaceAll("(EFI_\\w+_ENTRY_POINT)", MigrationTool.MIGRATIONCOMMENT + " $1");\r
-                       \r
-                       // start replacing names\r
-                       String r8thing;\r
-                       String r9thing;\r
-                       Iterator<String> it;\r
-                       // Converting non-locla function\r
-                       it = mi.hashnonlocalfunc.iterator();\r
-                       while (it.hasNext()) {\r
-                               r8thing = it.next();\r
-                               if (r8thing.matches("EfiInitializeDriverLib")) {                                        //s\r
-                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //p\r
-                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //e\r
-                               } else if (r8thing.matches("DxeInitializeDriverLib")) {                         //c\r
-                                       mi.hashrequiredr9libs.add("UefiBootServicesTableLib");                  //i\r
-                                       mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");               //a\r
-                                       mi.hashrequiredr9libs.add("DxeServicesTableLib");                               //l\r
-                               } else {                                                                                                                        //\r
-                                       mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                          // add a library here\r
-                               }\r
+            // replace BS -> gBS , RT -> gRT\r
+            Matcher mat = pat.matcher(wholeline);\r
+            if (mat.find()) {                                                // add a library here\r
+                MigrationTool.ui.println("Converting all BS->gBS, RT->gRT");\r
+                wholeline = mat.replaceAll("g$1$2$3");                            //unknown correctiveness\r
+            }\r
+            mat.reset();\r
+            while (mat.find()) {\r
+                if (mat.group(1).matches("BS")) {\r
+                    mi.hashrequiredr9libs.add("UefiBootServicesTableLib");\r
+                }\r
+                if (mat.group(1).matches("RT")) {\r
+                    mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");\r
+                }\r
+            }\r
+            // remove EFI_DRIVER_ENTRY_POINT\r
+            wholeline = wholeline.replaceAll("(EFI_\\w+_ENTRY_POINT)", MigrationTool.MIGRATIONCOMMENT + " $1");\r
+            \r
+            // start replacing names\r
+            String r8thing;\r
+            String r9thing;\r
+            Iterator<String> it;\r
+            // Converting non-locla function\r
+            it = mi.hashnonlocalfunc.iterator();\r
+            while (it.hasNext()) {\r
+                r8thing = it.next();\r
+                if (r8thing.matches("EfiInitializeDriverLib")) {                    //s\r
+                    mi.hashrequiredr9libs.add("UefiBootServicesTableLib");            //p\r
+                    mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");        //e\r
+                } else if (r8thing.matches("DxeInitializeDriverLib")) {                //c\r
+                    mi.hashrequiredr9libs.add("UefiBootServicesTableLib");            //i\r
+                    mi.hashrequiredr9libs.add("UefiRuntimeServicesTableLib");        //a\r
+                    mi.hashrequiredr9libs.add("DxeServicesTableLib");                //l\r
+                } else {                                                            //\r
+                    mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                // add a library here\r
+                }\r
 \r
-                               r8tor9 temp;\r
-                               if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
-                                       if (!r8thing.equals(r9thing)) {\r
-                                               if (wholeline.contains(r8thing)) {\r
-                                                       wholeline = wholeline.replaceAll(r8thing, r9thing);\r
-                                                       filefunc.add(new r8tor9(r8thing, r9thing));\r
-                                                       Iterator<r8tor9> rt = filefunc.iterator();\r
-                                                       while (rt.hasNext()) {\r
-                                                               temp = rt.next();\r
-                                                               if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
-                                                                       filer8only.add(r8thing);\r
-                                                                       mi.hashr8only.add(r8thing);\r
-                                                                       addr8 = true;\r
-                                                               }\r
-                                                       }\r
-                                               }\r
-                                       }\r
-                               }\r
-                       }                                                                                                                       //is any of the guids changed?\r
-                       if (addr8 == true) {\r
-                               wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
-                       }\r
-                       \r
-                       // Converting macro\r
-                       it = mi.hashnonlocalmacro.iterator();\r
-                       while (it.hasNext()) {                                          //macros are all assumed MdePkg currently\r
-                               r8thing = it.next();\r
-                               //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));                \r
-                               if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
-                                       if (wholeline.contains(r8thing)) {\r
-                                               wholeline = wholeline.replaceAll(r8thing, r9thing);\r
-                                               filemacro.add(new r8tor9(r8thing, r9thing));\r
-                                       }\r
-                               }\r
-                       }\r
+                r8tor9 temp;\r
+                if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {\r
+                    if (!r8thing.equals(r9thing)) {\r
+                        if (wholeline.contains(r8thing)) {\r
+                            wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                            filefunc.add(new r8tor9(r8thing, r9thing));\r
+                            Iterator<r8tor9> rt = filefunc.iterator();\r
+                            while (rt.hasNext()) {\r
+                                temp = rt.next();\r
+                                if (MigrationTool.db.r8only.contains(temp.r8thing)) {\r
+                                    filer8only.add(r8thing);\r
+                                    mi.hashr8only.add(r8thing);\r
+                                    addr8 = true;\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }                                                            //is any of the guids changed?\r
+            if (addr8 == true) {\r
+                wholeline = addincludefile(wholeline, "\"R8Lib.h\"");\r
+            }\r
+            \r
+            // Converting macro\r
+            it = mi.hashnonlocalmacro.iterator();\r
+            while (it.hasNext()) {                        //macros are all assumed MdePkg currently\r
+                r8thing = it.next();\r
+                //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing));        \r
+                if ((r9thing = MigrationTool.db.getR9Macro(r8thing)) != null) {\r
+                    if (wholeline.contains(r8thing)) {\r
+                        wholeline = wholeline.replaceAll(r8thing, r9thing);\r
+                        filemacro.add(new r8tor9(r8thing, r9thing));\r
+                    }\r
+                }\r
+            }\r
 \r
-                       // Converting guid\r
-                       replaceGuid(wholeline, mi.guid, "guid", fileguid);\r
-                       replaceGuid(wholeline, mi.ppi, "ppi", fileppi);\r
-                       replaceGuid(wholeline, mi.protocol, "protocol", fileprotocol);\r
+            // Converting guid\r
+            replaceGuid(wholeline, mi.guid, "guid", fileguid);\r
+            replaceGuid(wholeline, mi.ppi, "ppi", fileppi);\r
+            replaceGuid(wholeline, mi.protocol, "protocol", fileprotocol);\r
 \r
-                       // Converting Pei\r
-                       // First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%\r
-                       Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);\r
-                       if (mi.getModuleType().matches("PEIM")) {\r
-                       //if (mi.moduletype.contains("PEIM")) {\r
-                               Matcher mtrpei = ptnpei.matcher(wholeline);\r
-                               while (mtrpei.find()) {                                                                         // ! add a library here !\r
-                                       wholeline = mtrpei.replaceAll("PeiServices$1#%$2");\r
-                                       mi.hashrequiredr9libs.add("PeiServicesLib");\r
-                               }\r
-                               mtrpei.reset();\r
-                               if (wholeline.contains("PeiServicesCopyMem")) {\r
-                                       wholeline = wholeline.replaceAll("PeiServicesCopyMem#%", "CopyMem");\r
-                                       mi.hashrequiredr9libs.add("BaseMemoryLib");\r
-                               }\r
-                               if (wholeline.contains("PeiServicesSetMem")) {\r
-                                       wholeline = wholeline.replaceAll("PeiServicesSetMem#%", "SetMem");\r
-                                       mi.hashrequiredr9libs.add("BaseMemoryLib");\r
-                               }\r
+            // Converting Pei\r
+            // First , find all (**PeiServices)-> or (*PeiServices). with arg "PeiServices" , change name and add #%\r
+            Pattern ptnpei = Pattern.compile("\\(\\*\\*?PeiServices\\)[.-][>]?\\s*(\\w*)(\\s*\\(\\s*PeiServices\\s*,\\s*)", Pattern.MULTILINE);\r
+            if (mi.getModuleType().matches("PEIM")) {\r
+            //if (mi.moduletype.contains("PEIM")) {\r
+                Matcher mtrpei = ptnpei.matcher(wholeline);\r
+                while (mtrpei.find()) {                                        // ! add a library here !\r
+                    wholeline = mtrpei.replaceAll("PeiServices$1#%$2");\r
+                    mi.hashrequiredr9libs.add("PeiServicesLib");\r
+                }\r
+                mtrpei.reset();\r
+                if (wholeline.contains("PeiServicesCopyMem")) {\r
+                    wholeline = wholeline.replaceAll("PeiServicesCopyMem#%", "CopyMem");\r
+                    mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                }\r
+                if (wholeline.contains("PeiServicesSetMem")) {\r
+                    wholeline = wholeline.replaceAll("PeiServicesSetMem#%", "SetMem");\r
+                    mi.hashrequiredr9libs.add("BaseMemoryLib");\r
+                }\r
 \r
-                               // Second , find all #% to drop the arg "PeiServices"\r
-                               Pattern ptnpeiarg = Pattern.compile("#%+(\\s*\\(+\\s*)PeiServices\\s*,\\s*", Pattern.MULTILINE);\r
-                               Matcher mtrpeiarg = ptnpeiarg.matcher(wholeline);\r
-                               while (mtrpeiarg.find()) {\r
-                                       wholeline = mtrpeiarg.replaceAll("$1");\r
-                               }\r
-                       }\r
-                       \r
-                       wholeline = hobLibFuncDropStatus(wholeline);\r
-                       \r
-                       Matcher mtrmac;\r
-                       mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);\r
-                       if (mtrmac.find()) {\r
-                               wholeline = mtrmac.replaceAll("\\($1 \\/ $2 \\+ \\(\\(\\(2 \\* \\($1 \\% $2\\)\\) \\< $2\\) \\? 0 \\: 1\\)\\)");\r
-                       }\r
-                       mtrmac = Pattern.compile("EFI_MIN\\((.*), (.*)\\)").matcher(wholeline);\r
-                       if (mtrmac.find()) {\r
-                               wholeline = mtrmac.replaceAll("\\(\\($1 \\< $2\\) \\? $1 \\: $2\\)");\r
-                       }\r
-                       mtrmac = Pattern.compile("EFI_MAX\\((.*), (.*)\\)").matcher(wholeline);\r
-                       if (mtrmac.find()) {\r
-                               wholeline = mtrmac.replaceAll("\\(\\($1 \\> $2\\) \\? $1 \\: $2\\)");\r
-                       }\r
-                       mtrmac = Pattern.compile("EFI_UINTN_ALIGNED\\((.*)\\)").matcher(wholeline);\r
-                       if (mtrmac.find()) {\r
-                               wholeline = mtrmac.replaceAll("\\(\\(\\(UINTN\\) $1\\) \\& \\(sizeof \\(UINTN\\) \\- 1\\)\\)");\r
-                       }\r
-                       if (wholeline.contains("EFI_UINTN_ALIGN_MASK")) {\r
-                               wholeline = wholeline.replaceAll("EFI_UINTN_ALIGN_MASK", "(sizeof (UINTN) - 1)");\r
-                       }\r
+                // Second , find all #% to drop the arg "PeiServices"\r
+                Pattern ptnpeiarg = Pattern.compile("#%+(\\s*\\(+\\s*)PeiServices\\s*,\\s*", Pattern.MULTILINE);\r
+                Matcher mtrpeiarg = ptnpeiarg.matcher(wholeline);\r
+                while (mtrpeiarg.find()) {\r
+                    wholeline = mtrpeiarg.replaceAll("$1");\r
+                }\r
+            }\r
+            \r
+            wholeline = hobLibFuncDropStatus(wholeline);\r
+            \r
+            Matcher mtrmac;\r
+            mtrmac = Pattern.compile("EFI_IDIV_ROUND\\((.*), (.*)\\)").matcher(wholeline);\r
+            if (mtrmac.find()) {\r
+                wholeline = mtrmac.replaceAll("\\($1 \\/ $2 \\+ \\(\\(\\(2 \\* \\($1 \\% $2\\)\\) \\< $2\\) \\? 0 \\: 1\\)\\)");\r
+            }\r
+            mtrmac = Pattern.compile("EFI_MIN\\((.*), (.*)\\)").matcher(wholeline);\r
+            if (mtrmac.find()) {\r
+                wholeline = mtrmac.replaceAll("\\(\\($1 \\< $2\\) \\? $1 \\: $2\\)");\r
+            }\r
+            mtrmac = Pattern.compile("EFI_MAX\\((.*), (.*)\\)").matcher(wholeline);\r
+            if (mtrmac.find()) {\r
+                wholeline = mtrmac.replaceAll("\\(\\($1 \\> $2\\) \\? $1 \\: $2\\)");\r
+            }\r
+            mtrmac = Pattern.compile("EFI_UINTN_ALIGNED\\((.*)\\)").matcher(wholeline);\r
+            if (mtrmac.find()) {\r
+                wholeline = mtrmac.replaceAll("\\(\\(\\(UINTN\\) $1\\) \\& \\(sizeof \\(UINTN\\) \\- 1\\)\\)");\r
+            }\r
+            if (wholeline.contains("EFI_UINTN_ALIGN_MASK")) {\r
+                wholeline = wholeline.replaceAll("EFI_UINTN_ALIGN_MASK", "(sizeof (UINTN) - 1)");\r
+            }\r
 \r
-                       show(filefunc, "function");\r
-                       show(filemacro, "macro");\r
-                       show(fileguid, "guid");\r
-                       show(fileppi, "ppi");\r
-                       show(fileprotocol, "protocol");\r
-                       if (!filer8only.isEmpty()) {\r
-                               MigrationTool.ui.println("Converting r8only : " + filer8only);\r
-                       }\r
+            show(filefunc, "function");\r
+            show(filemacro, "macro");\r
+            show(fileguid, "guid");\r
+            show(fileppi, "ppi");\r
+            show(fileprotocol, "protocol");\r
+            if (!filer8only.isEmpty()) {\r
+                MigrationTool.ui.println("Converting r8only : " + filer8only);\r
+            }\r
 \r
-                       filefunc.clear();\r
-                       filemacro.clear();\r
-                       fileguid.clear();\r
-                       fileppi.clear();\r
-                       fileprotocol.clear();\r
-                       filer8only.clear();\r
+            filefunc.clear();\r
+            filemacro.clear();\r
+            fileguid.clear();\r
+            fileppi.clear();\r
+            fileprotocol.clear();\r
+            filer8only.clear();\r
 \r
-                       return wholeline;\r
-               }\r
-               \r
-               public boolean recognize(String filename) {\r
-                       return filename.contains(".c") || filename.contains(".C");\r
-               }\r
+            return wholeline;\r
+        }\r
+        \r
+        public boolean recognize(String filename) {\r
+            return filename.contains(".c") || filename.contains(".C");\r
+        }\r
 \r
-               public String namechange(String oldname) {\r
-                       if (oldname.contains(".C")) {\r
-                               return oldname.replaceFirst(".C", ".c");\r
-                       } else {\r
-                               return oldname;\r
-                       }\r
-               }\r
-       }\r
-       //---------------------------------------inner classes---------------------------------------//\r
+        public String namechange(String oldname) {\r
+            if (oldname.contains(".C")) {\r
+                return oldname.replaceFirst(".C", ".c");\r
+            } else {\r
+                return oldname;\r
+            }\r
+        }\r
+    }\r
+    //---------------------------------------inner classes---------------------------------------//\r
 \r
-       //-------------------------------------process functions-------------------------------------//\r
-       private static final String addincludefile(String wholeline, String hfile) {\r
-               return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile + "\n");\r
-       }\r
-       \r
-       private static final void show(Set<r8tor9> hash, String sh) {\r
-               Iterator<r8tor9> it = hash.iterator();\r
-               r8tor9 temp;\r
-               if (!hash.isEmpty()) {\r
-                       MigrationTool.ui.print("Converting " + sh + " : ");\r
-                       while (it.hasNext()) {\r
-                               temp = it.next();\r
-                               MigrationTool.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] ");\r
-                       }\r
-                       MigrationTool.ui.println("");\r
-               }\r
-       }\r
+    //-------------------------------------process functions-------------------------------------//\r
+    private static final String addincludefile(String wholeline, String hfile) {\r
+        return wholeline.replaceFirst("(\\*/\\s)", "$1\n#include " + hfile + "\n");\r
+    }\r
+    \r
+    private static final void show(Set<r8tor9> hash, String sh) {\r
+        Iterator<r8tor9> it = hash.iterator();\r
+        r8tor9 temp;\r
+        if (!hash.isEmpty()) {\r
+            MigrationTool.ui.print("Converting " + sh + " : ");\r
+            while (it.hasNext()) {\r
+                temp = it.next();\r
+                MigrationTool.ui.print("[" + temp.r8thing + "->" + temp.r9thing + "] ");\r
+            }\r
+            MigrationTool.ui.println("");\r
+        }\r
+    }\r
 \r
-       private static final void replaceGuid(String line, Set<String> hash, String kind, Set<r8tor9> filehash) {\r
-               Iterator<String> it;\r
-               String r8thing;\r
-               String r9thing;\r
-               it = hash.iterator();\r
-               while (it.hasNext()) {\r
-                       r8thing = it.next();\r
-                       if ((r9thing = MigrationTool.db.getR9Guidname(r8thing)) != null) {\r
-                               if (!r8thing.equals(r9thing)) {\r
-                                       if (line.contains(r8thing)) {\r
-                                               line = line.replaceAll(r8thing, r9thing);\r
-                                               filehash.add(new r8tor9(r8thing, r9thing));\r
-                                       }\r
-                               }\r
-                       }\r
-               }\r
-       }\r
+    private static final void replaceGuid(String line, Set<String> hash, String kind, Set<r8tor9> filehash) {\r
+        Iterator<String> it;\r
+        String r8thing;\r
+        String r9thing;\r
+        it = hash.iterator();\r
+        while (it.hasNext()) {\r
+            r8thing = it.next();\r
+            if ((r9thing = MigrationTool.db.getR9Guidname(r8thing)) != null) {\r
+                if (!r8thing.equals(r9thing)) {\r
+                    if (line.contains(r8thing)) {\r
+                        line = line.replaceAll(r8thing, r9thing);\r
+                        filehash.add(new r8tor9(r8thing, r9thing));\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
 \r
-       private final String hobLibFuncDropStatus(String wholeline) {           // or use regex to find pattern "Status = ..."\r
-               Pattern ptnhobstatus;\r
-               Matcher mtrhobstatus;\r
-               String templine = wholeline;\r
-               for (int i = 0; i < specialhoblibfunc.length; i++) {\r
-                       ptnhobstatus = Pattern.compile("(Status\\s*=\\s*)?" + specialhoblibfunc[i] + "(.*?\\)\\s*;)", Pattern.DOTALL);\r
-                       mtrhobstatus = ptnhobstatus.matcher(templine);\r
-                       if (mtrhobstatus.find()) {\r
-                               templine = mtrhobstatus.replaceAll(specialhoblibfunc[i] + mtrhobstatus.group(2) + "\n  //Migration comments: R9 Hob-building library functions will assert if build failure.\n  Status = EFI_SUCCESS;");\r
-                       }\r
-               }\r
-               return templine;\r
-       }\r
-       \r
-       private final void addr8only() throws Exception {\r
-               String paragraph = null;\r
-               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
-               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(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
-                               }\r
-                               //generate R8lib.h\r
-                               while ((mtrr8onlyhead = Func.ptnbrace.matcher(paragraph)).find()) {\r
-                                       paragraph = mtrr8onlyhead.replaceAll(";");\r
-                               }\r
-                               outfile2.append(paragraph + "\n\n");\r
-                       }\r
-               }\r
-               outfile1.flush();\r
-               outfile1.close();\r
-               outfile2.flush();\r
-               outfile2.close();\r
-               \r
-               mi.localmodulesources.add("R8Lib.h");\r
-               mi.localmodulesources.add("R8Lib.c");\r
-       }\r
-       //-------------------------------------process functions-------------------------------------//\r
-       \r
-       //-----------------------------------ForDoAll-----------------------------------//\r
-       public void run(String filepath) throws Exception {\r
-               String inname = filepath.replace(mi.modulepath + File.separator, "");\r
-               String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;\r
-               String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;\r
+    private final String hobLibFuncDropStatus(String wholeline) {        // or use regex to find pattern "Status = ..."\r
+        Pattern ptnhobstatus;\r
+        Matcher mtrhobstatus;\r
+        String templine = wholeline;\r
+        for (int i = 0; i < specialhoblibfunc.length; i++) {\r
+            ptnhobstatus = Pattern.compile("(Status\\s*=\\s*)?" + specialhoblibfunc[i] + "(.*?\\)\\s*;)", Pattern.DOTALL);\r
+            mtrhobstatus = ptnhobstatus.matcher(templine);\r
+            if (mtrhobstatus.find()) {\r
+                templine = mtrhobstatus.replaceAll(specialhoblibfunc[i] + mtrhobstatus.group(2) + "\n  //Migration comments: R9 Hob-building library functions will assert if build failure.\n  Status = EFI_SUCCESS;");\r
+            }\r
+        }\r
+        return templine;\r
+    }\r
+    \r
+    private final void addr8only() throws Exception {\r
+        String paragraph = null;\r
+        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
+        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(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
+                }\r
+                //generate R8lib.h\r
+                while ((mtrr8onlyhead = Func.ptnbrace.matcher(paragraph)).find()) {\r
+                    paragraph = mtrr8onlyhead.replaceAll(";");\r
+                }\r
+                outfile2.append(paragraph + "\n\n");\r
+            }\r
+        }\r
+        outfile1.flush();\r
+        outfile1.close();\r
+        outfile2.flush();\r
+        outfile2.close();\r
+        \r
+        mi.localmodulesources.add("R8Lib.h");\r
+        mi.localmodulesources.add("R8Lib.c");\r
+    }\r
+    //-------------------------------------process functions-------------------------------------//\r
+    \r
+    //-----------------------------------ForDoAll-----------------------------------//\r
+    public void run(String filepath) throws Exception {\r
+        String inname = filepath.replace(mi.modulepath + File.separator, "");\r
+        String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;\r
+        String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;\r
 \r
-               Iterator<Common.Laplace> itLaplace = Laplaces.iterator();\r
-               while (itLaplace.hasNext()) {\r
-                       Common.Laplace lap = itLaplace.next();\r
-                       if (lap.recognize(inname)) {\r
-                               MigrationTool.ui.println("\nHandling file: " + inname);\r
-                               lap.transform(tempinpath + inname, tempoutpath + lap.namechange(inname));\r
-                       }\r
-               }\r
-       }\r
-       \r
-       public boolean filter(File dir) {\r
-               return true;\r
-       }\r
-       //-----------------------------------ForDoAll-----------------------------------//\r
-       \r
-       private final void setModuleInfo(ModuleInfo moduleinfo) {\r
-               mi = moduleinfo;\r
-       }\r
-       \r
-       private final void start() throws Exception {\r
-               Laplaces.add(new DxsLaplace());\r
-               Laplaces.add(new CLaplace());\r
-               Laplaces.add(new IdleLaplace());\r
-               \r
-               Common.toDoAll(mi.localmodulesources, this);\r
-               \r
-               if (!mi.hashr8only.isEmpty()) {\r
-                       addr8only();\r
-               }\r
-               \r
-               Laplaces.clear();\r
-       }\r
-       \r
-       public static final void fireAt(ModuleInfo moduleinfo) throws Exception {\r
-               SFReplacer.setModuleInfo(moduleinfo);\r
-               SFReplacer.start();\r
-       }\r
+        Iterator<Common.Laplace> itLaplace = Laplaces.iterator();\r
+        while (itLaplace.hasNext()) {\r
+            Common.Laplace lap = itLaplace.next();\r
+            if (lap.recognize(inname)) {\r
+                MigrationTool.ui.println("\nHandling file: " + inname);\r
+                lap.transform(tempinpath + inname, tempoutpath + lap.namechange(inname));\r
+            }\r
+        }\r
+    }\r
+    \r
+    public boolean filter(File dir) {\r
+        return true;\r
+    }\r
+    //-----------------------------------ForDoAll-----------------------------------//\r
+    \r
+    private final void setModuleInfo(ModuleInfo moduleinfo) {\r
+        mi = moduleinfo;\r
+    }\r
+    \r
+    private final void start() throws Exception {\r
+        Laplaces.add(new DxsLaplace());\r
+        Laplaces.add(new CLaplace());\r
+        Laplaces.add(new IdleLaplace());\r
+        \r
+        Common.toDoAll(mi.localmodulesources, this);\r
+        \r
+        if (!mi.hashr8only.isEmpty()) {\r
+            addr8only();\r
+        }\r
+        \r
+        Laplaces.clear();\r
+    }\r
+    \r
+    public static final void fireAt(ModuleInfo moduleinfo) throws Exception {\r
+        SFReplacer.setModuleInfo(moduleinfo);\r
+        SFReplacer.start();\r
+    }\r
 }\r
index 9a77a53068443b8e332be7792554805ea4368394..4fda64a14910439c09a758eb3816183cb6567780 100644 (file)
@@ -15,18 +15,18 @@ package org.tianocore.migration;
 import java.util.*;\r
 \r
 public interface UI {\r
-       \r
-       public boolean yesOrNo(String question);\r
-       \r
-       public void print(String message);\r
-       \r
-       public void println(String message);\r
-       \r
-       public void println(Set<String> hash);\r
-       \r
-       public String choose(String message, Object[] choicelist);\r
-       \r
-       public String getInput(String message);\r
-       \r
-       public String getFilepath(String title, int mode);              // necessary ?\r
+    \r
+    public boolean yesOrNo(String question);\r
+    \r
+    public void print(String message);\r
+    \r
+    public void println(String message);\r
+    \r
+    public void println(Set<String> hash);\r
+    \r
+    public String choose(String message, Object[] choicelist);\r
+    \r
+    public String getInput(String message);\r
+    \r
+    public String getFilepath(String title, int mode);        // necessary ?\r
 }\r