groff
[Top][All Lists]
Advanced

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

[Groff] Copy register value to another register?


From: Clarke Echols
Subject: [Groff] Copy register value to another register?
Date: Sun, 30 May 2010 17:41:51 -0600
User-agent: Thunderbird 2.0.0.23 (X11/20090817)


I'm attempting to capture the current value of the vertical position register ( \n[nl] ) and set another register to that value so I can
use it to return to the current location for further output.

If I have inline code like this:

  >     .nr returnlocation \n[nl]
  >
  >          <do some stuff here>
  >
  >     .sp |\n[returnlocation]u

it works as expected.

But I prefer to use a macro like this:

         .de macro
         .nr returnlocation \n[nl]u  \"Preserve location to return to.
              <other code>

But when I do that, the register [returnlocation] is assigned a value
of -1 when I call the macro.

If I do this:

         .de macro
         .nr returnlocation \n[nl]u
         .nr returnlocatino \n[nl]u
              <other code>

then in the groff source file:

         <text>
         .macro arg
         <more text after macro-execute starts>

the defined register has an immediate value of -2 after the second "nr"
request.

It's not obvious to me that calling a macro should render the value
of \n[nl]u invalid (the usual C/Unix error case where you get -1
for a value).

Does anyone more experienced than I care to explain what's going on?

Thanks,

Clarke






reply via email to

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