[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in expression handling with registers in non-numeric format
From: |
Werner LEMBERG |
Subject: |
Re: Bug in expression handling with registers in non-numeric format |
Date: |
Sat, 11 Feb 2006 09:28:19 +0100 (CET) |
> .nr q 1
> .nr N 1
> .af q i
> .ie (\n[q]=1)&(\n[N]=1) .tm Ho!
> .el .tm boo
>
> bug.r:4: expected `;' after scale-indicator (got `=')
> boo
>
> By the time the if-else is evaluated, the number registers have been
> interpolated, and the expression is
>
> .ie (i=1)&(1=1) .tm Ho!
>
> The "i=1" then triggers the error message [..]
>
> Original troff appears to have evaluated this expression (i=1) as
> false with no error, so simply using the actual value for of the
> number register rather than its formatted representation is also
> wrong.
Hmm, I don't see a bug. groff emits a non-fatal error message and
continues correctly by evaluating the first term to `false'.
> In mm, it is possible to use the "P" number register in the above
> fragment (and also in one other place) to work around this.
Please provide a patch.
> However, I believe the bug is really a troff bug, and not an mm one.
What exactly do you consider a bug? Looking into the info file of
groff, section `Assigning Formats', I see this sentence:
When a register is used in the text of an input file (as opposed to
part of an expression), it is textually replaced (or interpolated)
with a representation of that number.
Actually, this is incorrect, as you demonstrate. I could try to
change troff, making the above sentence true (this is, ignoring
effects of `.af' within a numerical expression), but this probably
breaks existing code.
As a quick fix I'll correct groff.info :-)
Thanks for the report.
Werner