/[emacs]/emacs/src/regex.c
ViewVC logotype

Diff of /emacs/src/regex.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.178 by rms, Thu Sep 5 02:34:37 2002 UTC revision 1.179 by rms, Fri Sep 6 03:08:53 2002 UTC
# Line 2145  set_image_of_range_1 (work_area, start, Line 2145  set_image_of_range_1 (work_area, start,
2145    
2146    if (!RE_TRANSLATE_P (translate))    if (!RE_TRANSLATE_P (translate))
2147      {      {
2148          EXTEND_RANGE_TABLE (work_area, 2);
2149        work_area->table[work_area->used++] = (start);        work_area->table[work_area->used++] = (start);
2150        work_area->table[work_area->used++] = (end);        work_area->table[work_area->used++] = (end);
2151        return;        return -1;
2152      }      }
2153    
2154    eqv_table = XCHAR_TABLE (translate)->extras[2];    eqv_table = XCHAR_TABLE (translate)->extras[2];
# Line 2253  set_image_of_range_1 (work_area, start, Line 2254  set_image_of_range_1 (work_area, start,
2254    
2255  #endif /* emacs */  #endif /* emacs */
2256    
2257  /* We need to find the image of the range start..end when passed through  /* Record the the image of the range start..end when passed through
2258     TRANSLATE.  This is not necessarily TRANSLATE(start)..TRANSLATE(end)     TRANSLATE.  This is not necessarily TRANSLATE(start)..TRANSLATE(end)
2259     and is not even necessarily contiguous.     and is not even necessarily contiguous.
2260     We approximate it with the smallest contiguous range that contains     Normally we approximate it with the smallest contiguous range that contains
2261     all the chars we need.  However, that is not good enough for Latin-1,     all the chars we need.  However, for Latin-1 we go to extra effort
2262     so we do a better job in that case.     to do a better job.
2263    
2264       This function is not called for ASCII ranges.
2265    
2266     Returns -1 if successful, REG_ESPACE if ran out of space.  */     Returns -1 if successful, REG_ESPACE if ran out of space.  */
2267    
# Line 2273  set_image_of_range (work_area, start, en Line 2276  set_image_of_range (work_area, start, en
2276  #ifdef emacs  #ifdef emacs
2277    /* For Latin-1 ranges, use set_image_of_range_1    /* For Latin-1 ranges, use set_image_of_range_1
2278       to get proper handling of ranges that include letters and nonletters.       to get proper handling of ranges that include letters and nonletters.
2279       For ASCII, this is not necessary.       For a range that includes the whole of Latin-1, this is not necessary.
2280       For other character sets, we don't bother to get this right.  */       For other character sets, we don't bother to get this right.  */
2281    if (start < 04400 && end > 0200)    if (RE_TRANSLATE_P (translate) && start < 04400
2282          && !(start < 04200 && end >= 04377))
2283      {      {
2284          int newend;
2285        int tem;        int tem;
2286        tem = set_image_of_range_1 (work_area, start, end, translate);        newend = end;
2287          if (newend > 04377)
2288            newend = 04377;
2289          tem = set_image_of_range_1 (work_area, start, newend, translate);
2290        if (tem > 0)        if (tem > 0)
2291          return tem;          return tem;
2292    
# Line 2288  set_image_of_range (work_area, start, en Line 2296  set_image_of_range (work_area, start, en
2296      }      }
2297  #endif  #endif
2298    
2299    cmin = TRANSLATE (start), cmax = TRANSLATE (end);    EXTEND_RANGE_TABLE (work_area, 2);
2300      work_area->table[work_area->used++] = (start);
2301      work_area->table[work_area->used++] = (end);
2302    
2303      cmin = -1, cmax = -1;
2304    
2305    if (RE_TRANSLATE_P (translate))    if (RE_TRANSLATE_P (translate))
2306      for (; start <= end; start++)      {
2307        {        int ch;
         re_wchar_t c = TRANSLATE (start);  
         cmin = MIN (cmin, c);  
         cmax = MAX (cmax, c);  
       }  
2308    
2309    EXTEND_RANGE_TABLE (work_area, 2);        for (ch = start; ch <= end; ch++)
2310    work_area->table[work_area->used++] = (cmin);          {
2311    work_area->table[work_area->used++] = (cmax);            re_wchar_t c = TRANSLATE (ch);
2312              if (! (start <= c && c <= end))
2313                {
2314                  if (cmin == -1)
2315                    cmin = c, cmax = c;
2316                  else
2317                    {
2318                      cmin = MIN (cmin, c);
2319                      cmax = MAX (cmax, c);
2320                    }
2321                }
2322            }
2323    
2324          if (cmin != -1)
2325            {
2326              EXTEND_RANGE_TABLE (work_area, 2);
2327              work_area->table[work_area->used++] = (cmin);
2328              work_area->table[work_area->used++] = (cmax);
2329            }
2330        }
2331    
2332    return -1;    return -1;
2333  }  }

Legend:
Removed from v.1.178  
changed lines
  Added in v.1.179

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26