TCL Usage Example 1
Examining the structure of a tree and the contents of a node:
> tcl
TCL> set tree transp/shot=76778
TCL> dir
\TRANSP::TOP
:DEVICE :NTIMES1 :NTIMES2
:RUNID :SHOT
:SHOTYEAR :TOFF
FUN FUNMG
PRO PROMG UFILES
Total of 12 nodes.
TCL> set def
.ufiles
TCL> dir
\TRANSP::TOP.UFILES
ALP BDI BOL CUR DFL
ECF EDI EHP ELI GAS
L2B NB2 NER NIM NTX
RBZ RCY RM0 RMM RPL
RTP SAW TI2 VP2 VSB
VSF YMM ZPL
Total of 28 nodes.
TCL> set def
.cur
TCL> dir
\TRANSP::TOP.UFILES.CUR
:FILENAME :PATH :SIGNAL
Total of 3 nodes.
TCL> decompile
:signal
READ_UFILE($SHOT, "T", "CUR", "TR_DISK:", "BUDNY.TFTR")
TCL>
exit
A similar operation from IDL
IDL> mdstcl,'set tree transp/shot=76778'
% Compiled
module: mdstcl.
IDL> mdstcl,'dir'
\TRANSP::TOP
:DEVICE :NTIMES1 :NTIMES2 :RUNID :SHOT
:SHOTYEAR :TOFF
FUN FUNMG PRO PROMG UFILES
Total of
12 nodes.
IDL> mdstcl,'decompile :device'
"TFTR"
IDL> mdstcl,'set def
.ufiles'
IDL> mdstcl,'dir'
\TRANSP::TOP.UFILES
ALP BDI BOL CUR DFL
ECF EDI EHP ELI GAS
L2B NB2 NER NIM NTX
RBZ RCY RM0 RMM RPL
RTP SAW TI2 VP2 VSB
VSF YMM ZPL
Total of 28
nodes.
IDL>
TCL Usage Example 2
Adding a node to an existing branching node of a tree
The tree must be opened for edit with EDIT rather than SET TREE.
This will only be possible if the user has write access to the tree (subtree) file involved.
> tcl
TCL> edit transp/shot=76778
TCL> set def
\transp::top.ufiles.cur
TCL> dir
\TRANSP::TOP.UFILES.CUR
:FILENAME :PATH :SIGNAL
Total of 3 nodes.
TCL> add node
sclab/usage=text
TCL> dir
\TRANSP::TOP.UFILES.CUR
:FILENAME :PATH :SCLAB :SIGNAL
Total of 4
nodes.
TCL> put sclab
"READ_UFSCALAR($SHOT,""T"",""CUR"",""TR_DISK:"",
""BUDNY.TFTR"",""LAB"")"
TCL> decompile sclab
READ_UFSCALAR($SHOT, "T",
"CUR", "TR_DISK:", "BUDNY.TFTR", "LAB")
TCL> write
TCL>
exit
TCL Usage Example 3
Some TCL error messages can be misleading. Referring to a member node (:NODENAME) as if it
were a branching (child) node (.NODENAME) may result in “undefined node” messages.
Using the colon or period where TCL does not want it may also produce a misleading message:
> tcl
TCL> edit
transp/shot=76778
TCL> set def \transp::top.ufiles.cur
TCL>
dir
\TRANSP::TOP.UFILES.CUR
:FILENAME :PATH :SCLAB :SIGNAL
Total of 4 nodes.
TCL> add node
:scval
Undefined symbol ADD check spelling
TCL> add node scval
TCL>
dir
\TRANSP::TOP.UFILES.CUR
:FILENAME :PATH :SCLAB :SCVAL :SIGNAL
Total of 5
nodes.
TCL>