Patch 7.3.1092
Problem:    Can't build with regexp debugging.  NFA debug output shows wrong
            pattern.
Solution:   Fix debugging code for recent changes.  Add the pattern to the
            program.
Files:      src/regexp_nfa.c, src/regexp.h


*** ../vim-7.3.1091/src/regexp_nfa.c    2013-06-02 15:01:51.000000000 +0200
--- src/regexp_nfa.c    2013-06-02 15:48:57.000000000 +0200
***************
*** 3133,3144 ****
            {
                int col;
  
!               if (thread->sub.in_use <= 0)
                    col = -1;
                else if (REG_MULTI)
!                   col = thread->sub.list.multi[0].start.col;
                else
!                   col = (int)(thread->sub.list.line[0].start - regline);
                nfa_set_code(state->c);
                fprintf(log_fd, "> Adding state %d to list %d. char %d: %s 
(start col %d)\n",
                        abs(state->id), l->id, state->c, code, col);
--- 3133,3144 ----
            {
                int col;
  
!               if (thread->subs.norm.in_use <= 0)
                    col = -1;
                else if (REG_MULTI)
!                   col = thread->subs.norm.list.multi[0].start.col;
                else
!                   col = (int)(thread->subs.norm.list.line[0].start - regline);
                nfa_set_code(state->c);
                fprintf(log_fd, "> Adding state %d to list %d. char %d: %s 
(start col %d)\n",
                        abs(state->id), l->id, state->c, code, col);
***************
*** 3152,3163 ****
      {
        int col;
  
!       if (sub->in_use <= 0)
            col = -1;
        else if (REG_MULTI)
!           col = sub->list.multi[0].start.col;
        else
!           col = (int)(sub->list.line[0].start - regline);
        nfa_set_code(state->c);
        fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start 
col %d)\n",
                abs(state->id), l->id, state->c, code, col);
--- 3152,3163 ----
      {
        int col;
  
!       if (subs->norm.in_use <= 0)
            col = -1;
        else if (REG_MULTI)
!           col = subs->norm.list.multi[0].start.col;
        else
!           col = (int)(subs->norm.list.line[0].start - regline);
        nfa_set_code(state->c);
        fprintf(log_fd, "> Processing state %d for list %d. char %d: %s (start 
col %d)\n",
                abs(state->id), l->id, state->c, code, col);
***************
*** 3836,3847 ****
            {
                int col;
  
!               if (t->sub.in_use <= 0)
                    col = -1;
                else if (REG_MULTI)
!                   col = t->sub.list.multi[0].start.col;
                else
!                   col = (int)(t->sub.list.line[0].start - regline);
                nfa_set_code(t->state->c);
                fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
                        abs(t->state->id), (int)t->state->c, code, col);
--- 3836,3847 ----
            {
                int col;
  
!               if (t->subs.norm.in_use <= 0)
                    col = -1;
                else if (REG_MULTI)
!                   col = t->subs.norm.list.multi[0].start.col;
                else
!                   col = (int)(t->subs.norm.list.line[0].start - regline);
                nfa_set_code(t->state->c);
                fprintf(log_fd, "(%d) char %d %s (start col %d) ... \n",
                        abs(t->state->id), (int)t->state->c, code, col);
***************
*** 4818,4823 ****
--- 4818,4826 ----
      nfa_has_zend = prog->has_zend;
      nfa_has_backref = prog->has_backref;
      nfa_nsubexpr = prog->nsubexp;
+ #ifdef DEBUG
+     nfa_regengine.expr = prog->pattern;
+ #endif
  
      nstate = prog->nstate;
      for (i = 0; i < nstate; ++i)
***************
*** 4828,4833 ****
--- 4831,4840 ----
  
      retval = nfa_regtry(prog, col);
  
+ #ifdef DEBUG
+     nfa_regengine.expr = NULL;
+ #endif
+ 
  theend:
      return retval;
  }
***************
*** 4921,4926 ****
--- 4928,4937 ----
      /* Remember whether this pattern has any \z specials in it. */
      prog->reghasz = re_has_z;
  #endif
+ #ifdef DEBUG
+     prog->pattern = vim_strsave(expr); /* memory will leak */
+     nfa_regengine.expr = NULL;
+ #endif
  
  out:
      vim_free(post_start);
*** ../vim-7.3.1091/src/regexp.h        2013-06-01 23:02:48.000000000 +0200
--- src/regexp.h        2013-06-02 15:42:57.000000000 +0200
***************
*** 86,98 ****
      regengine_T               *engine;
      unsigned          regflags;
  
!     regprog_T         regprog;
!     nfa_state_T               *start;
      int                       has_zend;       /* pattern contains \ze */
      int                       has_backref;    /* pattern contains \1 .. \9 */
  #ifdef FEAT_SYN_HL
      int                       reghasz;
  #endif
      int                       nsubexp;        /* number of () */
      int                       nstate;
      nfa_state_T               state[0];       /* actually longer.. */
--- 86,100 ----
      regengine_T               *engine;
      unsigned          regflags;
  
!     nfa_state_T               *start;         /* points into state[] */
      int                       has_zend;       /* pattern contains \ze */
      int                       has_backref;    /* pattern contains \1 .. \9 */
  #ifdef FEAT_SYN_HL
      int                       reghasz;
  #endif
+ #ifdef DEBUG
+     char_u            *pattern;
+ #endif
      int                       nsubexp;        /* number of () */
      int                       nstate;
      nfa_state_T               state[0];       /* actually longer.. */
*** ../vim-7.3.1091/src/version.c       2013-06-02 15:01:51.000000000 +0200
--- src/version.c       2013-06-02 15:53:16.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     1092,
  /**/

-- 
I started out with nothing, and I still have most of it.
                                -- Michael Davis -- "Tonight Show"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui