]>
Commit | Line | Data |
---|---|---|
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 | 13 | package org.tianocore.migration;\r |
14 | \r | |
15 | import java.util.regex.*;\r | |
16 | \r | |
17 | public 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 | |
503fefcc | 26 | r8libname = linecontext[0];\r |
27e0221a | 27 | r9funcname = linecontext[2];\r |
503fefcc | 28 | if (r9funcname.contains("n/a")) {\r |
29 | r9funcname = "#error Unknown or missing library function in EDKII: " + r8funcname;\r | |
30 | }\r | |
27e0221a | 31 | r9libname = linecontext[3];\r |
32 | }\r | |
33 | public String r8funcname;\r | |
34 | public String r8libname;\r | |
35 | public String r9funcname;\r | |
36 | public String r9libname;\r | |
0dc8c589 | 37 | \r |
27e0221a | 38 | public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r |
0e9d14c4 | 39 | public static Pattern ptnfuncc = Pattern.compile("(?<!->)([a-zA-Z_]\\w*)\\s*\\(",Pattern.MULTILINE);\r |
27e0221a | 40 | public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r |
41 | public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be removed\r | |
42 | \r | |
43 | private static String reservedwords = "if for pack while switch return sizeof";\r | |
44 | \r | |
45 | public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r | |
46 | String temp = null;\r | |
0dc8c589 | 47 | \r |
27e0221a | 48 | temp = mtr.group(1); // both changed and not changed funcc are registered , for finding all the non-local function calls\r |
49 | Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so the two funcs can be merged\r | |
50 | if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r | |
51 | mi.hashfuncc.add(temp);\r | |
52 | }\r | |
53 | return temp;\r | |
54 | }\r | |
55 | /*\r | |
56 | public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r | |
57 | String temp = null;\r | |
0dc8c589 | 58 | \r |
27e0221a | 59 | temp = mtr.group(1); // both changed and not changed funcd are registered , for finding all the non-local function calls\r |
60 | if (!reservedwords.contains(temp)) {\r | |
61 | mi.hashfuncd.add(temp);\r | |
62 | }\r | |
63 | return temp;\r | |
64 | }\r | |
65 | */\r | |
0dc8c589 | 66 | }\r |