OSDN Git Service

Please enter the commit message for your changes. Lines starting
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / man / mann / watch.n
1 '\"
2 '\" Copyright 1991-1997 by Bell Labs Innovations for Lucent Technologies.
3 '\"
4 '\" Permission to use, copy, modify, and distribute this software and its
5 '\" documentation for any purpose and without fee is hereby granted, provided
6 '\" that the above copyright notice appear in all copies and that both that the
7 '\" copyright notice and warranty disclaimer appear in supporting documentation,
8 '\" and that the names of Lucent Technologies any of their entities not be used
9 '\" in advertising or publicity pertaining to distribution of the software
10 '\" without specific, written prior permission.
11 '\"
12 '\" Lucent Technologies disclaims all warranties with regard to this software,
13 '\" including all implied warranties of merchantability and fitness.  In no event
14 '\" shall Lucent Technologies be liable for any special, indirect or
15 '\" consequential damages or any damages whatsoever resulting from loss of use,
16 '\" data or profits, whether in an action of contract, negligence or other
17 '\" tortuous action, arising out of or in connection with the use or performance
18 '\" of this software.  
19 '\"
20 '\"
21 '\" The definitions below are for supplemental macros used in Tcl/Tk
22 '\" manual entries.
23 '\"
24 '\" .AP type name in/out ?indent?
25 '\"     Start paragraph describing an argument to a library procedure.
26 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
27 '\"     or "in/out" to describe whether procedure reads or modifies arg,
28 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
29 '\"     needed;  use .AS below instead)
30 '\"
31 '\" .AS ?type? ?name?
32 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
33 '\"     name are examples of largest possible arguments that will be passed
34 '\"     to .AP later.  If args are omitted, default tab stops are used.
35 '\"
36 '\" .BS
37 '\"     Start box enclosure.  From here until next .BE, everything will be
38 '\"     enclosed in one large box.
39 '\"
40 '\" .BE
41 '\"     End of box enclosure.
42 '\"
43 '\" .CS
44 '\"     Begin code excerpt.
45 '\"
46 '\" .CE
47 '\"     End code excerpt.
48 '\"
49 '\" .VS ?version? ?br?
50 '\"     Begin vertical sidebar, for use in marking newly-changed parts
51 '\"     of man pages.  The first argument is ignored and used for recording
52 '\"     the version when the .VS was added, so that the sidebars can be
53 '\"     found and removed when they reach a certain age.  If another argument
54 '\"     is present, then a line break is forced before starting the sidebar.
55 '\"
56 '\" .VE
57 '\"     End of vertical sidebar.
58 '\"
59 '\" .DS
60 '\"     Begin an indented unfilled display.
61 '\"
62 '\" .DE
63 '\"     End of indented unfilled display.
64 '\"
65 '\" .SO
66 '\"     Start of list of standard options for a Tk widget.  The
67 '\"     options follow on successive lines, in four columns separated
68 '\"     by tabs.
69 '\"
70 '\" .SE
71 '\"     End of list of standard options for a Tk widget.
72 '\"
73 '\" .OP cmdName dbName dbClass
74 '\"     Start of description of a specific option.  cmdName gives the
75 '\"     option's name as specified in the class command, dbName gives
76 '\"     the option's name in the option database, and dbClass gives
77 '\"     the option's class in the option database.
78 '\"
79 '\" .UL arg1 arg2
80 '\"     Print arg1 underlined, then print arg2 normally.
81 '\"
82 '\" RCS: @(#) $Id: man.macros,v 1.1.1.1 2009/05/09 16:27:42 pcmacdon Exp $
83 '\"
84 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
85 .if t .wh -1.3i ^B
86 .nr ^l \n(.l
87 .ad b
88 '\"     # Start an argument description
89 .de AP
90 .ie !"\\$4"" .TP \\$4
91 .el \{\
92 .   ie !"\\$2"" .TP \\n()Cu
93 .   el          .TP 15
94 .\}
95 .ta \\n()Au \\n()Bu
96 .ie !"\\$3"" \{\
97 \&\\$1  \\fI\\$2\\fP    (\\$3)
98 .\".b
99 .\}
100 .el \{\
101 .br
102 .ie !"\\$2"" \{\
103 \&\\$1  \\fI\\$2\\fP
104 .\}
105 .el \{\
106 \&\\fI\\$1\\fP
107 .\}
108 .\}
109 ..
110 '\"     # define tabbing values for .AP
111 .de AS
112 .nr )A 10n
113 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
114 .nr )B \\n()Au+15n
115 .\"
116 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
117 .nr )C \\n()Bu+\\w'(in/out)'u+2n
118 ..
119 .AS Tcl_Interp Tcl_CreateInterp in/out
120 '\"     # BS - start boxed text
121 '\"     # ^y = starting y location
122 '\"     # ^b = 1
123 .de BS
124 .br
125 .mk ^y
126 .nr ^b 1u
127 .if n .nf
128 .if n .ti 0
129 .if n \l'\\n(.lu\(ul'
130 .if n .fi
131 ..
132 '\"     # BE - end boxed text (draw box now)
133 .de BE
134 .nf
135 .ti 0
136 .mk ^t
137 .ie n \l'\\n(^lu\(ul'
138 .el \{\
139 .\"     Draw four-sided box normally, but don't draw top of
140 .\"     box if the box started on an earlier page.
141 .ie !\\n(^b-1 \{\
142 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
143 .\}
144 .el \}\
145 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
146 .\}
147 .\}
148 .fi
149 .br
150 .nr ^b 0
151 ..
152 '\"     # VS - start vertical sidebar
153 '\"     # ^Y = starting y location
154 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
155 .de VS
156 .if !"\\$2"" .br
157 .mk ^Y
158 .ie n 'mc \s12\(br\s0
159 .el .nr ^v 1u
160 ..
161 '\"     # VE - end of vertical sidebar
162 .de VE
163 .ie n 'mc
164 .el \{\
165 .ev 2
166 .nf
167 .ti 0
168 .mk ^t
169 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
170 .sp -1
171 .fi
172 .ev
173 .\}
174 .nr ^v 0
175 ..
176 '\"     # Special macro to handle page bottom:  finish off current
177 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
178 '\"     # page bottom macro.
179 .de ^B
180 .ev 2
181 'ti 0
182 'nf
183 .mk ^t
184 .if \\n(^b \{\
185 .\"     Draw three-sided box if this is the box's first page,
186 .\"     draw two sides but no top otherwise.
187 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
188 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
189 .\}
190 .if \\n(^v \{\
191 .nr ^x \\n(^tu+1v-\\n(^Yu
192 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
193 .\}
194 .bp
195 'fi
196 .ev
197 .if \\n(^b \{\
198 .mk ^y
199 .nr ^b 2
200 .\}
201 .if \\n(^v \{\
202 .mk ^Y
203 .\}
204 ..
205 '\"     # DS - begin display
206 .de DS
207 .RS
208 .nf
209 .sp
210 ..
211 '\"     # DE - end display
212 .de DE
213 .fi
214 .RE
215 .sp
216 ..
217 '\"     # SO - start of list of standard options
218 .de SO
219 .SH "STANDARD OPTIONS"
220 .LP
221 .nf
222 .ta 4c 8c 12c
223 .ft B
224 ..
225 '\"     # SE - end of list of standard options
226 .de SE
227 .fi
228 .ft R
229 .LP
230 See the \\fBoptions\\fR manual entry for details on the standard options.
231 ..
232 '\"     # OP - start of full description for a single option
233 .de OP
234 .LP
235 .nf
236 .ta 4c
237 Command-Line Name:      \\fB\\$1\\fR
238 Database Name:  \\fB\\$2\\fR
239 Database Class: \\fB\\$3\\fR
240 .fi
241 .IP
242 ..
243 '\"     # CS - begin code excerpt
244 .de CS
245 .RS
246 .nf
247 .ta .25i .5i .75i 1i
248 .ft CW
249 .sp
250 ..
251 '\"     # CE - end code excerpt
252 .de CE
253 .fi
254 .RE
255 .ft R
256 .sp
257 ..
258 .de UL
259 \\$1\l'|0\(ul'\\$2
260 ..
261 .TH watch n 2.5 BLT "BLT Built-In Commands"
262 .BS
263 .SH NAME
264 watch \- call Tcl procedures before and after each command
265 .SH SYNOPSIS
266 \fBwatch create\fR \fIwatchName\fR ?\fIoptions\fR?
267 .sp
268 \fBwatch activate\fR \fIwatchName\fR
269 .sp
270 \fBwatch deactivate\fR \fIwatchName\fR
271 .sp
272 \fBwatch delete\fR \fIwatchName\fR
273 .sp
274 \fBwatch configure\fR \fIwatchName\fR ?\fIoptions\fR
275 .sp
276 \fBwatch info\fR \fIwatchName\fR
277 .sp
278 \fBwatch names\fR 
279 .BE
280 .SH DESCRIPTION
281 The \fBwatch\fR command arranges for Tcl procedures to be invoked
282 before and after the execution of each Tcl command.
283 .SH INTRODUCTION
284 When an error occurs in Tcl, the global variable \fIerrorInfo\fR will
285 contain a stack-trace of the active procedures when the error occured.
286 Sometimes, however, the stack trace is insufficient.  You may need to
287 know exactly where in the program's execution the error occured.  In
288 cases like this, a more general tracing facility would be useful.
289 .PP
290 The \fBwatch\fR command lets you designate Tcl procedures to be
291 invoked before and after the execution of each Tcl command.  This
292 means you can display the command line and its results for each
293 command as it executes.  Another use is to profile your Tcl commands.
294 You can profile any Tcl command (like \fBif\fR and \fBset\fR), not just
295 Tcl procedures.
296 .SH EXAMPLE
297 The following example use \fBwatch\fR to trace Tcl commands 
298 (printing to standard error) both before and after they are executed. 
299 .CS 
300 proc preCmd { level command argv } {
301     set name [lindex $argv 0]
302     puts stderr "$level $name => $command"
303 }
304
305 proc postCmd { level command argv retcode results } {
306     set name [lindex $argv 0]
307     puts stderr "$level $name => $argv\n<= ($retcode) $results"
308 }
309 watch create trace \\
310         -postcmd postCmd -precmd preCmd
311 .CE
312 .SH "OPERATIONS"
313 The following operations are available for the \fBwatch\fR command:
314 .TP
315 \fBwatch activate \fIwatchName\fR 
316 Activates the watch, causing Tcl commands the be traced to the
317 maximum depth selected.
318 .TP
319 \fBwatch create \fIwatchName\fR ?\fIoptions\fR?...
320 Creates a new watch \fIwatchName\fR. It's an error if another watch 
321 \fIwatchName\fR already exists and an error message will be returned.
322 \fIOptions\fR may have any of the values accepted by the 
323 \fBwatch configure\fR command.
324 This command returns the empty string.  
325 .TP
326 \fBwatch configure \fIwatchName\fR ?\fIoptions...\fR?
327 Queries or modifies the configuration options of the watch \fIwatchName\fR.
328 \fIWatchName\fR is the name of a watch.
329 \fIOptions\fR may have any of the following values:
330 .RS
331 .TP
332 \fB\-active \fIboolean\fR
333 Specifies if the watch is active.
334 By default, watches are active when created.
335 .TP
336 \fB\-postcmd \fIstring\fR
337 Specifies a Tcl procedure to be called immediately after each Tcl
338 command.  \fIString\fR is name of a Tcl procedure and any extra
339 arguments to be passed to it.  Before \fIstring\fR is invoked, five
340 more arguments are appended: 1) the current level 2) the current
341 command line 3) a list containing the command after substitutions and
342 split into words 4) the return code of the command, and 5) the results
343 of the command.  The return status of the postcmd procedure is always
344 ignored.
345 .TP
346 \fB\-precmd \fIstring\fR 
347 Specifies a Tcl procedure to be called immediately before each Tcl
348 command.  \fIString\fR is name of a Tcl procedure and any extra
349 arguments to be passed to it.  Before \fIstring\fR is invoked, three
350 arguments are appended: 1) the current level 2) the current command
351 line, and 3) a list containing the command after substitutions and
352 split into words.  The return status of the \fB\-precmd\fR procedure
353 is always ignored.
354 .TP
355 \fB\-maxlevel \fInumber\fR
356 Specifies the maximum evaluation depth to watch Tcl commands.
357 The default maximum level is 10000.
358 .RE
359 .TP
360 \fBwatch deactivate \fIwatchName\fR 
361 Deactivates the watch.  The \fB\-precmd\fR and \fB\-postcmd\fR procedures
362 will no longer be invoked.
363 .TP
364 \fBwatch info \fIwatchName\fR 
365 Returns the configuration information associated with the 
366 watch \fIwatchName\fR.  \fIWatchName\fR is the name of a watch.
367 .TP
368 \fBwatch names\fR ?\fIstate\fR?
369 Lists the names of the watches for a given state.  \fIState\fR may be
370 one of the following: \fBactive\fR, \fBidle\fR, or \fBignore\fR.  If a
371 \fIstate\fR argument isn't specified,
372  all watches are
373 listed.
374 .RE
375 .SH KEYWORDS
376 debug, profile