\f
/* Interface: using the cache. */
-/* Return true if the text immediately after POS in BUF is known, for
- the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
+/* Return the value for the text immediately after POS in BUF if the value
+ is known, for the purposes of CACHE, and return zero otherwise.
+ If NEXT is non-zero, set *NEXT to the nearest
position after POS where the knowledge changes. */
int
region_cache_forward (struct buffer *buf, struct region_cache *c,
}
}
-/* Return true if the text immediately before POS in BUF is known, for
- the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest
+/* Return the value for the text immediately before POS in BUF if the
+ value is known, for the purposes of CACHE, and return zero
+ otherwise. If NEXT is non-zero, set *NEXT to the nearest
position before POS where the knowledge changes. */
int region_cache_backward (struct buffer *buf, struct region_cache *c,
ptrdiff_t pos, ptrdiff_t *next)
struct matrix_elt *p;
int i, j, k;
- /* Set to 1 if we have set a terminal window with
- set_terminal_window. It's unsigned to work around GCC bug 48228. */
- unsigned int terminal_window_p = 0;
+ /* True if we have set a terminal window with set_terminal_window. */
+ bool terminal_window_p = 0;
/* A queue for line insertions to be done. */
struct queue { int count, pos; };
alloca (window_size * sizeof *queue_start);
struct alt_queue *queue = queue_start;
- /* Set to 1 if a terminal window has been set with
- set_terminal_window: */
- int terminal_window_p = 0;
+ /* True if a terminal window has been set with set_terminal_window. */
+ bool terminal_window_p = 0;
- /* A nonzero value of write_follows indicates that a write has been
- selected, allowing either an insert or a delete to be selected
- next. When write_follows is zero, a delete cannot be selected
+ /* If true, a write has been selected, allowing either an insert or a
+ delete to be selected next. If false, a delete cannot be selected
unless j < i, and an insert cannot be selected unless i < j.
This corresponds to a similar restriction (with the ordering
reversed) in calculate_direct_scrolling, which is intended to
ensure that lines marked as inserted will be blank. */
- int write_follows_p = 1;
+ bool write_follows_p = 1;
/* For each row in the new matrix what row of the old matrix it is. */
int *copy_from = alloca (window_size * sizeof *copy_from);
Lisp_Object syntax_table;
struct re_pattern_buffer buf;
char fastmap[0400];
- /* Nonzero means regexp was compiled to do full POSIX backtracking. */
- char posix;
+ /* True means regexp was compiled to do full POSIX backtracking. */
+ bool posix;
};
/* The instances of that struct. */
ptrdiff_t, int);
static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, EMACS_INT, int,
- Lisp_Object, Lisp_Object, int);
+ Lisp_Object, Lisp_Object, bool);
static _Noreturn void
matcher_overflow (void)
PATTERN is the pattern to compile.
CP is the place to put the result.
TRANSLATE is a translation table for ignoring case, or nil for none.
- POSIX is nonzero if we want full backtracking (POSIX style)
- for this pattern. 0 means backtrack only enough to get a valid match.
+ POSIX is true if we want full backtracking (POSIX style) for this pattern.
+ False means backtrack only enough to get a valid match.
The behavior also depends on Vsearch_spaces_regexp. */
static void
-compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix)
+compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
+ Lisp_Object translate, bool posix)
{
char *val;
reg_syntax_t old;
values that will result from matching this pattern.
If it is 0, we should compile the pattern not to record any
subexpression bounds.
- POSIX is nonzero if we want full backtracking (POSIX style)
- for this pattern. 0 means backtrack only enough to get a valid match. */
+ POSIX is true if we want full backtracking (POSIX style) for this pattern.
+ False means backtrack only enough to get a valid match. */
struct re_pattern_buffer *
compile_pattern (Lisp_Object pattern, struct re_registers *regp,
- Lisp_Object translate, int posix, bool multibyte)
+ Lisp_Object translate, bool posix, bool multibyte)
{
struct regexp_cache *cp, **cpp;
\f
static Lisp_Object
-looking_at_1 (Lisp_Object string, int posix)
+looking_at_1 (Lisp_Object string, bool posix)
{
Lisp_Object val;
unsigned char *p1, *p2;
}
\f
static Lisp_Object
-string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix)
+string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start,
+ bool posix)
{
ptrdiff_t val;
struct re_pattern_buffer *bufp;
static Lisp_Object
search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
- Lisp_Object count, int direction, int RE, int posix)
+ Lisp_Object count, int direction, int RE, bool posix)
{
- register EMACS_INT np;
+ EMACS_INT np;
EMACS_INT lim;
ptrdiff_t lim_byte;
EMACS_INT n = direction;
return make_number (np);
}
\f
-/* Return 1 if REGEXP it matches just one constant string. */
+/* Return true if REGEXP it matches just one constant string. */
-static int
+static bool
trivial_regexp_p (Lisp_Object regexp)
{
ptrdiff_t len = SBYTES (regexp);
static EMACS_INT
search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n,
- int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix)
+ int RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix)
{
ptrdiff_t len = SCHARS (string);
ptrdiff_t len_byte = SBYTES (string);
/* Set to positive if we find a non-ASCII char that need
translation. Otherwise set to zero later. */
int char_base = -1;
- int boyer_moore_ok = 1;
+ bool boyer_moore_ok = 1;
/* MULTIBYTE says whether the text to be searched is multibyte.
We must convert PATTERN to match that, or we will not really
(Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp)
{
enum { nochange, all_caps, cap_initial } case_action;
- register ptrdiff_t pos, pos_byte;
- int some_multiletter_word;
- int some_lowercase;
- int some_uppercase;
- int some_nonuppercase_initial;
- register int c, prevc;
+ ptrdiff_t pos, pos_byte;
+ bool some_multiletter_word;
+ bool some_lowercase;
+ bool some_uppercase;
+ bool some_nonuppercase_initial;
+ int c, prevc;
ptrdiff_t sub;
ptrdiff_t opoint, newpoint;
{
ptrdiff_t substart = -1;
ptrdiff_t subend = 0;
- int delbackslash = 0;
+ bool delbackslash = 0;
FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte);
ptrdiff_t substed_alloc_size, substed_len;
bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
bool str_multibyte = STRING_MULTIBYTE (newtext);
- int really_changed = 0;
+ bool really_changed = 0;
substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
? STRING_BYTES_BOUND
}
\f
static Lisp_Object
-match_limit (Lisp_Object num, int beginningp)
+match_limit (Lisp_Object num, bool beginningp)
{
EMACS_INT n;
return Qnil;
}
-/* If non-zero the match data have been saved in saved_search_regs
+/* If true the match data have been saved in saved_search_regs
during the execution of a sentinel or filter. */
-static int search_regs_saved;
+static bool search_regs_saved;
static struct re_registers saved_search_regs;
static Lisp_Object saved_last_thing_searched;
doc: /* Return a regexp string which matches exactly STRING and nothing else. */)
(Lisp_Object string)
{
- register char *in, *out, *end;
- register char *temp;
- int backslashes_added = 0;
+ char *in, *out, *end;
+ char *temp;
+ ptrdiff_t backslashes_added = 0;
CHECK_STRING (string);