1 /* This file is part of the Sub::Op Perl module.
2 * See http://search.cpan.org/dist/Sub-Op/ */
4 #define PERL_NO_GET_CONTEXT
9 #define __PACKAGE__ "Sub::Op::Test"
10 #define __PACKAGE_LEN__ (sizeof(__PACKAGE__)-1)
14 STATIC HV *sub_op_test_map = NULL;
16 STATIC OP *sub_op_test_check(pTHX_ OP *o, void *ud_) {
17 char buf[sizeof(void*)*2+1];
20 (void) hv_store(sub_op_test_map, buf, sprintf(buf, "%"UVxf, PTR2UV(o)), cb, 0);
25 STATIC OP *sub_op_test_pp(pTHX) {
32 char buf[sizeof(void*)*2+1];
34 svp = hv_fetch(sub_op_test_map, buf, sprintf(buf, "%"UVxf, PTR2UV(PL_op)), 0);
45 items = call_sv(cb, G_ARRAY);
48 for (i = 0; i < items; ++i)
58 /* --- XS ------------------------------------------------------------------ */
60 MODULE = Sub::Op::Test PACKAGE = Sub::Op::Test
66 sub_op_test_map = newHV();
70 _init(SV *name, SV *cb)
77 if (SvTYPE(cb) >= SVt_PVCV) {
78 k.name = SvPV_const(name, k.len);
79 k.check = sub_op_test_check;
80 k.ud = SvREFCNT_inc(cb);
81 k.pp = sub_op_test_pp;
82 sub_op_register(aTHX_ &k);