Fix several bugs & enhancement.
[mirror_edk2.git] / Tools / Java / 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
27e0221a 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
0dc8c589 29\r
49324055 30 public static Pattern ptntmacro = Pattern.compile("\\b\\w(\\w|\\d)*",Pattern.MULTILINE);\r
0dc8c589 31\r
27e0221a 32 private static String unmacro = "VOID UINTN BOOLEAN ASSERT OPTIONAL STATIC NULL TRUE IN OUT FALSE";\r
0dc8c589 33\r
27e0221a 34 public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
35 String temp = null;\r
36 \r
37 temp = mtr.group();\r
9f98dbb7 38 mi.hashmacro.add(temp);\r
27e0221a 39 if (MigrationTool.db.hasMacro(temp)) { // only changed macros registered, because the database of macro has only changed ones\r
40 if (!unmacro.contains(temp)) {\r
41 mi.hashnonlocalmacro.add(temp);\r
42 }\r
43 return temp;\r
44 }\r
45 return null;\r
46 }\r
0dc8c589 47}