static Lisp_Object
string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix)
{
- int val;
+ EMACS_INT val;
struct re_pattern_buffer *bufp;
EMACS_INT pos, pos_byte;
int i;
return make_number (string_byte_to_char (string, val));
}
-DEFUN ("string-match", Fstring_match, Sstring_match, 2, 3, 0,
+DEFUE ("string-match", Fstring_match, Sstring_match, 2, 3, 0,
doc: /* Return index of start of first match for REGEXP in STRING, or nil.
Matching ignores case if `case-fold-search' is non-nil.
If third arg START is non-nil, start search at that index in STRING.
and return the index of the match, or negative on failure.
This does not clobber the match data. */
-int
+EMACS_INT
fast_string_match (Lisp_Object regexp, Lisp_Object string)
{
- int val;
+ EMACS_INT val;
struct re_pattern_buffer *bufp;
bufp = compile_pattern (regexp, 0, Qnil,
This does not clobber the match data.
We assume that STRING contains single-byte characters. */
-int
+EMACS_INT
fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string)
{
- int val;
+ EMACS_INT val;
struct re_pattern_buffer *bufp;
size_t len = strlen (string);
/* Like fast_string_match but ignore case. */
-int
+EMACS_INT
fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
{
- int val;
+ EMACS_INT val;
struct re_pattern_buffer *bufp;
bufp = compile_pattern (regexp, 0, Vascii_canon_table,
EMACS_INT
scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
- EMACS_INT count, int *shortage, int allow_quit)
+ EMACS_INT count, EMACS_INT *shortage, int allow_quit)
{
struct region_cache *newline_cache;
int direction;
EMACS_INT
find_next_newline_no_quit (EMACS_INT from, EMACS_INT cnt)
{
- return scan_buffer ('\n', from, 0, cnt, (int *) 0, 0);
+ return scan_buffer ('\n', from, 0, cnt, (EMACS_INT *) 0, 0);
}
/* Like find_next_newline, but returns position before the newline,
EMACS_INT
find_before_next_newline (EMACS_INT from, EMACS_INT to, EMACS_INT cnt)
{
- int shortage;
+ EMACS_INT shortage;
EMACS_INT pos = scan_buffer ('\n', from, to, cnt, &shortage, 1);
if (shortage == 0)
search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
Lisp_Object count, int direction, int RE, int posix)
{
- register int np;
+ register EMACS_INT np;
EMACS_INT lim, lim_byte;
- int n = direction;
+ EMACS_INT n = direction;
if (!NILP (count))
{
int translate_prev_byte1 = 0;
int translate_prev_byte2 = 0;
int translate_prev_byte3 = 0;
- int translate_prev_byte4 = 0;
/* The general approach is that we are going to maintain that we know
the first (closest to the present position, in whatever direction
{
translate_prev_byte2 = str[cblen - 3];
if (cblen > 3)
- {
- translate_prev_byte3 = str[cblen - 4];
- if (cblen > 4)
- translate_prev_byte4 = str[cblen - 5];
- }
+ translate_prev_byte3 = str[cblen - 4];
}
}
static Lisp_Object
wordify (Lisp_Object string, int lax)
{
- register unsigned char *p, *o;
+ register unsigned char *o;
register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0;
Lisp_Object val;
int prev_c = 0;
int whitespace_at_end;
CHECK_STRING (string);
- p = SDATA (string);
len = SCHARS (string);
for (i = 0, i_byte = 0; i < len; )
if (SYNTAX (c) != Sword)
{
punct_count++;
- if (i > 0 && SYNTAX (prev_c) == Sword)
+ if (SYNTAX (prev_c) == Sword)
word_count++;
}
whitespace_at_end = 0;
}
else
- whitespace_at_end = 1;
-
- if (!word_count)
- return empty_unibyte_string;
+ {
+ whitespace_at_end = 1;
+ if (!word_count)
+ return empty_unibyte_string;
+ }
adjust = - punct_count + 5 * (word_count - 1)
+ ((lax && !whitespace_at_end) ? 2 : 4);
memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
o += i_byte - i_byte_orig;
}
- else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count)
+ else if (SYNTAX (prev_c) == Sword && --word_count)
{
*o++ = '\\';
*o++ = 'W';
/* We build up the substituted string in ACCUM. */
Lisp_Object accum;
Lisp_Object middle;
- int length = SBYTES (newtext);
+ EMACS_INT length = SBYTES (newtext);
accum = Qnil;
: search_regs.end[n]));
}
-DEFUN ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
+DEFUE ("match-beginning", Fmatch_beginning, Smatch_beginning, 1, 1, 0,
doc: /* Return position of start of text matched by last search.
SUBEXP, a number, specifies which parenthesized expression in the last
regexp.
return match_limit (subexp, 1);
}
-DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0,
+DEFUE ("match-end", Fmatch_end, Smatch_end, 1, 1, 0,
doc: /* Return position of end of text matched by last search.
SUBEXP, a number, specifies which parenthesized expression in the last
regexp.
return match_limit (subexp, 0);
}
-DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0,
+DEFUE ("match-data", Fmatch_data, Smatch_data, 0, 3, 0,
doc: /* Return a list containing all info on what the last search matched.
Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.
All the elements are markers or nil (nil if the Nth pair didn't match)
len = 0;
for (i = 0; i < search_regs.num_regs; i++)
{
- int start = search_regs.start[i];
+ EMACS_INT start = search_regs.start[i];
if (start >= 0)
{
if (EQ (last_thing_searched, Qt)
But it was ill-conceived: those supposedly-internal markers get exposed via
the undo-list, so freeing them here is unsafe. */
-DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0,
+DEFUE ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0,
doc: /* Set internal data on last search match from elements of LIST.
LIST should have been created by calling `match-data' previously.