]> git.proxmox.com Git - mirror_edk2.git/commitdiff
fix the bug in revision 1746
authorjjin9 <jjin9@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 14 Oct 2006 11:50:20 +0000 (11:50 +0000)
committerjjin9 <jjin9@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 14 Oct 2006 11:50:20 +0000 (11:50 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1747 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/ContextTool/org/tianocore/context/ParseParameter.java
Tools/Java/Source/ContextTool/org/tianocore/context/TargetFile.java

index 8b818059d5a4dfaea33f173540ac5af15f4d367f..8f1c8b2f779a666e611532311d9557a99837b97d 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
index adde59b8437fc3bfc1f4595edd9bbce3942535cf..76c4b183d6174215c76aeba41a41ef60f6a1a975 100644 (file)
@@ -157,14 +157,16 @@ public class TargetFile {
                     if (textLine.indexOf("ACTIVE_PLATFORM") != -1) {\r
                         if(pflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curpstr.length() >= ParseParameter.plength) {\r
+                                if(ParseParameter.npflag == true) {\r
                                     bw.write(ParseParameter.curpstr);\r
-                                    bw.newLine();\r
-                                    pflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                pflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curpstr.length() >= ParseParameter.plength) {\r
+                            if(ParseParameter.npflag == true) {\r
                                 bw.write(ParseParameter.curpstr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -175,14 +177,16 @@ public class TargetFile {
                     } else if (textLine.indexOf("TARGET_ARCH") != -1) {\r
                         if(aflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curastr.length() >= ParseParameter.alength) {\r
+                                if(ParseParameter.naflag == true) {\r
                                     bw.write(ParseParameter.curastr);\r
-                                    bw.newLine();\r
-                                    aflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                aflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curastr.length() >= ParseParameter.alength) {\r
+                            if(ParseParameter.naflag == true) {\r
                                 bw.write(ParseParameter.curastr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -193,14 +197,16 @@ public class TargetFile {
                     } else if (textLine.indexOf("TARGET") != -1) {\r
                         if(tflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curtstr.length() >= ParseParameter.tlength) {\r
+                                if(ParseParameter.ntflag == true) {\r
                                     bw.write(ParseParameter.curtstr);\r
-                                    bw.newLine();\r
-                                    tflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                tflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curtstr.length() >= ParseParameter.tlength) {\r
+                            if(ParseParameter.ntflag == true) {\r
                                 bw.write(ParseParameter.curtstr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -211,14 +217,16 @@ public class TargetFile {
                     } else if (textLine.indexOf("TOOL_CHAIN_CONF") != -1) {\r
                         if(cflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curcstr.length() >= ParseParameter.clength) {\r
+                                if(ParseParameter.ncflag == true) {\r
                                     bw.write(ParseParameter.curcstr);\r
-                                    bw.newLine();\r
-                                    cflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                cflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curcstr.length() >= ParseParameter.clength) {\r
+                            if(ParseParameter.ncflag == true) {\r
                                 bw.write(ParseParameter.curcstr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -229,14 +237,16 @@ public class TargetFile {
                     } else if (textLine.indexOf("TOOL_CHAIN_TAG") != -1) {\r
                         if(nflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curnstr.length() >= ParseParameter.nlength) {\r
+                                if(ParseParameter.nnflag == true) {\r
                                     bw.write(ParseParameter.curnstr);\r
-                                    bw.newLine();\r
-                                    nflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                nflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curnstr.length() >= ParseParameter.nlength) {\r
+                            if(ParseParameter.nnflag == true) {\r
                                 bw.write(ParseParameter.curnstr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -247,14 +257,16 @@ public class TargetFile {
                     } else if (textLine.indexOf("MAX_CONCURRENT_THREAD_NUMBER") != -1) {\r
                         if(mflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curmstr.length() >= ParseParameter.mlength) {\r
+                                if(ParseParameter.nmflag == true) {\r
                                     bw.write(ParseParameter.curmstr);\r
-                                    bw.newLine();\r
-                                    mflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                mflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curmstr.length() >= ParseParameter.mlength) {\r
+                            if(ParseParameter.nmflag == true) {\r
                                 bw.write(ParseParameter.curmstr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -265,14 +277,16 @@ public class TargetFile {
                     }else if (textLine.indexOf("MULTIPLE_THREAD") != -1) {\r
                         if(meflag == true){\r
                             if(textLine.trim().charAt(0) == '#'){\r
-                                if(ParseParameter.curmestr.length() >= ParseParameter.melength) {\r
+                                if(ParseParameter.nmeflag == true) {\r
                                     bw.write(ParseParameter.curmestr);\r
-                                    bw.newLine();\r
-                                    meflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
+                                bw.newLine();\r
+                                meflag = false;\r
                                 continue;\r
                             }\r
-                            if(ParseParameter.curmestr.length() >= ParseParameter.melength) {\r
+                            if(ParseParameter.nmeflag == true) {\r
                                 bw.write(ParseParameter.curmestr);\r
                             } else {\r
                                 bw.write(textLine);\r
@@ -286,25 +300,25 @@ public class TargetFile {
             //\r
             //user maybe delete the line *ACTIVE_PLATFORM*=*\r
             //\r
-            if( (pflag == true) && (ParseParameter.curpstr.length() >= ParseParameter.plength) ){\r
+            if( (pflag == true) && (ParseParameter.npflag == true) ){\r
                 bw.write(ParseParameter.curpstr);\r
                 bw.newLine();\r
-            } else if ( (tflag == true) && (ParseParameter.curtstr.length() >= ParseParameter.tlength) ){\r
+            } else if ( (tflag == true) && (ParseParameter.ntflag == true) ){\r
                 bw.write(ParseParameter.curtstr);\r
                 bw.newLine();\r
-            } else if ( (aflag == true) && (ParseParameter.curastr.length() >= ParseParameter.alength) ){\r
+            } else if ( (aflag == true) && (ParseParameter.naflag == true) ){\r
                 bw.write(ParseParameter.curastr);\r
                 bw.newLine();\r
-            } else if ( (cflag == true) && (ParseParameter.curcstr.length() >= ParseParameter.clength) ){\r
+            } else if ( (cflag == true) && (ParseParameter.ncflag == true) ){\r
                 bw.write(ParseParameter.curcstr);\r
                 bw.newLine();\r
-            } else if ( (nflag == true) && (ParseParameter.curnstr.length() >= ParseParameter.nlength) ){\r
+            } else if ( (nflag == true) && (ParseParameter.nnflag == true) ){\r
                 bw.write(ParseParameter.curnstr);\r
                 bw.newLine();\r
-            } else if ( (meflag == true) && (ParseParameter.curmestr.length() >= ParseParameter.melength) ){\r
+            } else if ( (meflag == true) && (ParseParameter.nmeflag == true) ){\r
                 bw.write(ParseParameter.curmestr);\r
                 bw.newLine();\r
-            } else if ( (mflag == true) && (ParseParameter.curmstr.length() >= ParseParameter.mlength) ){\r
+            } else if ( (mflag == true) && (ParseParameter.nmflag == true) ){\r
                 bw.write(ParseParameter.curmstr);\r
                 bw.newLine();\r
             }\r