]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/Macro.java
Add MigrationTools
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Macro.java
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java b/Tools/Source/MigrationTools/org/tianocore/migration/Macro.java
new file mode 100644 (file)
index 0000000..2e8356e
--- /dev/null
@@ -0,0 +1,34 @@
+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
+               if (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