Change 29459 by [EMAIL PROTECTED] on 2006/12/04 17:50:51
Better version of last patch, by Yves Orton.
Actually the regexp engine structure only needs
one compilation function hook.
Affected files ...
... //depot/perl/ext/re/re.xs#35 edit
... //depot/perl/ext/re/re_top.h#6 edit
... //depot/perl/regcomp.c#524 edit
... //depot/perl/regcomp.h#106 edit
... //depot/perl/regexp.h#78 edit
Differences ...
==== //depot/perl/ext/re/re.xs#35 (text) ====
Index: perl/ext/re/re.xs
--- perl/ext/re/re.xs#34~29458~ 2006-12-04 09:22:02.000000000 -0800
+++ perl/ext/re/re.xs 2006-12-04 09:50:51.000000000 -0800
@@ -11,8 +11,7 @@
START_EXTERN_C
-extern regexp* my_regcomp (pTHX_ char* exp, char* xend, PMOP* pm);
-extern regexp* my_re_compile(pTHX_ char *exp, char *xend, PMOP *pm);
+extern regexp* my_re_compile (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);
@@ -32,8 +31,7 @@
END_EXTERN_C
const struct regexp_engine my_reg_engine = {
- my_regcomp,
- my_re_compile,
+ my_re_compile,
my_regexec,
my_re_intuit_start,
my_re_intuit_string,
==== //depot/perl/ext/re/re_top.h#6 (text) ====
Index: perl/ext/re/re_top.h
--- perl/ext/re/re_top.h#5~29458~ 2006-12-04 09:22:02.000000000 -0800
+++ perl/ext/re/re_top.h 2006-12-04 09:50:51.000000000 -0800
@@ -12,7 +12,6 @@
#define Perl_regdump my_regdump
#define Perl_regprop my_regprop
#define Perl_re_intuit_start my_re_intuit_start
-#define Perl_pregcomp my_regcomp
#define Perl_re_compile my_re_compile
#define Perl_regfree_internal my_regfree
#define Perl_re_intuit_string my_re_intuit_string
==== //depot/perl/regcomp.c#524 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#523~29457~ 2006-12-04 08:24:09.000000000 -0800
+++ perl/regcomp.c 2006-12-04 09:50:51.000000000 -0800
@@ -3965,20 +3965,18 @@
extern const struct regexp_engine my_reg_engine;
#define RE_ENGINE_PTR &my_reg_engine
#endif
-
+
+#ifndef PERL_IN_XSUB_RE
regexp *
Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
{
dVAR;
- GET_RE_DEBUG_FLAGS_DECL;
- DEBUG_r(if (!PL_colorset) reginitcolors());
-#ifndef PERL_IN_XSUB_RE
- {
+ HV * const table = GvHV(PL_hintgv);
/* Dispatch a request to compile a regexp to correct
regexp engine. */
- HV * const table = GvHV(PL_hintgv);
if (table) {
SV **ptr= hv_fetchs(table, "regcomp", FALSE);
+ GET_RE_DEBUG_FLAGS_DECL;
if (ptr && SvIOK(*ptr) && SvIV(*ptr)) {
const regexp_engine *eng=INT2PTR(regexp_engine*,SvIV(*ptr));
DEBUG_COMPILE_r({
@@ -3988,10 +3986,9 @@
return CALLREGCOMP_ENG(eng, exp, xend, pm);
}
}
- }
-#endif
return Perl_re_compile(aTHX_ exp, xend, pm);
}
+#endif
regexp *
Perl_re_compile(pTHX_ char *exp, char *xend, PMOP *pm)
@@ -4013,6 +4010,8 @@
RExC_state_t copyRExC_state;
#endif
GET_RE_DEBUG_FLAGS_DECL;
+ DEBUG_r(if (!PL_colorset) reginitcolors());
+
if (exp == NULL)
FAIL("NULL regexp argument");
==== //depot/perl/regcomp.h#106 (text) ====
Index: perl/regcomp.h
--- perl/regcomp.h#105~29458~ 2006-12-04 09:22:02.000000000 -0800
+++ perl/regcomp.h 2006-12-04 09:50:51.000000000 -0800
@@ -92,6 +92,23 @@
* special test to reverse the sign of BACK pointers since the offset is
* stored negative.]
*/
+typedef struct regexp_internal {
+ regexp_paren_ofs *swap; /* Swap copy of *startp / *endp */
+ U32 *offsets; /* offset annotations 20001228 MJD
+ data about mapping the program to the
+ string*/
+ regnode *regstclass; /* Optional startclass as identified or
constructed
+ by the optimiser */
+ struct reg_data *data; /* Additional miscellaneous data used by the
program.
+ Used to make it easier to clone and free
arbitrary
+ data that the regops need. Often the ARG
field of
+ a regop is an index into this structure */
+ regnode program[1]; /* Unwarranted chumminess with compiler. */
+} regexp_internal;
+
+#define RXi_SET(x,y) (x)->pprivate = (void*)(y)
+#define RXi_GET(x) ((regexp_internal *)((x)->pprivate))
+#define RXi_GET_DECL(r,ri) regexp_internal *ri = RXi_GET(r)
struct regnode_string {
U8 str_len;
@@ -404,7 +421,6 @@
EXTCONST regexp_engine PL_core_reg_engine;
#else /* DOINIT */
EXTCONST regexp_engine PL_core_reg_engine = {
- Perl_pregcomp,
Perl_re_compile,
Perl_regexec_flags,
Perl_re_intuit_start,
==== //depot/perl/regexp.h#78 (text) ====
Index: perl/regexp.h
--- perl/regexp.h#77~29458~ 2006-12-04 09:22:02.000000000 -0800
+++ perl/regexp.h 2006-12-04 09:50:51.000000000 -0800
@@ -84,24 +84,6 @@
} regexp;
-typedef struct regexp_internal {
- regexp_paren_ofs *swap; /* Swap copy of *startp / *endp */
- U32 *offsets; /* offset annotations 20001228 MJD
- data about mapping the program to the
- string*/
- regnode *regstclass; /* Optional startclass as identified or
constructed
- by the optimiser */
- struct reg_data *data; /* Additional miscellaneous data used by the
program.
- Used to make it easier to clone and free
arbitrary
- data that the regops need. Often the ARG
field of
- a regop is an index into this structure */
- regnode program[1]; /* Unwarranted chumminess with compiler. */
-} regexp_internal;
-
-#define RXi_SET(x,y) (x)->pprivate = (void*)(y)
-#define RXi_GET(x) ((regexp_internal *)((x)->pprivate))
-#define RXi_GET_DECL(r,ri) regexp_internal *ri = RXi_GET(r)
-
typedef struct re_scream_pos_data_s
{
char **scream_olds; /* match pos */
@@ -110,7 +92,6 @@
typedef struct regexp_engine {
regexp* (*comp) (pTHX_ char* exp, char* xend, PMOP* pm);
- regexp* (*compile) (pTHX_ char *exp, char *xend, PMOP *pm);
I32 (*exec) (pTHX_ regexp* prog, char* stringarg, char* strend,
char* strbeg, I32 minend, SV* screamer,
void* data, U32 flags);
End of Patch.