This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Improve custom OP support.
authorBen Morrow <ben@morrow.me.uk>
Mon, 15 Nov 2010 00:13:51 +0000 (16:13 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 15 Nov 2010 00:44:35 +0000 (16:44 -0800)
commit1830b3d9c87f8b1473b0a80759846f7a5dccae5a
treebeb18022aed134c48b163e704373a677892a1433
parentdd2637fb4f1ec3b64aa66be5b50af8823b480ce4
Improve custom OP support.

Change the custom op registrations from two separate hashes to one hash
holding structure pointers, and add API functions to register ops and
look them up. This will make it easier to add new properties of custom
ops in the future. Copy entries across from the old hashes where
necessary, to preserve compatibility.

Add two new properties, in addition to the already-existing 'name' and
'description': 'class' and 'peep'. 'class' is one of the OA_*OP
constants, and allows B and other introspection mechanisms to work with
custom ops that aren't BASEOPs. 'peep' is a pointer to a function that
will be called for ops of this type from Perl_rpeep.

Adjust B.xs to take account of the new properties, and also to give
custom ops their registered name rather than simply 'custom'.
13 files changed:
embed.fnc
embedvar.h
ext/B/B.xs
global.sym
intrpvar.h
mathoms.c
op.c
op.h
opcode.h
perl.h
proto.h
regen/opcode.pl
sv.c