2 .\"@ Load this before a macro package that you want to trace.
4 .\" Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
6 .\" Copyright (C) 1989 - 1992, 2000, 2002 - 2004, 2006 - 2008
7 .\" Free Software Foundation, Inc.
8 .\" Written by James Clark (jjc@jclark.com)
10 .\" This is free software; you can redistribute it and/or modify it under
11 .\" the terms of the GNU General Public License as published by the Free
12 .\" Software Foundation; either version 2, or (at your option) any later
15 .\" This is distributed in the hope that it will be useful, but WITHOUT ANY
16 .\" WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 .\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 .\" You should have received a copy of the GNU General Public License along
21 .\" with groff; see the file COPYING. If not, write to the Free Software
22 .\" Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
26 .\" Tracing within groff means replacing the original macros or requests
27 .\" with special versions which act as wrappers to emit tracing information.
28 .\" A natural consequence of creating such wrappers is that arguments must
29 .\" be expanded once more. In most cases it doesn't matter, however,
30 .\" sometimes it makes a difference.
32 .\" To limit side effects, only macros are traced by default, together
33 .\" with some requests like `.return' which don't take (user) arguments.
34 .\" If you want more tracing, especially of number and string register
35 .\" assignments, add the `-r trace-full=1' command line option.
38 .\" Regarding the usage of `.do': All lines of macros which should
39 .\" work in compatibility mode must be protected if they contain
40 .\" GNU troff extensions and are defined with `.de'. Example: `.ds',
41 .\" but not `.ds1', since the latter can't be called in compatibility
62 . tm1 "\*[!!!sp]*** return
77 . do tm1 "\*[!!!sp]*** .nr \$* (-> \n[\$1])
89 . do tm1 "\*[!!!sp]*** .ds \$^
97 . tm1 "\*[!!!sp]*** .ds1 \$^
105 . do tm1 "\*[!!!sp]*** .as \$^
113 . tm1 "\*[!!!sp]*** .as1 \$^
118 . rn substring !!substring
124 . tm1 "\*[!!!sp]*** .substring \$* (-> `\*[\$1]')
133 . do tm1 "\*[!!!sp]*** .so \$* {
139 . do !!substring !!!sp 1
140 . do tm1 "\*[!!!sp]*** }
144 . !!c We must use `.de' for the redefinition of .mso to avoid
145 . !!c side effects; for example, it might be called with
153 . do tm1 "\*[!!!sp]*** .mso \$* {
159 . do !!substring !!!sp 1
160 . do tm1 "\*[!!!sp]*** }
169 . als !!substring substring
183 . tm1 "\*[!!!sp]*** .als \$*
195 . tm1 "\*[!!!sp]*** .rm \$*
207 . do tm1 "\*[!!!sp]*** .rn \$*
211 .!!c Now the central tracing macros. The redefined `de' macros
212 .!!c create wrapper macros `foo' which emit tracing messages
213 .!!c before and after the call to the traced macro `!!foo'.
215 .!!c Note that we define `!!foo' in advance so that an alias to
216 .!!c `!!!!foo' is possible. The latter occurs if `foo' is
217 .!!c called as \\[foo].
219 .!!c The call to `dei' must be the last instruction in the macro
220 .!!c (since it continues the definition of the macro to trace).
229 . do ie \\n[.br] .do !!ds !!!br .\"
230 . el .do !!ds !!!br '\"
231 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** de trace enter: \\*[!!!br]\\$0 \\$@
232 . el .do tm1 "\\*[!!!sp]*** de trace enter \$1: \\*[!!!br]\\$0 \\$@
235 . do nop \\*[!!\\$0]\\
237 . do !!substring !!!sp 1
238 . do ie \\n[.br] .do !!ds !!!br .\"
239 . el .do !!ds !!!br '\"
240 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
241 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
244 . do tm1 "\*[!!!sp]*** .de \$*
246 . do !!ds !!d1 !!\$1\"
256 . ie \\n[.br] .!!ds !!!br .\"
258 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** de1 trace enter: \\*[!!!br]\\$0 \\$@
259 . el .tm1 "\\*[!!!sp]*** de1 trace enter \$1: \\*[!!!br]\\$0 \\$@
264 . !!substring !!!sp 1
265 . ie \\n[.br] .!!ds !!!br .\"
267 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
268 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
271 . tm1 "\*[!!!sp]*** .de1 \$*
286 . do ie \\n[.br] .do !!ds !!!br .\"
287 . el .do !!ds !!!br '\"
288 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** am trace enter: \\*[!!!br]\\$0 \\$@
289 . el .do tm1 "\\*[!!!sp]*** am trace enter \$1: \\*[!!!br]\\$0 \\$@
292 . do nop \\*[!!\\$0]\\
294 . do !!substring !!!sp 1
295 . do ie \\n[.br] .do !!ds !!!br .\"
296 . el .do !!ds !!!br '\"
297 . ie "\$1"\\$0" .do tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
298 . el .do tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
301 . do tm1 "\*[!!!sp]*** .am \$*
303 . do !!ds !!a1 !!\$1\"
313 . ie \\n[.br] .!!ds !!!br .\"
315 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** am1 trace enter: \\*[!!!br]\\$0 \\$@
316 . el .tm1 "\\*[!!!sp]*** am1 trace enter \$1: \\*[!!!br]\\$0 \\$@
321 . !!substring !!!sp 1
322 . ie \\n[.br] .!!ds !!!br .\"
324 . ie "\$1"\\$0" .tm1 "\\*[!!!sp]*** trace exit: \\*[!!!br]\\$0 \\$@
325 . el .tm1 "\\*[!!!sp]*** trace exit \$1: \\*[!!!br]\\$0 \\$@
328 . tm1 "\*[!!!sp]*** .am1 \$*