better -Mre=debugcolor
Ilya Zakharevich [Fri, 27 Nov 1998 16:16:48 +0000 (11:16 -0500)]
Message-Id: <199811272116.QAA03502@monk.mps.ohio-state.edu>

p4raw-id: //depot/perl@2371

embedvar.h
objXSUB.h
regexec.c
thrdvar.h

index b1aad3a..9d82427 100644 (file)
@@ -61,6 +61,7 @@
 #define PL_reg_re              (PL_curinterp->Treg_re)
 #define PL_reg_start_tmp       (PL_curinterp->Treg_start_tmp)
 #define PL_reg_start_tmpl      (PL_curinterp->Treg_start_tmpl)
+#define PL_reg_starttry                (PL_curinterp->Treg_starttry)
 #define PL_reg_sv              (PL_curinterp->Treg_sv)
 #define PL_regbol              (PL_curinterp->Tregbol)
 #define PL_regcc               (PL_curinterp->Tregcc)
 #define PL_Treg_re             PL_reg_re
 #define PL_Treg_start_tmp      PL_reg_start_tmp
 #define PL_Treg_start_tmpl     PL_reg_start_tmpl
+#define PL_Treg_starttry       PL_reg_starttry
 #define PL_Treg_sv             PL_reg_sv
 #define PL_Tregbol             PL_regbol
 #define PL_Tregcc              PL_regcc
 #define PL_reg_re              (thr->Treg_re)
 #define PL_reg_start_tmp       (thr->Treg_start_tmp)
 #define PL_reg_start_tmpl      (thr->Treg_start_tmpl)
+#define PL_reg_starttry                (thr->Treg_starttry)
 #define PL_reg_sv              (thr->Treg_sv)
 #define PL_regbol              (thr->Tregbol)
 #define PL_regcc               (thr->Tregcc)
index 2a86440..3c154e4 100644 (file)
--- a/objXSUB.h
+++ b/objXSUB.h
 #define PL_reg_start_tmp       pPerl->PL_reg_start_tmp
 #undef  PL_reg_start_tmpl
 #define PL_reg_start_tmpl      pPerl->PL_reg_start_tmpl
+#undef  PL_reg_starttry
+#define PL_reg_starttry                pPerl->PL_reg_starttry
 #undef  PL_reg_sv
 #define PL_reg_sv              pPerl->PL_reg_sv
 #undef  PL_regbol
index e4de1ed..36a35b0 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1080,6 +1080,7 @@ regtry(regexp *prog, char *startpos)
     PL_reglastparen = &prog->lastparen;
     prog->lastparen = 0;
     PL_regsize = 0;
+    DEBUG_r(PL_reg_starttry = startpos);
     if (PL_reg_start_tmpl <= prog->nparens) {
        PL_reg_start_tmpl = prog->nparens*3/2 + 3;
         if(PL_reg_start_tmp)
@@ -1161,7 +1162,7 @@ regmatch(regnode *prog)
            int l = (PL_regeol - locinput > taill ? taill : PL_regeol - locinput);
            int pref_len = (locinput - PL_bostr > (5 + taill) - l 
                            ? (5 + taill) - l : locinput - PL_bostr);
-           int pref0_len = pref_len  - (locinput - PL_reginput);
+           int pref0_len = pref_len  - (locinput - PL_reg_starttry);
 
            if (l + pref_len < (5 + taill) && l < PL_regeol - locinput)
                l = ( PL_regeol - locinput > (5 + taill) - pref_len 
index 7c72259..d9cb9c6 100644 (file)
--- a/thrdvar.h
+++ b/thrdvar.h
@@ -167,6 +167,7 @@ PERLVARI(Tregexecp, regexec_t, FUNC_NAME_TO_PTR(regexec_flags))
                                        /* Pointer to RE executer */
 PERLVARI(Treginterp_cnt,int,       0)  /* Whether `re'
                                                   was interpolated. */
+PERLVARI(Treg_starttry,        char *,     0)  /* -Dr: where regtry was called. */
 #ifdef DEBUGGING
 PERLVARI(Twatchaddr,   char **,    0)
 PERLVAR(Twatchok,      char *)