国产毛片a精品毛-国产毛片黄片-国产毛片久久国产-国产毛片久久精品-青娱乐极品在线-青娱乐精品

mygod22的個人空間 http://www.qingdxww.cn/space-uid-85252.html [收藏] [復(fù)制] [RSS]

博客

TCL中catch命令

已有 3107 次閱讀2013-9-9 12:17 |個人分類:TCL| TCL, catch

NAMEcatch - Evaluate script and trap exceptional returnsSYNOPSIScatch script ?varName?
DESCRIPTIONThe catch command may be used to prevent errors from aborting command interpretation. The catch command calls the Tcl interpreter recursively to execute script, and always returns without raising an error, regardless of any errors that might occur while executing script.

If script raises an error, catch will return a non-zero integer value corresponding to the exceptional return code returned by evaluation of script. Tcl defines the normal return code from script evaluation to be zero (0), or TCL_OK. Tcl also defines four exceptional return codes: 1 (TCL_ERROR), 2 (TCL_RETURN), 3 (TCL_BREAK), and 4 (TCL_CONTINUE). Errors during evaluation of a script are indicated by a return code of TCL_ERROR. The other exceptional return codes are returned by thereturnbreak, and continue commands and in other special situations as documented. Tcl packages can define new commands that return other integer values as return codes as well, and scripts that make use of the return -code command can also have return codes other than the five defined by Tcl.

If the varName argument is given, then the variable it names is set to the result of the script evaluation. When the return code from the script is 1 (TCL_ERROR), the value stored in varName is an error message. When the return code from the script is 0 (TCL_OK), the value stored in resultVarName is the value returned fromscript.

If script does not raise an error, catch will return 0 (TCL_OK) and set the variable to the value returned from script.

Note that catch catches all exceptions, including those generated by break and continue as well as errors. The only errors that are not caught are syntax errors found when the script is compiled. This is because the catch command only catches errors during runtime. When the catch statement is compiled, the script is compiled as well and any syntax errors will generate a Tcl error.

EXAMPLESThe catch command may be used in an if to branch based on the success of a script.if { [catch {open $someFile w} fid] } { puts stderr "Could not open $someFile for writing\n$fid" exit 1 }

The catch command will not catch compiled syntax errors. The first time proc foo is called, the body will be compiled and a Tcl error will be generated.

proc foo {} { catch {expr {1 +- }} }載自:http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm

路過

雞蛋

鮮花

握手

雷人

評論 (0 個評論)

facelist

您需要登錄后才可以評論 登錄 | 立即注冊

關(guān)于我們  -  服務(wù)條款  -  使用指南  -  站點地圖  -  友情鏈接  -  聯(lián)系我們
電子工程網(wǎng) © 版權(quán)所有   京ICP備16069177號 | 京公網(wǎng)安備11010502021702
返回頂部
主站蜘蛛池模板: 国产精品三级一区二区 | 成人伊人青草久久综合网破解版 | www毛片 | 岛国在线最新 | 欧美精品一区二区三区免费观看 | 91视频一区二区 | 麻豆影业 | 91tv在线观看 | 污片网站 | 男人天堂新 | 欧美第六页 | 欧美影欧美影院免费观看视频 | 91牛牛| 四虎国产精品免费久久影院 | 国产在线观看福利 | 国产手机在线 | 日本高清不卡中文字幕 | 99久久精品久久久久久清纯 | 色网站在线观看 | 欧美成人全部免费观看1314色 | 天堂网最新版www | 99热这里只有精品99 | 久热国产在线 | 日本护士xxxjapanese| 九一色视频 | 国产福利一区二区麻豆 | 91年精品国产福利线观看久久 | 久久精彩免费视频 | 青青国产精品 | 伊人网国产 | 一区二区三区在线免费观看视频 | 中文在线最新版天堂8 | 九九99视频在线观看视频观看 | 国产精品免费福利 | 国产成a人片在线观看视频 国产产一区二区三区久久毛片国语 | 青青草综合 | 国产视频a | 日韩欧美亚洲中字幕在线播放 | 久久麻豆视频 | 国产欧美成人 | 四虎影视永久地址www成人 |