comparison src/search.c @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children 8626e4521993
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
300 p2 = BI_BUF_CEILING_OF (buf, p1); 300 p2 = BI_BUF_CEILING_OF (buf, p1);
301 s1 = p2 - p1; 301 s1 = p2 - p1;
302 s2 = BI_BUF_ZV (buf) - p2; 302 s2 = BI_BUF_ZV (buf) - p2;
303 303
304 regex_emacs_buffer = buf; 304 regex_emacs_buffer = buf;
305 regex_emacs_buffer_p = 1;
306 i = re_match_2 (bufp, (char *) BI_BUF_BYTE_ADDRESS (buf, p1), 305 i = re_match_2 (bufp, (char *) BI_BUF_BYTE_ADDRESS (buf, p1),
307 s1, (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, 306 s1, (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2,
308 BI_BUF_PT (buf) - BI_BUF_BEGV (buf), &search_regs, 307 BI_BUF_PT (buf) - BI_BUF_BEGV (buf), &search_regs,
309 BI_BUF_ZV (buf) - BI_BUF_BEGV (buf)); 308 BI_BUF_ZV (buf) - BI_BUF_BEGV (buf));
310 309
391 : 0), 0, ERROR_ME); 390 : 0), 0, ERROR_ME);
392 QUIT; 391 QUIT;
393 { 392 {
394 Bytecount bis = charcount_to_bytecount (XSTRING_DATA (string), s); 393 Bytecount bis = charcount_to_bytecount (XSTRING_DATA (string), s);
395 regex_emacs_buffer = buf; 394 regex_emacs_buffer = buf;
396 regex_emacs_buffer_p = 0;
397 val = re_search (bufp, (char *) XSTRING_DATA (string), 395 val = re_search (bufp, (char *) XSTRING_DATA (string),
398 XSTRING_LENGTH (string), bis, 396 XSTRING_LENGTH (string), bis,
399 XSTRING_LENGTH (string) - bis, 397 XSTRING_LENGTH (string) - bis,
400 &search_regs); 398 &search_regs);
401 } 399 }
485 } 483 }
486 } 484 }
487 485
488 /* #### evil current-buffer dependency */ 486 /* #### evil current-buffer dependency */
489 regex_emacs_buffer = current_buffer; 487 regex_emacs_buffer = current_buffer;
490 regex_emacs_buffer_p = 0;
491 val = re_search (bufp, (char *) newnonreloc + offset, length, 0, 488 val = re_search (bufp, (char *) newnonreloc + offset, length, 0,
492 length, 0); 489 length, 0);
493 490
494 no_quit_in_re_search = 0; 491 no_quit_in_re_search = 0;
495 return val; 492 return val;
1122 while (n < 0) 1119 while (n < 0)
1123 { 1120 {
1124 Bytecount val; 1121 Bytecount val;
1125 QUIT; 1122 QUIT;
1126 regex_emacs_buffer = buf; 1123 regex_emacs_buffer = buf;
1127 regex_emacs_buffer_p = 1;
1128 val = re_search_2 (bufp, 1124 val = re_search_2 (bufp,
1129 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, 1125 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1,
1130 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, 1126 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2,
1131 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, 1127 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs,
1132 pos - BI_BUF_BEGV (buf)); 1128 pos - BI_BUF_BEGV (buf));
1161 while (n > 0) 1157 while (n > 0)
1162 { 1158 {
1163 Bytecount val; 1159 Bytecount val;
1164 QUIT; 1160 QUIT;
1165 regex_emacs_buffer = buf; 1161 regex_emacs_buffer = buf;
1166 regex_emacs_buffer_p = 1;
1167 val = re_search_2 (bufp, 1162 val = re_search_2 (bufp,
1168 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1, 1163 (char *) BI_BUF_BYTE_ADDRESS (buf, p1), s1,
1169 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2, 1164 (char *) BI_BUF_BYTE_ADDRESS (buf, p2), s2,
1170 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs, 1165 pos - BI_BUF_BEGV (buf), lim - pos, &search_regs,
1171 lim - BI_BUF_BEGV (buf)); 1166 lim - BI_BUF_BEGV (buf));
2039 make_int (strpos))); 2034 make_int (strpos)));
2040 else 2035 else
2041 newtext = accum; 2036 newtext = accum;
2042 } 2037 }
2043 2038
2044 /* newtext can be nil. */
2045 if (NILP (newtext))
2046 newtext = build_string ("");
2047
2048 if (case_action == all_caps) 2039 if (case_action == all_caps)
2049 newtext = Fupcase (newtext, buffer); 2040 newtext = Fupcase (newtext, buffer);
2050 else if (case_action == cap_initial) 2041 else if (case_action == cap_initial)
2051 newtext = Fupcase_initials (newtext, buffer); 2042 newtext = Fupcase_initials (newtext, buffer);
2052 2043