bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug or feature?


From: Werner LEMBERG
Subject: Re: Bug or feature?
Date: Sun, 26 Feb 2012 11:23:26 +0100 (CET)

Sorry for the late reply.

> .nf
> .de show
> Pass \\$*
> ..
> .
> .de clean
> .show Uncleaned = This is \\$* shown
> .ev cln
> .nf
> .box a
> \\$*
> .fl
> .box
> .chop a \" remove newline
> .asciify a
> .show Cleaned = This is \\*[a] shown
> Cleaned = This is \\*[a] shown
> .tm This is \\*[a] shown
> .ev
> ..
> .
> .clean Deri \N'76' James
>
> Which should produce:-
>
> Pass Uncleaned = This is Deri L James shown
> Pass Cleaned = This is Deri
> Cleaned = This is Deri L James shown
>
> The line 'Pass Cleaned" has been truncated where the \N'76' glyph
> should be, note that it is not just \\*[a] truncated but the
> following literal 'shown' which is missing as well.
>
> The .tm displays "This is Deri  James shown".
>
> So it seems it is the parameter passing mechanism which chokes on
> the glyph in the string register.
>
> Feature or bug?

I consider it a feature, however, it is undocumented.

The \N'...' sequence can't be converted with `.asciify'; it stores
value 0 as the character code in the macro's input token list and the
glyph node itself in the macro's output node list (see section
"`gtroff' internals" in the groff info manual for details).

If you use \\$*, only input tokens are handled, converted to a string.
In other words, the output node list of macro `a' is ignored, and only
the input token list is copied.  Since groff internally uses strings
which are delimited by NULL bytes, this value 0 prematurely finishes
the argument string, yielding the result you are observing.

Try

  .clean Deri \\\\N'76' James

to avoid premature expansion of \N'...' and you get this:

  Pass Uncleaned = This is Deri L James shown
  Pass Cleaned = This is Deri L James shown
  Cleaned = This is Deri L James shown

BTW, this is one of the few occasions where \E doesn't give the
desired result:

  .clean Deri \EN'76' James

yields

  Pass Uncleaned = This is Deri L James shown
  Pass Cleaned = This is Deri
  Cleaned = This is Deri L James shown

because \EN'76' gets expanded to a glyph node as soon as the diversion
`a' gets built.

I would be glad if you could improve the documentation of .asciify,
explicitly noting that \N'...' can't be converted.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]