Sync-to-go: update copyright for 2015
[s-roff.git] / man / tmac-trace.7.in
blob7570d28e452e50848d4f514f682ed5e473e27fa0
1 .ig
2 @L_ROFF@_trace.7
4 Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
6 Copyright (C) 2002, 2006 - 2008 Free Software Foundation, Inc.
7 written by Bernd Warken.
9 Permission is granted to copy, distribute and/or modify this document
10 under the terms of the GNU Free Documentation License, Version 1.1 or
11 any later version published by the Free Software Foundation; with the
12 Invariant Sections being this .ig-section and AUTHOR, with no
13 Front-Cover Texts, and with no Back-Cover Texts.
15 You should have received a copy of the Free Documentation License
16 as part of the file COPYING; also located in the main directory of the
17 source package of this program.
20 .ds Ellipsis .\|.\|.\&\"
22 .TH @U_ROFF@_TRACE @MAN7EXT@ "@MDATE@" "@T_ROFF@ v@VERSION@"
24 .\"
25 .SH NAME
26 @L_ROFF@_trace \- @T_ROFF@ macro package trace.tmac
28 .\"
29 .SH SYNOPSIS
31 .SY "@L_ROFF@ \-m trace"
32 .RI [ options
33 .IR \*[Ellipsis] ]
34 .RI [ files
35 .IR \*[Ellipsis] ]
36 .YS
38 .\"
39 .SH DESCRIPTION
41 The
42 .I trace
43 macro package can be a valuable tool for debugging documents written
44 in the roff formatting language.
45 A call stack trace is protocolled on standard error, this is, a
46 diagnostic message is emitted on entering and exiting of a macro call.
47 This greatly eases to track down an error in some macro.
50 This tracing process is activated by specifying the groff or troff
51 command line option
52 .BR \-m\ trace .
53 A finer control can be obtained by including the macro file within the
54 document via
55 .BR .mso\ trace.tmac .
56 Only macros that are defined after this line are traced.
59 If command line option
60 .B \-r\ trace-full=1
61 is given (or if this register is set in the document), number and string
62 register assignments together with some other requests are traced also.
65 If some other macro package should be traced as well it must be specified
66 after
67 .B \-m\ trace
68 on the command line.
71 The macro file
72 .B trace.tmac
73 is unusual because it does not contain any macros to be called by a
74 user.
75 Instead, the existing macro definition and appending facilities are
76 modified such that they display diagnostic messages.
78 .\"
79 .SH EXAMPLES
81 In the following examples, a roff fragment is fed into @L_ROFF@ via
82 standard input.
83 As we are only interested in the diagnostic messages (standard error)
84 on the terminal, the normal formatted output (standard output) is
85 redirected to the nirvana device
86 .IR /dev/null .
87 The resulting diagnostic messages are displayed directly below the
88 corresponding example.
90 .\"
91 .SS "Command line option"
93 Example:
95 .RS
97 .EX
98 \fIsh#\fP echo '.
99 > .de test_macro
100 > ..
101 > .test_macro
102 > .test_macro some dummy arguments
103 > ' | @L_ROFF@ -m trace >/dev/null
105 *** .de test_macro
106 *** de trace enter: .test_macro
107 *** trace exit: .test_macro
108 *** de trace enter: .test_macro "some" "dummy" "arguments"
109 *** trace exit: .test_macro "some" "dummy" "arguments"
114 The entry and the exit of each macro call is displayed on the terminal
115 (standard output) \[em] together with the arguments (if any).
118 .SS "Nested macro calls"
120 Example:
125 \fIsh#\fP echo '.
126 > .de child
127 > ..
128 > .de parent
129 > .child
130 > ..
131 > .parent
132 > ' | @L_ROFF@ -m trace >/dev/null
134 *** .de child
135 *** .de parent
136 *** de trace enter: .parent
137  *** de trace enter: .child
138  *** trace exit: .child
139 *** trace exit: .parent
144 This shows that macro calls can be nested.
145 This powerful feature can help to tack down quite complex call stacks.
148 .SS "Activating with .mso"
150 Example:
155 \fIsh#\fP echo '.
156 > .de before
157 > ..
158 > .mso trace.tmac
159 > .de after
160 > ..
161 > .before
162 > .after
163 > .before
164 >  ' | @L_ROFF@ >/dev/null
166 *** de trace enter: .after
167 *** trace exit: .after
172 Here, the tracing is activated within the document, not by a command
173 line option.
174 As tracing was not active when macro
175 .I before
176 was defined, no call of this macro is protocolled; on the other hand,
177 the macro
178 .I after
179 is fully protocolled.
182 .SH PROBLEMS
184 Because
185 .B trace.tmac
186 wraps the
187 .B .de
188 request (and its cousins), macro arguments are expanded one level more.
189 This causes problems if an argument contains four backslashes or more
190 to prevent too early expansion of the backslash.  For example, this
191 macro call
195 \&.foo \e\e\e\en[bar]
199 normally passes `\e\en[bar]' to macro `.foo', but with the redefined
200 .B .de
201 request it passes `\en[bar]' instead.
204 The solution to this problem is to use @L_ROFF@'s
205 .B \eE
206 escape which is an escape character not interpreted in copy mode, for
207 example
211 \&.foo \eEn[bar]
215 .SH FILES
218 .I trace
219 macros are kept in the file
220 .B trace.tmac
221 located in the
222 .IR "tmac directory" ;
224 .BR @L_ROFF@_tmac (@MAN5EXT@)
225 for details.
228 .SH ENVIRONMENT
231 .B $@U_ROFF@_TMAC_PATH
232 A colon-separated list of additional tmac directories in which to
233 search for macro files; see
234 .BR @L_ROFF@_tmac (@MAN5EXT@)
235 for details.
238 .SH AUTHOR
240 Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
242 Copyright (C) 2002, 2006 - 2008 Free Software Foundation, Inc.
244 This document was written by Bernd Warken.
246 This document is distributed under the terms of the FDL (GNU Free
247 Documentation License) version 1.1 or later.
249 You should have received a copy of the FDL on your system, it is also
250 available on-line at the
251 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
252 GNU copyleft site
253 .UE .
256 .SH "SEE ALSO"
259 .BR @L_ROFF@ (@MAN1EXT@)
260 An overview of the @T_ROFF@ system.
263 .BR @L_TROFF@ (@MAN1EXT@)
264 For details on option
265 .BR \-m .
268 .BR @L_ROFF@_tmac (@MAN5EXT@)
269 A general description of @T_ROFF@ macro packages.
272 .BR @L_ROFF@ (@MAN7EXT@)
273 A short reference for the @T_ROFF@ formatting language.
275 .\" s-ts-mode