]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/ContextTool/org/tianocore/context/HelpInfo.java
To fix EDKT284.
[mirror_edk2.git] / Tools / Source / ContextTool / org / tianocore / context / HelpInfo.java
index 09daf023b67df0aa9dafbc106bc394f82c56a1c8..b65ee0a131898de3720a16679a95b489d7a676a0 100644 (file)
@@ -1,5 +1,20 @@
+/** @file\r
+  File is HelpInfo class which is used to output the usage info. \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.context;\r
 \r
 package org.tianocore.context;\r
 \r
+import java.util.LinkedList;\r
+\r
 public class HelpInfo {\r
 \r
     \r
 public class HelpInfo {\r
 \r
     \r
@@ -9,12 +24,15 @@ public class HelpInfo {
      * @return no return value\r
      **/\r
     public static void outputUsageInfo() {\r
      * @return no return value\r
      **/\r
     public static void outputUsageInfo() {\r
+        System.out.printf("\n%s", DescripationString);\r
         System.out.printf("\n%s", UsageInfoString);\r
         System.out.printf("\n%s", DetailOfOptionString);\r
 \r
         System.out.printf("\n%s", UsageInfoString);\r
         System.out.printf("\n%s", DetailOfOptionString);\r
 \r
-        for (int i = 0; i < 6; i++) {\r
+        for (int i = 0; i < settingnum; i++) {\r
             outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);\r
         }\r
             outputSubUsageInfo(UsageString[i], UsageStringInfo[i]);\r
         }\r
+        \r
+        System.out.printf("\n%s", ExampleString);\r
     }\r
 \r
     /** \r
     }\r
 \r
     /** \r
@@ -24,17 +42,13 @@ public class HelpInfo {
      * @return no return value\r
      **/\r
     private static void outputSubUsageInfo(String str1, String str2) {\r
      * @return no return value\r
      **/\r
     private static void outputSubUsageInfo(String str1, String str2) {\r
+        \r
         splitString(str2);\r
         splitString(str2);\r
-        if (substrnum > 0) {\r
-            System.out.printf("\n%4s %-30s %s", "", str1, substr[0]);\r
-            for (int i = 1; i < substrnum; i++) {\r
-                if (substr[i] != null)\r
-                    System.out.printf("\n%4s %-30s %s", "", "", substr[i]);\r
-            }\r
-            substrnum = 0;\r
-        } else {\r
-            System.out.printf("\n%4s %-30s %s", "", str1, str2);\r
+        System.out.printf("\n%4s %-30s %s", "", str1, List.get(0));\r
+        for (int i=1; i<List.size(); i++){\r
+            System.out.printf("\n%4s %-30s %s", "", "", List.get(i));\r
         }\r
         }\r
+        List.clear();\r
     }\r
 \r
     /** \r
     }\r
 \r
     /** \r
@@ -45,41 +59,46 @@ public class HelpInfo {
     private static void splitString(String str) {\r
         int strlength = str.length();\r
         if (strlength > MaxSrtingLength) {\r
     private static void splitString(String str) {\r
         int strlength = str.length();\r
         if (strlength > MaxSrtingLength) {\r
-            \r
-            //we should modify the array to list, for it is strange to + 2\r
-            substrnum = strlength / MaxSrtingLength + 2;\r
             String[] tokens = str.split("[ ]", 0);\r
             String[] tokens = str.split("[ ]", 0);\r
-            substr = new String[substrnum];\r
+            String tempstr = null;\r
             int templength = 0;\r
             int templength = 0;\r
-            int j = 0;\r
             int start = 0;\r
             int end = 0;\r
             for (int i = 0; i < tokens.length; i++) {\r
                 if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {\r
                     end = templength;\r
                 } else {\r
             int start = 0;\r
             int end = 0;\r
             for (int i = 0; i < tokens.length; i++) {\r
                 if ((templength = end + tokens[i].length() + 1) < (MaxSrtingLength + start)) {\r
                     end = templength;\r
                 } else {\r
-                    substr[j++] = str.substring(start, end);\r
+                    tempstr = str.substring(start, end);\r
+                    List.add(tempstr);\r
                     start = end;\r
                     i = i - 1;\r
                 }\r
             }\r
                     start = end;\r
                     i = i - 1;\r
                 }\r
             }\r
-            substr[j] = str.substring(start, end - 1);\r
+            tempstr = str.substring(start, end - 1);\r
+            List.add(tempstr);\r
+        } else {\r
+            List.add(str);\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
-    private static String[] substr = null;\r
-\r
-    private static int substrnum = 0;\r
+    \r
+    private static LinkedList<String> List = new LinkedList<String>();\r
 \r
     private static final int MaxSrtingLength = 40;\r
 \r
     private static final int MaxSrtingLength = 40;\r
-\r
-    private static final String UsageInfoString = "Usage: context [-option1] [args] [-option2] [args] ...";\r
+    \r
+    private static final int settingnum = 7;\r
+    \r
+    private static final String DescripationString = "The purpose of this tool is modifying the settings in target.txt";\r
+    \r
+    private static final String UsageInfoString = "Usage: ContextTool [-option1] [args] [-option2] [args] ...";\r
 \r
     private static final String DetailOfOptionString = "Where options include:";\r
 \r
     private static final String DetailOfOptionString = "Where options include:";\r
+    \r
+    private static final String ExampleString = "Example: ContextTool -a IA32 IA64 EBC -c Tools/Conf/tools_def.txt -t DEBUG -n GCC -p EdkNt32Pkg/Nt32.fpd -m 2\n";\r
 \r
     private static final String HString = "-h";\r
 \r
 \r
     private static final String HString = "-h";\r
 \r
-    private static final String HStringInfo = "print this help message";\r
+    private static final String HStringInfo = "print usage info";\r
 \r
     private static final String AString = "-a  <list of Arch>";\r
 \r
 \r
     private static final String AString = "-a  <list of Arch>";\r
 \r
@@ -87,7 +106,7 @@ public class HelpInfo {
 \r
     private static final String CString = "-c  <tool_definition_file.txt>";\r
 \r
 \r
     private static final String CString = "-c  <tool_definition_file.txt>";\r
 \r
-    private static final String CStringInfo = "Assign a txt file, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/. If no file is specified, the default filename is \"tools_def.txt\"";\r
+    private static final String CStringInfo = "Assign a txt file with the relative path to WORKSPACE, which specify the tools to use for the build and must be located in the path: WORKSPACE/Tools/Conf/. If no file is specified, the default filename is \"tools_def.txt\"";\r
 \r
     private static final String NString = "-n  <list of TagNames>";\r
 \r
 \r
     private static final String NString = "-n  <list of TagNames>";\r
 \r
@@ -101,9 +120,13 @@ public class HelpInfo {
 \r
     private static final String TStringInfo = "What kind of the version is the binary target, such as DEBUG, RELEASE. Multiple values can be specified on a single line, using space to separate the values.";\r
 \r
 \r
     private static final String TStringInfo = "What kind of the version is the binary target, such as DEBUG, RELEASE. Multiple values can be specified on a single line, using space to separate the values.";\r
 \r
+    private static final String MString = "-m  <num of Threads>";\r
+    \r
+    private static final String MStringInfo = "number should GE 0. 0 clears both MULTIPLE_THREAD and MAX_CONCURRENT_THREAD_NUMBER, others enable MULTIPLE_THREAD and set MAX_CONCURRENT_THREAD_NUMBER.";\r
+    \r
     private static final String[] UsageString = { HString, AString, CString,\r
     private static final String[] UsageString = { HString, AString, CString,\r
-            NString, PString, TString };\r
+            NString, PString, TString, MString };\r
 \r
     private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,\r
 \r
     private static final String[] UsageStringInfo = { HStringInfo, AStringInfo,\r
-            CStringInfo, NStringInfo, PStringInfo, TStringInfo };\r
+            CStringInfo, NStringInfo, PStringInfo, TStringInfo, MStringInfo };\r
 }\r
 }\r