X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Plugin.xs;h=b4db0bd724ac2553ef2711c7d2da51df88437209;hb=1fc6cd8f496c252e5a93fbde4ee8ee02bfc30c17;hp=5095c730d47133255bc6526a415295f16cd16428;hpb=1563077bd33bb07b7ef50968c22739c722452769;p=perl%2Fmodules%2Fre-engine-Plugin.git diff --git a/Plugin.xs b/Plugin.xs index 5095c73..b4db0bd 100644 --- a/Plugin.xs +++ b/Plugin.xs @@ -308,17 +308,28 @@ STATIC const rep_hint_t *rep_hint(pTHX) { Perl_croak(aTHX_ "Not an object"); \ } +#if REP_HAS_PERL(5, 19, 4) +# define REP_ENG_EXEC_MINEND_TYPE SSize_t +#else +# define REP_ENG_EXEC_MINEND_TYPE I32 +#endif + START_EXTERN_C EXTERN_C const regexp_engine engine_plugin; -#if PERL_VERSION <= 10 -EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV * const, const U32); -#else +#if REP_HAS_PERL(5, 11, 0) EXTERN_C REGEXP * Plugin_comp(pTHX_ SV * const, U32); +#else +EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV * const, const U32); #endif EXTERN_C I32 Plugin_exec(pTHX_ REGEXP * const, char *, char *, - char *, I32, SV *, void *, U32); + char *, REP_ENG_EXEC_MINEND_TYPE, SV *, void *, U32); +#if REP_HAS_PERL(5, 19, 1) +EXTERN_C char * Plugin_intuit(pTHX_ REGEXP * const, SV *, const char * const, + char *, char *, U32, re_scream_pos_data *); +#else EXTERN_C char * Plugin_intuit(pTHX_ REGEXP * const, SV *, char *, char *, U32, re_scream_pos_data *); +#endif EXTERN_C SV * Plugin_checkstr(pTHX_ REGEXP * const); EXTERN_C void Plugin_free(pTHX_ REGEXP * const); EXTERN_C void * Plugin_dupe(pTHX_ REGEXP * const, CLONE_PARAMS *); @@ -336,9 +347,7 @@ EXTERN_C SV * Plugin_package(pTHX_ REGEXP * const); #ifdef USE_ITHREADS EXTERN_C void * Plugin_dupe(pTHX_ REGEXP * const, CLONE_PARAMS *); #endif -END_EXTERN_C -START_EXTERN_C EXTERN_C const regexp_engine engine_plugin; END_EXTERN_C @@ -354,9 +363,12 @@ const regexp_engine engine_plugin = { Plugin_numbered_buff_LENGTH, Plugin_named_buff, Plugin_named_buff_iter, - Plugin_package, + Plugin_package #if defined(USE_ITHREADS) - Plugin_dupe, + , Plugin_dupe +#endif +#if REP_HAS_PERL(5, 17, 0) + , 0 #endif }; @@ -384,7 +396,7 @@ typedef struct replug { SV * cb_num_capture_buff_LENGTH; } *re__engine__Plugin; -#if PERL_VERSION >= 11 +#if REP_HAS_PERL(5, 11, 0) # define rxREGEXP(RX) (SvANY(RX)) # define newREGEXP(RX) ((RX) = ((REGEXP*) newSV_type(SVt_REGEXP))) #else @@ -393,10 +405,10 @@ typedef struct replug { #endif REGEXP * -#if PERL_VERSION <= 10 -Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) -#else +#if REP_HAS_PERL(5, 11, 0) Plugin_comp(pTHX_ SV * const pattern, U32 flags) +#else +Plugin_comp(pTHX_ const SV * const pattern, const U32 flags) #endif { dSP; @@ -432,7 +444,7 @@ Plugin_comp(pTHX_ SV * const pattern, U32 flags) rx->extflags = flags; /* Flags for perl to use */ rx->engine = RE_ENGINE_PLUGIN; /* Compile to use this engine */ -#if PERL_VERSION <= 10 +#if !REP_HAS_PERL(5, 11, 0) rx->refcnt = 1; /* Refcount so we won't be destroyed */ /* Precompiled pattern for pp_regcomp to use */ @@ -494,7 +506,8 @@ Plugin_comp(pTHX_ SV * const pattern, U32 flags) I32 Plugin_exec(pTHX_ REGEXP * const RX, char *stringarg, char *strend, - char *strbeg, I32 minend, SV *sv, void *data, U32 flags) + char *strbeg, REP_ENG_EXEC_MINEND_TYPE minend, + SV *sv, void *data, U32 flags) { dSP; I32 matched; @@ -538,11 +551,19 @@ Plugin_exec(pTHX_ REGEXP * const RX, char *stringarg, char *strend, } char * +#if REP_HAS_PERL(5, 19, 1) +Plugin_intuit(pTHX_ REGEXP * const RX, SV *sv, const char * const strbeg, + char *strpos, char *strend, U32 flags, re_scream_pos_data *data) +#else Plugin_intuit(pTHX_ REGEXP * const RX, SV *sv, char *strpos, - char *strend, U32 flags, re_scream_pos_data *data) + char *strend, U32 flags, re_scream_pos_data *data) +#endif { PERL_UNUSED_ARG(RX); PERL_UNUSED_ARG(sv); +#if REP_HAS_PERL(5, 19, 1) + PERL_UNUSED_ARG(strbeg); +#endif PERL_UNUSED_ARG(strpos); PERL_UNUSED_ARG(strend); PERL_UNUSED_ARG(flags);