aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-09-06 03:09:13 +0000
committerRichard M. Stallman2002-09-06 03:09:13 +0000
commitb7c1256511ff0ef1ee93fdca30a2ed26d6c02e72 (patch)
tree273257f05a4a1338d5ebc2e5fc57a1190b750db2
parent6d621baba59ed092fe61579cfb491a0f8eeee412 (diff)
downloademacs-b7c1256511ff0ef1ee93fdca30a2ed26d6c02e72.tar.gz
emacs-b7c1256511ff0ef1ee93fdca30a2ed26d6c02e72.zip
(set_image_of_range_1): In no-TRANSLATE case,
call EXTEND_RANGE_TABLE and return a proper value. (set_image_of_range): Don't call set_image_of_range_1 if no TRANSLATE or if range includes all of Latin-1. Only call it for the Latin-1 part of the range. For other cases, make two separate ranges, one for the original specified characters and one for their case-conversions.
-rw-r--r--src/ChangeLog11
-rw-r--r--src/regex.c63
2 files changed, 56 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f4961e70012..330361ebf0e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12002-09-05 Richard M. Stallman <rms@gnu.org>
2
3 * regex.c (set_image_of_range_1): In no-TRANSLATE case,
4 call EXTEND_RANGE_TABLE and return a proper value.
5 (set_image_of_range): Don't call set_image_of_range_1
6 if no TRANSLATE or if range includes all of Latin-1.
7 Only call it for the Latin-1 part of the range.
8 For other cases, make two separate ranges,
9 one for the original specified characters and one for
10 their case-conversions.
11
12002-09-04 Richard M. Stallman <rms@gnu.org> 122002-09-04 Richard M. Stallman <rms@gnu.org>
2 13
3 * s/sol2-5.h (UNEXEC): Use unexsol.o. 14 * s/sol2-5.h (UNEXEC): Use unexsol.o.
diff --git a/src/regex.c b/src/regex.c
index 3b04fe30d23..317e630f72a 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -2145,9 +2145,10 @@ set_image_of_range_1 (work_area, start, end, translate)
2145 2145
2146 if (!RE_TRANSLATE_P (translate)) 2146 if (!RE_TRANSLATE_P (translate))
2147 { 2147 {
2148 EXTEND_RANGE_TABLE (work_area, 2);
2148 work_area->table[work_area->used++] = (start); 2149 work_area->table[work_area->used++] = (start);
2149 work_area->table[work_area->used++] = (end); 2150 work_area->table[work_area->used++] = (end);
2150 return; 2151 return -1;
2151 } 2152 }
2152 2153
2153 eqv_table = XCHAR_TABLE (translate)->extras[2]; 2154 eqv_table = XCHAR_TABLE (translate)->extras[2];
@@ -2253,12 +2254,14 @@ set_image_of_range_1 (work_area, start, end, translate)
2253 2254
2254#endif /* emacs */ 2255#endif /* emacs */
2255 2256
2256/* We need to find the image of the range start..end when passed through 2257/* Record the the image of the range start..end when passed through
2257 TRANSLATE. This is not necessarily TRANSLATE(start)..TRANSLATE(end) 2258 TRANSLATE. This is not necessarily TRANSLATE(start)..TRANSLATE(end)
2258 and is not even necessarily contiguous. 2259 and is not even necessarily contiguous.
2259 We approximate it with the smallest contiguous range that contains 2260 Normally we approximate it with the smallest contiguous range that contains
2260 all the chars we need. However, that is not good enough for Latin-1, 2261 all the chars we need. However, for Latin-1 we go to extra effort
2261 so we do a better job in that case. 2262 to do a better job.
2263
2264 This function is not called for ASCII ranges.
2262 2265
2263 Returns -1 if successful, REG_ESPACE if ran out of space. */ 2266 Returns -1 if successful, REG_ESPACE if ran out of space. */
2264 2267
@@ -2273,12 +2276,17 @@ set_image_of_range (work_area, start, end, translate)
2273#ifdef emacs 2276#ifdef emacs
2274 /* For Latin-1 ranges, use set_image_of_range_1 2277 /* For Latin-1 ranges, use set_image_of_range_1
2275 to get proper handling of ranges that include letters and nonletters. 2278 to get proper handling of ranges that include letters and nonletters.
2276 For ASCII, this is not necessary. 2279 For a range that includes the whole of Latin-1, this is not necessary.
2277 For other character sets, we don't bother to get this right. */ 2280 For other character sets, we don't bother to get this right. */
2278 if (start < 04400 && end > 0200) 2281 if (RE_TRANSLATE_P (translate) && start < 04400
2282 && !(start < 04200 && end >= 04377))
2279 { 2283 {
2284 int newend;
2280 int tem; 2285 int tem;
2281 tem = set_image_of_range_1 (work_area, start, end, translate); 2286 newend = end;
2287 if (newend > 04377)
2288 newend = 04377;
2289 tem = set_image_of_range_1 (work_area, start, newend, translate);
2282 if (tem > 0) 2290 if (tem > 0)
2283 return tem; 2291 return tem;
2284 2292
@@ -2288,19 +2296,38 @@ set_image_of_range (work_area, start, end, translate)
2288 } 2296 }
2289#endif 2297#endif
2290 2298
2291 cmin = TRANSLATE (start), cmax = TRANSLATE (end); 2299 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;
2292 2304
2293 if (RE_TRANSLATE_P (translate)) 2305 if (RE_TRANSLATE_P (translate))
2294 for (; start <= end; start++) 2306 {
2295 { 2307 int ch;
2296 re_wchar_t c = TRANSLATE (start);
2297 cmin = MIN (cmin, c);
2298 cmax = MAX (cmax, c);
2299 }
2300 2308
2301 EXTEND_RANGE_TABLE (work_area, 2); 2309 for (ch = start; ch <= end; ch++)
2302 work_area->table[work_area->used++] = (cmin); 2310 {
2303 work_area->table[work_area->used++] = (cmax); 2311 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 }
2304 2331
2305 return -1; 2332 return -1;
2306} 2333}