emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/regex.c


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/regex.c
Date: Thu, 05 Sep 2002 23:08:53 -0400

Index: emacs/src/regex.c
diff -c emacs/src/regex.c:1.178 emacs/src/regex.c:1.179
*** emacs/src/regex.c:1.178     Wed Sep  4 22:34:37 2002
--- emacs/src/regex.c   Thu Sep  5 23:08:53 2002
***************
*** 2145,2153 ****
  
    if (!RE_TRANSLATE_P (translate))
      {
        work_area->table[work_area->used++] = (start);
        work_area->table[work_area->used++] = (end);
!       return;
      }
  
    eqv_table = XCHAR_TABLE (translate)->extras[2];
--- 2145,2154 ----
  
    if (!RE_TRANSLATE_P (translate))
      {
+       EXTEND_RANGE_TABLE (work_area, 2);
        work_area->table[work_area->used++] = (start);
        work_area->table[work_area->used++] = (end);
!       return -1;
      }
  
    eqv_table = XCHAR_TABLE (translate)->extras[2];
***************
*** 2253,2264 ****
  
  #endif /* emacs */
  
! /* We need to find the image of the range start..end when passed through
     TRANSLATE.  This is not necessarily TRANSLATE(start)..TRANSLATE(end)
     and is not even necessarily contiguous.
!    We approximate it with the smallest contiguous range that contains
!    all the chars we need.  However, that is not good enough for Latin-1,
!    so we do a better job in that case.
  
     Returns -1 if successful, REG_ESPACE if ran out of space.  */
  
--- 2254,2267 ----
  
  #endif /* emacs */
  
! /* Record the the image of the range start..end when passed through
     TRANSLATE.  This is not necessarily TRANSLATE(start)..TRANSLATE(end)
     and is not even necessarily contiguous.
!    Normally we approximate it with the smallest contiguous range that contains
!    all the chars we need.  However, for Latin-1 we go to extra effort
!    to do a better job.
! 
!    This function is not called for ASCII ranges.
  
     Returns -1 if successful, REG_ESPACE if ran out of space.  */
  
***************
*** 2273,2284 ****
  #ifdef emacs
    /* For Latin-1 ranges, use set_image_of_range_1
       to get proper handling of ranges that include letters and nonletters.
!      For ASCII, this is not necessary.
       For other character sets, we don't bother to get this right.  */
!   if (start < 04400 && end > 0200)
      {
        int tem;
!       tem = set_image_of_range_1 (work_area, start, end, translate);
        if (tem > 0)
        return tem;
  
--- 2276,2292 ----
  #ifdef emacs
    /* For Latin-1 ranges, use set_image_of_range_1
       to get proper handling of ranges that include letters and nonletters.
!      For a range that includes the whole of Latin-1, this is not necessary.
       For other character sets, we don't bother to get this right.  */
!   if (RE_TRANSLATE_P (translate) && start < 04400
!       && !(start < 04200 && end >= 04377))
      {
+       int newend;
        int tem;
!       newend = end;
!       if (newend > 04377)
!       newend = 04377;
!       tem = set_image_of_range_1 (work_area, start, newend, translate);
        if (tem > 0)
        return tem;
  
***************
*** 2288,2306 ****
      }
  #endif
  
!   cmin = TRANSLATE (start), cmax = TRANSLATE (end);
  
    if (RE_TRANSLATE_P (translate))
!     for (; start <= end; start++)
!       {
!       re_wchar_t c = TRANSLATE (start);
!       cmin = MIN (cmin, c);
!       cmax = MAX (cmax, c);
!       }
  
!   EXTEND_RANGE_TABLE (work_area, 2);
!   work_area->table[work_area->used++] = (cmin);
!   work_area->table[work_area->used++] = (cmax);
  
    return -1;
  }
--- 2296,2333 ----
      }
  #endif
  
!   EXTEND_RANGE_TABLE (work_area, 2);
!   work_area->table[work_area->used++] = (start);
!   work_area->table[work_area->used++] = (end);
! 
!   cmin = -1, cmax = -1;
  
    if (RE_TRANSLATE_P (translate))
!     {
!       int ch;
  
!       for (ch = start; ch <= end; ch++)
!       {
!         re_wchar_t c = TRANSLATE (ch);
!         if (! (start <= c && c <= end))
!           {
!             if (cmin == -1)
!               cmin = c, cmax = c;
!             else
!               {
!                 cmin = MIN (cmin, c);
!                 cmax = MAX (cmax, c);
!               }
!           }
!       }
! 
!       if (cmin != -1)
!       {
!         EXTEND_RANGE_TABLE (work_area, 2);
!         work_area->table[work_area->used++] = (cmin);
!         work_area->table[work_area->used++] = (cmax);
!       }
!     }
  
    return -1;
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]