Karsten Hopp bec2cd
To: vim_dev@googlegroups.com
Karsten Hopp bec2cd
Subject: Patch 7.3.978
Karsten Hopp bec2cd
Fcc: outbox
Karsten Hopp bec2cd
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp bec2cd
Mime-Version: 1.0
Karsten Hopp bec2cd
Content-Type: text/plain; charset=UTF-8
Karsten Hopp bec2cd
Content-Transfer-Encoding: 8bit
Karsten Hopp bec2cd
------------
Karsten Hopp bec2cd
Karsten Hopp bec2cd
Patch 7.3.978
Karsten Hopp bec2cd
Problem:    Regexp debug logs don't have a good name.
Karsten Hopp bec2cd
Solution:   Use clear names and make it possible to write logs for the old and
Karsten Hopp bec2cd
	    new engines separately. (Taro Muraoka)
Karsten Hopp bec2cd
Files:	    src/regexp.c, src/regexp_nfa.c
Karsten Hopp bec2cd
Karsten Hopp bec2cd
Karsten Hopp bec2cd
*** ../vim-7.3.977/src/regexp.c	2013-05-19 19:16:25.000000000 +0200
Karsten Hopp bec2cd
--- src/regexp.c	2013-05-20 21:41:19.000000000 +0200
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 51,56 ****
Karsten Hopp bec2cd
--- 51,58 ----
Karsten Hopp bec2cd
  # define BT_REGEXP_DUMP
Karsten Hopp bec2cd
  /* save the debugging data to a file instead of displaying it */
Karsten Hopp bec2cd
  # define BT_REGEXP_LOG
Karsten Hopp bec2cd
+ # define BT_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
+ # define BT_REGEXP_DEBUG_LOG_NAME	"bt_regexp_debug.log"
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
  /*
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 7828,7838 ****
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
      if (prog == NULL)	    /* error compiling regexp with initial engine */
