X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Plugin.xs;h=9004adeed655e6ce3def1c5a7950f641945ce861;hb=5aedd658d1e70fe63277bc50f162a16be1574d55;hp=2229d48f3882b3ea8acb2ab1b4a64f83767b52aa;hpb=b79029228fea29f8c1e84d62831a0a1c8b0ddefe;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/Plugin.xs b/Plugin.xs index 2229d48..9004ade 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -155,7 +155,7 @@ const regexp_engine engine_plugin = { typedef struct replug { /* Pointer back to the containing regexp struct so that accessors - * can modify nparens, gofs etc. */ + * can modify nparens, gofs, etc... */ struct regexp *rx; /* A copy of the pattern given to comp, for ->pattern */ @@ -215,7 +215,7 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) obj = newSV(0); SvREFCNT_inc_simple_void_NN(obj); Newxz(re, 1, struct replug); - sv_setref_pv(obj, "re::engine::Plugin", (void *) re); + sv_setref_pv(obj, XSH_PACKAGE, (void *) re); newREGEXP(RX); rx = rxREGEXP(RX); @@ -233,8 +233,7 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) rx->precomp = savepvn(pbuf, rx->prelen); /* Set up qr// stringification to be equivalent to the supplied - * pattern, this should be done via overload eventually. - */ + * pattern, this should be done via overload eventually */ rx->wraplen = rx->prelen; Newx(rx->wrapped, rx->wraplen, char); Copy(rx->precomp, rx->wrapped, rx->wraplen, char); @@ -247,9 +246,8 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) re->pattern = (SV *) pattern; SvREFCNT_inc_simple_void(re->pattern); - /* If there's an exec callback, store it into the private object so - * that it will be the one to be called, even if the engine changes - * in between */ + /* If there's an exec callback, store it into the private object so that it + * will be the one to be called, even if the engine changes in between */ if (h->exec) { re->cb_exec = h->exec; SvREFCNT_inc_simple_void_NN(h->exec); @@ -259,9 +257,8 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) re->cb_num_capture_buff_STORE = NULL; re->cb_num_capture_buff_LENGTH = NULL; - /* Call our callback function if one was defined, if not we've - * already set up all the stuff we're going to to need for - * subsequent exec and other calls */ + /* Call our callback function if one was defined, if not we've already set up + * all the stuff we're going to to need for subsequent exec and other calls */ if (h->comp) { ENTER; SAVETMPS; @@ -277,8 +274,7 @@ Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) } /* If any of the comp-time accessors were called we'll have to - * update the regexp struct with the new info. - */ + * update the regexp struct with the new info */ Newxz(rx->offs, rx->nparens + 1, regexp_paren_pair); return RX; @@ -550,7 +546,7 @@ Plugin_package(pTHX_ REGEXP * const RX) { PERL_UNUSED_ARG(RX); - return newSVpvs("re::engine::Plugin"); + return newSVpvs(XSH_PACKAGE); } static void xsh_user_global_setup(pTHX) { @@ -588,11 +584,13 @@ void pattern(re::engine::Plugin self, ...) PPCODE: XPUSHs(self->pattern); + XSRETURN(1); void str(re::engine::Plugin self, ...) PPCODE: XPUSHs(self->str); + XSRETURN(1); void mod(re::engine::Plugin self) @@ -630,6 +628,7 @@ PPCODE: XSRETURN_EMPTY; } else { XPUSHs(self->stash); + XSRETURN(1); } void @@ -644,6 +643,7 @@ PPCODE: } else { XPUSHs(sv_2mortal(&PL_sv_undef)); } + XSRETURN(1); } void @@ -658,6 +658,7 @@ PPCODE: } else { XPUSHs(sv_2mortal(&PL_sv_undef)); } + XSRETURN(1); } void @@ -672,6 +673,7 @@ PPCODE: } else { XPUSHs(sv_2mortal(&PL_sv_undef)); } + XSRETURN(1); } void @@ -682,6 +684,7 @@ PPCODE: self->cb_exec = ST(1); SvREFCNT_inc_simple_void(self->cb_exec); } + XSRETURN(0); void _num_capture_buff_FETCH(re::engine::Plugin self, ...) @@ -691,6 +694,7 @@ PPCODE: self->cb_num_capture_buff_FETCH = ST(1); SvREFCNT_inc_simple_void(self->cb_num_capture_buff_FETCH); } + XSRETURN(0); void _num_capture_buff_STORE(re::engine::Plugin self, ...) @@ -700,6 +704,7 @@ PPCODE: self->cb_num_capture_buff_STORE = ST(1); SvREFCNT_inc_simple_void(self->cb_num_capture_buff_STORE); } + XSRETURN(0); void _num_capture_buff_LENGTH(re::engine::Plugin self, ...) @@ -709,6 +714,7 @@ PPCODE: self->cb_num_capture_buff_LENGTH = ST(1); SvREFCNT_inc_simple_void(self->cb_num_capture_buff_LENGTH); } + XSRETURN(0); SV * _tag(SV *comp, SV *exec) @@ -725,3 +731,4 @@ void ENGINE() PPCODE: XPUSHs(sv_2mortal(newSViv(PTR2IV(&engine_plugin)))); + XSRETURN(1);