summaryrefslogtreecommitdiff
path: root/ext/re/re.xs
blob: b49a1103778264969fdbb59f7020ccc9b0c376f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* We need access to debugger hooks */
#ifndef DEBUGGING
#  define DEBUGGING
#endif

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

extern regexp*	my_regcomp (pTHX_ char* exp, char* xend, PMOP* pm);
extern I32	my_regexec (pTHX_ regexp* prog, char* stringarg, char* strend,
			    char* strbeg, I32 minend, SV* screamer,
			    void* data, U32 flags);

static int oldfl;

#define R_DB 512

static void
deinstall(pTHX)
{
    dTHR;
    PL_regexecp = &Perl_regexec_flags;
    PL_regcompp = &Perl_pregcomp;
    if (!oldfl)
	PL_debug &= ~R_DB;
}

static void
install(pTHX)
{
    dTHR;
    PL_colorset = 0;			/* Allow reinspection of ENV. */
    PL_regexecp = &my_regexec;
    PL_regcompp = &my_regcomp;
    oldfl = PL_debug & R_DB;
    PL_debug |= R_DB;
}

MODULE = re	PACKAGE = re

void
install()
  CODE:
    install(aTHX);

void
deinstall()
  CODE:
    deinstall(aTHX);