This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] Add hook for re_dup() into regex engine as reg_dupe (make re pluggable...
authorYves Orton <demerphq@gmail.com>
Fri, 29 Sep 2006 16:57:07 +0000 (18:57 +0200)
committerH.Merijn Brand <h.m.brand@xs4all.nl>
Fri, 29 Sep 2006 15:05:22 +0000 (15:05 +0000)
Message-ID: <9b18b3110609290757n62b3484i7bb948f965524191@mail.gmail.com>

p4raw-id: //depot/perl@28902

perl.h
regcomp.c
regexp.h

diff --git a/perl.h b/perl.h
index bc0b192..ac26b38 100644 (file)
--- a/perl.h
+++ b/perl.h
 
 #define CALLREGCOMP(exp, xend, pm) Perl_pregcomp(aTHX_ exp,xend,pm)
 
+#define CALLREGCOMP_ENG(prog, exp, xend, pm) \
+    CALL_FPTR(((prog)->comp))(aTHX_ exp, xend, pm)
 #define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,screamer,data,flags) \
-    CALL_FPTR((prog)->engine->regexec)(aTHX_ (prog),(stringarg),(strend), \
+    CALL_FPTR((prog)->engine->exec)(aTHX_ (prog),(stringarg),(strend), \
         (strbeg),(minend),(screamer),(data),(flags))
 #define CALLREG_INTUIT_START(prog,sv,strpos,strend,flags,data) \
-    CALL_FPTR((prog)->engine->re_intuit_start)(aTHX_ (prog), (sv), (strpos), \
+    CALL_FPTR((prog)->engine->intuit)(aTHX_ (prog), (sv), (strpos), \
         (strend),(flags),(data))
 #define CALLREG_INTUIT_STRING(prog) \
-    CALL_FPTR((prog)->engine->re_intuit_string)(aTHX_ (prog))
+    CALL_FPTR((prog)->engine->checkstr)(aTHX_ (prog))
 #define CALLREGFREE(prog) \
-    if(prog) CALL_FPTR((prog)->engine->regfree)(aTHX_ (prog))
+    if(prog) CALL_FPTR((prog)->engine->free)(aTHX_ (prog))
 #if defined(USE_ITHREADS)         
 #define CALLREGDUPE(prog,param) \
-    (prog ? CALL_FPTR((prog)->engine->regdupe)(aTHX_ (prog),(param)) \
+    (prog ? CALL_FPTR((prog)->engine->dupe)(aTHX_ (prog),(param)) \
           : (REGEXP *)NULL) 
 #endif
 
index 063549e..9f92af8 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -3713,7 +3713,7 @@ Perl_pregcomp(pTHX_ char *exp, char *xend, PMOP *pm)
                 PerlIO_printf(Perl_debug_log, "Using engine %"UVxf"\n",
                     SvIV(*ptr));
             });            
-            return CALL_FPTR((eng->regcomp))(aTHX_ exp, xend, pm);
+            return CALLREGCOMP_ENG(eng, exp, xend, pm);
         } 
     })
     register regexp *r;
index 09759fa..99973c1 100644 (file)
--- a/regexp.h
+++ b/regexp.h
@@ -66,17 +66,17 @@ typedef struct re_scream_pos_data_s
 } re_scream_pos_data;
 
 typedef struct regexp_engine {
-    regexp*    (*regcomp) (pTHX_ char* exp, char* xend, PMOP* pm);
-    I32                (*regexec) (pTHX_ regexp* prog, char* stringarg, char* strend,
+    regexp* (*comp) (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);
-    char*      (*re_intuit_start) (pTHX_ regexp *prog, SV *sv, char *strpos,
-                                   char *strend, U32 flags,
-                                   struct re_scream_pos_data_s *data);
-    SV*                (*re_intuit_string) (pTHX_ regexp *prog);
-    void       (*regfree) (pTHX_ struct regexp* r);
-#if defined(USE_ITHREADS)
-    regexp*    (*regdupe) (pTHX_ const regexp *r, CLONE_PARAMS *param);
+    char*   (*intuit) (pTHX_ regexp *prog, SV *sv, char *strpos,
+                           char *strend, U32 flags,
+                           struct re_scream_pos_data_s *data);
+    SV*            (*checkstr) (pTHX_ regexp *prog);
+    void    (*free) (pTHX_ struct regexp* r);
+#ifdef USE_ITHREADS
+    regexp* (*dupe) (pTHX_ const regexp *r, CLONE_PARAMS *param);
 #endif    
 } regexp_engine;