📄 x-codetcl5.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><link rel="STYLESHEET" type="text/css" href="wrs.css"><title> Tcl Coding Conventions </title></head><body bgcolor="FFFFFF"><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="x-codetcl.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="x-codetcl.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-codetcl4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-codetcl6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p><font face="Helvetica, sans-serif" class="sans"><h3 class="H2"><i><a name="84424">A.5 Tcl Code Outside Procedures</a></i></h3></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84426"> </a>Tcl allows code that is not in a procedure. This code is interpreted immediately when the file is read by the Tcl interpreter. Aside from the global-variable initialization done in the globals block near the top of the file, collect all such material at the bottom of the file.</p><dd><p class="Body"><a name="84427"> </a>However, it improves clarity--when possible--to collect any initialization code in an initialization procedure, leaving only a single call to that procedure at the bottom of the file. This is especially true for dialog creation and initialization, and more generally for all commands related to graphic objects. </p><dd><p class="Body"><a name="84428"> </a>Tcl code outside procedures must also have a documentation heading, including the following blocks:</p></dl><dl class="margin"><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84429"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"><b class="hb">Banner:</b></font> A Tcl comment that consists of 78 pound symbols (<b class="operator">#</b>) across the page.</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84430"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"><b class="hb">Title:</b></font> One line containing the file name followed by a short, one-line description. The file name in the title must match the file name in the file heading.</li></ul></p><p class="listspace"><ul class="Bullet" type="disc"><li><a name="84431"> </a><font face="Helvetica, sans-serif" size="-1" class="sans"><b class="hb">Description:</b></font> A description of the out-of-procedure code.</li></ul></p></dl><dl class="margin"><dd><p class="Body"><a name="84432"> </a>The following is a sample heading for Tcl code outside all procedures.</p></dl></dl><h4 class="EntityTitle"><a name="84433"><font face="Helvetica, sans-serif" size="-1" class="sans">Example A-4: Heading for Out-of-Procedure Tcl Code</font></a></h4><dl class="margin"><dl class="margin"><dd><pre class="Code"><b><a name="84434">##################################################################### # 01Spy.tcl - Initialization code # # This code is executed when the file is sourced. It executes the module # entry routine which does all the necessary initialization to get a # runnable spy utility. # # Call the entry point for the module spyInit</a></b></pre></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="x-codetcl.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="x-codetcl.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="x-codetcl4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="x-codetcl6.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc. conversion tool: Quadralay WebWorks Publisher 4.0.11 template: CSS Template, Jan 1998 - Jefro --->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -