+/** @file\r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ \r
+ **/\r
package org.tianocore.migration;\r
\r
import java.util.regex.*;\r
\r
public class Func {\r
- Func(String r8func,String r8lib,String r9func,String r9lib) {\r
- r8funcname = r8func;\r
- r8libname = r8lib;\r
- r9funcname = r9func;\r
- r9libname = r9lib;\r
- }\r
- Func(String[] linecontext) {\r
- r8funcname = linecontext[1];\r
- r8libname = linecontext[0];\r
- r9funcname = linecontext[2];\r
- r9libname = linecontext[3];\r
- }\r
- public String r8funcname;\r
- public String r8libname;\r
- public String r9funcname;\r
- public String r9libname;\r
+ Func(String r8func,String r8lib,String r9func,String r9lib) {\r
+ r8funcname = r8func;\r
+ r8libname = r8lib;\r
+ r9funcname = r9func;\r
+ r9libname = r9lib;\r
+ }\r
+ Func(String[] linecontext) {\r
+ r8funcname = linecontext[1];\r
+ r8libname = linecontext[0];\r
+ r9funcname = linecontext[2];\r
+ if (r9funcname.contains("n/a")) {\r
+ r9funcname = "#error Unknown or missing library function in EDKII: " + r8funcname;\r
+ }\r
+ r9libname = linecontext[3];\r
+ }\r
+ public String r8funcname;\r
+ public String r8libname;\r
+ public String r9funcname;\r
+ public String r9libname;\r
\r
- public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r
- public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)",Pattern.MULTILINE);\r
- public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r
- public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be removed\r
- \r
- private static String reservedwords = "if for pack while switch return sizeof";\r
- \r
- public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
- String temp = null;\r
+ public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);\r
+ public static Pattern ptnfuncc = Pattern.compile("(?<!->)([a-zA-Z_]\\w*)\\s*\\(",Pattern.MULTILINE);\r
+ public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);\r
+ public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be removed\r
+ \r
+ private static String reservedwords = "if for pack while switch return sizeof";\r
+ \r
+ public static String register(Matcher mtr, ModuleInfo mi, Database db) {\r
+ String temp = null;\r
\r
- temp = mtr.group(1); // both changed and not changed funcc are registered , for finding all the non-local function calls\r
- Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so the two funcs can be merged\r
- if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r
- mi.hashfuncc.add(temp);\r
- }\r
- return temp;\r
- }\r
- /*\r
- public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r
- String temp = null;\r
+ temp = mtr.group(1); // both changed and not changed funcc are registered , for finding all the non-local function calls\r
+ Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so the two funcs can be merged\r
+ if (!reservedwords.contains(temp) && mtrlowcase.find()) {\r
+ mi.hashfuncc.add(temp);\r
+ }\r
+ return temp;\r
+ }\r
+ /*\r
+ public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {\r
+ String temp = null;\r
\r
- temp = mtr.group(1); // both changed and not changed funcd are registered , for finding all the non-local function calls\r
- if (!reservedwords.contains(temp)) {\r
- mi.hashfuncd.add(temp);\r
- }\r
- return temp;\r
- }\r
- */\r
+ temp = mtr.group(1); // both changed and not changed funcd are registered , for finding all the non-local function calls\r
+ if (!reservedwords.contains(temp)) {\r
+ mi.hashfuncd.add(temp);\r
+ }\r
+ return temp;\r
+ }\r
+ */\r
}\r