Implement the roff(7) .shift and .return requests,
authorschwarze <schwarze@openbsd.org>
Thu, 23 Aug 2018 14:16:11 +0000 (14:16 +0000)
committerschwarze <schwarze@openbsd.org>
Thu, 23 Aug 2018 14:16:11 +0000 (14:16 +0000)
commit3dc5225d1395cc5b77bcbe172d4e8bbf2d9d7474
tree812239974ebead2f64b581ffdaa62ac71c784b8a
parentd68164a26921c7f7b0c176ab405d710a7cd3703f
Implement the roff(7) .shift and .return requests,
for example used by groff_hdtbl(7) and groff_mom(7).

Also correctly interpolate arguments during nested macro execution
even after .shift and .return, implemented using a stack of argument
arrays.

Note that only read.c, but not roff.c can detect the end of a macro
execution, and the existence of .shift implies that arguments cannot
be interpolated up front, so unfortunately, this includes a partial
revert of roff.c rev. 1.209, moving argument interpolation back into
the function roff_res().
20 files changed:
regress/usr.bin/mandoc/roff/Makefile
regress/usr.bin/mandoc/roff/de/infinite.in
regress/usr.bin/mandoc/roff/de/infinite.out_ascii
regress/usr.bin/mandoc/roff/de/infinite.out_lint
regress/usr.bin/mandoc/roff/return/Makefile [new file with mode: 0644]
regress/usr.bin/mandoc/roff/return/basic.in [new file with mode: 0644]
regress/usr.bin/mandoc/roff/return/basic.out_ascii [new file with mode: 0644]
regress/usr.bin/mandoc/roff/return/basic.out_lint [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/Makefile [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/bad.in [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/bad.out_ascii [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/bad.out_lint [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/basic.in [new file with mode: 0644]
regress/usr.bin/mandoc/roff/shift/basic.out_ascii [new file with mode: 0644]
share/man/man7/roff.7
usr.bin/mandoc/libmandoc.h
usr.bin/mandoc/mandoc.1
usr.bin/mandoc/mandoc.h
usr.bin/mandoc/read.c
usr.bin/mandoc/roff.c