[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] proposal: add variable traps to groff.
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] proposal: add variable traps to groff. |
Date: |
Fri, 08 Oct 2004 07:01:14 +0200 (CEST) |
> In addition several number registers are changed by special purpose
> requests. For example the read only \n[.p] is set using .pl.
>From an internal point of view, this is not true. The `pl' request
sets a variable in the top diversion structure (to specify the page
length), and as soon as the user accesses the `.p' register, this
variable is directly read.
> This is I guess because the groff implementation itself has to
> maintain a .vpt at the bottom of the page, so groff must notice when
> \n[.p] changes.
groff tests after each line whether the current position is greater
than the actual page length (or another vertical trap). It uses the
internal variable, not the `.p' register.
> So the request .pl is the groff engine wrapper macro for .nr .p.
Well, you could interpret the groff engine that way, but it probably
hides the real mechanism too much.
> I am using tcl quite a lot nowadays and I found its variable traps
> useful in handling multiple access to a single variable. Maybe this
> is why I thought about having register traps in groff. This might
> be a dumb idea, I do not know. I am just a macro user, so I might
> completely miss the point here.
At the cost of speed you already can trace such registers by
redefining the corresponding requests:
.rn pl pl-orig
.de pl
. pl-orig \\$1
. nr .pl-debug \\n[.p]
..
What you can't trace are escapes like \n[...] or \*[...], so it
actually makes sense to have your `.wr' and `.ws' requests. I've
saved your proposal in my `groff' directory, but I can't promise any
realization in the near future.
Werner