develooper Front page | perl.perl6.internals | Postings from June 2002

Some minor changes

Thread Next
From:
Dan Sugalski
Date:
June 30, 2002 07:53
Subject:
Some minor changes
Message ID:
a05111b00b943903a7e23@[128.252.5.12]
I've added (or will add, depending on whether this gets to the list 
before the CVS syncup does) a couple of new opcodes.

find_type(INT, STR) returns the integer identifier number for any 
known PMC type. That means you can now do:

     find_type I0, "PerlArray"
     new P0, I0

instead of

     new P0, .PerlArray

Not a big deal for builtin types, but it means that you don't have to 
tell the assembler about every new PMC class that gets added to the 
system. (At the moment you do need to add the new class to 
global_setup.c still, but I'm working on fixing that so PMCs can be 
dynamically loadable)

lookback(INT|NUM|STR|PMC, INT) looks back up the user stack for the 
entry you asked for with $2 and puts it in $1. Types are checked, so 
no sneaky putting a PMC pointer into a string register or anything. 
If $2 is negative, it counts up from the bottom, with the bottommost 
entry in the stack being -1.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk

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