02.03.2014 Views

Tornado

Tornado

Tornado

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Tornado</strong> 2.0<br />

User’s Guide<br />

Variables<br />

For global variables, the Tcl set command appears first on the line, separated from<br />

the identifier by a tab character. Complete the declaration with a meaningful<br />

comment at the end of the same line. Variables, values, and comments should be<br />

aligned, as in the following example:<br />

set rootMemNBytes 0 ;# memory for TCB and root stack<br />

set rootTaskId 0 ;# root task ID<br />

set symSortByName 1 ;# boolean for alphabetical sort<br />

Procedures<br />

The procedure name and list of parameters appear on the first line, followed by the<br />

opening curly brace. The declarations of global variables used inside the procedure<br />

begin on the next line, one on each separate line. The rest of the procedure code<br />

begins after a blank line. For example:<br />

proc lstFind {list node} {<br />

global firstNode<br />

global lastNode<br />

}<br />

...<br />

B.3.5 Code Layout<br />

The maximum length for any line of code is 80 characters. If more than 80<br />

characters are required, use the backslash character to continue on the next line.<br />

The rest of this section describes conventions for the graphic layout of Tcl code,<br />

covering the following elements:<br />

■<br />

■<br />

■<br />

■<br />

vertical spacing<br />

horizontal spacing<br />

indentation<br />

comments<br />

Vertical Spacing<br />

■<br />

Use blank lines to make code more readable and to group logically related<br />

sections of code together. Put a blank line before and after comment lines.<br />

330

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!