[vim] - patchlevel 1014

Karsten Hopp karsten at fedoraproject.org
Tue Jun 4 10:08:08 UTC 2013


commit 0723cf5d4a52dc4853a25ebaf61a79ce622a45bc
Author: Karsten Hopp <karsten at redhat.com>
Date:   Tue Jun 4 12:05:58 2013 +0200

    - patchlevel 1014

 7.3.1014 |  192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 192 insertions(+), 0 deletions(-)
---
diff --git a/7.3.1014 b/7.3.1014
new file mode 100644
index 0000000..5cc84be
--- /dev/null
+++ b/7.3.1014
@@ -0,0 +1,192 @@
+To: vim_dev at googlegroups.com
+Subject: Patch 7.3.1014
+Fcc: outbox
+From: Bram Moolenaar <Bram at moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 7.3.1014
+Problem:    New regexp state dump is hard to read.
+Solution:   Make the state dump more pretty. (Taro Muraoka)
+Files:	    src/regexp_nfa.c
+
+
+*** ../vim-7.3.1013/src/regexp_nfa.c	2013-05-25 12:18:34.000000000 +0200
+--- src/regexp_nfa.c	2013-05-25 12:25:43.000000000 +0200
+***************
+*** 183,189 ****
+  #ifdef DEBUG
+  static void nfa_set_code __ARGS((int c));
+  static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
+! static void nfa_print_state __ARGS((FILE *debugf, nfa_state_T *state, int ident));
+  static void nfa_dump __ARGS((nfa_regprog_T *prog));
+  #endif
+  static int *re2post __ARGS((void));
+--- 183,190 ----
+  #ifdef DEBUG
+  static void nfa_set_code __ARGS((int c));
+  static void nfa_postfix_dump __ARGS((char_u *expr, int retval));
+! static void nfa_print_state __ARGS((FILE *debugf, nfa_state_T *state));
+! static void nfa_print_state2 __ARGS((FILE *debugf, nfa_state_T *state, garray_T *indent));
+  static void nfa_dump __ARGS((nfa_regprog_T *prog));
+  #endif
+  static int *re2post __ARGS((void));
+***************
+*** 1811,1839 ****
+   * Print the NFA starting with a root node "state".
+   */
+      static void
+! nfa_print_state(debugf, state, ident)
+      FILE *debugf;
+      nfa_state_T *state;
+-     int ident;
+  {
+!     int i;
+  
+      if (state == NULL)
+  	return;
+  
+      fprintf(debugf, "(%2d)", abs(state->id));
+!     for (i = 0; i < ident; i++)
+! 	fprintf(debugf, "%c", ' ');
+  
+      nfa_set_code(state->c);
+!     fprintf(debugf, "%s %s (%d) (id=%d)\n",
+! 		 state->negated ? "NOT" : "", code, state->c, abs(state->id));
+      if (state->id < 0)
+  	return;
+  
+      state->id = abs(state->id) * -1;
+!     nfa_print_state(debugf, state->out, ident + 4);
+!     nfa_print_state(debugf, state->out1, ident + 4);
+  }
+  
+  /*
+--- 1812,1885 ----
+   * Print the NFA starting with a root node "state".
+   */
+      static void
+! nfa_print_state(debugf, state)
+      FILE *debugf;
+      nfa_state_T *state;
+  {
+!     garray_T indent;
+! 
+!     ga_init2(&indent, 1, 64);
+!     ga_append(&indent, '\0');
+!     nfa_print_state2(debugf, state, &indent);
+!     ga_clear(&indent);
+! }
+! 
+!     static void
+! nfa_print_state2(debugf, state, indent)
+!     FILE *debugf;
+!     nfa_state_T *state;
+!     garray_T *indent;
+! {
+!     char_u  *p;
+  
+      if (state == NULL)
+  	return;
+  
+      fprintf(debugf, "(%2d)", abs(state->id));
+! 
+!     /* Output indent */
+!     p = (char_u *)indent->ga_data;
+!     if (indent->ga_len >= 3)
+!     {
+! 	int	last = indent->ga_len - 3;
+! 	char_u	save[2];
+! 
+! 	STRNCPY(save, &p[last], 2);
+! 	STRNCPY(&p[last], "+-", 2);
+! 	fprintf(debugf, " %s", p);
+! 	STRNCPY(&p[last], save, 2);
+!     }
+!     else
+! 	fprintf(debugf, " %s", p);
+  
+      nfa_set_code(state->c);
+!     fprintf(debugf, "%s%s (%d) (id=%d)\n",
+! 		 state->negated ? "NOT " : "", code, state->c, abs(state->id));
+      if (state->id < 0)
+  	return;
+  
+      state->id = abs(state->id) * -1;
+! 
+!     /* grow indent for state->out */
+!     indent->ga_len -= 1;
+!     if (state->out1)
+! 	ga_concat(indent, "| ");
+!     else
+! 	ga_concat(indent, "  ");
+!     ga_append(indent, '\0');
+! 
+!     nfa_print_state2(debugf, state->out, indent);
+! 
+!     /* replace last part of indent for state->out1 */
+!     indent->ga_len -= 3;
+!     ga_concat(indent, "  ");
+!     ga_append(indent, '\0');
+! 
+!     nfa_print_state2(debugf, state->out1, indent);
+! 
+!     /* shrink indent */
+!     indent->ga_len -= 3;
+!     ga_append(indent, '\0');
+  }
+  
+  /*
+***************
+*** 1847,1853 ****
+  
+      if (debugf != NULL)
+      {
+! 	nfa_print_state(debugf, prog->start, 0);
+  	fclose(debugf);
+      }
+  }
+--- 1893,1899 ----
+  
+      if (debugf != NULL)
+      {
+! 	nfa_print_state(debugf, prog->start);
+  	fclose(debugf);
+      }
+  }
+***************
+*** 3505,3511 ****
+  #endif
+  	fprintf(f, "\tInput text is \"%s\" \n", reginput);
+  	fprintf(f, "		=======================================================\n\n\n\n\n\n\n");
+! 	nfa_print_state(f, start, 0);
+  	fprintf(f, "\n\n");
+  	fclose(f);
+      }
+--- 3551,3557 ----
+  #endif
+  	fprintf(f, "\tInput text is \"%s\" \n", reginput);
+  	fprintf(f, "		=======================================================\n\n\n\n\n\n\n");
+! 	nfa_print_state(f, start);
+  	fprintf(f, "\n\n");
+  	fclose(f);
+      }
+*** ../vim-7.3.1013/src/version.c	2013-05-25 12:18:34.000000000 +0200
+--- src/version.c	2013-05-25 12:27:22.000000000 +0200
+***************
+*** 730,731 ****
+--- 730,733 ----
+  {   /* Add new patch number below this line */
++ /**/
++     1014,
+  /**/
+
+-- 
+Lower life forms have more fun!
+
+ /// Bram Moolenaar -- Bram at Moolenaar.net -- 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    ///


More information about the scm-commits mailing list