306 |
} |
} |
307 |
|
|
308 |
re_match_object = Qnil; |
re_match_object = Qnil; |
309 |
|
|
310 |
i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
i = re_match_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
311 |
PT_BYTE - BEGV_BYTE, &search_regs, |
PT_BYTE - BEGV_BYTE, &search_regs, |
312 |
ZV_BYTE - BEGV_BYTE); |
ZV_BYTE - BEGV_BYTE); |
313 |
immediate_quit = 0; |
immediate_quit = 0; |
314 |
|
|
315 |
if (i == -2) |
if (i == -2) |
316 |
matcher_overflow (); |
matcher_overflow (); |
317 |
|
|
390 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
391 |
immediate_quit = 1; |
immediate_quit = 1; |
392 |
re_match_object = string; |
re_match_object = string; |
393 |
|
|
394 |
val = re_search (bufp, (char *) SDATA (string), |
val = re_search (bufp, (char *) SDATA (string), |
395 |
SBYTES (string), pos_byte, |
SBYTES (string), pos_byte, |
396 |
SBYTES (string) - pos_byte, |
SBYTES (string) - pos_byte, |
458 |
0, STRING_MULTIBYTE (string)); |
0, STRING_MULTIBYTE (string)); |
459 |
immediate_quit = 1; |
immediate_quit = 1; |
460 |
re_match_object = string; |
re_match_object = string; |
461 |
|
|
462 |
val = re_search (bufp, (char *) SDATA (string), |
val = re_search (bufp, (char *) SDATA (string), |
463 |
SBYTES (string), 0, |
SBYTES (string), 0, |
464 |
SBYTES (string), 0); |
SBYTES (string), 0); |
550 |
int allow_quit; |
int allow_quit; |
551 |
{ |
{ |
552 |
struct region_cache *newline_cache; |
struct region_cache *newline_cache; |
553 |
int direction; |
int direction; |
554 |
|
|
555 |
if (count > 0) |
if (count > 0) |
556 |
{ |
{ |
611 |
ceiling_byte = min (tem, ceiling_byte); |
ceiling_byte = min (tem, ceiling_byte); |
612 |
|
|
613 |
{ |
{ |
614 |
/* The termination address of the dumb loop. */ |
/* The termination address of the dumb loop. */ |
615 |
register unsigned char *ceiling_addr |
register unsigned char *ceiling_addr |
616 |
= BYTE_POS_ADDR (ceiling_byte) + 1; |
= BYTE_POS_ADDR (ceiling_byte) + 1; |
617 |
register unsigned char *cursor |
register unsigned char *cursor |
856 |
|
|
857 |
if (shortage == 0) |
if (shortage == 0) |
858 |
pos--; |
pos--; |
859 |
|
|
860 |
return pos; |
return pos; |
861 |
} |
} |
862 |
|
|
1062 |
s2 = 0; |
s2 = 0; |
1063 |
} |
} |
1064 |
re_match_object = Qnil; |
re_match_object = Qnil; |
1065 |
|
|
1066 |
while (n < 0) |
while (n < 0) |
1067 |
{ |
{ |
1068 |
int val; |
int val; |
1528 |
int infinity, limit, stride_for_teases = 0; |
int infinity, limit, stride_for_teases = 0; |
1529 |
register int *BM_tab; |
register int *BM_tab; |
1530 |
int *BM_tab_base; |
int *BM_tab_base; |
1531 |
register unsigned char *cursor, *p_limit; |
register unsigned char *cursor, *p_limit; |
1532 |
register int i, j; |
register int i, j; |
1533 |
unsigned char *pat, *pat_end; |
unsigned char *pat, *pat_end; |
1534 |
int multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
int multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
1561 |
/* a single test, a test for having gone past the end of the */ |
/* a single test, a test for having gone past the end of the */ |
1562 |
/* permissible match region, to test for both possible matches (when */ |
/* permissible match region, to test for both possible matches (when */ |
1563 |
/* the stride goes past the end immediately) and failure to */ |
/* the stride goes past the end immediately) and failure to */ |
1564 |
/* match (where you get nudged past the end one stride at a time). */ |
/* match (where you get nudged past the end one stride at a time). */ |
1565 |
|
|
1566 |
/* Here we make a "mickey mouse" BM table. The stride of the search */ |
/* Here we make a "mickey mouse" BM table. The stride of the search */ |
1567 |
/* is determined only by the last character of the putative match. */ |
/* is determined only by the last character of the putative match. */ |
1568 |
/* If that character does not match, we will stride the proper */ |
/* If that character does not match, we will stride the proper */ |
1569 |
/* distance to propose a match that superimposes it on the last */ |
/* distance to propose a match that superimposes it on the last */ |
1570 |
/* instance of a character that matches it (per trt), or misses */ |
/* instance of a character that matches it (per trt), or misses */ |
1571 |
/* it entirely if there is none. */ |
/* it entirely if there is none. */ |
1572 |
|
|
1573 |
dirlen = len_byte * direction; |
dirlen = len_byte * direction; |
1574 |
infinity = dirlen - (lim_byte + pos_byte + len_byte + len_byte) * direction; |
infinity = dirlen - (lim_byte + pos_byte + len_byte + len_byte) * direction; |
1656 |
|
|
1657 |
BM_tab[j] = dirlen - i; |
BM_tab[j] = dirlen - i; |
1658 |
/* A translation table is accompanied by its inverse -- see */ |
/* A translation table is accompanied by its inverse -- see */ |
1659 |
/* comment following downcase_table for details */ |
/* comment following downcase_table for details */ |
1660 |
if (this_translated) |
if (this_translated) |
1661 |
{ |
{ |
1662 |
int starting_ch = ch; |
int starting_ch = ch; |
1844 |
/* This loop can be coded for space rather than */ |
/* This loop can be coded for space rather than */ |
1845 |
/* speed because it will usually run only once. */ |
/* speed because it will usually run only once. */ |
1846 |
/* (the reach is at most len + 21, and typically */ |
/* (the reach is at most len + 21, and typically */ |
1847 |
/* does not exceed len) */ |
/* does not exceed len) */ |
1848 |
while ((limit - pos_byte) * direction >= 0) |
while ((limit - pos_byte) * direction >= 0) |
1849 |
pos_byte += BM_tab[FETCH_BYTE (pos_byte)]; |
pos_byte += BM_tab[FETCH_BYTE (pos_byte)]; |
1850 |
/* now run the same tests to distinguish going off the */ |
/* now run the same tests to distinguish going off the */ |
1957 |
for (i = 0, i_byte = 0; i < len; ) |
for (i = 0, i_byte = 0; i < len; ) |
1958 |
{ |
{ |
1959 |
int c; |
int c; |
1960 |
|
|
1961 |
FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); |
FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); |
1962 |
|
|
1963 |
if (SYNTAX (c) != Sword) |
if (SYNTAX (c) != Sword) |
1992 |
{ |
{ |
1993 |
int c; |
int c; |
1994 |
int i_byte_orig = i_byte; |
int i_byte_orig = i_byte; |
1995 |
|
|
1996 |
FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); |
FETCH_STRING_CHAR_ADVANCE (c, string, i, i_byte); |
1997 |
|
|
1998 |
if (SYNTAX (c) == Sword) |
if (SYNTAX (c) == Sword) |
2360 |
if (c == '\\') |
if (c == '\\') |
2361 |
{ |
{ |
2362 |
FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); |
FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); |
2363 |
|
|
2364 |
if (c == '&') |
if (c == '&') |
2365 |
{ |
{ |
2366 |
substart = search_regs.start[sub]; |
substart = search_regs.start[sub]; |
2593 |
|
|
2594 |
/* Now move point "officially" to the start of the inserted replacement. */ |
/* Now move point "officially" to the start of the inserted replacement. */ |
2595 |
move_if_not_intangible (newpoint); |
move_if_not_intangible (newpoint); |
2596 |
|
|
2597 |
return Qnil; |
return Qnil; |
2598 |
} |
} |
2599 |
|
|
2639 |
Lisp_Object subexp; |
Lisp_Object subexp; |
2640 |
{ |
{ |
2641 |
return match_limit (subexp, 0); |
return match_limit (subexp, 0); |
2642 |
} |
} |
2643 |
|
|
2644 |
DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 2, 0, |
DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 2, 0, |
2645 |
doc: /* Return a list containing all info on what the last search matched. |
doc: /* Return a list containing all info on what the last search matched. |
2687 |
last_thing_searched); |
last_thing_searched); |
2688 |
data[2 * i + 1] = Fmake_marker (); |
data[2 * i + 1] = Fmake_marker (); |
2689 |
Fset_marker (data[2 * i + 1], |
Fset_marker (data[2 * i + 1], |
2690 |
make_number (search_regs.end[i]), |
make_number (search_regs.end[i]), |
2691 |
last_thing_searched); |
last_thing_searched); |
2692 |
} |
} |
2693 |
else |
else |
2740 |
if (!CONSP (list) && !NILP (list)) |
if (!CONSP (list) && !NILP (list)) |
2741 |
list = wrong_type_argument (Qconsp, list); |
list = wrong_type_argument (Qconsp, list); |
2742 |
|
|
2743 |
/* Unless we find a marker with a buffer in LIST, assume that this |
/* Unless we find a marker with a buffer in LIST, assume that this |
2744 |
match data came from a string. */ |
match data came from a string. */ |
2745 |
last_thing_searched = Qt; |
last_thing_searched = Qt; |
2746 |
|
|
2809 |
list = Fcdr (list); |
list = Fcdr (list); |
2810 |
} |
} |
2811 |
|
|
2812 |
return Qnil; |
return Qnil; |
2813 |
} |
} |
2814 |
|
|
2815 |
/* If non-zero the match data have been saved in saved_search_regs |
/* If non-zero the match data have been saved in saved_search_regs |
2873 |
|
|
2874 |
in = SDATA (string); |
in = SDATA (string); |
2875 |
end = in + SBYTES (string); |
end = in + SBYTES (string); |
2876 |
out = temp; |
out = temp; |
2877 |
|
|
2878 |
for (; in != end; in++) |
for (; in != end; in++) |
2879 |
{ |
{ |
2890 |
out - temp, |
out - temp, |
2891 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
2892 |
} |
} |
2893 |
|
|
2894 |
void |
void |
2895 |
syms_of_search () |
syms_of_search () |
2896 |
{ |
{ |