develooper Front page | perl.perl6.internals | Postings from September 2001

[PATCH] Constant Access Macros

Thread Previous | Thread Next
From:
Jason Gloudon
Date:
September 30, 2001 20:38
Subject:
[PATCH] Constant Access Macros
Message ID:
20010930233737.A24623@gloudon.com
On Sun, Sep 30, 2001 at 11:31:21AM -0400, Gregor N. Purdy wrote:
 
> And, BTW, the current PackFile_Constant type isn't using a union.
> It has separate members for each type of constant. This could be
> changed once things are working. There's probably a few other
> things that could use some cleanup/refinement too, such as
> documentation.

Here is a patch for macros for accessing constants from ops.  This uses
(INT|STR|NUM)_PCONST(i) for the relevant types. Best to avoid filling opcode
definitions with manual structure dereferences.

/* SET Nx, CONSTANT */
AUTO_OP set_n_nc {
  NUM_REG(P1) = PCONST(P2)->number;
}

is now 

/* SET Nx, CONSTANT */
AUTO_OP set_n_nc {
  NUM_REG(P1) = NUM_PCONST(P2);
}


-- 
Jason


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About