]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/MigrationTools/org/tianocore/migration/Func.java
1. Fix EDKT273 "Externs are not being grouped together in MSA Files"
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Func.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 Func {\r
27e0221a 18 Func(String r8func,String r8lib,String r9func,String r9lib) {\r
19 r8funcname = r8func;\r
20 r8libname = r8lib;\r
21 r9funcname = r9func;\r
22 r9libname = r9lib;\r
23 }\r
24 Func(String[] linecontext) {\r
25 r8funcname = linecontext[1];\r
26 r8libname = linecontext[0];\r
27 r9funcname = linecontext[2];\r
28 r9libname = linecontext[3];\r
29 }\r
30 public String r8funcname;\r
31 public String r8libname;\r
32 public String r9funcname;\r
33 public String r9libname;\r
0dc8c589 34\r
27e0221a 35 public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r
36 //public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)",Pattern.MULTILINE);\r
37 public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\(",Pattern.MULTILINE);\r
38 public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r
39 public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be removed\r
40 \r
41 private static String reservedwords = "if for pack while switch return sizeof";\r
42 \r
43 public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
44 String temp = null;\r
0dc8c589 45\r
27e0221a 46 temp = mtr.group(1); // both changed and not changed funcc are registered , for finding all the non-local function calls\r
47 Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so the two funcs can be merged\r
48 if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r
49 mi.hashfuncc.add(temp);\r
50 }\r
51 return temp;\r
52 }\r
53 /*\r
54 public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r
55 String temp = null;\r
0dc8c589 56\r
27e0221a 57 temp = mtr.group(1); // both changed and not changed funcd are registered , for finding all the non-local function calls\r
58 if (!reservedwords.contains(temp)) {\r
59 mi.hashfuncd.add(temp);\r
60 }\r
61 return temp;\r
62 }\r
63 */\r
0dc8c589 64}\r