]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blob - Plugin.h
Fix up prototypes to match the callbacks in the actual 5.10 release
[perl/modules/re-engine-Plugin.git] / Plugin.h
1
2 #define GET_SELF_FROM_PPRIVATE(pprivate)        \
3     re__engine__Plugin self;                    \
4     SELF_FROM_PPRIVATE(self,pprivate);
5
6 /* re__engine__Plugin self; SELF_FROM_PPRIVATE(self,rx->pprivate) */
7 #define SELF_FROM_PPRIVATE(self, pprivate)                   \
8         if (sv_isobject(pprivate)) {                             \
9         SV * ref = SvRV((SV*)pprivate);                      \
10             IV tmp = SvIV((SV*)ref);                             \
11             self = INT2PTR(re__engine__Plugin,tmp);              \
12     } else {                                                 \
13         Perl_croak(aTHX_ "Not an object");                   \
14     }
15
16 START_EXTERN_C
17 EXTERN_C const regexp_engine engine_plugin;
18 EXTERN_C REGEXP * Plugin_comp(pTHX_ const SV const *, const U32);
19 EXTERN_C I32      Plugin_exec(pTHX_ REGEXP * const, char *, char *,
20                               char *, I32, SV *, void *, U32);
21 EXTERN_C char *   Plugin_intuit(pTHX_ REGEXP * const, SV *, char *,
22                                 char *, U32, re_scream_pos_data *);
23 EXTERN_C SV *     Plugin_checkstr(pTHX_ REGEXP * const);
24 EXTERN_C void     Plugin_free(pTHX_ REGEXP * const);
25 EXTERN_C void     Plugin_numbered_buff_FETCH(pTHX_ REGEXP * const,
26                                              const I32, SV * const);
27 EXTERN_C void     Plugin_numbered_buff_STORE(pTHX_ REGEXP * const,
28                                              const I32, SV const * const);
29 EXTERN_C I32      Plugin_numbered_buff_LENGTH(pTHX_ REGEXP * const,
30                                               const SV * const, const I32);
31 EXTERN_C SV *     Plugin_named_buff (pTHX_ REGEXP * const, SV * const,
32                                      SV * const, const U32);
33 EXTERN_C SV *     Plugin_named_buff_iter (pTHX_ REGEXP * const, const SV * const,
34                                           const U32);
35 EXTERN_C SV *     Plugin_package(pTHX_ REGEXP * const);
36 #ifdef USE_ITHREADS
37 EXTERN_C void *   Plugin_dupe(pTHX_ REGEXP * const, CLONE_PARAMS *);
38 #endif
39 END_EXTERN_C
40
41 START_EXTERN_C
42 EXTERN_C const regexp_engine engine_plugin;
43 END_EXTERN_C
44
45 #define RE_ENGINE_PLUGIN (&engine_plugin)
46 const regexp_engine engine_plugin = {
47     Plugin_comp,
48     Plugin_exec,
49     Plugin_intuit,
50     Plugin_checkstr,
51     Plugin_free,
52     Plugin_numbered_buff_FETCH,
53     Plugin_numbered_buff_STORE,
54     Plugin_numbered_buff_LENGTH,
55     Plugin_named_buff,
56     Plugin_named_buff_iter,
57     Plugin_package,
58 #if defined(USE_ITHREADS)        
59     Plugin_dupe,
60 #endif
61 };
62
63 typedef struct replug {
64     /* Pointer back to the containing REGEXP struct so that accessors
65      * can modify nparens, gofs etc. */
66     REGEXP * rx;
67
68     /* A copy of the pattern given to comp, for ->pattern */
69     SV * pattern;
70
71     /* A copy of the string being matched against, for ->str */
72     SV * str;
73
74     /* The ->stash */
75     SV * stash;
76
77     /*
78      * Callbacks
79      */
80
81     SV * cb_free;
82
83     /* ->num_captures */
84     SV * cb_num_capture_buff_FETCH;
85     SV * cb_num_capture_buff_STORE;
86     SV * cb_num_capture_buff_LENGTH;
87 } *re__engine__Plugin;