summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorBen Morrow <ben@morrow.me.uk>2010-11-14 16:13:51 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-14 16:44:35 -0800
commit1830b3d9c87f8b1473b0a80759846f7a5dccae5a (patch)
treebeb18022aed134c48b163e704373a677892a1433 /proto.h
parentdd2637fb4f1ec3b64aa66be5b50af8823b480ce4 (diff)
downloadperl-1830b3d9c87f8b1473b0a80759846f7a5dccae5a.tar.gz
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'.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 3bae4fe52b..3a80ae2ae1 100644
--- a/proto.h
+++ b/proto.h
@@ -588,6 +588,18 @@ PERL_CALLCONV const char * Perl_custom_op_name(pTHX_ const OP *o)
#define PERL_ARGS_ASSERT_CUSTOM_OP_NAME \
assert(o)
+PERL_CALLCONV void Perl_custom_op_register(pTHX_ Perl_ppaddr_t ppaddr, const XOP *xop)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_CUSTOM_OP_REGISTER \
+ assert(ppaddr); assert(xop)
+
+PERL_CALLCONV const XOP * Perl_custom_op_xop(pTHX_ const OP *o)
+ __attribute__pure__
+ __attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_CUSTOM_OP_XOP \
+ assert(o)
+
PERL_CALLCONV void Perl_cv_ckproto_len(pTHX_ const CV* cv, const GV* gv, const char* p, const STRLEN len)
__attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_CV_CKPROTO_LEN \