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 3 of the License, or
16 .\" (at your option) any later version.
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
24 .\" along with this program. If not, see <http://www.gnu.org/licenses/>.
28 .\" Tracing within groff means replacing the original macros or requests
29 .\" with special versions which act as wrappers to emit tracing information.
30 .\" A natural consequence of creating such wrappers is that arguments must
31 .\" be expanded once more. In most cases it doesn't matter, however,
32 .\" sometimes it makes a difference.
34 .\" To limit side effects, only macros are traced by default, together
35 .\" with some requests like `.return' which don't take (user) arguments.
36 .\" If you want more tracing, especially of number and string register
37 .\" assignments, add the `-r trace-full=1' command line option.
40 .\" Regarding the usage of `.do': All lines of macros which should
41 .\" work in compatibility mode must be protected if they contain
42 .\" GNU troff extensions and are defined with `.de'. Example: `.ds',
43 .\" but not `.ds1', since the latter can't be called in compatibility
64 . tm1 "\*[!!!sp]*** return
79 . do tm1 "\*[!!!sp]*** .nr \$* (-> \n[\$1])
91 . do tm1 "\*[!!!sp]*** .ds \$^
99 . tm1 "\*[!!!sp]*** .ds1 \$^
107 . do tm1 "\*[!!!sp]*** .as \$^
115 . tm1 "\*[!!!sp]*** .as1 \$^
120 . rn substring !!substring
126 . tm1 "\*[!!!sp]*** .substring \$* (-> `\*[\$1]')
135 . do tm1 "\*[!!!sp]*** .so \$* {
141 . do !!substring !!!sp 1
142 . do tm1 "\*[!!!sp]*** }
146 . !!c We must use `.de' for the redefinition of .mso to avoid
147 . !!c side effects; for example, it might be called with
155 . do tm1 "\*[!!!sp]*** .mso \$* {
161 . do !!substring !!!sp 1
162 . do tm1 "\*[!!!sp]*** }
171 . als !!substring substring
185 . tm1 "\*[!!!sp]*** .als \$*
197 . tm1 "\*[!!!sp]*** .rm \$*
209 . do tm1 "\*[!!!sp]*** .rn \$*
213 .!!c Now the central tracing macros. The redefined `de' macros
214 .!!c create wrapper macros `foo' which emit tracing messages
215 .!!c before and after the call to the traced macro `!!foo'.
217 .!!c Note that we define `!!foo' in advance so that an alias to
218 .!!c `!!!!foo' is possible. The latter occurs if `foo' is
219 .!!c called as \\[foo].
221 .!!c The call to `dei' must be the last instruction in the macro
222 .!!c (since it continues the definition of the macro to trace).
231 . do ie \\n[.br] .do !!ds !!!br .\"
232 . el .do !!ds !!!br '\"
233 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** de trace enter: \\*[!!!br]\\$0 \\$@
234 . el .do tm1 "\\*[!!!sp]*** de trace enter \$1: \\*[!!!br]\\$0 \\$@
237 . do nop \\*[!!\\$0]\\
239 . do !!substring !!!sp 1
240 . do ie \\n[.br] .do !!ds !!!br .\"
241 . el .do !!ds !!!br '\"
242 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
243 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
246 . do tm1 "\*[!!!sp]*** .de \$*
248 . do !!ds !!d1 !!\$1\"
258 . ie \\n[.br] .!!ds !!!br .\"
260 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** de1 trace enter: \\*[!!!br]\\$0 \\$@
261 . el .tm1 "\\*[!!!sp]*** de1 trace enter \$1: \\*[!!!br]\\$0 \\$@
266 . !!substring !!!sp 1
267 . ie \\n[.br] .!!ds !!!br .\"
269 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
270 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
273 . tm1 "\*[!!!sp]*** .de1 \$*
288 . do ie \\n[.br] .do !!ds !!!br .\"
289 . el .do !!ds !!!br '\"
290 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** am trace enter: \\*[!!!br]\\$0 \\$@
291 . el .do tm1 "\\*[!!!sp]*** am trace enter \$1: \\*[!!!br]\\$0 \\$@
294 . do nop \\*[!!\\$0]\\
296 . do !!substring !!!sp 1
297 . do ie \\n[.br] .do !!ds !!!br .\"
298 . el .do !!ds !!!br '\"
299 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
300 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
303 . do tm1 "\*[!!!sp]*** .am \$*
305 . do !!ds !!a1 !!\$1\"
315 . ie \\n[.br] .!!ds !!!br .\"
317 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** am1 trace enter: \\*[!!!br]\\$0 \\$@
318 . el .tm1 "\\*[!!!sp]*** am1 trace enter \$1: \\*[!!!br]\\$0 \\$@
323 . !!substring !!!sp 1
324 . ie \\n[.br] .!!ds !!!br .\"
326 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
327 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
330 . tm1 "\*[!!!sp]*** .am1 \$*