X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=blobdiff_plain;f=Plugin.h;h=7fc63d43760d11933b9cfc86c38fe6a9aa5c22a9;hp=2124ad871a51822b04498f25e567b64ccbd1e47d;hb=92cf1014a173792464bbe74d342d9c44bb7698ee;hpb=2dd7bc5f80da4fe2220e28de1102641c239d084c diff --git a/Plugin.h b/Plugin.h index 2124ad8..7fc63d4 100644 --- a/Plugin.h +++ b/Plugin.h @@ -1,4 +1,3 @@ - #define GET_SELF_FROM_PPRIVATE(pprivate) \ re__engine__Plugin self; \ SELF_FROM_PPRIVATE(self,pprivate); @@ -15,7 +14,11 @@ START_EXTERN_C EXTERN_C const regexp_engine engine_plugin; -EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV const *, const U32); +#if PERL_VERSION <= 10 +EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV * const, const U32); +#else +EXTERN_C REGEXP * Plugin_comp(pTHX_ SV * const, U32); +#endif EXTERN_C I32 Plugin_exec(pTHX_ REGEXP * const, char *, char *, char *, I32, SV *, void *, U32); EXTERN_C char * Plugin_intuit(pTHX_ REGEXP * const, SV *, char *, @@ -28,7 +31,9 @@ EXTERN_C void Plugin_numbered_buff_STORE(pTHX_ REGEXP * const, const I32, SV const * const); EXTERN_C I32 Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const, const SV * const, const I32); -EXTERN_C SV * Plugin_named_buff_FETCH(pTHX_ REGEXP * const, SV * const, +EXTERN_C SV * Plugin_named_buff (pTHX_ REGEXP * const, SV * const, + SV * const, const U32); +EXTERN_C SV * Plugin_named_buff_iter (pTHX_ REGEXP * const, const SV * const, const U32); EXTERN_C SV * Plugin_package(pTHX_ REGEXP * const); #ifdef USE_ITHREADS @@ -50,7 +55,8 @@ const regexp_engine engine_plugin = { Plugin_numbered_buff_FETCH, Plugin_numbered_buff_STORE, Plugin_numbered_buff_LENGTH, - Plugin_named_buff_FETCH, + Plugin_named_buff, + Plugin_named_buff_iter, Plugin_package, #if defined(USE_ITHREADS) Plugin_dupe, @@ -58,9 +64,9 @@ const regexp_engine engine_plugin = { }; typedef struct replug { - /* Pointer back to the containing REGEXP struct so that accessors + /* Pointer back to the containing regexp struct so that accessors * can modify nparens, gofs etc. */ - REGEXP * rx; + struct regexp * rx; /* A copy of the pattern given to comp, for ->pattern */ SV * pattern; @@ -71,10 +77,8 @@ typedef struct replug { /* The ->stash */ SV * stash; - /* - * Callbacks - */ - + /* Callbacks */ + SV * cb_exec; SV * cb_free; /* ->num_captures */ @@ -82,3 +86,11 @@ typedef struct replug { SV * cb_num_capture_buff_STORE; SV * cb_num_capture_buff_LENGTH; } *re__engine__Plugin; + +#if PERL_VERSION >= 11 +# define rxREGEXP(RX) (SvANY(RX)) +# define newREGEXP(RX) ((RX) = ((REGEXP*) newSV_type(SVt_REGEXP))) +#else +# define rxREGEXP(RX) (RX) +# define newREGEXP(RX) (Newxz((RX), 1, struct regexp)) +#endif