| 笔记本 | |
| 2019-01-15 22:58:11 | 用parse_proc_arguments传递自定义procedure的参数 | 走来走去 | 223.166.231.233 |
如果自己写了一个procedure需要传递参数,用parse_proc_arguments可以方便地将参数赋给一个array变量。
例如:
proc my_proc { args } {
set options(-color) ""
set options(-shape) ""
parse_proc_arguments -args $args options
puts "The color is : $options(-color) "
puts "The shpae is : $options(-shape) "
}
define_proc_attributes my_proc \
-info "trace " \
-define_args { \
{-color "" "" string required} \
{-shape "" "" string optional } \
}
运行结果如下:
icc2_shell> my_proc -color red -shape reg
The color is : red
The shpae is : reg
icc2_shell>
| |||
| 回到首页 , 时钟 , 联系信箱:yzbox#163.com(把#换成@) | 粤ICP备18155639号 |