3 .\" Load this before a macro package that you want to trace.
6 .\" Copyright (C) 1989, 1990, 1991, 1992, 2000, 2002, 2003, 2004, 2006,
8 .\" Free Software Foundation, Inc.
9 .\" Written by James Clark (jjc@jclark.com)
11 .\" This file is part of groff.
13 .\" groff is free software; you can redistribute it and/or modify it under
14 .\" the terms of the GNU General Public License as published by the Free
15 .\" Software Foundation; either version 2, or (at your option) any later
18 .\" groff is distributed in the hope that it will be useful, but WITHOUT ANY
19 .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 .\" You should have received a copy of the GNU General Public License along
24 .\" with groff; see the file COPYING. If not, write to the Free Software
25 .\" Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
29 .\" Tracing within groff means replacing the original macros or requests
30 .\" with special versions which act as wrappers to emit tracing information.
31 .\" A natural consequence of creating such wrappers is that arguments must
32 .\" be expanded once more. In most cases it doesn't matter, however,
33 .\" sometimes it makes a difference.
35 .\" To limit side effects, only macros are traced by default, together
36 .\" with some requests like `.return' which don't take (user) arguments.
37 .\" If you want more tracing, especially of number and string register
38 .\" assignments, add the `-r trace-full=1' command line option.
41 .\" Regarding the usage of `.do': All lines of macros which should
42 .\" work in compatibility mode must be protected if they contain
43 .\" GNU troff extensions and are defined with `.de'. Example: `.ds',
44 .\" but not `.ds1', since the latter can't be called in compatibility
65 . tm1 "\*[!!!sp]*** return
80 . do tm1 "\*[!!!sp]*** .nr \$* (-> \n[\$1])
92 . do tm1 "\*[!!!sp]*** .ds \$^
100 . tm1 "\*[!!!sp]*** .ds1 \$^
108 . do tm1 "\*[!!!sp]*** .as \$^
116 . tm1 "\*[!!!sp]*** .as1 \$^
121 . rn substring !!substring
127 . tm1 "\*[!!!sp]*** .substring \$* (-> `\*[\$1]')
136 . do tm1 "\*[!!!sp]*** .so \$* {
142 . do !!substring !!!sp 1
143 . do tm1 "\*[!!!sp]*** }
147 . !!c We must use `.de' for the redefinition of .mso to avoid
148 . !!c side effects; for example, it might be called with
156 . do tm1 "\*[!!!sp]*** .mso \$* {
162 . do !!substring !!!sp 1
163 . do tm1 "\*[!!!sp]*** }
172 . als !!substring substring
186 . tm1 "\*[!!!sp]*** .als \$*
198 . tm1 "\*[!!!sp]*** .rm \$*
210 . do tm1 "\*[!!!sp]*** .rn \$*
214 .!!c Now the central tracing macros. The redefined `de' macros
215 .!!c create wrapper macros `foo' which emit tracing messages
216 .!!c before and after the call to the traced macro `!!foo'.
218 .!!c Note that we define `!!foo' in advance so that an alias to
219 .!!c `!!!!foo' is possible. The latter occurs if `foo' is
220 .!!c called as \\[foo].
222 .!!c The call to `dei' must be the last instruction in the macro
223 .!!c (since it continues the definition of the macro to trace).
232 . do ie \\n[.br] .do !!ds !!!br .\"
233 . el .do !!ds !!!br '\"
234 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** de trace enter: \\*[!!!br]\\$0 \\$@
235 . el .do tm1 "\\*[!!!sp]*** de trace enter \$1: \\*[!!!br]\\$0 \\$@
238 . do nop \\*[!!\\$0]\\
240 . do !!substring !!!sp 1
241 . do ie \\n[.br] .do !!ds !!!br .\"
242 . el .do !!ds !!!br '\"
243 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
244 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
247 . do tm1 "\*[!!!sp]*** .de \$*
249 . do !!ds !!d1 !!\$1\"
259 . ie \\n[.br] .!!ds !!!br .\"
261 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** de1 trace enter: \\*[!!!br]\\$0 \\$@
262 . el .tm1 "\\*[!!!sp]*** de1 trace enter \$1: \\*[!!!br]\\$0 \\$@
267 . !!substring !!!sp 1
268 . ie \\n[.br] .!!ds !!!br .\"
270 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
271 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
274 . tm1 "\*[!!!sp]*** .de1 \$*
289 . do ie \\n[.br] .do !!ds !!!br .\"
290 . el .do !!ds !!!br '\"
291 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** am trace enter: \\*[!!!br]\\$0 \\$@
292 . el .do tm1 "\\*[!!!sp]*** am trace enter \$1: \\*[!!!br]\\$0 \\$@
295 . do nop \\*[!!\\$0]\\
297 . do !!substring !!!sp 1
298 . do ie \\n[.br] .do !!ds !!!br .\"
299 . el .do !!ds !!!br '\"
300 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
301 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
304 . do tm1 "\*[!!!sp]*** .am \$*
306 . do !!ds !!a1 !!\$1\"
316 . ie \\n[.br] .!!ds !!!br .\"
318 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** am1 trace enter: \\*[!!!br]\\$0 \\$@
319 . el .tm1 "\\*[!!!sp]*** am1 trace enter \$1: \\*[!!!br]\\$0 \\$@
324 . !!substring !!!sp 1
325 . ie \\n[.br] .!!ds !!!br .\"
327 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
328 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
331 . tm1 "\*[!!!sp]*** .am1 \$*