Command Reference 2. FPGA Express Shell Commanddsefine_proc_attributes _N_A_M_E define_proc_attributes Defines attributes of a Tcl procedure, including an information string for help, a command group, a set of argument descriptions for help, and so on. The command returns the empty string. SYNTAX string define_proc_attributes _p_r_o_c__n_a_m_e [-info _i_n_f_o__t_e_x_t] [-define_args _a_r_g__d_e_f_s] [-command_group _g_r_o_u_p__n_a_m_e] [-hide_body] [-dont_abbrev] [-permanent] string _p_r_o_c__n_a_m_e string _i_n_f_o__t_e_x_t list _a_r_g__d_e_f_s string _g_r_o_u_p__n_a_m_e ARGUMENTS _p_r_o_c__n_a_m_e Name of the existing procedure. -info _i_n_f_o__t_e_x_t Provides a help string for the procedure. This is printed by the help command when you request help for the procedure. If you don't specify _i_n_f_o__t_e_x_t, the default is "Procedure". -define_args _a_r_g__d_e_f_s Defines each possible procedure argument for use with help -verbose. This is a list of lists where each list element defines one argument. -command_group _g_r_o_u_p__n_a_m_e Defines the command group for the procedure. By default, procedures are placed in the "Procedures" command group. -hide_body Hides the body of the procedure from -info body. v3.0 Synopsys Inc. 1988-1998. All rights reserved. 2-1 define_proc_attribut2e.s FPGA Express Shell Commands Command Reference -dont_abbrev The procedure can never be abbreviated. By default, procedures can be abbreviated, subject to the value of the sh_command_abbrev_mode variable. -permanent Defines the procedure as permanent. You cannot modify permanent procedures in any way, so use this option carefully. DESCRIPTION The define_proc_attributes command associates attributes with a Tcl procedure. These attributes are used to define help for the procedure, locate it in a particular command group, and protect it. When a procedure is created with the proc command, it is placed in the Procedures command group. It has no help text for its arguments. You can view the body of the procedure with -info body, and you can modify the procedure and its attributes. The define_proc_attributes command allows you to change these aspects of a procedure. Note that the arguments to Tcl procedures are all named positional arguments. They can be programmed with default values, and there can be optional arguments by using the special argument name _a_r_g_s. The define_proc_attributes command does not relate the information that you enter for argument definitions with -define_args to the actual argument names. If you are describing anything other than positional arguments, it is expected that you are also using parse_proc_arguments to validate and extract your arguments. The _i_n_f_o__t_e_x_t is displayed when you use the help command on the procedure. Use -define_args to define help text and constraints for individual arguments. This makes the help for the procedure look like the help for an application command. The value for -define_args is a list of lists. Each element has this format: _a_r_g__n_a_m_e _o_p_t_i_o_n__h_e_l_p _v_a_l_u_e__h_e_l_p _d_a_t_a__t_y_p_e _a_t_t_r_i_b_u_t_e_s The _a_r_g__n_a_m_e is the name of the argument. _o_p_t_i_o_n__h_e_l_p is a short description of the argument. The _v_a_l_u_e__h_e_l_p is typically the argument name for positional 2-2 Synopsys Inc. 1988-1998. All rights reserved. v3.0 Command Reference 2. FPGA Express Shell Commanddsefine_proc_attributes arguments, or a one word description for dash options. It has no meaning for a boolean option. The _d_a_t_a__t_y_p_e and _a_t_t_r_i_b_u_t_e_s are optional and will be used for option validation. The _d_a_t_a__t_y_p_e can be any of: string, list, boolean, int, float, or one_of_string. The default is string. The _a_t_t_r_i_b_u_t_e_s is itself a list that can have any of the following entries: "required", "optional", "value_help", and "values {}". Note that "required" and "optional" are mutually exclusive. If the argument type is one_of_string, you must specify the "values" attribute. The "value_help" attribute indicates that the valid values for a one_of_string argument should be listed whenever argument help is shown. The default for _a_t_t_r_i_b_u_t_e_s is "required". Change the command group of the procedure using -command_group. Protect the contents of the procedure from being viewed by using -hide_body. Prevent further modifications to the procedure by using -permanent. Prevent abbreviation of the procedure by using -dont_abbrev. EXAMPLES The following procedure adds two numbers together and returns the sum. For demonstration purposes, unused arguments are defined. prompt> proc plus {a b} { return [expr $a + $b]} prompt> define_proc_attributes plus -info "Add two numbers" ? -define_args { {a "first addend" a string required} {b "second addend" b string required} {"-verbose" "issue a message" "" boolean optional}} prompt> help -verbose plus Usage: plus # Add two numbers [-verbose] (issue a message) a (first addend) b (second addend) prompt> plus 5 6 11 SEE ALSO help(2), _p_a_r_s_e__p_r_o_c__a_r_g_u_m_e_n_t_s(_2), _p_r_o_c(_2), _s_h__c_o_m_m_a_n_d__a_b_b_r_e_v__m_o_d_e(_3). v3.0 Synopsys Inc. 1988-1998. All rights reserved. 2-3