tcl/Itcl error: wrong # args: should be "itcl::class name { definition }"
tcl/Itcl error: wrong # args: should be "itcl::class name { definition }"
我目前正在学习Itcl语言(基于tcl语言)
然后我写了下面的脚本。
该脚本正在实现一个驱动程序,该驱动程序应获取 4 个参数并将它们存储在 class
实例的私有变量中
#!/bin/tclsh
package require Itcl
itcl::class driver {
# private variables
private variable bundle_id ""
private variable scope ""
private variable isSimulationModel ""
private variable isX ""
private method set_data_field {data_field_flag data_value} {
switch -- $data_field_flag {
-bundle {
set bundle_id $data_value
catch {unset bundle_id}
return
}
-scope {
set scope $data_value
catch {unset scope}
return
}
-isSimulationModel {
set isSimulationModel $data_value
catch {unset isSimulationModel}
return
}
-isX{
set isX $data_value
catch {unset isX}
return
}
}
return
}
constructor {bundle hdl_path is_simulation_model is_x} {
set_data_field -bundle $bundle
set_data_field -scope $hdl_path
set_data_field -isSimulationModel $is_simulation_model
set_data_field -isX $is_x
}
destructor {}
} #* _DRIVER_ * #
driver d 1 2 3 4
当我尝试 运行 时,出现以下错误:
wrong # args: should be "itcl::class name { definition }"
while executing "itcl::class driver {
# private variables
private variable bundle_id ""
private variable scope ""
private variable isSimulationModel ""
private v..."
(file "./driver.itcl" line 5)
任何人都可以帮助我并告诉我我做错了什么导致我收到此错误吗?
内联注释必须以分号开头:
} ;#* _DRIVER_ * #
^
就像现在一样,您正在做 itcl::class driver { ... } #* _DRIVER_ * #
,#* _DRIVER_ * #
是 4 个额外参数(#*
、_DRIVER_
、*
和 #
).
阅读有关 wiki 上 Tcl 评论的更多信息。
我目前正在学习Itcl语言(基于tcl语言)
然后我写了下面的脚本。
该脚本正在实现一个驱动程序,该驱动程序应获取 4 个参数并将它们存储在 class
#!/bin/tclsh
package require Itcl
itcl::class driver {
# private variables
private variable bundle_id ""
private variable scope ""
private variable isSimulationModel ""
private variable isX ""
private method set_data_field {data_field_flag data_value} {
switch -- $data_field_flag {
-bundle {
set bundle_id $data_value
catch {unset bundle_id}
return
}
-scope {
set scope $data_value
catch {unset scope}
return
}
-isSimulationModel {
set isSimulationModel $data_value
catch {unset isSimulationModel}
return
}
-isX{
set isX $data_value
catch {unset isX}
return
}
}
return
}
constructor {bundle hdl_path is_simulation_model is_x} {
set_data_field -bundle $bundle
set_data_field -scope $hdl_path
set_data_field -isSimulationModel $is_simulation_model
set_data_field -isX $is_x
}
destructor {}
} #* _DRIVER_ * #
driver d 1 2 3 4
当我尝试 运行 时,出现以下错误:
wrong # args: should be "itcl::class name { definition }"
while executing "itcl::class driver {
# private variables
private variable bundle_id ""
private variable scope ""
private variable isSimulationModel ""
private v..."
(file "./driver.itcl" line 5)
任何人都可以帮助我并告诉我我做错了什么导致我收到此错误吗?
内联注释必须以分号开头:
} ;#* _DRIVER_ * #
^
就像现在一样,您正在做 itcl::class driver { ... } #* _DRIVER_ * #
,#* _DRIVER_ * #
是 4 个额外参数(#*
、_DRIVER_
、*
和 #
).
阅读有关 wiki 上 Tcl 评论的更多信息。