]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / MigrationTools / org / tianocore / migration / Macro.java
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Macro.java
new file mode 100644 (file)
index 0000000..bd10b5a
--- /dev/null
@@ -0,0 +1,47 @@
+/** @file\r
\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
+ **/\r
+package org.tianocore.migration;\r
+\r
+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
+\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
+\r
+    public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
+        String temp = null;\r
+        \r
+        temp = mtr.group();\r
+        mi.hashmacro.add(temp);\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