groff
[Top][All Lists]
Advanced

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

Re: [Groff] on \$0


From: Werner LEMBERG
Subject: Re: [Groff] on \$0
Date: Fri, 12 Jul 2002 10:05:40 +0200 (CEST)

> \\$0 refers to the macro name under which it a macro was called.
> Unfortunately, \$0 is not set, that's a pity.  It would be great
> for defining variable names that are local to a macro.  For example:
> 
> .de range:some_macro
> .  ds \\$0:s
> ..
> .als M range:some_macro
> 
> 
> The local variable name `\\$0:s' expands to `M:s', but it should be
> `range:some_macro:s'.
> 
> 
> I would wish to be able to do:
> 
> .de range:some_macro
> .  ds \$0:s            \" `\$0' is actually always empty.
> ..
> .als M range:some_macro
> 
> 
> Unfortunately, \$0 is not set at copy-in time.

Have a look into trace.tmac.  For example, you could do the following:

  .rn de de!!
  .de!! de
  .  ds namespace \\$1
  .  de!! \\$1
  ..
  .
  .de test
  .  ds \\*[namespace]:s xxx
  ..
  .
  .als M test
  .M
  .
  .tm \*[namespace]:s
    => test:s
  .tm \*[\*[namespace]:s]
    => xxx

IMHO this should be sufficient for your purposes.


      Werner

reply via email to

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