[ID 20011201.170] Time::HiRes in devel-perl causes segfaults for xs users
[p5sagit/p5-mst-13.2.git] / ext / re / re.xs
CommitLineData
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 10extern regexp* my_regcomp (pTHX_ char* exp, char* xend, PMOP* pm);
11extern I32 my_regexec (pTHX_ regexp* prog, char* stringarg, char* strend,
20ce7b12 12 char* strbeg, I32 minend, SV* screamer,
13 void* data, U32 flags);
f722798b 14extern void my_regfree (pTHX_ struct regexp* r);
15extern 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);
18extern SV* my_re_intuit_string (pTHX_ regexp *prog);
56953603 19
df3728a2 20#define MY_CXT_KEY "re::_guts" XS_VERSION
89ca4ac7 21
22typedef struct {
23 int x_oldflag; /* debug flag */
24} my_cxt_t;
25
26START_MY_CXT
27
28#define oldflag (MY_CXT.x_oldflag)
56953603 29
56953603 30static void
89ca4ac7 31uninstall(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
44static void
cea2e8a9 45install(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
58MODULE = re PACKAGE = re
59
89ca4ac7 60BOOT:
61{
62 MY_CXT_INIT;
63}
64
65
56953603 66void
67install()
cea2e8a9 68 CODE:
69 install(aTHX);
56953603 70
71void
89ca4ac7 72uninstall()
cea2e8a9 73 CODE:
89ca4ac7 74 uninstall(aTHX);