groff
[Top][All Lists]
Advanced

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

Re: [Groff] MM's nested lists: AL inside BVL


From: Ted Harding
Subject: Re: [Groff] MM's nested lists: AL inside BVL
Date: Sun, 27 Jun 2010 18:32:48 +0100 (BST)

On 27-Jun-10 12:15:07, Tadziu Hoffmann wrote:
>> I am intrigued by this behaviour, by the way. I consider it to be
>> a close approximation to a bug! I have looked into the classic
>> documentation of UNIX troff, and I have not found any warnings
>> about this.
>> 
>> These days, I do not have access to a UNIX (non-groff) troff,
>> so cannot test it. So, for anyone with access to UNIX troff,
>> or to Heirloom troff, what is the behaviour on these?
> 
> nroff on DEC OSF1 does the same.  I don't have the sources
> but I guess this is pretty much "Unix nroff" since the names
> of the source files found in the binary follow closely those
> of plan9 troff.
> 
> Without looking at the sources I can't tell how it's actually
> done, but my impression is that all processing actually takes
> place as text, so when you say
> 
>   .nr Y \nX
> 
> the internal representation of the number in register X is not
> simply copied to Y, but instead the \nX is first converted
> to its textual representation, and then the line is again
> interpreted and the textual representation is converted back
> to the internal representation of the number.  Perhaps
> inefficient, but predictable.  And this is also why
> 
>   .nr X 9
>   .af X i
>   .nr Y \nX
> 
> doesn't work.

Thanks, Tadziu! I had come to the same impression myself, and had
tried to track it down in the source but got lost!

I have Heirloom troff installed (under /usr/ucb) and get the same
behaviour again. Here are results from [A] gnu nroff and from
[B] heirloom nroff:

[A]
nroff << EOT
> .nr Y 10
> .nr Z (7-8)
> .nr Y (\n[Z])
> The value of Y is \n[Y]
> EOT
The value of Y is -1

nroff << EOT
> .nr Y 10
> .nr Z (7-8)
> .nr Y \n[Z]
> The value of Y is \n[Y]
> EOT
The value of Y is 9

[B]
/usr/ucb/nroff << EOT
> .nr Y 10
> .nr Z (7-8)
> .nr Y (\nZ)
> The value of Y is \nY  \" -1
> EOT
The value of Y is -1

/usr/ucb/nroff << EOT
> .nr Y 10
> .nr Z (7-8)
> .nr Y \nZ
> The value of Y is \nY
> EOT
The value of Y is 9

[Remove the "continuation" prompts "> " from the above if you
want to try this yourselves]

So now we have nroff from GNU groff, DEC OSF1, and Heirloom troff
all doing the same. It looks as though it has been carved in stone
since the beginning! I'm still wondering why this is not explicitly
documented. As well as being a trap for the unwary, it is potentially
also a technique for the ingenious!

Best wishes to all,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 27-Jun-10                                       Time: 18:32:44
------------------------------ XFMail ------------------------------



reply via email to

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