summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools/org/tianocore/migration/Func.java
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-10 09:27:16 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-10 09:27:16 +0000
commit0dc8c5893276cf6638727060d31bca322eba2805 (patch)
treef86a4215176fe41d1236a9b14867b199ae9b12dc /Tools/Source/MigrationTools/org/tianocore/migration/Func.java
parentc8b59d238ccbcabb24a672208df1e95551b3ecdd (diff)
downloadedk2-0dc8c5893276cf6638727060d31bca322eba2805.zip
edk2-0dc8c5893276cf6638727060d31bca322eba2805.tar.gz
edk2-0dc8c5893276cf6638727060d31bca322eba2805.tar.bz2
Add MigrationTools
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1232 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/MigrationTools/org/tianocore/migration/Func.java')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/Func.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Func.java b/Tools/Source/MigrationTools/org/tianocore/migration/Func.java
new file mode 100644
index 0000000..843995a
--- /dev/null
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/Func.java
@@ -0,0 +1,51 @@
+package org.tianocore.migration;
+
+import java.util.regex.*;
+
+public class Func {
+ Func(String r8func,String r8lib,String r9func,String r9lib) {
+ r8funcname = r8func;
+ r8libname = r8lib;
+ r9funcname = r9func;
+ r9libname = r9lib;
+ }
+ Func(String[] linecontext) {
+ r8funcname = linecontext[1];
+ r8libname = linecontext[0];
+ r9funcname = linecontext[2];
+ r9libname = linecontext[3];
+ }
+ public String r8funcname;
+ public String r8libname;
+ public String r9funcname;
+ public String r9libname;
+
+ public static Pattern ptnbrace = Pattern.compile("\\{[^\\{\\}]*\\}",Pattern.MULTILINE);
+ public static Pattern ptnfuncc = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)",Pattern.MULTILINE);
+ public static Pattern ptnfuncd = Pattern.compile("([a-zA-Z_]\\w*)\\s*\\([^\\)\\(]*\\)\\s*@",Pattern.MULTILINE);
+ public static Pattern ptnlowcase = Pattern.compile("[a-z]"); // must be removed
+
+ private static String reservedwords = "if for pack while switch return sizeof";
+
+ public static String register(Matcher mtr, ModuleInfo mi, Database db) {
+ String temp = null;
+
+ temp = mtr.group(1); // both changed and not changed funcc are registered , for finding all the non-local function calls
+ Matcher mtrlowcase = ptnlowcase.matcher(temp); // must be removed , so the two funcs can be merged
+ if (!reservedwords.contains(temp) && mtrlowcase.find()) {
+ mi.hashfuncc.add(temp);
+ }
+ return temp;
+ }
+ /*
+ public static String registerFuncD(Matcher mtr, ModuleInfo mi, Database db) {
+ String temp = null;
+
+ temp = mtr.group(1); // both changed and not changed funcd are registered , for finding all the non-local function calls
+ if (!reservedwords.contains(temp)) {
+ mi.hashfuncd.add(temp);
+ }
+ return temp;
+ }
+ */
+}