public static boolean checkParameter(String[] args) {\r
\r
if(args.length == 0){\r
- HelpInfo.outputUsageInfo();\r
+ TargetFile.readFile();\r
+ outputCurSetting();\r
return false;\r
} else {\r
- if( args[0].charAt(0) != '-' ){\r
+ if( (args[0].compareToIgnoreCase("-h") == 0) || (args[0].compareToIgnoreCase("/h") == 0) || \r
+ (args[0].compareToIgnoreCase("-?") == 0) || (args[0].compareToIgnoreCase("/?") == 0) || \r
+ (args[0].compareToIgnoreCase("-help") == 0) || (args[0].compareToIgnoreCase("/help") == 0) ){\r
HelpInfo.outputUsageInfo();\r
return false;\r
}\r
+ if( args[0].charAt(0) != '-' ){\r
+ System.out.printf("%s\n", "Error arguments! Please type \"ContextTool -h\" for helpinfo.");\r
+ return false;\r
+ }\r
for(int i=0; i<args.length; i++){\r
- if( (args[i].compareToIgnoreCase("-h") == 0) || \r
- (args[i].startsWith("-") && ((args[i].charAt(1) != 'a') && (args[i].charAt(1) != 'c') \r
- && (args[i].charAt(1) != 'n') && (args[i].charAt(1) != 'p') && (args[i].charAt(1) != 't') && (args[i].charAt(1) != 'm')))){\r
- HelpInfo.outputUsageInfo();\r
+ if( (args[i].startsWith("-") && \r
+ ((args[i].compareTo("-a") != 0) && (args[i].compareTo("-c") != 0) && \r
+ (args[i].compareTo("-n") != 0) && (args[i].compareTo("-p") != 0) && \r
+ (args[i].compareTo("-t") != 0) && (args[i].compareTo("-m") != 0)))){\r
+ System.out.printf("%s\n", "Error arguments! Please type \"ContextTool -h\" for helpinfo."); \r
return false;\r
}\r
}\r
}\r
\r
- standardizeParameter(args);\r
return true; \r
}\r
\r
* @param args -- user's input\r
* @return no return value\r
**/\r
- private static void standardizeParameter(String[] args) {\r
+ public static int standardizeParameter(String[] args) {\r
\r
- //\r
- // the parameters's length are same.\r
- //\r
- length = pstr.length();\r
\r
StringBuffer InputData = new StringBuffer();\r
for (int i = 0; i < args.length; i++) {\r
j = InputData.length();\r
\r
String argstr = InputData.substring(i, j);\r
-\r
+ i = j;\r
if (argstr.charAt(1) == 'p') {\r
- pstr += argstr.substring(2);\r
- // pstr += "\n";\r
+ //\r
+ // argstr is "-p ", display current setting\r
+ //\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curpstr);\r
+ return 1;\r
+ }\r
+ //\r
+ //argstr is "-p ?", display possible setting\r
+ //\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "assign the platform FPD file's relative path to WORKSPACE" );\r
+ return 2;\r
+ }\r
+ //\r
+ //argstr is "-p 0", clean current setting\r
+ //\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
+ curpstr = pstr;\r
+ continue;\r
+ }\r
+ curpstr = mergeSetting(curpstr, argstr);\r
} else if (argstr.charAt(1) == 't') {\r
- tstr += argstr.substring(2);\r
- // tstr += "\n";\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curtstr);\r
+ return 1;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "What kind of the version is the binary target, such as DEBUG, RELEASE" );\r
+ return 2;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
+ curtstr = tstr;\r
+ continue;\r
+ }\r
+ curtstr = mergeSetting(curtstr, argstr);\r
} else if (argstr.charAt(1) == 'a') {\r
- astr += argstr.substring(2);\r
-// astr += "\n";\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curastr);\r
+ return 1;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "What kind of architechure is the binary target, such as IA32, IA64, X64, EBC, or ARM" );\r
+ return 2;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
+ curastr = astr;\r
+ continue;\r
+ }\r
+ curastr = mergeSetting(curastr, argstr);\r
} else if (argstr.charAt(1) == 'c') {\r
- cstr += argstr.substring(2);\r
-// cstr += "\n";\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curcstr);\r
+ return 1;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "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/" );\r
+ return 2;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
+ curcstr = cstr;\r
+ continue;\r
+ }\r
+ curcstr = mergeSetting(curcstr, argstr);\r
} else if (argstr.charAt(1) == 'n') {\r
- nstr += argstr.substring(2);\r
-// nstr += "\n";\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curnstr);\r
+ return 1;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "Specify the TagName, such as GCC, MSFT" );\r
+ return 2;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '0'){\r
+ curnstr = nstr;\r
+ continue;\r
+ }\r
+ curnstr = mergeSetting(curnstr, argstr);\r
} else if (argstr.charAt(1) == 'm') {\r
+ if(argstr.length() < 4 && argstr.charAt(2) == ' '){\r
+ System.out.printf("%s\n", curmstr);\r
+ return 1;\r
+ }\r
+ if(argstr.length() < 6 && argstr.charAt(3) == '?'){\r
+ System.out.printf( "%s\n", "The number of concurrent threads. Default is 2. Recommend to set this value to one more than the number of your compurter cores or CPUs." );\r
+ return 2;\r
+ }\r
mstr += argstr.substring(2);\r
-// mstr += "\n";\r
+ curmstr = mstr;\r
if (argstr.charAt(3) == '0'){\r
mestr += " Disable";\r
} else {\r
mestr += " Enable";\r
}\r
- }\r
- i = j;\r
+ curmestr = mestr;\r
+ }\r
+ \r
}\r
-\r
+ return 0;\r
+ }\r
+ \r
+ \r
+ 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
+ }\r
+ \r
+ return S1;\r
+ }\r
+ \r
+ public static boolean outputCurSetting(){\r
+ \r
+ System.out.printf( "%s\n", "The current setting is:" );\r
+ System.out.printf( "%s\n", curpstr );\r
+ System.out.printf( "%s\n", curtstr );\r
+ System.out.printf( "%s\n", curastr );\r
+ System.out.printf( "%s\n", curcstr );\r
+ System.out.printf( "%s\n", curnstr );\r
+ System.out.printf( "%s\n", curmstr );\r
+ System.out.printf( "%s\n", curmestr );\r
+ \r
+ return true;\r
}\r
\r
public static int length = 0;\r
public static String nstr = new String("TOOL_CHAIN_TAG = ");\r
public static String mstr = new String("MAX_CONCURRENT_THREAD_NUMBER = ");\r
public static String mestr = new String("MULTIPLE_THREAD = ");\r
+ \r
+ public static String curpstr = null;\r
+ public static String curtstr = null;\r
+ public static String curastr = null;\r
+ public static String curcstr = null;\r
+ public static String curnstr = null;\r
+ public static String curmstr = null;\r
+ public static String curmestr = null;\r
+ \r
+ public static int plength = 0;\r
+ public static int tlength = 0;\r
+ public static int alength = 0;\r
+ public static int clength = 0;\r
+ public static int nlength = 0;\r
+ public static int mlength = 0;\r
+ public static int melength = 0;\r
\r
}\r