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