-------- Original Message --------
Subject: Re: macro PIR needs
Date: Mon, 14 Apr 2008 18:03:44 +0200
From: François Perrad <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: jerry gay <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
jerry gay wrote:
On Mon, Apr 14, 2008 at 5:03 AM, Klaas-Jan Stol <[EMAIL PROTECTED]> wrote:
IMCC's macro processor doesn't currently allow for uniquely generated
variable names. It's in the pdd (19), but not yet implemented.
You're right in that it only works for labels.
kjs
On Mon, Apr 14, 2008 at 1:32 PM, François Perrad
<[EMAIL PROTECTED]> wrote:
>
> In Lua libraries, I wrote many time the same piece of code.
> The purpose of this code is to register each function.
> So, I try to write the following PIR macro :
>
> .macro register(tname, fname)
> .const .Sub $fname = .fname
> $fname.'setfenv'(_lua__GLOBAL)
> set $P1, .fname
> .tname[$P1] = $fname
> .endm
>
also note that .Sub is deprecated, and should be replaced by 'Sub'
~jerry
Perhaps in the future, but currently, NO.
The syntax
new $P0, 'Sub'
is OK.
But with .const, the only is way
.const .Sub funct = 'funct'
François.