On 08-Oct-09 10:38:13, Miklos Somogyi wrote: > Hello Folks, > > A macro that updates a number register needs the name of the > register, its value and the increment. > Is it possible to do this with only two parameters? I.e. to > recover the name from the \n[reg] value or vice-versa? > > Miklos
Hi Miklos, It would help if you were more explicit about what you are really trying to do here! If you do \n[reg] (or \\n[reg] in a macro) you will only get the value; you will not be able to find out the name from the value! You could get the increment by evaluating, in turn .nr nreg0 \n[reg] .nr nreg1 \n+[reg] .nr incrt \n[nreg1]-\n[nreg0] .nr reg \nreg0 \"(to reset reg) The following illustrates the above: .nr reg 5 3 .de mymac .nr nreg0 \\n[\\$1] .nr nreg1 \\n+[\\$1] .nr incrt \\n[nreg1]-\\n[nreg0] .nr \\$1 \\n[nreg0] .br Initial value of \en[\\$1]: \\n[nreg0] .br Next value of \en[\\$1]: \\n[nreg1] .br Increment: \\n[incrt] .br Final value of \en[\\$1]: \\n[\\$1] = \\n[nreg0] .. .mymac reg which produces the output: Initial value of \n[reg]: 5 Next value of \n[reg]: 8 Increment: 3 Final value of \n[reg]: 5 = 5 Is this the sort of thing you are looking for? If not, what are you looking for? Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <ted.hard...@manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 08-Oct-09 Time: 12:09:26 ------------------------------ XFMail ------------------------------