> Before creating a bug report, I would like to verify that I am not
> misunderstanding something and that this is indeed a bug. 
[snip]

Hard to tell.  Maybe it's a feature of Heirloom roff.

The documentation doesn't say much about how these output-line
traps work internally except that they are triggered when
a line containing the trigger has been output.  I guess
they're similar to transparent lines embedded with \!,
with the difference that transparent lines can be used to
trigger macros only when the text is reprocessed (as when
outputting a diversion), otherwise they're copied directly
to the postprocessor.

Since groff doesn't have output-line traps, I decided to
compare the situation with transparent lines embedded in a
diversion (case 5 in the attached source file, with case 4
as control).

The result from case 4 is the same in groff and Heirloom roff
(using the respective nroffs):

  AAAAAA BBB BBB
  .CCC  CCC  DDD
  DDD   DDD  DDD
  DDD

However, while cases 5 and 6 processed with groff result in
exactly the same output as case 4, Heirloom roff seems to
reprocess the lines of the diversion upon output as if they
were input, i.e., the line starting with .CCC is treated as
a macro invocation and disappears from the output:

  AAAAAA BBB BBB
  DDD  DDD   DDD
  DDD

Having more experience with groff, which strictly distinguishes
between input and output, I would say this is a bug in Heirloom
roff, but since our old Ultrix machine has been decommissioned
I no longer have a way to test how AT&T nroff behaved in this
situation.  Does anyone else have an opportunity to check this?


.\"
.\" ================================================================
.do xflag 3
.po 0
.ll 100p
.de CCC
.tm CCC called with \\n(.$ args: \\$@
.\" \Z'\X'SetColor: blue'ccc\X'SetColor: black''\c
..
.de M
.tm M called with \\n(.$ args: \\$@
.\" \Z'\X'SetColor: red'mmm\X'SetColor: black''\c
..

.\" (1) OK if word doesn't appear at line break:
AAA\PM\c
AAA BBB BBB BBB BBB .CCC CCC
DDD DDD DDD DDD DDD

.\" (2) If, by chance, word appears at line break
.\"     then word and remainder of line disappear.
AAA\PM\c
AAA BBB BBB BBB .CCC CCC
DDD DDD DDD DDD DDD

.\" (3) Expected output for (2) (removed \PM)
AAA\c
AAA BBB BBB BBB .CCC CCC
DDD DDD DDD DDD DDD

.\" (4) different input, causing .CCC to be
.\" at the beginning of the output line:
AAA\c
AAA BBB BBB .CCC CCC
DDD DDD DDD DDD DDD

.\" (5) analogous situation with a transparent line
.\"     processed while rereading the diversion:
.di XX
AAA\c
\!.M
AAA BBB BBB .CCC CCC
DDD DDD DDD DDD DDD
.br
.di
.XX

.\" (6) same thing, but without the transparent line:
.di XX
AAA\c
AAA BBB BBB .CCC CCC
DDD DDD DDD DDD DDD
.br
.di
.XX

Reply via email to