B-C
view release on metacpan or search on metacpan
ByteLoader/ByteLoader.xs view on Meta::CPAN
}
MODULE = ByteLoader PACKAGE = ByteLoader
PROTOTYPES: ENABLE
void
import(...)
PREINIT:
SV *sv = newSVpvn ("", 0);
PPCODE:
if (!sv)
croak ("Could not allocate ByteLoader buffers");
filter_add(byteloader_filter, sv);
void
unimport(...)
PPCODE:
filter_del(byteloader_filter);
# Local variables:
# c-indent-level: 4
# End:
# vim: expandtab shiftwidth=4:
#endif
MODULE = B PACKAGE = B::PMOP
#if defined(RX_UTF8) && PERL_VERSION < 20
SV*
precomp(o)
B::OP o
PPCODE:
{
if (SvROK(ST(0))) {
IV tmp = SvIV((SV*)SvRV(ST(0)));
o = INT2PTR(B__OP,tmp);
}
else
croak("precomp(o) argument is not a reference");
if (o) {
REGEXP *rx = PM_GETRE(cPMOPo);
if (!rx)
RETVAL = (!SvREADONLY(stash) && Gv_AMG(stash)) ? 1 : 0;
OUTPUT:
RETVAL
#if PERL_VERSION > 13
# returns a single or multiple ENAME(s), since 5.14
void
ENAMES(hv)
B::HV hv
PPCODE:
if (SvOOK(hv)) {
if (HvENAME_HEK(hv)) {
I32 i = 0;
const I32 count = HvAUX(hv)->xhv_name_count;
if (count) {
HEK** names = HvAUX(hv)->xhv_name_u.xhvnameu_names;
HEK *const *hekp = names + (count < 0 ? 1 : 0);
HEK *const *const endp = names + (count < 0 ? -count : count);
while (hekp < endp) {
assert(*hekp);
HEK_UTF8(hek) ? SVf_UTF8|SVs_TEMP : SVs_TEMP);
XSRETURN(1);
}
}
}
XSRETURN_UNDEF;
I32
name_count(hv)
B::HV hv
PPCODE:
PERL_UNUSED_VAR(RETVAL);
PERL_UNUSED_VAR(TARG);
if (SvOOK(hv))
mPUSHi(HvAUX(hv)->xhv_name_count);
else
mPUSHi(0);
XSRETURN(1);
#endif
# Return the contents of the op_aux array as a list of IV/SV/GV/PADOFFSET objects.
# This version here returns the padoffset of SV/GV under ithreads, and not the
# SV/GV itself. It also uses simplified mPUSH macros.
# With MCONCAT contrary to B::aux_list always return both slots, binary and utf8.
# The design of the upstream aux_list method deviates significantly from proper B design.
void
aux_list_thr(o)
B::OP o
PPCODE:
PERL_UNUSED_VAR(cv); /* not needed on unthreaded builds */
switch (o->op_type) {
default:
XSRETURN(0); /* by default, an empty list */
case OP_MULTIDEREF:
#ifdef USE_ITHREADS
# define PUSH_SV(item) mPUSHu((item)->pad_offset)
#else
# define PUSH_SV(item) PUSHs(make_sv_object(aTHX_ (item)->sv))
COP_stashflags(o)
B::COP o
#endif
#ifdef CopLABEL_len_flags
SV*
COP_label(o)
B::OP o
PPCODE:
{
STRLEN len;
U32 flags;
const char *pv = CopLABEL_len_flags(cCOPo, &len, &flags);
PERL_UNUSED_VAR(RETVAL);
ST(0) = pv ? sv_2mortal(newSVpvn_flags(pv, len, flags))
: &PL_sv_undef;
}
XSRETURN(1);
RETVAL
MODULE = B__OP PACKAGE = B::OP PREFIX = op_
#ifdef need_op_slabbed
I32
op_slabbed(op)
B::OP op
PPCODE:
mPUSHi(op->op_slabbed);
I32
op_savefree(op)
B::OP op
PPCODE:
mPUSHi(op->op_savefree);
I32
op_static(op)
B::OP op
PPCODE:
mPUSHi(op->op_static);
#endif
#ifdef need_op_folded
I32
op_folded(op)
B::OP op
PPCODE:
mPUSHi(op->op_folded);
#endif
MODULE = B PACKAGE = B::HV PREFIX = Hv
#ifdef need_HvARRAY_utf8
void
HvARRAY_utf8(hv)
B::HV hv
PPCODE:
if (HvKEYS(hv) > 0) {
HE *he;
(void)hv_iterinit(hv);
EXTEND(sp, HvKEYS(hv) * 2);
while ((he = hv_iternext(hv))) {
if (HeSVKEY(he)) {
mPUSHs(HeSVKEY(he));
} else if (HeKUTF8(he)) {
PUSHs(newSVpvn_flags(HeKEY(he), HeKLEN(he), SVf_UTF8|SVs_TEMP));
} else {
( run in 0.887 second using v1.01-cache-2.11-cpan-71847e10f99 )