fix the bug in revision 1746
[mirror_edk2.git] / Tools / Java / Source / ContextTool / org / tianocore / context / TargetFile.java
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 (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.write(ParseParameter.curpstr);\r
-                                    bw.newLine();\r
-                                    pflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                pflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     } 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.write(ParseParameter.curastr);\r
-                                    bw.newLine();\r
-                                    aflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                aflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     } 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.write(ParseParameter.curtstr);\r
-                                    bw.newLine();\r
-                                    tflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                tflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     } 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.write(ParseParameter.curcstr);\r
-                                    bw.newLine();\r
-                                    cflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                cflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     } 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.write(ParseParameter.curnstr);\r
-                                    bw.newLine();\r
-                                    nflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                nflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     } 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.write(ParseParameter.curmstr);\r
-                                    bw.newLine();\r
-                                    mflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                mflag = false;\r
                                 continue;\r
                             }\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
                                 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
                     }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.write(ParseParameter.curmestr);\r
-                                    bw.newLine();\r
-                                    meflag = false;\r
+                                }else{\r
+                                    bw.write(textLine);\r
                                 }\r
                                 }\r
+                                bw.newLine();\r
+                                meflag = false;\r
                                 continue;\r
                             }\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
                                 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
             //\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
                 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
                 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
                 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
                 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
                 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
                 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
                 bw.write(ParseParameter.curmstr);\r
                 bw.newLine();\r
             }\r