128 |
|
|
129 |
if (multibyte == STRING_MULTIBYTE (pattern)) |
if (multibyte == STRING_MULTIBYTE (pattern)) |
130 |
{ |
{ |
131 |
raw_pattern = (unsigned char *) XSTRING (pattern)->data; |
raw_pattern = (unsigned char *) SDATA (pattern); |
132 |
raw_pattern_size = STRING_BYTES (XSTRING (pattern)); |
raw_pattern_size = SBYTES (pattern); |
133 |
} |
} |
134 |
else if (multibyte) |
else if (multibyte) |
135 |
{ |
{ |
136 |
raw_pattern_size = count_size_as_multibyte (XSTRING (pattern)->data, |
raw_pattern_size = count_size_as_multibyte (SDATA (pattern), |
137 |
XSTRING (pattern)->size); |
SCHARS (pattern)); |
138 |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
139 |
copy_text (XSTRING (pattern)->data, raw_pattern, |
copy_text (SDATA (pattern), raw_pattern, |
140 |
XSTRING (pattern)->size, 0, 1); |
SCHARS (pattern), 0, 1); |
141 |
} |
} |
142 |
else |
else |
143 |
{ |
{ |
147 |
by subtracting nonascii-insert-offset from each non-ASCII char, |
by subtracting nonascii-insert-offset from each non-ASCII char, |
148 |
so that only the multibyte chars which really correspond to |
so that only the multibyte chars which really correspond to |
149 |
the chosen single-byte character set can possibly match. */ |
the chosen single-byte character set can possibly match. */ |
150 |
raw_pattern_size = XSTRING (pattern)->size; |
raw_pattern_size = SCHARS (pattern); |
151 |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
152 |
copy_text (XSTRING (pattern)->data, raw_pattern, |
copy_text (SDATA (pattern), raw_pattern, |
153 |
STRING_BYTES (XSTRING (pattern)), 1, 0); |
SBYTES (pattern), 1, 0); |
154 |
} |
} |
155 |
|
|
156 |
cp->regexp = Qnil; |
cp->regexp = Qnil; |
212 |
cp = *cpp; |
cp = *cpp; |
213 |
/* Entries are initialized to nil, and may be set to nil by |
/* Entries are initialized to nil, and may be set to nil by |
214 |
compile_pattern_1 if the pattern isn't valid. Don't apply |
compile_pattern_1 if the pattern isn't valid. Don't apply |
215 |
XSTRING in those cases. However, compile_pattern_1 is only |
string accessors in those cases. However, compile_pattern_1 |
216 |
applied to the cache entry we pick here to reuse. So nil |
is only applied to the cache entry we pick here to reuse. So |
217 |
should never appear before a non-nil entry. */ |
nil should never appear before a non-nil entry. */ |
218 |
if (NILP (cp->regexp)) |
if (NILP (cp->regexp)) |
219 |
goto compile_it; |
goto compile_it; |
220 |
if (XSTRING (cp->regexp)->size == XSTRING (pattern)->size |
if (SCHARS (cp->regexp) == SCHARS (pattern) |
221 |
&& STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern) |
&& STRING_MULTIBYTE (cp->regexp) == STRING_MULTIBYTE (pattern) |
222 |
&& !NILP (Fstring_equal (cp->regexp, pattern)) |
&& !NILP (Fstring_equal (cp->regexp, pattern)) |
223 |
&& EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) |
&& EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) |
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 |
|
|
372 |
pos = 0, pos_byte = 0; |
pos = 0, pos_byte = 0; |
373 |
else |
else |
374 |
{ |
{ |
375 |
int len = XSTRING (string)->size; |
int len = SCHARS (string); |
376 |
|
|
377 |
CHECK_NUMBER (start); |
CHECK_NUMBER (start); |
378 |
pos = XINT (start); |
pos = XINT (start); |
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 *) XSTRING (string)->data, |
val = re_search (bufp, (char *) SDATA (string), |
395 |
STRING_BYTES (XSTRING (string)), pos_byte, |
SBYTES (string), pos_byte, |
396 |
STRING_BYTES (XSTRING (string)) - pos_byte, |
SBYTES (string) - pos_byte, |
397 |
&search_regs); |
&search_regs); |
398 |
immediate_quit = 0; |
immediate_quit = 0; |
399 |
last_thing_searched = Qt; |
last_thing_searched = Qt; |
419 |
If third arg START is non-nil, start search at that index in STRING. |
If third arg START is non-nil, start search at that index in STRING. |
420 |
For index of first char beyond the match, do (match-end 0). |
For index of first char beyond the match, do (match-end 0). |
421 |
`match-end' and `match-beginning' also give indices of substrings |
`match-end' and `match-beginning' also give indices of substrings |
422 |
matched by parenthesis constructs in the pattern. */) |
matched by parenthesis constructs in the pattern. |
423 |
|
|
424 |
|
You can use the function `match-string' to extract the substrings |
425 |
|
matched by the parenthesis constructions in REGEXP. */) |
426 |
(regexp, string, start) |
(regexp, string, start) |
427 |
Lisp_Object regexp, string, start; |
Lisp_Object regexp, string, start; |
428 |
{ |
{ |
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 *) XSTRING (string)->data, |
val = re_search (bufp, (char *) SDATA (string), |
463 |
STRING_BYTES (XSTRING (string)), 0, |
SBYTES (string), 0, |
464 |
STRING_BYTES (XSTRING (string)), 0); |
SBYTES (string), 0); |
465 |
immediate_quit = 0; |
immediate_quit = 0; |
466 |
return val; |
return val; |
467 |
} |
} |
476 |
int |
int |
477 |
fast_c_string_match_ignore_case (regexp, string) |
fast_c_string_match_ignore_case (regexp, string) |
478 |
Lisp_Object regexp; |
Lisp_Object regexp; |
479 |
char *string; |
const char *string; |
480 |
{ |
{ |
481 |
int val; |
int val; |
482 |
struct re_pattern_buffer *bufp; |
struct re_pattern_buffer *bufp; |
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 |
|
|
942 |
trivial_regexp_p (regexp) |
trivial_regexp_p (regexp) |
943 |
Lisp_Object regexp; |
Lisp_Object regexp; |
944 |
{ |
{ |
945 |
int len = STRING_BYTES (XSTRING (regexp)); |
int len = SBYTES (regexp); |
946 |
unsigned char *s = XSTRING (regexp)->data; |
unsigned char *s = SDATA (regexp); |
947 |
while (--len >= 0) |
while (--len >= 0) |
948 |
{ |
{ |
949 |
switch (*s++) |
switch (*s++) |
1014 |
Lisp_Object inverse_trt; |
Lisp_Object inverse_trt; |
1015 |
int posix; |
int posix; |
1016 |
{ |
{ |
1017 |
int len = XSTRING (string)->size; |
int len = SCHARS (string); |
1018 |
int len_byte = STRING_BYTES (XSTRING (string)); |
int len_byte = SBYTES (string); |
1019 |
register int i; |
register int i; |
1020 |
|
|
1021 |
if (running_asynch_code) |
if (running_asynch_code) |
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; |
1139 |
int raw_pattern_size_byte; |
int raw_pattern_size_byte; |
1140 |
unsigned char *patbuf; |
unsigned char *patbuf; |
1141 |
int multibyte = !NILP (current_buffer->enable_multibyte_characters); |
int multibyte = !NILP (current_buffer->enable_multibyte_characters); |
1142 |
unsigned char *base_pat = XSTRING (string)->data; |
unsigned char *base_pat = SDATA (string); |
1143 |
int charset_base = -1; |
int charset_base = -1; |
1144 |
int boyer_moore_ok = 1; |
int boyer_moore_ok = 1; |
1145 |
|
|
1149 |
|
|
1150 |
if (multibyte == STRING_MULTIBYTE (string)) |
if (multibyte == STRING_MULTIBYTE (string)) |
1151 |
{ |
{ |
1152 |
raw_pattern = (unsigned char *) XSTRING (string)->data; |
raw_pattern = (unsigned char *) SDATA (string); |
1153 |
raw_pattern_size = XSTRING (string)->size; |
raw_pattern_size = SCHARS (string); |
1154 |
raw_pattern_size_byte = STRING_BYTES (XSTRING (string)); |
raw_pattern_size_byte = SBYTES (string); |
1155 |
} |
} |
1156 |
else if (multibyte) |
else if (multibyte) |
1157 |
{ |
{ |
1158 |
raw_pattern_size = XSTRING (string)->size; |
raw_pattern_size = SCHARS (string); |
1159 |
raw_pattern_size_byte |
raw_pattern_size_byte |
1160 |
= count_size_as_multibyte (XSTRING (string)->data, |
= count_size_as_multibyte (SDATA (string), |
1161 |
raw_pattern_size); |
raw_pattern_size); |
1162 |
raw_pattern = (unsigned char *) alloca (raw_pattern_size_byte + 1); |
raw_pattern = (unsigned char *) alloca (raw_pattern_size_byte + 1); |
1163 |
copy_text (XSTRING (string)->data, raw_pattern, |
copy_text (SDATA (string), raw_pattern, |
1164 |
XSTRING (string)->size, 0, 1); |
SCHARS (string), 0, 1); |
1165 |
} |
} |
1166 |
else |
else |
1167 |
{ |
{ |
1171 |
by subtracting nonascii-insert-offset from each non-ASCII char, |
by subtracting nonascii-insert-offset from each non-ASCII char, |
1172 |
so that only the multibyte chars which really correspond to |
so that only the multibyte chars which really correspond to |
1173 |
the chosen single-byte character set can possibly match. */ |
the chosen single-byte character set can possibly match. */ |
1174 |
raw_pattern_size = XSTRING (string)->size; |
raw_pattern_size = SCHARS (string); |
1175 |
raw_pattern_size_byte = XSTRING (string)->size; |
raw_pattern_size_byte = SCHARS (string); |
1176 |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1); |
1177 |
copy_text (XSTRING (string)->data, raw_pattern, |
copy_text (SDATA (string), raw_pattern, |
1178 |
STRING_BYTES (XSTRING (string)), 1, 0); |
SBYTES (string), 1, 0); |
1179 |
} |
} |
1180 |
|
|
1181 |
/* Copy and optionally translate the pattern. */ |
/* Copy and optionally translate the pattern. */ |
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 */ |
1951 |
int adjust; |
int adjust; |
1952 |
|
|
1953 |
CHECK_STRING (string); |
CHECK_STRING (string); |
1954 |
p = XSTRING (string)->data; |
p = SDATA (string); |
1955 |
len = XSTRING (string)->size; |
len = SCHARS (string); |
1956 |
|
|
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) |
1978 |
adjust = - punct_count + 5 * (word_count - 1) + 4; |
adjust = - punct_count + 5 * (word_count - 1) + 4; |
1979 |
if (STRING_MULTIBYTE (string)) |
if (STRING_MULTIBYTE (string)) |
1980 |
val = make_uninit_multibyte_string (len + adjust, |
val = make_uninit_multibyte_string (len + adjust, |
1981 |
STRING_BYTES (XSTRING (string)) |
SBYTES (string) |
1982 |
+ adjust); |
+ adjust); |
1983 |
else |
else |
1984 |
val = make_uninit_string (len + adjust); |
val = make_uninit_string (len + adjust); |
1985 |
|
|
1986 |
o = XSTRING (val)->data; |
o = SDATA (val); |
1987 |
*o++ = '\\'; |
*o++ = '\\'; |
1988 |
*o++ = 'b'; |
*o++ = 'b'; |
1989 |
prev_c = 0; |
prev_c = 0; |
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) |
1999 |
{ |
{ |
2000 |
bcopy (&XSTRING (string)->data[i_byte_orig], o, |
bcopy (SDATA (string) + i_byte_orig, o, |
2001 |
i_byte - i_byte_orig); |
i_byte - i_byte_orig); |
2002 |
o += i_byte - i_byte_orig; |
o += i_byte - i_byte_orig; |
2003 |
} |
} |
2245 |
{ |
{ |
2246 |
if (search_regs.start[sub] < 0 |
if (search_regs.start[sub] < 0 |
2247 |
|| search_regs.start[sub] > search_regs.end[sub] |
|| search_regs.start[sub] > search_regs.end[sub] |
2248 |
|| search_regs.end[sub] > XSTRING (string)->size) |
|| search_regs.end[sub] > SCHARS (string)) |
2249 |
args_out_of_range (make_number (search_regs.start[sub]), |
args_out_of_range (make_number (search_regs.start[sub]), |
2250 |
make_number (search_regs.end[sub])); |
make_number (search_regs.end[sub])); |
2251 |
} |
} |
2345 |
/* We build up the substituted string in ACCUM. */ |
/* We build up the substituted string in ACCUM. */ |
2346 |
Lisp_Object accum; |
Lisp_Object accum; |
2347 |
Lisp_Object middle; |
Lisp_Object middle; |
2348 |
int length = STRING_BYTES (XSTRING (newtext)); |
int length = SBYTES (newtext); |
2349 |
|
|
2350 |
accum = Qnil; |
accum = Qnil; |
2351 |
|
|
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]; |
2437 |
perform substitution on the replacement string. */ |
perform substitution on the replacement string. */ |
2438 |
if (NILP (literal)) |
if (NILP (literal)) |
2439 |
{ |
{ |
2440 |
int length = STRING_BYTES (XSTRING (newtext)); |
int length = SBYTES (newtext); |
2441 |
unsigned char *substed; |
unsigned char *substed; |
2442 |
int substed_alloc_size, substed_len; |
int substed_alloc_size, substed_len; |
2443 |
int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); |
int buf_multibyte = !NILP (current_buffer->enable_multibyte_characters); |
2474 |
else |
else |
2475 |
{ |
{ |
2476 |
/* Note that we don't have to increment POS. */ |
/* Note that we don't have to increment POS. */ |
2477 |
c = XSTRING (newtext)->data[pos_byte++]; |
c = SREF (newtext, pos_byte++); |
2478 |
if (buf_multibyte) |
if (buf_multibyte) |
2479 |
c = unibyte_char_to_multibyte (c); |
c = unibyte_char_to_multibyte (c); |
2480 |
} |
} |
2496 |
} |
} |
2497 |
else |
else |
2498 |
{ |
{ |
2499 |
c = XSTRING (newtext)->data[pos_byte++]; |
c = SREF (newtext, pos_byte++); |
2500 |
if (buf_multibyte) |
if (buf_multibyte) |
2501 |
c = unibyte_char_to_multibyte (c); |
c = unibyte_char_to_multibyte (c); |
2502 |
} |
} |
2561 |
/* Replace the old text with the new in the cleanest possible way. */ |
/* Replace the old text with the new in the cleanest possible way. */ |
2562 |
replace_range (search_regs.start[sub], search_regs.end[sub], |
replace_range (search_regs.start[sub], search_regs.end[sub], |
2563 |
newtext, 1, 0, 1); |
newtext, 1, 0, 1); |
2564 |
newpoint = search_regs.start[sub] + XSTRING (newtext)->size; |
newpoint = search_regs.start[sub] + SCHARS (newtext); |
2565 |
|
|
2566 |
if (case_action == all_caps) |
if (case_action == all_caps) |
2567 |
Fupcase_region (make_number (search_regs.start[sub]), |
Fupcase_region (make_number (search_regs.start[sub]), |
2570 |
Fupcase_initials_region (make_number (search_regs.start[sub]), |
Fupcase_initials_region (make_number (search_regs.start[sub]), |
2571 |
make_number (newpoint)); |
make_number (newpoint)); |
2572 |
|
|
2573 |
|
/* Adjust search data for this change. */ |
2574 |
|
{ |
2575 |
|
int oldend = search_regs.end[sub]; |
2576 |
|
int change = newpoint - search_regs.end[sub]; |
2577 |
|
int i; |
2578 |
|
|
2579 |
|
for (i = 0; i < search_regs.num_regs; i++) |
2580 |
|
{ |
2581 |
|
if (search_regs.start[i] > oldend) |
2582 |
|
search_regs.start[i] += change; |
2583 |
|
if (search_regs.end[i] > oldend) |
2584 |
|
search_regs.end[i] += change; |
2585 |
|
} |
2586 |
|
} |
2587 |
|
|
2588 |
/* Put point back where it was in the text. */ |
/* Put point back where it was in the text. */ |
2589 |
if (opoint <= 0) |
if (opoint <= 0) |
2590 |
TEMP_SET_PT (opoint + ZV); |
TEMP_SET_PT (opoint + ZV); |
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. |
2651 |
If INTEGERS (the optional first argument) is non-nil, always use integers |
If INTEGERS (the optional first argument) is non-nil, always use integers |
2652 |
\(rather than markers) to represent buffer positions. |
\(rather than markers) to represent buffer positions. |
2653 |
If REUSE is a list, reuse it as part of the value. If REUSE is long enough |
If REUSE is a list, reuse it as part of the value. If REUSE is long enough |
2654 |
to hold all the values, and if INTEGERS is non-nil, no consing is done. */) |
to hold all the values, and if INTEGERS is non-nil, no consing is done. |
2655 |
|
|
2656 |
|
Return value is undefined if the last search failed. */) |
2657 |
(integers, reuse) |
(integers, reuse) |
2658 |
Lisp_Object integers, reuse; |
Lisp_Object integers, reuse; |
2659 |
{ |
{ |
2689 |
last_thing_searched); |
last_thing_searched); |
2690 |
data[2 * i + 1] = Fmake_marker (); |
data[2 * i + 1] = Fmake_marker (); |
2691 |
Fset_marker (data[2 * i + 1], |
Fset_marker (data[2 * i + 1], |
2692 |
make_number (search_regs.end[i]), |
make_number (search_regs.end[i]), |
2693 |
last_thing_searched); |
last_thing_searched); |
2694 |
} |
} |
2695 |
else |
else |
2742 |
if (!CONSP (list) && !NILP (list)) |
if (!CONSP (list) && !NILP (list)) |
2743 |
list = wrong_type_argument (Qconsp, list); |
list = wrong_type_argument (Qconsp, list); |
2744 |
|
|
2745 |
/* 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 |
2746 |
match data came from a string. */ |
match data came from a string. */ |
2747 |
last_thing_searched = Qt; |
last_thing_searched = Qt; |
2748 |
|
|
2811 |
list = Fcdr (list); |
list = Fcdr (list); |
2812 |
} |
} |
2813 |
|
|
2814 |
return Qnil; |
return Qnil; |
2815 |
} |
} |
2816 |
|
|
2817 |
/* 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 |
2869 |
|
|
2870 |
CHECK_STRING (string); |
CHECK_STRING (string); |
2871 |
|
|
2872 |
temp = (unsigned char *) alloca (STRING_BYTES (XSTRING (string)) * 2); |
temp = (unsigned char *) alloca (SBYTES (string) * 2); |
2873 |
|
|
2874 |
/* Now copy the data into the new string, inserting escapes. */ |
/* Now copy the data into the new string, inserting escapes. */ |
2875 |
|
|
2876 |
in = XSTRING (string)->data; |
in = SDATA (string); |
2877 |
end = in + STRING_BYTES (XSTRING (string)); |
end = in + SBYTES (string); |
2878 |
out = temp; |
out = temp; |
2879 |
|
|
2880 |
for (; in != end; in++) |
for (; in != end; in++) |
2881 |
{ |
{ |
2888 |
} |
} |
2889 |
|
|
2890 |
return make_specified_string (temp, |
return make_specified_string (temp, |
2891 |
XSTRING (string)->size + backslashes_added, |
SCHARS (string) + backslashes_added, |
2892 |
out - temp, |
out - temp, |
2893 |
STRING_MULTIBYTE (string)); |
STRING_MULTIBYTE (string)); |
2894 |
} |
} |
2895 |
|
|
2896 |
void |
void |
2897 |
syms_of_search () |
syms_of_search () |
2898 |
{ |
{ |