2012-08-27 Paul Eggert <eggert@cs.ucla.edu>
+ * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
+ * composite.c (find_composition, composition_gstring_p)
+ (composition_reseat_it, find_automatic_composition):
+ * data.c (let_shadows_buffer_binding_p)
+ (let_shadows_global_binding_p, set_internal, make_blv)
+ (Fmake_variable_buffer_local, Fmake_local_variable)
+ (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
+ (cons_to_signed, arith_driver):
+ * dbusbind.c (xd_in_read_queued_messages):
+ * dired.c (directory_files_internal, file_name_completion):
+ Use bool for booleans.
+ * dired.c (file_name_completion):
+ * process.h (fd_callback):
+ Omit int (actually boolean) argument. It wasn't being used.
+ All uses changed.
+ * composite.h, lisp.h: Reflect above API changes.
+
* cmds.c, coding.c: Use bool for booleans.
* cmds.c (move_point, Fself_insert_command):
* coding.h (struct composition status, struct coding_system):
This doesn't check the validity of composition. */
-int
+bool
find_composition (ptrdiff_t pos, ptrdiff_t limit,
ptrdiff_t *start, ptrdiff_t *end,
Lisp_Object *prop, Lisp_Object object)
Lisp_Object, Lisp_Object,
Lisp_Object);
-int
+bool
composition_gstring_p (Lisp_Object gstring)
{
Lisp_Object header;
string. In that case, FACE must not be NULL.
If the character is composed, setup members of CMP_IT (id, nglyphs,
- from, to, reversed_p), and return 1. Otherwise, update
- CMP_IT->stop_pos, and return 0. */
+ from, to, reversed_p), and return true. Otherwise, update
+ CMP_IT->stop_pos, and return false. */
-int
-composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, Lisp_Object string)
+bool
+composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
+ ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w,
+ struct face *face, Lisp_Object string)
{
if (endpos < 0)
endpos = NILP (string) ? BEGV : 0;
/* This is like find_composition, but find an automatic composition
instead. It is assured that POS is not within a static
composition. If found, set *GSTRING to the glyph-string
- representing the composition, and return 1. Otherwise, *GSTRING to
- Qnil, and return 0. */
+ representing the composition, and return true. Otherwise, *GSTRING to
+ Qnil, and return false. */
-static int
+static bool
find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
ptrdiff_t *start, ptrdiff_t *end,
Lisp_Object *gstring, Lisp_Object string)
int c;
Lisp_Object window;
struct window *w;
- int need_adjustment = 0;
+ bool need_adjustment = 0;
window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
if (NILP (window))
extern Lisp_Object composition_hash_table;
extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t,
Lisp_Object, Lisp_Object);
-extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
- Lisp_Object *, Lisp_Object);
+extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
+ Lisp_Object *, Lisp_Object);
extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
extern void make_composition_value_copy (Lisp_Object);
extern void compose_region (int, int, Lisp_Object, Lisp_Object,
extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
-extern int composition_gstring_p (Lisp_Object);
+extern bool composition_gstring_p (Lisp_Object);
extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
struct font_metrics *);
extern void composition_compute_stop_pos (struct composition_it *,
ptrdiff_t, ptrdiff_t, ptrdiff_t,
Lisp_Object);
-extern int composition_reseat_it (struct composition_it *,
- ptrdiff_t, ptrdiff_t, ptrdiff_t,
- struct window *, struct face *,
- Lisp_Object);
+extern bool composition_reseat_it (struct composition_it *, ptrdiff_t,
+ ptrdiff_t, ptrdiff_t, struct window *,
+ struct face *, Lisp_Object);
extern int composition_update_it (struct composition_it *,
ptrdiff_t, ptrdiff_t, Lisp_Object);
return newval;
}
-/* Return 1 if SYMBOL currently has a let-binding
+/* Return true if SYMBOL currently has a let-binding
which was made in the buffer that is now current. */
-static int
+static bool
let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
{
struct specbinding *p;
return 0;
}
-static int
+static bool
let_shadows_global_binding_p (Lisp_Object symbol)
{
struct specbinding *p;
If buffer/frame-locality is an issue, WHERE specifies which context to use.
(nil stands for the current buffer/frame).
- If BINDFLAG is zero, then if this symbol is supposed to become
+ If BINDFLAG is false, then if this symbol is supposed to become
local in every buffer where it is set, then we make it local.
- If BINDFLAG is nonzero, we don't do that. */
+ If BINDFLAG is true, we don't do that. */
void
-set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag)
+set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
+ bool bindflag)
{
- int voide = EQ (newval, Qunbound);
+ bool voide = EQ (newval, Qunbound);
struct Lisp_Symbol *sym;
Lisp_Object tem1;
};
static struct Lisp_Buffer_Local_Value *
-make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents)
+make_blv (struct Lisp_Symbol *sym, bool forwarded,
+ union Lisp_Val_Fwd valcontents)
{
struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv);
Lisp_Object symbol;
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
- int forwarded IF_LINT (= 0);
+ bool forwarded IF_LINT (= 0);
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument. */)
- (register Lisp_Object variable)
+ (Lisp_Object variable)
{
- register Lisp_Object tem;
- int forwarded IF_LINT (= 0);
+ Lisp_Object tem;
+ bool forwarded IF_LINT (= 0);
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
Note that since Emacs 23.1, variables cannot be both buffer-local and
frame-local any more (buffer-local bindings used to take precedence over
frame-local bindings). */)
- (register Lisp_Object variable)
+ (Lisp_Object variable)
{
- int forwarded;
+ bool forwarded;
union Lisp_Val_Fwd valcontents;
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
{
double f1 = 0, f2 = 0;
- int floatp = 0;
+ bool floatp = 0;
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1);
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2);
uintmax_t
cons_to_unsigned (Lisp_Object c, uintmax_t max)
{
- int valid = 0;
+ bool valid = 0;
uintmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
intmax_t
cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
{
- int valid = 0;
+ bool valid = 0;
intmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
static Lisp_Object
arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
{
- register Lisp_Object val;
- ptrdiff_t argnum;
- register EMACS_INT accum = 0;
- register EMACS_INT next;
-
- int overflow = 0;
- ptrdiff_t ok_args;
- EMACS_INT ok_accum;
+ Lisp_Object val;
+ ptrdiff_t argnum, ok_args;
+ EMACS_INT accum = 0;
+ EMACS_INT next, ok_accum;
+ bool overflow = 0;
switch (code)
{
static Lisp_Object xd_registered_buses;
/* Whether we are reading a D-Bus event. */
-static int xd_in_read_queued_messages = 0;
+static bool xd_in_read_queued_messages = 0;
\f
/* We use "xd_" and "XD_" as prefix for all internal symbols, because
}
/* Prototype. */
-static void
-xd_read_queued_messages (int fd, void *data, int for_read);
+static void xd_read_queued_messages (int fd, void *data);
/* Start monitoring WATCH for possible I/O. */
static dbus_bool_t
/* Callback called when something is ready to read or write. */
static void
-xd_read_queued_messages (int fd, void *data, int for_read)
+xd_read_queued_messages (int fd, void *data)
{
Lisp_Object busp = xd_registered_buses;
Lisp_Object bus = Qnil;
}
/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
- When ATTRS is zero, return a list of directory filenames; when
- non-zero, return a list of directory filenames and their attributes.
+ If not ATTRS, return a list of directory filenames;
+ if ATTRS, return a list of directory filenames and their attributes.
In the latter case, ID_FORMAT is passed to Ffile_attributes. */
Lisp_Object
-directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format)
+directory_files_internal (Lisp_Object directory, Lisp_Object full,
+ Lisp_Object match, Lisp_Object nosort, bool attrs,
+ Lisp_Object id_format)
{
DIR *d;
ptrdiff_t directory_nbytes;
Lisp_Object list, dirfilename, encoded_directory;
struct re_pattern_buffer *bufp = NULL;
- int needsep = 0;
+ bool needsep = 0;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
DIRENTRY *dp;
if (DIRENTRY_NONEMPTY (dp))
{
ptrdiff_t len;
- int wanted = 0;
+ bool wanted = 0;
Lisp_Object name, finalname;
struct gcpro gcpro1, gcpro2;
}
\f
-static Lisp_Object file_name_completion
- (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag,
- Lisp_Object predicate);
+static Lisp_Object file_name_completion (Lisp_Object, Lisp_Object, bool,
+ Lisp_Object);
DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
2, 3, 0,
if (!NILP (handler))
return call4 (handler, Qfile_name_completion, file, directory, predicate);
- return file_name_completion (file, directory, 0, 0, predicate);
+ return file_name_completion (file, directory, 0, predicate);
}
DEFUN ("file-name-all-completions", Ffile_name_all_completions,
if (!NILP (handler))
return call3 (handler, Qfile_name_all_completions, file, directory);
- return file_name_completion (file, directory, 1, 0, Qnil);
+ return file_name_completion (file, directory, 1, Qnil);
}
static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr);
static Lisp_Object Qdefault_directory;
static Lisp_Object
-file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate)
+file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
+ Lisp_Object predicate)
{
DIR *d;
ptrdiff_t bestmatchsize = 0;
Lisp_Object encoded_dir;
struct stat st;
int directoryp;
- /* If includeall is zero, exclude files in completion-ignored-extensions as
+ /* If not INCLUDEALL, exclude files in completion-ignored-extensions as
well as "." and "..". Until shown otherwise, assume we can't exclude
anything. */
- int includeall = 1;
+ bool includeall = 1;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
{
DIRENTRY *dp;
ptrdiff_t len;
- int canexclude = 0;
+ bool canexclude = 0;
errno = 0;
dp = readdir (d);
Lisp_Object);
extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
-extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
+extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
extern void syms_of_data (void);
extern void init_data (void);
extern void swap_in_global_binding (struct Lisp_Symbol *);
extern void syms_of_dired (void);
extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
- int, Lisp_Object);
+ bool, Lisp_Object);
/* Defined in term.c */
extern int *char_ins_del_vector;
for (channel = 0; channel <= max_input_desc; ++channel)
{
struct fd_callback_data *d = &fd_callback_info[channel];
- if (FD_ISSET (channel, &Available)
- && d->func != 0
- && (d->condition & FOR_READ) != 0)
- d->func (channel, d->data, 1);
- if (FD_ISSET (channel, &write_mask)
- && d->func != 0
- && (d->condition & FOR_WRITE) != 0)
- d->func (channel, d->data, 0);
- }
+ if (d->func
+ && ((d->condition & FOR_READ
+ && FD_ISSET (channel, &Available))
+ || (d->condition & FOR_WRITE
+ && FD_ISSET (channel, &write_mask))))
+ d->func (channel, d->data);
+ }
for (channel = 0; channel <= max_process_desc; channel++)
{
extern void unhold_keyboard_input (void);
extern int kbd_on_hold_p (void);
-typedef void (*fd_callback)(int fd, void *data, int for_read);
+typedef void (*fd_callback) (int fd, void *data);
extern void add_read_fd (int fd, fd_callback func, void *data);
extern void delete_read_fd (int fd);
open to a session manager, just return. */
static void
-x_session_check_input (int fd, void *data, int for_read)
+x_session_check_input (int fd, void *data)
{
int ret;