| 1 | package org.tianocore.migration;\r |
| 2 | \r |
| 3 | import java.util.regex.*;\r |
| 4 | \r |
| 5 | public class Macro {\r |
| 6 | Macro(String r8, String r9) {\r |
| 7 | r8name = r8;\r |
| 8 | r9name = r9;\r |
| 9 | }\r |
| 10 | Macro(String[] linecontext) {\r |
| 11 | r8name = linecontext[0];\r |
| 12 | r9name = linecontext[1];\r |
| 13 | }\r |
| 14 | \r |
| 15 | public String r8name;\r |
| 16 | public String r9name;\r |
| 17 | \r |
| 18 | public static Pattern ptntmacro = Pattern.compile("\\b[A-Z_]+\\s*?\\(?\\b",Pattern.MULTILINE);\r |
| 19 | \r |
| 20 | private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";\r |
| 21 | \r |
| 22 | public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r |
| 23 | String temp = null;\r |
| 24 | \r |
| 25 | temp = mtr.group();\r |
| 26 | if (db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones\r |
| 27 | if (!unmacro.contains(temp)) {\r |
| 28 | mi.hashnonlocalmacro.add(temp);\r |
| 29 | }\r |
| 30 | return temp;\r |
| 31 | }\r |
| 32 | return null;\r |
| 33 | }\r |
| 34 | } |