aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/obm/docs/gui.doc/TclQuickRef.html
blob: 3f41eb29d611f7e33457b19a549803a459d33790 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<title>Tcl Quick Reference</title>


<H1><pre>TCL Quick Reference
Based on TCL version 6.4
Jeff Tranter 12-Aug-1992</pre><h1>


<pre>
Basic Language Features

#	comment (continues to end of line)
" "	allows embedding whitespace in arguments; substitutions made
{ }	group arguments; substitutions not made
[ ]	command substitution; replace with result of command
$var	variable substitution
;	command separator


Backslash Substitution

\b		backspace
\[		open bracket
\f		form feed
\]		close bracket
\n		newline
\$		dollar sign
\r		carriage return
\<space>	space
\t		tab
\;		semi-colon
\v		vertical tab
\"		double-quote
\{		left brace
\<newln>	newline
\}		right brace
\\		backslash
\ddd		octal digits


Built-in Variables

env
errorCode
errorInfo


Operators (in decreasing order of precedence)

- ~ !	unary minus, bit-wise NOT, logical NOT
* / %	multiply, divide, remainder
+ -	add, subtract
<< >>	left and right shift
< > <= >=	boolean comparisons
== !=	boolean equal, not equa
&	bit-wise AND
^	bit-wise exclusive OR
|	bit-wise inclusive OR
&&	logical AND
||	logical OR
x?y:z	conditional operator

All operators support integers.
All support floating point except ~, %, <<, >>, &, ^, and |
Boolean operators can also be used on strings.


Regular Expressions
regex | regex	match either expression
regex*	match zero or more of regex
regex+	match one or more of regex
regex?	match zero or one of regex
.	any single character (except newline)
^	match beginning of line
$	match end of line
\c	match character c
c	match character c
[]	match set of characters
[a-z]	match range of characters
[^]	match characters not in range or set
()	group expressions


Keywords

append varName value [value value ...]
array anymore arrayName searchId
array donesearch arrayName searchId
array names arrayName
array nextelement arrayName searchId
array size arrayName
array startsearch arrayName
break
case string [in] patList body [patList body ...]
case string [in] {patList body [patList body ...]
catch command [varName]
cd [dirName]
close fileId
concat arg [arg ...]
continue
error message [info] [code]
eof fileId
error $errMsg $savedInfo
eval arg [arg ...]
exec arg [arg ...]
exit [returnCode]
expr arg
file atime name
file dirname name
file executable name
file exists name
file extension name
file isdirectory name
file isfile name
file lstat name varName
file mtime name
file owned name
file readable name
file readlink name
file rootname name
file size name
file stat  name varName
file tail name
file type name
file writable name
flush fileId
for start test next body
foreach varname list body
format formatString [arg arg ...]
gets fileId [varName]
glob [-nocomplain] filename [filename ...]
global varname [varname ...]
history
history add command [exec]
history change newValue [event]
history event [event]
history info [count]
history keep count
history nextid
history redo [event]
history substitute old new [event]
history words selector [event]
if test [then] trueBody [else] [falseBody]
incr varName [increment]
info args procname
info body procname
info cmdcount
info commands [pattern]
info default procname arg varname
into variable varname
info exists varName
info globals [pattern]
info level [number]
info library
info locals [pattern]
info procs [pattern]
info script
info tclversion
info vars [pattern]
join list [joinString]
lappend varName value [value value ...]
lindex list index
linsert list index element [element element ...]
list arg [arg ...]
llength list
lrange list first last
lreplace list first last [element element ...]
lsearch list pattern
lsort list
open fileName [access]
proc name args body
puts fileId string [nonewline]
pwd
read fileId
read fileId nonewline
read fileId numBytes
regexp [-indices] [-nocase] exp string [matchVar] [subMatchVar subMatchVar ...]
regsub [-all] [-nocase] exp string subSpec varName
rename oldName newName
return [value]
scan string format varname1 [varname2 ...]
seek fileId offset [origin]
set varname [value]
source fileName
split string [splitChars]
string compare string1 string2
string first string1 string2
string index string charIndex
string last string1 string2
string length string
string match pattern string
string range string first last
string tolower string
string toupper string
string trim string [chars]
string trimleft string [chars]
string trimright string [chars]
tell fileId
time command [count]
trace variable name ops command
trace vdelete name ops command
trace vinfo name
unknown cmdName [arg arg ...]
unset name [name name ...]
uplevel [level] command [command ...]
upvar [level] otherVar myVar [otherVar myVar ...]
while test body
</pre>