Command Reference 2. FPGA Express Shell Commandsparse_proc_arguments _N_A_M_E parse_proc_arguments Parses the arguments passed into a Tcl procedure. SYNTAX string parse_proc_arguments -args _a_r_g__l_i_s_t _r_e_s_u_l_t__a_r_r_a_y list _a_r_g__l_i_s_t string _r_e_s_u_l_t__a_r_r_a_y ARGUMENTS -args _a_r_g__l_i_s_t Specified the list of arguments passed in to the Tcl procedure. _r_e_s_u_l_t__a_r_r_a_y Specifies the name of the array into which the parsed arguments should be stored. DESCRIPTION The parse_proc_arguments command is used within a Tcl procedure to enable use of the -help option, and to support argument validation. It should typically be the first command called within a procedure. Procedures that use parse_proc_arguments will validate the semantics of the procedure arguments and generate the same syntax and semantic error messages as any application command (see the examples that follow). When a procedure that uses parse_proc_arguments is invoked with the -help option, parse_proc_arguments will print help information (in the same style as using help -verbose) and will then cause the calling procedure to return. Similarily, if there was any type of error with the arguments (missing required arguments, invalid value, and so on), parse_proc_arguments will return a Tcl error and the calling procedure will terminate and return. If you didn't specify -help, and the specified arguments were valid, the array variable _r_e_s_u_l_t__a_r_r_a_y will contain each of the argument values, subscripted with the argument name. Note that the argument name here is NOT the names of the arguments in the procedure definition, but rather the names of the arguments as defined using the define_proc_attributes command. The parse_proc_arguments command cannot be used outside v3.0 Synopsys Inc. 1988-1998. All rights reserved. 2-1 parse_proc_argument2s. FPGA Express Shell Commands Command Reference of a procedure. EXAMPLES The following procedure shows how parse_proc_arguments is typically used. The argHandler procedure parses the arguments it receives. If the parse is successful, argHandler prints the options or values actually received. proc argHandler args { parse_proc_arguments -args $args results foreach argname [array names results] { echo " $argname = $results($argname)" } } define_proc_attributes argHandler -info "argument processor" \ -define_args \ {{-Oos "oos help" AnOos one_of_string {required value_help {values {a b}}}} {-Int "int help" AnInt int optional} {-Float "float help" AFloat float optional} {-Bool "bool help" "" boolean optional} {-String "string help" AString string optional} {-List "list help" AList list optional}} Invoking argHandler with the -help option generates the following: prompt> argHandler -help Usage: argHandler # argument processor -Oos AnOos (oos help: Values: a, b) [-Int AnInt] (int help) [-Float AFloat] (float help) [-Bool] (bool help) [-String AString] (string help) [-List AList] (list help) Invoking argHandler with an invalid option causes the following output (and a Tcl error): prompt> argHandler -Int z Error: value 'z' for option '-Int' not of type 'integer' (CMD-009) Error: Required argument '-Oos' was not found (CMD-007) Invoking argHandler with valid arguments generates the following: prompt> argHandler -Int 6 -Oos a -Oos = a -Int = 6 2-2 Synopsys Inc. 1988-1998. All rights reserved. v3.0 Command Reference 2. FPGA Express Shell Commandsparse_proc_arguments SEE ALSO define_proc_attributes(2), _h_e_l_p(2), _p_r_o_c(2). v3.0 Synopsys Inc. 1988-1998. All rights reserved. 2-3