Add License Head to all files
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Macro.java
CommitLineData
b0282412 1/** @file\r
2 \r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8 \r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 \r
12 **/\r
0dc8c589 13package org.tianocore.migration;\r
14\r
15import java.util.regex.*;\r
16\r
17public class Macro {\r
18 Macro(String r8, String r9) {\r
19 r8name = r8;\r
20 r9name = r9;\r
21 }\r
22 Macro(String[] linecontext) {\r
23 r8name = linecontext[0];\r
24 r9name = linecontext[1];\r
25 }\r
26 \r
27 public String r8name;\r
28 public String r9name;\r
29\r
30 public static Pattern ptntmacro = Pattern.compile("\\b[A-Z_]+\\s*?\\(?\\b",Pattern.MULTILINE);\r
31\r
32 private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";\r
33\r
34 public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
35 String temp = null;\r
36 \r
37 temp = mtr.group();\r
38 if (db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones\r
39 if (!unmacro.contains(temp)) {\r
40 mi.hashnonlocalmacro.add(temp);\r
41 }\r
42 return temp;\r
43 }\r
44 return null;\r
45 }\r
46}