Karsten Hopp bec2cd
      {
Karsten Hopp bec2cd
! #ifdef DEBUG
Karsten Hopp bec2cd
  	if (regexp_engine != BACKTRACKING_ENGINE)   /* debugging log for NFA */
Karsten Hopp bec2cd
  	{
Karsten Hopp bec2cd
  	    FILE *f;
Karsten Hopp bec2cd
! 	    f = fopen("debug.log", "a");
Karsten Hopp bec2cd
  	    if (f)
Karsten Hopp bec2cd
  	    {
Karsten Hopp bec2cd
  		if (!syntax_error)
Karsten Hopp bec2cd
--- 7830,7840 ----
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
      if (prog == NULL)	    /* error compiling regexp with initial engine */
Karsten Hopp bec2cd
      {
Karsten Hopp bec2cd
! #ifdef BT_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
  	if (regexp_engine != BACKTRACKING_ENGINE)   /* debugging log for NFA */
Karsten Hopp bec2cd
  	{
Karsten Hopp bec2cd
  	    FILE *f;
Karsten Hopp bec2cd
! 	    f = fopen(BT_REGEXP_DEBUG_LOG_NAME, "a");
Karsten Hopp bec2cd
  	    if (f)
Karsten Hopp bec2cd
  	    {
Karsten Hopp bec2cd
  		if (!syntax_error)
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 7842,7848 ****
Karsten Hopp bec2cd
  		fclose(f);
Karsten Hopp bec2cd
  	    }
Karsten Hopp bec2cd
  	    else
Karsten Hopp bec2cd
! 		EMSG("(NFA) Could not open \"debug.log\" to write !!!");
Karsten Hopp bec2cd
  	    /*
Karsten Hopp bec2cd
  	    if (syntax_error)
Karsten Hopp bec2cd
  		EMSG("NFA Regexp: Syntax Error !");
Karsten Hopp bec2cd
--- 7844,7851 ----
Karsten Hopp bec2cd
  		fclose(f);
Karsten Hopp bec2cd
  	    }
Karsten Hopp bec2cd
  	    else
Karsten Hopp bec2cd
! 		EMSG2("(NFA) Could not open \"%s\" to write !!!",
Karsten Hopp bec2cd
!                         BT_REGEXP_DEBUG_LOG_NAME);
Karsten Hopp bec2cd
  	    /*
Karsten Hopp bec2cd
  	    if (syntax_error)
Karsten Hopp bec2cd
  		EMSG("NFA Regexp: Syntax Error !");
Karsten Hopp bec2cd
*** ../vim-7.3.977/src/regexp_nfa.c	2013-05-20 21:26:26.000000000 +0200
Karsten Hopp bec2cd
--- src/regexp_nfa.c	2013-05-20 21:41:19.000000000 +0200
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 9,14 ****
Karsten Hopp bec2cd
--- 9,16 ----
Karsten Hopp bec2cd
  /* Comment this out to disable log files. They can get pretty big */
Karsten Hopp bec2cd
  # define ENABLE_LOG
Karsten Hopp bec2cd
  # define LOG_NAME "log_nfarun.log"
Karsten Hopp bec2cd
+ # define NFA_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
+ # define NFA_REGEXP_DEBUG_LOG_NAME	"nfa_regexp_debug.log"
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
  /* Upper limit allowed for {m,n} repetitions handled by NFA */
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 2849,2860 ****
Karsten Hopp bec2cd
      int		*listids = NULL;
Karsten Hopp bec2cd
      int		j = 0;
Karsten Hopp bec2cd
      int		len = 0;
Karsten Hopp bec2cd
! #ifdef DEBUG
Karsten Hopp bec2cd
!     FILE	*debug = fopen("list.log", "a");
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
      if (debug == NULL)
Karsten Hopp bec2cd
      {
Karsten Hopp bec2cd
! 	EMSG(_("(NFA) COULD NOT OPEN list.log !"));
Karsten Hopp bec2cd
  	return FALSE;
Karsten Hopp bec2cd
      }
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
--- 2851,2862 ----
Karsten Hopp bec2cd
      int		*listids = NULL;
Karsten Hopp bec2cd
      int		j = 0;
Karsten Hopp bec2cd
      int		len = 0;
Karsten Hopp bec2cd
! #ifdef NFA_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
!     FILE	*debug = fopen(NFA_REGEXP_DEBUG_LOG_NAME, "a");
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
      if (debug == NULL)
Karsten Hopp bec2cd
      {
Karsten Hopp bec2cd
! 	EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG_NAME);
Karsten Hopp bec2cd
  	return FALSE;
Karsten Hopp bec2cd
      }
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 2950,2956 ****
Karsten Hopp bec2cd
  	fprintf(log_fd, "\n");
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
! #ifdef DEBUG
Karsten Hopp bec2cd
  	fprintf(debug, "\n-------------------\n");
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
--- 2952,2958 ----
Karsten Hopp bec2cd
  	fprintf(log_fd, "\n");
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
! #ifdef NFA_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
  	fprintf(debug, "\n-------------------\n");
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 2966,2972 ****
Karsten Hopp bec2cd
  	    else
Karsten Hopp bec2cd
  		t = &thislist->t[i];
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
! #ifdef DEBUG
Karsten Hopp bec2cd
  	    nfa_set_code(t->state->c);
Karsten Hopp bec2cd
  	    fprintf(debug, "%s, ", code);
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
--- 2968,2974 ----
Karsten Hopp bec2cd
  	    else
Karsten Hopp bec2cd
  		t = &thislist->t[i];
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
! #ifdef NFA_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
  	    nfa_set_code(t->state->c);
Karsten Hopp bec2cd
  	    fprintf(debug, "%s, ", code);
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 3436,3442 ****
Karsten Hopp bec2cd
      if (listids != NULL)
Karsten Hopp bec2cd
  	vim_free(listids);
Karsten Hopp bec2cd
  #undef ADD_POS_NEG_STATE
Karsten Hopp bec2cd
! #ifdef DEBUG
Karsten Hopp bec2cd
      fclose(debug);
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
--- 3438,3444 ----
Karsten Hopp bec2cd
      if (listids != NULL)
Karsten Hopp bec2cd
  	vim_free(listids);
Karsten Hopp bec2cd
  #undef ADD_POS_NEG_STATE
Karsten Hopp bec2cd
! #ifdef NFA_REGEXP_DEBUG_LOG
Karsten Hopp bec2cd
      fclose(debug);
Karsten Hopp bec2cd
  #endif
Karsten Hopp bec2cd
  
Karsten Hopp bec2cd
*** ../vim-7.3.977/src/version.c	2013-05-20 21:26:26.000000000 +0200
Karsten Hopp bec2cd
--- src/version.c	2013-05-20 21:48:27.000000000 +0200
Karsten Hopp bec2cd
***************
Karsten Hopp bec2cd
*** 730,731 ****
Karsten Hopp bec2cd
--- 730,733 ----
Karsten Hopp bec2cd
  {   /* Add new patch number below this line */
Karsten Hopp bec2cd
+ /**/
Karsten Hopp bec2cd
+     978,
Karsten Hopp bec2cd
  /**/
Karsten Hopp bec2cd
Karsten Hopp bec2cd
-- 
Karsten Hopp bec2cd
SIGIRO -- irony detected (iron core dumped)
Karsten Hopp bec2cd
Karsten Hopp bec2cd
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp bec2cd
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp bec2cd
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp bec2cd
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///