fix the bug in revision 1746
[mirror_edk2.git] / Tools / Java / Source / ContextTool / org / tianocore / context / ParseParameter.java
index 8b81805..8f1c8b2 100644 (file)
@@ -94,9 +94,15 @@ public class ParseParameter {
                 //\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
                     curpstr = pstr;\r
+                    npflag = true;\r
                     continue;\r
                 }\r
-                curpstr = mergeSetting(curpstr, argstr);\r
+                if(curpstr == null){\r
+                    curpstr = pstr.concat(argstr.substring(2));\r
+                }else{\r
+                    curpstr = mergeSetting(curpstr, argstr);\r
+                }\r
+                npflag = true;\r
             } else if (argstr.charAt(1) == 't') {\r
                 if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
                     System.out.printf("%s\n", curtstr);\r
@@ -108,9 +114,15 @@ public class ParseParameter {
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
                     curtstr = tstr;\r
+                    ntflag = true;\r
                     continue;\r
                 }\r
-                curtstr = mergeSetting(curtstr, argstr);\r
+                if(curtstr == null){\r
+                    curtstr = tstr.concat(argstr.substring(2));\r
+                }else{\r
+                    curtstr = mergeSetting(curtstr, argstr);\r
+                }\r
+                ntflag = true;\r
             } else if (argstr.charAt(1) == 'a') {\r
                 if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
                     System.out.printf("%s\n", curastr);\r
@@ -122,9 +134,15 @@ public class ParseParameter {
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
                     curastr = astr;\r
+                    naflag = true;\r
                     continue;\r
                 }\r
-                curastr = mergeSetting(curastr, argstr);\r
+                if(curastr == null){\r
+                    curastr = astr.concat(argstr.substring(2));\r
+                }else{\r
+                    curastr = mergeSetting(curastr, argstr);\r
+                }\r
+                naflag = true;\r
             } else if (argstr.charAt(1) == 'c') {\r
                 if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
                     System.out.printf("%s\n", curcstr);\r
@@ -136,9 +154,15 @@ public class ParseParameter {
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
                     curcstr = cstr;\r
+                    ncflag = true;\r
                     continue;\r
                 }\r
-                curcstr = mergeSetting(curcstr, argstr);\r
+                if(curcstr == null){\r
+                    curcstr = pstr.concat(argstr.substring(2));\r
+                }else{\r
+                    curcstr = mergeSetting(curcstr, argstr);\r
+                }\r
+                ncflag = true;\r
             } else if (argstr.charAt(1) == 'n') {\r
                 if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
                     System.out.printf("%s\n", curnstr);\r
@@ -150,9 +174,15 @@ public class ParseParameter {
                 }\r
                 if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
                     curnstr = nstr;\r
+                    nnflag = true;\r
                     continue;\r
                 }\r
-                curnstr = mergeSetting(curnstr, argstr);\r
+                if(curnstr == null){\r
+                    curnstr = nstr.concat(argstr.substring(2));\r
+                }else{\r
+                    curnstr = mergeSetting(curnstr, argstr);\r
+                }\r
+                nnflag = true;\r
             } else if (argstr.charAt(1) == 'm') {\r
                 if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
                     System.out.printf("%s\n", curmstr);\r
@@ -164,12 +194,14 @@ public class ParseParameter {
                 }\r
                 mstr += argstr.substring(2);\r
                 curmstr = mstr;\r
+                nmflag = true;\r
                 if (argstr.charAt(3) == '0'){\r
                     mestr += " Disable";\r
                 } else {\r
                     mestr += " Enable";\r
                 }\r
                 curmestr = mestr;\r
+                nmeflag = true;\r
             }\r
             \r
         }\r
@@ -180,13 +212,10 @@ public class ParseParameter {
     public static String mergeSetting( String S1, String S2){\r
         \r
         String[] S = S2.split(" ");\r
-        if(S1 == null){\r
-            S1 = tstr.concat(S2.substring(2));\r
-        }else{\r
-            for(int i = 1; i < S.length; i++){\r
-                if( S1.contains(S[i]) == false ){\r
-                    S1 = S1.concat(S[i]).concat(" ");\r
-                }\r
+\r
+        for(int i = 1; i < S.length; i++){\r
+            if(S1.contains(S[i]) == false){\r
+                S1 = S1.concat(" ").concat(S[i]);\r
             }\r
         }\r
         \r
@@ -231,5 +260,13 @@ public class ParseParameter {
     public static int nlength = 0;\r
     public static int mlength = 0;\r
     public static int melength = 0;\r
+    \r
+    public static boolean npflag = false;\r
+    public static boolean ntflag = false;\r
+    public static boolean naflag = false;\r
+    public static boolean ncflag = false;\r
+    public static boolean nnflag = false;\r
+    public static boolean nmflag = false;\r
+    public static boolean nmeflag = false;\r
 \r
 }\r