Commit | Line | Data |
41b16711 |
1 | #if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING) |
2 | # define DEBUGGING |
3 | #endif |
4 | |
c5be433b |
5 | #define PERL_NO_GET_CONTEXT |
56953603 |
6 | #include "EXTERN.h" |
7 | #include "perl.h" |
8 | #include "XSUB.h" |
9 | |
cea2e8a9 |
10 | extern regexp* my_regcomp (pTHX_ char* exp, char* xend, PMOP* pm); |
11 | extern I32 my_regexec (pTHX_ regexp* prog, char* stringarg, char* strend, |
20ce7b12 |
12 | char* strbeg, I32 minend, SV* screamer, |
13 | void* data, U32 flags); |
f722798b |
14 | extern void my_regfree (pTHX_ struct regexp* r); |
15 | extern char* my_re_intuit_start (pTHX_ regexp *prog, SV *sv, char *strpos, |
16 | char *strend, U32 flags, |
17 | struct re_scream_pos_data_s *data); |
18 | extern SV* my_re_intuit_string (pTHX_ regexp *prog); |
56953603 |
19 | |
df3728a2 |
20 | #define MY_CXT_KEY "re::_guts" XS_VERSION |
89ca4ac7 |
21 | |
22 | typedef struct { |
23 | int x_oldflag; /* debug flag */ |
24 | } my_cxt_t; |
25 | |
26 | START_MY_CXT |
27 | |
28 | #define oldflag (MY_CXT.x_oldflag) |
56953603 |
29 | |
56953603 |
30 | static void |
89ca4ac7 |
31 | uninstall(pTHX) |
56953603 |
32 | { |
89ca4ac7 |
33 | dMY_CXT; |
0b94c7bb |
34 | PL_regexecp = Perl_regexec_flags; |
35 | PL_regcompp = Perl_pregcomp; |
36 | PL_regint_start = Perl_re_intuit_start; |
37 | PL_regint_string = Perl_re_intuit_string; |
38 | PL_regfree = Perl_pregfree; |
f722798b |
39 | |
89ca4ac7 |
40 | if (!oldflag) |
aea4f609 |
41 | PL_debug &= ~DEBUG_r_FLAG; |
56953603 |
42 | } |
43 | |
44 | static void |
cea2e8a9 |
45 | install(pTHX) |
56953603 |
46 | { |
89ca4ac7 |
47 | dMY_CXT; |
285bbc62 |
48 | PL_colorset = 0; /* Allow reinspection of ENV. */ |
3280af22 |
49 | PL_regexecp = &my_regexec; |
50 | PL_regcompp = &my_regcomp; |
f722798b |
51 | PL_regint_start = &my_re_intuit_start; |
52 | PL_regint_string = &my_re_intuit_string; |
53 | PL_regfree = &my_regfree; |
89ca4ac7 |
54 | oldflag = PL_debug & DEBUG_r_FLAG; |
d8981068 |
55 | PL_debug |= DEBUG_r_FLAG; |
56953603 |
56 | } |
57 | |
58 | MODULE = re PACKAGE = re |
59 | |
89ca4ac7 |
60 | BOOT: |
61 | { |
62 | MY_CXT_INIT; |
63 | } |
64 | |
65 | |
56953603 |
66 | void |
67 | install() |
cea2e8a9 |
68 | CODE: |
69 | install(aTHX); |
56953603 |
70 | |
71 | void |
89ca4ac7 |
72 | uninstall() |
cea2e8a9 |
73 | CODE: |
89ca4ac7 |
74 | uninstall(aTHX); |