summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2013-12-14 13:36:44 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2013-12-14 13:36:44 -0800
commit96c0686368d8b7d481cb40239db896ff37df416a (patch)
tree84d8ee02271476dd4aaaee52c5302f2c576089ef /src
parent5ae811ddef14ea1989088c259a9ed2d14d5332b4 (diff)
downloademacs-96c0686368d8b7d481cb40239db896ff37df416a.tar.gz
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK): Use bool for boolean. * lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE): Remove. All uses replaced with uncapitalized version. * lib-src/emacsclient.c (message): * lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names): * lib-src/hexl.c (un_flag, iso_flag, endian): * lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next) (pop_trash): Use bool for boolean. * lib-src/etags.c (bool): Remove. * lib-src/etags.c (globals, members, declarations, no_line_directive) (no_duplicates): Use 'int' for boolean values that getopt requires to be 'int'. Formerly, these were 'bool' and 'bool' was 'int', but we can no longer rely on this implementation. * lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields. * lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields. * src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c: No need to include <stdbool.h>, since conf_post.h does it now. * src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION) (BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P) (SET_PER_BUFFER_VALUE_P): * src/ccl.c, src/ccl.h (setup_ccl_program): * src/ccl.h (CHECK_CCL_PROGRAM): * src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR) (CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY) (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): * src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID) (CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET) (CHARSET_FAST_MAP_SET): * src/coding.c (decode_coding_ccl, encode_coding_ccl): * src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC) (CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2) (JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE) (ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8) (decode_coding_c_string): * src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE): * src/conf_post.h (has_attribute): * src/dispextern.h (trace_redisplay_p): (INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE) (SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH) (SET_GLYPH_FROM_CHAR_GLYPH): (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P) (FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P) (PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p) (cursor_in_mouse_face_p): * src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows) (blank_row, prepare_desired_row) (build_frame_matrix_from_leaf_window, make_current) (mirror_make_current, mirrored_line_dance, mirror_line_dance) (update_window, scrolling_window, update_frame_line): * src/disptab.h (GLYPH_FOLLOW_ALIASES): * src/editfns.c (Fformat): * src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC) (FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE) (FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC) (FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC) (FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY) (CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG) (FONT_DEFERRED_LOG): * src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P): (FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME) (FRAME_MOUSE_UPDATE): * src/fringe.c (Fdefine_fringe_bitmap): * src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask) (x_create_bitmap_from_xpm_data, xpm_load_image): * src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT) (set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE) (MERGE_INTERVAL_CACHE): * src/keymap.h (KEYMAPP): * src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE) (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP) (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER) (CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER) (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT) (DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT) (RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE) (SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp): * src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX) (UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD) (SETUP_BUFFER_SYNTAX_TABLE): * src/systime.h (timespec_valid_p): * src/term.c (save_and_enable_current_matrix): * src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P): * src/xdisp.c (in_display_vector_p, display_tool_bar_line) (redisplay_internal, try_window_reusing_current_matrix) (sync_frame_with_window_matrix_rows, try_window_id) (display_menu_bar, display_tty_menu_item, display_mode_line) (coords_in_mouse_face_p, cursor_in_mouse_face_p): * src/xmenu.c (xmenu_show): * src/xterm.c (use_xim, x_term_init): * src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET) (struct x_bitmap_record): Use bool for booleans. * src/ccl.c (struct buffer_text): * src/ccl.h (struct ccl_program): * src/charset.h (struct charset): * src/cm.h (struct cm): * src/coding.h (struct iso_2022_spec, struct coding_system): * src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row) (struct glyph_string, struct face, struct face_cache) (struct bidi_string_data, struct bidi_it) (struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo) (struct image): * src/editfns.c (Fformat): * src/frame.h (struct frame): * src/fringe.c (struct fringe_bitmap): * src/intervals.h (struct interval): * src/keyboard.h (struct kboard): * src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker) (struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free) (struct Lisp_Buffer_Local_Value, union specbinding): * src/macfont.m (struct macfont_info): * src/process.h (struct Lisp_Process): * src/termchar.h (struct tty_display_info): * src/window.h (struct window): * src/xterm.h (struct x_output): Use bool_bf for boolean bit-fields. * src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0. All callers changed. * src/ccl.h (struct ccl_program): Remove unused members private_state, src_multibyte, dst_multibyte, cr_consumed, suppress_error, eight_bit_control. (struct ccl_spec): Remove unused members cr_carryover, eight_bit_carryover. * src/conf_post.h: Include <stdbool.h>. (bool_bf): New type. * src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY): * src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE) Surround statement macro with proper 'do { ... } while (false)' brackets. (SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool. (PRODUCE_GLYPHS): Simplify use of boolean. * src/fileio.c (Fcopy_file): If I is an integer, prefer 'if (I != 0)' to 'if (I)'. * src/lisp.h (UNGCPRO): Return void, not int. (FOR_EACH_TAIL): Use void expression, not int expression. * src/region-cache.c: Reindent. * src/region-cache.h: Copy comments from region-cache.c, to fix incorrect remarks about booleans.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog130
-rw-r--r--src/atimer.h1
-rw-r--r--src/buffer.h32
-rw-r--r--src/ccl.c27
-rw-r--r--src/ccl.h30
-rw-r--r--src/character.h36
-rw-r--r--src/charset.h26
-rw-r--r--src/cm.h14
-rw-r--r--src/coding.c4
-rw-r--r--src/coding.h61
-rw-r--r--src/composite.h4
-rw-r--r--src/conf_post.h11
-rw-r--r--src/dispextern.h416
-rw-r--r--src/dispnew.c40
-rw-r--r--src/disptab.h2
-rw-r--r--src/editfns.c6
-rw-r--r--src/fileio.c4
-rw-r--r--src/font.h49
-rw-r--r--src/frame.h124
-rw-r--r--src/fringe.c4
-rw-r--r--src/gnutls.h6
-rw-r--r--src/image.c12
-rw-r--r--src/intervals.h50
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.h2
-rw-r--r--src/lisp.h190
-rw-r--r--src/macfont.m6
-rw-r--r--src/process.h18
-rw-r--r--src/region-cache.c5
-rw-r--r--src/region-cache.h27
-rw-r--r--src/syntax.h15
-rw-r--r--src/syssignal.h1
-rw-r--r--src/systime.h4
-rw-r--r--src/syswait.h1
-rw-r--r--src/term.c2
-rw-r--r--src/termchar.h43
-rw-r--r--src/unexelf.c1
-rw-r--r--src/window.h86
-rw-r--r--src/xdisp.c50
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.c10
-rw-r--r--src/xterm.h54
42 files changed, 863 insertions, 745 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1422f6b1f68..a063d2d51d6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,133 @@
+2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ Use bool for boolean, focusing on headers.
+ * atimer.h, lisp.h, syssignal.h, syswait.h, unexelf.c:
+ No need to include <stdbool.h>, since conf_post.h does it now.
+ * buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
+ (BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
+ (SET_PER_BUFFER_VALUE_P):
+ * ccl.c, ccl.h (setup_ccl_program):
+ * ccl.h (CHECK_CCL_PROGRAM):
+ * character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
+ (CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
+ (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
+ (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
+ (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
+ (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
+ (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
+ * charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
+ (CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
+ (CHARSET_FAST_MAP_SET):
+ * coding.c (decode_coding_ccl, encode_coding_ccl):
+ * coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
+ (CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
+ (JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
+ (ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
+ (decode_coding_c_string):
+ * composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
+ * conf_post.h (has_attribute):
+ * dispextern.h (trace_redisplay_p):
+ (INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
+ (SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
+ (SET_GLYPH_FROM_CHAR_GLYPH):
+ (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
+ (FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
+ (PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
+ (cursor_in_mouse_face_p):
+ * dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
+ (blank_row, prepare_desired_row)
+ (build_frame_matrix_from_leaf_window, make_current)
+ (mirror_make_current, mirrored_line_dance, mirror_line_dance)
+ (update_window, scrolling_window, update_frame_line):
+ * disptab.h (GLYPH_FOLLOW_ALIASES):
+ * editfns.c (Fformat):
+ * font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
+ (FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
+ (FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
+ (FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
+ (FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
+ (CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
+ (FONT_DEFERRED_LOG):
+ * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
+ (FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
+ (FRAME_MOUSE_UPDATE):
+ * fringe.c (Fdefine_fringe_bitmap):
+ * image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
+ (x_create_bitmap_from_xpm_data, xpm_load_image):
+ * intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
+ (set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
+ (MERGE_INTERVAL_CACHE):
+ * keymap.h (KEYMAPP):
+ * lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
+ (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
+ (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
+ (CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
+ (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
+ (DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
+ (RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
+ (SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
+ * syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
+ (UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
+ (SETUP_BUFFER_SYNTAX_TABLE):
+ * systime.h (timespec_valid_p):
+ * term.c (save_and_enable_current_matrix):
+ * window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
+ * xdisp.c (in_display_vector_p, display_tool_bar_line)
+ (redisplay_internal, try_window_reusing_current_matrix)
+ (sync_frame_with_window_matrix_rows, try_window_id)
+ (display_menu_bar, display_tty_menu_item, display_mode_line)
+ (coords_in_mouse_face_p, cursor_in_mouse_face_p):
+ * xmenu.c (xmenu_show):
+ * xterm.c (use_xim, x_term_init):
+ * xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
+ (struct x_bitmap_record):
+ Use bool for booleans.
+ * ccl.c (struct buffer_text):
+ * ccl.h (struct ccl_program):
+ * charset.h (struct charset):
+ * cm.h (struct cm):
+ * coding.h (struct iso_2022_spec, struct coding_system):
+ * dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
+ (struct glyph_string, struct face, struct face_cache)
+ (struct bidi_string_data, struct bidi_it)
+ (struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
+ (struct image):
+ * editfns.c (Fformat):
+ * frame.h (struct frame):
+ * fringe.c (struct fringe_bitmap):
+ * intervals.h (struct interval):
+ * keyboard.h (struct kboard):
+ * lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
+ (struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
+ (struct Lisp_Buffer_Local_Value, union specbinding):
+ * macfont.m (struct macfont_info):
+ * process.h (struct Lisp_Process):
+ * termchar.h (struct tty_display_info):
+ * window.h (struct window):
+ * xterm.h (struct x_output):
+ Use bool_bf for boolean bit-fields.
+ * ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
+ All callers changed.
+ * ccl.h (struct ccl_program): Remove unused members private_state,
+ src_multibyte, dst_multibyte, cr_consumed, suppress_error,
+ eight_bit_control.
+ (struct ccl_spec): Remove unused members cr_carryover,
+ eight_bit_carryover.
+ * conf_post.h: Include <stdbool.h>.
+ (bool_bf): New type.
+ * dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
+ * interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
+ Surround statement macro with proper 'do { ... } while (false)' brackets.
+ (SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
+ (PRODUCE_GLYPHS): Simplify use of boolean.
+ * fileio.c (Fcopy_file):
+ If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
+ * lisp.h (UNGCPRO): Return void, not int.
+ (FOR_EACH_TAIL): Use void expression, not int expression.
+ * region-cache.c: Reindent.
+ * region-cache.h: Copy comments from region-cache.c, to fix
+ incorrect remarks about booleans.
+
2013-12-14 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (Fmove_point_visually): Expect overshoot in move_it_to
diff --git a/src/atimer.h b/src/atimer.h
index 8c4d732aa4e..b1017c8ec28 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_ATIMER_H
#define EMACS_ATIMER_H
-#include <stdbool.h>
#include <time.h>
/* Forward declaration. */
diff --git a/src/buffer.h b/src/buffer.h
index 10d5fdc23e0..60f522514c3 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -226,7 +226,7 @@ INLINE_HEADER_BEGIN
BUF_BEG_UNCHANGED (buf) = (start) - BUF_BEG (buf); \
} \
} \
- while (0)
+ while (false)
/* Macros to set PT in the current buffer, or another buffer. */
@@ -302,7 +302,7 @@ extern void enlarge_buffer_text (struct buffer *, ptrdiff_t);
else \
wrong_type_argument (Qinteger_or_marker_p, __pos); \
} \
- while (0)
+ while (false)
/* Maximum number of bytes in a buffer.
A buffer cannot contain more bytes than a 1-origin fixnum can represent,
@@ -472,13 +472,13 @@ struct buffer_text
to move a marker within a buffer. */
struct Lisp_Marker *markers;
- /* Usually 0. Temporarily set to 1 in decode_coding_gap to
+ /* Usually false. Temporarily true in decode_coding_gap to
prevent Fgarbage_collect from shrinking the gap and losing
not-yet-decoded bytes. */
- unsigned inhibit_shrinking : 1;
+ bool_bf inhibit_shrinking : 1;
/* True if it needs to be redisplayed. */
- unsigned redisplay : 1;
+ bool_bf redisplay : 1;
};
/* Most code should use this macro to access Lisp fields in struct buffer. */
@@ -849,10 +849,10 @@ struct buffer
/* Non-zero means don't use redisplay optimizations for
displaying this buffer. */
- unsigned prevent_redisplay_optimizations_p : 1;
+ bool_bf prevent_redisplay_optimizations_p : 1;
/* Non-zero whenever the narrowing is changed in this buffer. */
- unsigned clip_changed : 1;
+ bool_bf clip_changed : 1;
/* List of overlays that end at or before the current center,
in order of end-position. */
@@ -1021,7 +1021,7 @@ bset_width_table (struct buffer *b, Lisp_Object val)
else \
eassert (b->indirections >= 0); \
} \
- } while (0)
+ } while (false)
/* Chain of all buffers, including killed ones. */
@@ -1119,16 +1119,16 @@ record_unwind_current_buffer (void)
do { \
ptrdiff_t maxlen = 40; \
overlays = alloca (maxlen * sizeof *overlays); \
- noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
+ noverlays = overlays_at (posn, false, &overlays, &maxlen, \
nextp, NULL, chrq); \
if (noverlays > maxlen) \
{ \
maxlen = noverlays; \
overlays = alloca (maxlen * sizeof *overlays); \
- noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
+ noverlays = overlays_at (posn, false, &overlays, &maxlen, \
nextp, NULL, chrq); \
} \
- } while (0)
+ } while (false)
extern Lisp_Object Vbuffer_alist;
extern Lisp_Object Qbefore_change_functions;
@@ -1267,12 +1267,12 @@ extern int last_per_buffer_idx;
#define PER_BUFFER_VAR_IDX(VAR) \
PER_BUFFER_IDX (PER_BUFFER_VAR_OFFSET (VAR))
-/* Value is non-zero if the variable with index IDX has a local value
+/* Value is true if the variable with index IDX has a local value
in buffer B. */
#define PER_BUFFER_VALUE_P(B, IDX) \
(((IDX) < 0 || IDX >= last_per_buffer_idx) \
- ? (emacs_abort (), 0) \
+ ? (emacs_abort (), false) \
: ((B)->local_flags[IDX] != 0))
/* Set whether per-buffer variable with index IDX has a buffer-local
@@ -1283,7 +1283,7 @@ extern int last_per_buffer_idx;
if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \
emacs_abort (); \
(B)->local_flags[IDX] = (VAL); \
- } while (0)
+ } while (false)
/* Return the index value of the per-buffer variable at offset OFFSET
in the buffer structure.
@@ -1348,7 +1348,7 @@ downcase (int c)
return NATNUMP (down) ? XFASTINT (down) : c;
}
-/* 1 if C is upper case. */
+/* True if C is upper case. */
INLINE bool uppercasep (int c) { return downcase (c) != c; }
/* Upcase a character C known to be not upper case. */
@@ -1360,7 +1360,7 @@ upcase1 (int c)
return NATNUMP (up) ? XFASTINT (up) : c;
}
-/* 1 if C is lower case. */
+/* True if C is lower case. */
INLINE bool
lowercasep (int c)
{
diff --git a/src/ccl.c b/src/ccl.c
index 8fec18296a6..84bdb9b97c3 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -628,7 +628,7 @@ do \
{ \
struct ccl_program called_ccl; \
if (stack_idx >= 256 \
- || (setup_ccl_program (&called_ccl, (symbol)) != 0)) \
+ || ! setup_ccl_program (&called_ccl, (symbol))) \
{ \
if (stack_idx > 0) \
{ \
@@ -1712,9 +1712,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
}
ccl_error_handler:
- /* The suppress_error member is set when e.g. a CCL-based coding
- system is used for terminal output. */
- if (!ccl->suppress_error && destination)
+ if (destination)
{
/* We can insert an error message only if DESTINATION is
specified and we still have a room to store the message
@@ -1919,10 +1917,10 @@ ccl_get_compiled_code (Lisp_Object ccl_prog, ptrdiff_t *idx)
/* Setup fields of the structure pointed by CCL appropriately for the
execution of CCL program CCL_PROG. CCL_PROG is the name (symbol)
of the CCL program or the already compiled code (vector).
- Return 0 if we succeed this setup, else return -1.
+ Return true iff successful.
- If CCL_PROG is nil, we just reset the structure pointed by CCL. */
-int
+ If CCL_PROG is nil, just reset the structure pointed by CCL. */
+bool
setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
{
int i;
@@ -1933,7 +1931,7 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
ccl_prog = ccl_get_compiled_code (ccl_prog, &ccl->idx);
if (! VECTORP (ccl_prog))
- return -1;
+ return false;
vp = XVECTOR (ccl_prog);
ccl->size = vp->header.size;
ccl->prog = vp->contents;
@@ -1950,14 +1948,11 @@ setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
ccl->ic = CCL_HEADER_MAIN;
for (i = 0; i < 8; i++)
ccl->reg[i] = 0;
- ccl->last_block = 0;
- ccl->private_state = 0;
+ ccl->last_block = false;
ccl->status = 0;
ccl->stack_idx = 0;
- ccl->suppress_error = 0;
- ccl->eight_bit_control = 0;
- ccl->quit_silently = 0;
- return 0;
+ ccl->quit_silently = false;
+ return true;
}
@@ -2003,7 +1998,7 @@ programs. */)
struct ccl_program ccl;
int i;
- if (setup_ccl_program (&ccl, ccl_prog) < 0)
+ if (! setup_ccl_program (&ccl, ccl_prog))
error ("Invalid CCL program");
CHECK_VECTOR (reg);
@@ -2065,7 +2060,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
ptrdiff_t consumed_chars, consumed_bytes, produced_chars;
int buf_magnification;
- if (setup_ccl_program (&ccl, ccl_prog) < 0)
+ if (! setup_ccl_program (&ccl, ccl_prog))
error ("Invalid CCL program");
CHECK_VECTOR (status);
diff --git a/src/ccl.h b/src/ccl.h
index cc5daf11e1c..b01a73f3a2d 100644
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -51,34 +51,16 @@ struct ccl_program {
int reg[8]; /* CCL registers, reg[7] is used for
condition flag of relational
operations. */
- int private_state; /* CCL instruction may use this
- for private use, mainly for saving
- internal states on suspending.
- This variable is set to 0 when ccl is
- set up. */
- int last_block; /* Set to 1 while processing the last
- block. */
int status; /* Exit status of the CCL program. */
int buf_magnification; /* Output buffer magnification. How
many times bigger the output buffer
should be than the input buffer. */
int stack_idx; /* How deep the call of CCL_Call is nested. */
- int src_multibyte; /* 1 if the input buffer is multibyte. */
- int dst_multibyte; /* 1 if the output buffer is multibyte. */
- int cr_consumed; /* Flag for encoding DOS-like EOL
- format when the CCL program is used
- for encoding by a coding
- system. */
int consumed;
int produced;
- int suppress_error; /* If nonzero, don't insert error
- message in the output. */
- int eight_bit_control; /* If nonzero, ccl_driver counts all
- eight-bit-control bytes written by
- CCL_WRITE_CHAR. After execution,
- if no such byte is written, set
- this value to zero. */
- int quit_silently; /* If nonzero, don't append "CCL:
+ bool_bf last_block : 1; /* Set to true while processing the last
+ block. */
+ bool_bf quit_silently : 1; /* If true, don't append "CCL:
Quitted" to the generated text when
CCL program is quitted. */
};
@@ -88,15 +70,13 @@ struct ccl_program {
struct ccl_spec {
struct ccl_program ccl;
- int cr_carryover; /* CR carryover flag. */
- unsigned char eight_bit_carryover[MAX_MULTIBYTE_LENGTH];
};
#define CODING_SPEC_CCL_PROGRAM(coding) ((coding)->spec.ccl.ccl)
/* Setup fields of the structure pointed by CCL appropriately for the
execution of ccl program CCL_PROG (symbol or vector). */
-extern int setup_ccl_program (struct ccl_program *, Lisp_Object);
+extern bool setup_ccl_program (struct ccl_program *, Lisp_Object);
extern void ccl_driver (struct ccl_program *, int *, int *, int, int,
Lisp_Object);
@@ -107,6 +87,6 @@ extern Lisp_Object Qccl, Qcclp;
do { \
if (NILP (Fccl_program_p (x))) \
wrong_type_argument (Qcclp, (x)); \
- } while (0);
+ } while (false);
#endif /* EMACS_CCL_H */
diff --git a/src/character.h b/src/character.h
index e944b5775ed..748a9c3ea39 100644
--- a/src/character.h
+++ b/src/character.h
@@ -91,7 +91,7 @@ INLINE_HEADER_BEGIN
do { \
if (! ASCII_CHAR_P (c)) \
c = CHAR_TO_BYTE8 (c); \
- } while (0)
+ } while (false)
/* If C is not ASCII, make it multibyte. Assumes C < 256. */
@@ -123,14 +123,14 @@ INLINE_HEADER_BEGIN
Lisp_Object tmp = XCAR (x); \
CHECK_CHARACTER (tmp); \
XSETCAR ((x), tmp); \
- } while (0)
+ } while (false)
#define CHECK_CHARACTER_CDR(x) \
do { \
Lisp_Object tmp = XCDR (x); \
CHECK_CHARACTER (tmp); \
XSETCDR ((x), tmp); \
- } while (0)
+ } while (false)
/* Nonzero iff C is a character of code less than 0x100. */
#define SINGLE_BYTE_CHAR_P(c) UNSIGNED_CMP (c, <, 0x100)
@@ -209,7 +209,7 @@ INLINE_HEADER_BEGIN
verify (sizeof (c) <= sizeof (unsigned)); \
(p) += char_string (c, p); \
} \
- } while (0)
+ } while (false)
/* Nonzero iff BYTE starts a non-ASCII character in a multibyte
@@ -274,7 +274,7 @@ INLINE_HEADER_BEGIN
do { \
if ((p) < (limit)) \
(p) += BYTES_BY_CHAR_HEAD (*(p)); \
- } while (0)
+ } while (false)
/* If P is after LIMIT, advance P to the previous character boundary.
@@ -291,7 +291,7 @@ INLINE_HEADER_BEGIN
} while (chp >= limit && ! CHAR_HEAD_P (*chp)); \
(p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \
} \
- } while (0)
+ } while (false)
/* Return the character code of character whose multibyte form is at
P. Note that this macro unifies CJK characters whose codepoints
@@ -382,7 +382,7 @@ INLINE_HEADER_BEGIN
BYTEIDX++; \
} \
} \
- while (0)
+ while (false)
/* Like FETCH_STRING_CHAR_ADVANCE, but return a multibyte character
even if STRING is unibyte. */
@@ -406,7 +406,7 @@ INLINE_HEADER_BEGIN
MAKE_CHAR_MULTIBYTE (OUTPUT); \
} \
} \
- while (0)
+ while (false)
/* Like FETCH_STRING_CHAR_ADVANCE, but assumes STRING is multibyte. */
@@ -421,7 +421,7 @@ INLINE_HEADER_BEGIN
BYTEIDX += fetch_len; \
CHARIDX++; \
} \
- while (0)
+ while (false)
/* Like FETCH_STRING_CHAR_ADVANCE, but fetch character from the current
@@ -445,7 +445,7 @@ INLINE_HEADER_BEGIN
BYTEIDX++; \
} \
} \
- while (0)
+ while (false)
/* Like FETCH_CHAR_ADVANCE, but assumes the current buffer is multibyte. */
@@ -460,7 +460,7 @@ INLINE_HEADER_BEGIN
BYTEIDX += chlen; \
CHARIDX++; \
} \
- while (0)
+ while (false)
/* Increment the buffer byte position POS_BYTE of the current buffer to
@@ -470,7 +470,7 @@ INLINE_HEADER_BEGIN
do { \
unsigned char *chp = BYTE_POS_ADDR (pos_byte); \
pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
- } while (0)
+ } while (false)
/* Decrement the buffer byte position POS_BYTE of the current buffer to
@@ -490,7 +490,7 @@ INLINE_HEADER_BEGIN
chp--; \
pos_byte--; \
} \
- } while (0)
+ } while (false)
/* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */
@@ -503,7 +503,7 @@ INLINE_HEADER_BEGIN
else \
INC_POS ((bytepos)); \
} \
- while (0)
+ while (false)
/* Decrement both CHARPOS and BYTEPOS, each in the appropriate way. */
@@ -517,7 +517,7 @@ INLINE_HEADER_BEGIN
else \
DEC_POS ((bytepos)); \
} \
- while (0)
+ while (false)
/* Increment the buffer byte position POS_BYTE of the current buffer to
@@ -529,7 +529,7 @@ INLINE_HEADER_BEGIN
do { \
unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \
pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
- } while (0)
+ } while (false)
/* Decrement the buffer byte position POS_BYTE of the current buffer to
@@ -548,7 +548,7 @@ INLINE_HEADER_BEGIN
chp--; \
pos_byte--; \
} \
- } while (0)
+ } while (false)
/* Return a non-outlandish value for the tab width. */
@@ -602,7 +602,7 @@ sanitize_char_width (EMACS_INT width)
: 0)
/* If C is a high surrogate, return 1. If C is a low surrogate,
- return 0. Otherwise, return 0. */
+ return 2. Otherwise, return 0. */
#define CHAR_SURROGATE_PAIR_P(c) \
((c) < 0xD800 ? 0 \
diff --git a/src/charset.h b/src/charset.h
index d5c41ec6f49..7453192bb9c 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -171,23 +171,23 @@ struct charset
unsigned char *code_space_mask;
/* True if there's no gap in code-points. */
- unsigned code_linear_p : 1;
+ bool_bf code_linear_p : 1;
/* True if the charset is treated as 96 chars in ISO-2022
as opposed to 94 chars. */
- unsigned iso_chars_96 : 1;
+ bool_bf iso_chars_96 : 1;
/* True if the charset is compatible with ASCII. */
- unsigned ascii_compatible_p : 1;
+ bool_bf ascii_compatible_p : 1;
/* True if the charset is supplementary. */
- unsigned supplementary_p : 1;
+ bool_bf supplementary_p : 1;
/* True if all the code points are representable by Lisp_Int. */
- unsigned compact_codes_p : 1;
+ bool_bf compact_codes_p : 1;
/* True if the charset is unified with Unicode. */
- unsigned unified_p : 1;
+ bool_bf unified_p : 1;
/* ISO final byte of the charset: 48..127. It may be -1 if the
charset doesn't conform to ISO-2022. */
@@ -344,7 +344,7 @@ set_charset_attr (struct charset *charset, enum charset_attr_index idx,
do { \
if (! SYMBOLP (x) || CHARSET_SYMBOL_HASH_INDEX (x) < 0) \
wrong_type_argument (Qcharsetp, (x)); \
- } while (0)
+ } while (false)
/* Check if X is a valid charset symbol. If valid, set ID to the id
@@ -357,7 +357,7 @@ set_charset_attr (struct charset *charset, enum charset_attr_index idx,
wrong_type_argument (Qcharsetp, (x)); \
id = XINT (AREF (HASH_VALUE (XHASH_TABLE (Vcharset_hash_table), idx), \
charset_id)); \
- } while (0)
+ } while (false)
/* Check if X is a valid charset symbol. If valid, set ATTR to the
@@ -366,7 +366,7 @@ set_charset_attr (struct charset *charset, enum charset_attr_index idx,
do { \
if (!SYMBOLP (x) || NILP (attr = CHARSET_SYMBOL_ATTRIBUTES (x))) \
wrong_type_argument (Qcharsetp, (x)); \
- } while (0)
+ } while (false)
#define CHECK_CHARSET_GET_CHARSET(x, charset) \
@@ -374,7 +374,7 @@ set_charset_attr (struct charset *charset, enum charset_attr_index idx,
int csid; \
CHECK_CHARSET_GET_ID (x, csid); \
charset = CHARSET_FROM_ID (csid); \
- } while (0)
+ } while (false)
/* Lookup Vcharset_ordered_list and return the first charset that
@@ -383,7 +383,7 @@ set_charset_attr (struct charset *charset, enum charset_attr_index idx,
((c) < 0x80 ? CHARSET_FROM_ID (charset_ascii) \
: char_charset ((c), Qnil, NULL))
-#if 0
+#if false
/* Char-table of charset-sets. Each element is a bool vector indexed
by a charset ID. */
extern Lisp_Object Vchar_charset_set;
@@ -452,7 +452,7 @@ extern Lisp_Object charset_work;
: encode_char (charset, c))))
-/* Set to 1 when a charset map is loaded to warn that a buffer text
+/* Set to true when a charset map is loaded to warn that a buffer text
and a string data may be relocated. */
extern bool charset_map_loaded;
@@ -489,7 +489,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
(fast_map)[(c) >> 10] |= 1 << (((c) >> 7) & 7); \
else \
(fast_map)[((c) >> 15) + 62] |= 1 << (((c) >> 12) & 7); \
- } while (0)
+ } while (false)
diff --git a/src/cm.h b/src/cm.h
index f3455b79569..5a1b1010a22 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -47,7 +47,7 @@ struct cm
char *cm_abs; /* absolute (cm) */
const char *cm_habs; /* horizontal absolute (ch) */
const char *cm_vabs; /* vertical absolute (cv) */
-#if 0
+#if false
const char *cm_ds; /* "don't send" string (ds) */
#endif
const char *cm_multiup; /* multiple up (UP) */
@@ -57,19 +57,19 @@ struct cm
int cm_cols; /* number of cols on screen (co) */
int cm_rows; /* number of rows on screen (li) */
int cm_tabwidth; /* tab width (it) */
- unsigned int cm_autowrap:1; /* autowrap flag (am) */
- unsigned int cm_magicwrap:1; /* VT-100: cursor stays in last col but
+ bool_bf cm_autowrap : 1; /* autowrap flag (am) */
+ bool_bf cm_magicwrap : 1; /* VT-100: cursor stays in last col but
will cm_wrap if next char is
printing (xn) */
- unsigned int cm_usetabs:1; /* if set, use tabs */
- unsigned int cm_losewrap:1; /* if reach right margin, forget cursor
+ bool_bf cm_usetabs : 1; /* if set, use tabs */
+ bool_bf cm_losewrap : 1; /* if reach right margin, forget cursor
location */
- unsigned int cm_autolf:1; /* \r performs a \r\n (rn) */
+ bool_bf cm_autolf : 1; /* \r performs a \r\n (rn) */
/* Parameterized capabilities. This needs to be a struct since
the costs are accessed through pointers. */
-#if 0
+#if false
struct parmcap cc_abs; /* absolute (cm) */
struct parmcap cc_habs; /* horizontal absolute (ch) */
struct parmcap cc_vabs; /* vertical absolute (cv) */
diff --git a/src/coding.c b/src/coding.c
index 4ee55f7c8e6..03ce4828040 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5199,7 +5199,7 @@ decode_coding_ccl (struct coding_system *coding)
source_charbuf[i++] = *p++;
if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK)
- ccl->last_block = 1;
+ ccl->last_block = true;
/* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */
charset_map_loaded = 0;
ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf,
@@ -5259,7 +5259,7 @@ encode_coding_ccl (struct coding_system *coding)
CODING_GET_INFO (coding, attrs, charset_list);
if (coding->consumed_char == coding->src_chars
&& coding->mode & CODING_MODE_LAST_BLOCK)
- ccl->last_block = 1;
+ ccl->last_block = true;
do
{
diff --git a/src/coding.h b/src/coding.h
index 39f9d62462b..299c20d0a51 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -226,7 +226,7 @@ enum coding_attr_index
hash_lookup (XHASH_TABLE (Vcoding_system_hash_table), \
coding_system_symbol, NULL)
-/* Return 1 if CODING_SYSTEM_SYMBOL is a coding system. */
+/* Return true if CODING_SYSTEM_SYMBOL is a coding system. */
#define CODING_SYSTEM_P(coding_system_symbol) \
(CODING_SYSTEM_ID (coding_system_symbol) >= 0 \
@@ -240,7 +240,7 @@ enum coding_attr_index
if (CODING_SYSTEM_ID (x) < 0 \
&& NILP (Fcheck_coding_system (x))) \
wrong_type_argument (Qcoding_system_p, (x)); \
- } while (0)
+ } while (false)
/* Check if X is a coding system or not. If it is, set SEPC to the
@@ -256,7 +256,7 @@ enum coding_attr_index
} \
if (NILP (spec)) \
wrong_type_argument (Qcoding_system_p, (x)); \
- } while (0)
+ } while (false)
/* Check if X is a coding system or not. If it is, set ID to the
@@ -273,7 +273,7 @@ enum coding_attr_index
} \
if (id < 0) \
wrong_type_argument (Qcoding_system_p, (x)); \
- } while (0)
+ } while (false)
/*** GENERAL section ***/
@@ -361,13 +361,13 @@ struct iso_2022_spec
/* True temporarily only when graphic register 2 or 3 is invoked by
single-shift while encoding. */
- unsigned single_shifting : 1;
+ bool_bf single_shifting : 1;
/* True temporarily only when processing at beginning of line. */
- unsigned bol : 1;
+ bool_bf bol : 1;
/* If true, we are now scanning embedded UTF-8 sequence. */
- unsigned embedded_utf_8 : 1;
+ bool_bf embedded_utf_8 : 1;
/* The current composition. */
struct composition_status cmp_status;
@@ -455,11 +455,11 @@ struct coding_system
unsigned char *safe_charsets;
/* The following two members specify how binary 8-bit code 128..255
- are represented in source and destination text respectively. 1
- means they are represented by 2-byte sequence, 0 means they are
+ are represented in source and destination text respectively. True
+ means they are represented by 2-byte sequence, false means they are
represented by 1-byte as is (see the comment in character.h). */
- unsigned src_multibyte : 1;
- unsigned dst_multibyte : 1;
+ bool_bf src_multibyte : 1;
+ bool_bf dst_multibyte : 1;
/* How may heading bytes we can skip for decoding. This is set to
-1 in setup_coding_system, and updated by detect_coding. So,
@@ -510,14 +510,14 @@ struct coding_system
/* True if the source of conversion is not in the member
`charbuf', but at `src_object'. */
- unsigned chars_at_source : 1;
+ bool_bf chars_at_source : 1;
/* Nonzero if the result of conversion is in `destination'
buffer rather than in `dst_object'. */
- unsigned raw_destination : 1;
+ bool_bf raw_destination : 1;
- /* Set to 1 if charbuf contains an annotation. */
- unsigned annotated : 1;
+ /* Set to true if charbuf contains an annotation. */
+ bool_bf annotated : 1;
unsigned char carryover[64];
int carryover_bytes;
@@ -543,28 +543,29 @@ struct coding_system
#define CODING_REQUIRE_DETECTION_MASK 0x1000
#define CODING_RESET_AT_BOL_MASK 0x2000
-/* Return 1 if the coding context CODING requires annotation
+/* Return nonzero if the coding context CODING requires annotation
handling. */
#define CODING_REQUIRE_ANNOTATION(coding) \
((coding)->common_flags & CODING_ANNOTATION_MASK)
-/* Return 1 if the coding context CODING prefers decoding into unibyte. */
+/* Return nonzero if the coding context CODING prefers decoding into
+ unibyte. */
#define CODING_FOR_UNIBYTE(coding) \
((coding)->common_flags & CODING_FOR_UNIBYTE_MASK)
-/* Return 1 if the coding context CODING requires specific code to be
+/* Return nonzero if the coding context CODING requires specific code to be
attached at the tail of converted text. */
#define CODING_REQUIRE_FLUSHING(coding) \
((coding)->common_flags & CODING_REQUIRE_FLUSHING_MASK)
-/* Return 1 if the coding context CODING requires code conversion on
+/* Return nonzero if the coding context CODING requires code conversion on
decoding. */
#define CODING_REQUIRE_DECODING(coding) \
((coding)->dst_multibyte \
|| (coding)->common_flags & CODING_REQUIRE_DECODING_MASK)
-/* Return 1 if the coding context CODING requires code conversion on
+/* Return nonzero if the coding context CODING requires code conversion on
encoding.
The non-multibyte part of the condition is to support encoding of
unibyte strings/buffers generated by string-as-unibyte or
@@ -575,12 +576,12 @@ struct coding_system
|| (coding)->mode & CODING_MODE_SELECTIVE_DISPLAY)
-/* Return 1 if the coding context CODING requires some kind of code
+/* Return nonzero if the coding context CODING requires some kind of code
detection. */
#define CODING_REQUIRE_DETECTION(coding) \
((coding)->common_flags & CODING_REQUIRE_DETECTION_MASK)
-/* Return 1 if the coding context CODING requires code conversion on
+/* Return nonzero if the coding context CODING requires code conversion on
decoding or some kind of code detection. */
#define CODING_MAY_REQUIRE_DECODING(coding) \
(CODING_REQUIRE_DECODING (coding) \
@@ -604,7 +605,7 @@ struct coding_system
(j1 = s1 * 2 - ((s1 >= 0xE0) ? 0x161 : 0xE1), \
j2 = s2 - ((s2 >= 0x7F) ? 0x20 : 0x1F)); \
(code) = (j1 << 8) | j2; \
- } while (0)
+ } while (false)
#define SJIS_TO_JIS2(code) \
do { \
@@ -629,7 +630,7 @@ struct coding_system
j2 = s2 - ((s2 >= 0x7F ? 0x20 : 0x1F)); \
} \
(code) = (j1 << 8) | j2; \
- } while (0)
+ } while (false)
#define JIS_TO_SJIS(code) \
@@ -644,7 +645,7 @@ struct coding_system
(s1 = j1 / 2 + ((j1 < 0x5F) ? 0x70 : 0xB0), \
s2 = j2 + 0x7E); \
(code) = (s1 << 8) | s2; \
- } while (0)
+ } while (false)
#define JIS_TO_SJIS2(code) \
do { \
@@ -668,7 +669,7 @@ struct coding_system
s2 = j2 + 0x7E; \
} \
(code) = (s1 << 8) | s2; \
- } while (0)
+ } while (false)
/* Encode the file name NAME using the specified coding system
for file names, if any. */
@@ -682,18 +683,18 @@ struct coding_system
for system functions, if any. */
#define ENCODE_SYSTEM(str) \
(! NILP (Vlocale_coding_system) \
- ? code_convert_string_norecord (str, Vlocale_coding_system, 1) \
+ ? code_convert_string_norecord (str, Vlocale_coding_system, true) \
: str)
/* Decode the string STR using the specified coding system
for system functions, if any. */
#define DECODE_SYSTEM(str) \
(! NILP (Vlocale_coding_system) \
- ? code_convert_string_norecord (str, Vlocale_coding_system, 0) \
+ ? code_convert_string_norecord (str, Vlocale_coding_system, false) \
: str)
/* Note that this encodes utf-8, not utf-8-emacs, so it's not a no-op. */
-#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
+#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, true)
/* Extern declarations. */
extern Lisp_Object code_conversion_save (bool, bool);
@@ -759,7 +760,7 @@ extern Lisp_Object from_unicode_buffer (const wchar_t* wstr);
(coding)->src_chars = (coding)->src_bytes = (bytes); \
decode_coding_object ((coding), Qnil, 0, 0, (bytes), (bytes), \
(dst_object)); \
- } while (0)
+ } while (false)
extern Lisp_Object preferred_coding_system (void);
diff --git a/src/composite.h b/src/composite.h
index 9026d03f7b6..ff48d15eb0c 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -112,7 +112,7 @@ composition_registered_p (Lisp_Object prop)
gref = (rule_code) / 12; \
if (gref > 12) gref = 11; \
nref = (rule_code) % 12; \
- } while (0)
+ } while (false)
/* Like COMPOSITION_DECODE_REFS (RULE_CODE, GREF, NREF), but also
decode RULE_CODE into XOFF and YOFF (vertical offset). */
@@ -122,7 +122,7 @@ composition_registered_p (Lisp_Object prop)
xoff = (rule_code) >> 16; \
yoff = ((rule_code) >> 8) & 0xFF; \
COMPOSITION_DECODE_REFS (rule_code, gref, nref); \
- } while (0)
+ } while (false)
/* Nonzero if the global reference point GREF and new reference point NREF are
valid. */
diff --git a/src/conf_post.h b/src/conf_post.h
index 2d967c0fefc..5e738e4d6b0 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -32,6 +32,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
# include config_opsysfile
#endif
+#include <stdbool.h>
+
+/* The pre-C99 <stdbool.h> emulation doesn't work for bool bitfields. */
+#if __STDC_VERSION__ < 199901
+typedef unsigned int bool_bf;
+#else
+typedef bool bool_bf;
+#endif
+
#ifndef WINDOWSNT
/* On AIX 3 this must be included before any other include file. */
#include <alloca.h>
@@ -41,7 +50,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif
#ifndef __has_attribute
-# define __has_attribute(a) 0 /* non-clang */
+# define __has_attribute(a) false /* non-clang */
#endif
#ifdef DARWIN_OS
diff --git a/src/dispextern.h b/src/dispextern.h
index 97847e04686..ded11e58dfb 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -139,9 +139,9 @@ enum window_part
/* Macros to include code only if GLYPH_DEBUG is defined. */
#ifdef GLYPH_DEBUG
-#define IF_DEBUG(X) X
+#define IF_DEBUG(X) (X)
#else
-#define IF_DEBUG(X) (void) 0
+#define IF_DEBUG(X) ((void) 0)
#endif
/* Macro for displaying traces of redisplay. If Emacs was compiled
@@ -150,18 +150,18 @@ enum window_part
#ifdef GLYPH_DEBUG
-extern int trace_redisplay_p EXTERNALLY_VISIBLE;
+extern bool trace_redisplay_p EXTERNALLY_VISIBLE;
#include <stdio.h>
#define TRACE(X) \
+ do { \
if (trace_redisplay_p) \
fprintf X; \
- else \
- (void) 0
+ } while (false)
#else /* not GLYPH_DEBUG */
-#define TRACE(X) (void) 0
+#define TRACE(X) ((void) 0)
#endif /* GLYPH_DEBUG */
@@ -205,7 +205,7 @@ struct text_pos
else \
++(POS).bytepos; \
} \
- while (0)
+ while (false)
/* Decrement text position POS. */
@@ -218,7 +218,7 @@ struct text_pos
else \
--(POS).bytepos; \
} \
- while (0)
+ while (false)
/* Set text position POS from marker MARKER. */
@@ -323,7 +323,7 @@ GLYPH_CODE_FACE (Lisp_Object gc)
SET_GLYPH (glyph, (XINT (gc) & ((1 << CHARACTERBITS)-1)), \
(XINT (gc) >> CHARACTERBITS)); \
} \
- while (0)
+ while (false)
/* The ID of the mode line highlighting face. */
enum { GLYPH_MODE_LINE_FACE = 1 };
@@ -408,41 +408,41 @@ struct glyph
should be an enumerator of type enum glyph_type. */
unsigned type : 3;
- /* 1 means this glyph was produced from multibyte text. Zero
+ /* True means this glyph was produced from multibyte text. False
means it was produced from unibyte text, i.e. charsets aren't
applicable, and encoding is not performed. */
- unsigned multibyte_p : 1;
+ bool_bf multibyte_p : 1;
- /* Non-zero means draw a box line at the left or right side of this
+ /* True means draw a box line at the left or right side of this
glyph. This is part of the implementation of the face attribute
`:box'. */
- unsigned left_box_line_p : 1;
- unsigned right_box_line_p : 1;
+ bool_bf left_box_line_p : 1;
+ bool_bf right_box_line_p : 1;
- /* Non-zero means this glyph's physical ascent or descent is greater
+ /* True means this glyph's physical ascent or descent is greater
than its logical ascent/descent, i.e. it may potentially overlap
glyphs above or below it. */
- unsigned overlaps_vertically_p : 1;
+ bool_bf overlaps_vertically_p : 1;
- /* For terminal frames, 1 means glyph is a padding glyph. Padding
+ /* For terminal frames, true means glyph is a padding glyph. Padding
glyphs are used for characters whose visual shape consists of
more than one glyph (e.g. Asian characters). All but the first
glyph of such a glyph sequence have the padding_p flag set. This
flag is used only to minimize code changes. A better way would
probably be to use the width field of glyphs to express padding.
- For graphic frames, 1 means the pixel width of the glyph in a
+ For graphic frames, true means the pixel width of the glyph in a
font is 0, but 1-pixel is padded on displaying for correct cursor
displaying. The member `pixel_width' above is set to 1. */
- unsigned padding_p : 1;
+ bool_bf padding_p : 1;
- /* 1 means the actual glyph is not available, draw using `struct
+ /* True means the actual glyph is not available, draw using `struct
glyphless' below instead. This can happen when a font couldn't
be loaded, or a character doesn't have a glyph in a font. */
- unsigned glyph_not_available_p : 1;
+ bool_bf glyph_not_available_p : 1;
- /* Non-zero means don't display cursor here. */
- unsigned avoid_cursor_p : 1;
+ /* True means don't display cursor here. */
+ bool_bf avoid_cursor_p : 1;
/* Resolved bidirectional level of this character [0..63]. */
unsigned resolved_level : 5;
@@ -491,7 +491,7 @@ struct glyph
struct
{
/* Flag to tell if the composition is automatic or not. */
- unsigned automatic : 1;
+ bool_bf automatic : 1;
/* ID of the composition. */
unsigned id : 31;
} cmp;
@@ -515,8 +515,8 @@ struct glyph
{
/* Value is an enum of the type glyphless_display_method. */
unsigned method : 2;
- /* 1 iff this glyph is for a character of no font. */
- unsigned for_no_font : 1;
+ /* True iff this glyph is for a character of no font. */
+ bool_bf for_no_font : 1;
/* Length of acronym or hexadecimal code string (at most 8). */
unsigned len : 4;
/* Character to display. Actually we need only 22 bits. */
@@ -584,7 +584,7 @@ struct glyph
(GLYPH).face_id = (FACE_ID); \
(GLYPH).padding_p = (PADDING_P); \
} \
- while (0)
+ while (false)
/* Fill a character type glyph GLYPH from a glyph typedef FROM as
defined in lisp.h. */
@@ -593,7 +593,7 @@ struct glyph
SET_CHAR_GLYPH ((GLYPH), \
GLYPH_CHAR ((FROM)), \
GLYPH_FACE ((FROM)), \
- 0)
+ false)
/* Construct a glyph code from a character glyph GLYPH. If the
character is multibyte, return -1 as we can't use glyph table for a
@@ -607,7 +607,7 @@ struct glyph
else \
SET_GLYPH ((G), -1, 0); \
} \
- while (0)
+ while (false)
#define GLYPH_INVALID_P(GLYPH) (GLYPH_CHAR (GLYPH) < 0)
@@ -722,11 +722,11 @@ struct glyph_matrix
/* Flag indicating that scrolling should not be tried in
update_window. This flag is set by functions like try_window_id
which do their own scrolling. */
- unsigned no_scrolling_p : 1;
+ bool_bf no_scrolling_p : 1;
- /* Non-zero means window displayed in this matrix has a header
+ /* True means window displayed in this matrix has a header
line. */
- unsigned header_line_p : 1;
+ bool_bf header_line_p : 1;
#ifdef GLYPH_DEBUG
/* A string identifying the method used to display the matrix. */
@@ -750,7 +750,7 @@ struct glyph_matrix
void check_matrix_pointer_lossage (struct glyph_matrix *);
#define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX))
#else
-#define CHECK_MATRIX(MATRIX) (void) 0
+#define CHECK_MATRIX(MATRIX) ((void) 0)
#endif
@@ -916,107 +916,107 @@ struct glyph_row
/* Vertical offset of the right fringe bitmap. */
signed right_fringe_offset : FRINGE_HEIGHT_BITS;
- /* 1 means that at least one of the left and right fringe bitmaps is
+ /* True means that at least one of the left and right fringe bitmaps is
periodic and thus depends on the y-position of the row. */
- unsigned fringe_bitmap_periodic_p : 1;
+ bool_bf fringe_bitmap_periodic_p : 1;
- /* 1 means that we must draw the bitmaps of this row. */
- unsigned redraw_fringe_bitmaps_p : 1;
+ /* True means that we must draw the bitmaps of this row. */
+ bool_bf redraw_fringe_bitmaps_p : 1;
- /* In a desired matrix, 1 means that this row must be updated. In a
- current matrix, 0 means that the row has been invalidated, i.e.
+ /* In a desired matrix, true means that this row must be updated. In a
+ current matrix, false means that the row has been invalidated, i.e.
the row's contents do not agree with what is visible on the
screen. */
- unsigned enabled_p : 1;
+ bool_bf enabled_p : 1;
- /* 1 means row displays a text line that is truncated on the left or
+ /* True means row displays a text line that is truncated on the left or
right side. */
- unsigned truncated_on_left_p : 1;
- unsigned truncated_on_right_p : 1;
+ bool_bf truncated_on_left_p : 1;
+ bool_bf truncated_on_right_p : 1;
- /* 1 means that this row displays a continued line, i.e. it has a
+ /* True means that this row displays a continued line, i.e. it has a
continuation mark at the right side. */
- unsigned continued_p : 1;
+ bool_bf continued_p : 1;
- /* 0 means that this row does not contain any text, i.e. it is
+ /* False means that this row does not contain any text, i.e., it is
a blank line at the window and buffer end. */
- unsigned displays_text_p : 1;
+ bool_bf displays_text_p : 1;
- /* 1 means that this line ends at ZV. */
- unsigned ends_at_zv_p : 1;
+ /* True means that this line ends at ZV. */
+ bool_bf ends_at_zv_p : 1;
- /* 1 means the face of the last glyph in the text area is drawn to
+ /* True means the face of the last glyph in the text area is drawn to
the right end of the window. This flag is used in
update_text_area to optimize clearing to the end of the area. */
- unsigned fill_line_p : 1;
+ bool_bf fill_line_p : 1;
- /* Non-zero means display a bitmap on X frames indicating that this
+ /* True means display a bitmap on X frames indicating that this
line contains no text and ends in ZV. */
- unsigned indicate_empty_line_p : 1;
+ bool_bf indicate_empty_line_p : 1;
- /* 1 means this row contains glyphs that overlap each other because
+ /* True means this row contains glyphs that overlap each other because
of lbearing or rbearing. */
- unsigned contains_overlapping_glyphs_p : 1;
+ bool_bf contains_overlapping_glyphs_p : 1;
- /* 1 means this row is as wide as the window it is displayed in, including
+ /* True means this row is as wide as the window it is displayed in, including
scroll bars, fringes, and internal borders. This also
implies that the row doesn't have marginal areas. */
- unsigned full_width_p : 1;
+ bool_bf full_width_p : 1;
- /* Non-zero means row is a mode or header-line. */
- unsigned mode_line_p : 1;
+ /* True means row is a mode or header-line. */
+ bool_bf mode_line_p : 1;
- /* 1 in a current row means this row is overlapped by another row. */
- unsigned overlapped_p : 1;
+ /* True in a current row means this row is overlapped by another row. */
+ bool_bf overlapped_p : 1;
- /* 1 means this line ends in the middle of a character consisting
+ /* True means this line ends in the middle of a character consisting
of more than one glyph. Some glyphs have been put in this row,
the rest are put in rows below this one. */
- unsigned ends_in_middle_of_char_p : 1;
+ bool_bf ends_in_middle_of_char_p : 1;
- /* 1 means this line starts in the middle of a character consisting
+ /* True means this line starts in the middle of a character consisting
of more than one glyph. Some glyphs have been put in the
previous row, the rest are put in this row. */
- unsigned starts_in_middle_of_char_p : 1;
+ bool_bf starts_in_middle_of_char_p : 1;
- /* 1 in a current row means this row overlaps others. */
- unsigned overlapping_p : 1;
+ /* True in a current row means this row overlaps others. */
+ bool_bf overlapping_p : 1;
- /* 1 means some glyphs in this row are displayed in mouse-face. */
- unsigned mouse_face_p : 1;
+ /* True means some glyphs in this row are displayed in mouse-face. */
+ bool_bf mouse_face_p : 1;
- /* 1 means this row was ended by a newline from a string. */
- unsigned ends_in_newline_from_string_p : 1;
+ /* True means this row was ended by a newline from a string. */
+ bool_bf ends_in_newline_from_string_p : 1;
- /* 1 means this row width is exactly the width of the window, and the
+ /* True means this row width is exactly the width of the window, and the
final newline character is hidden in the right fringe. */
- unsigned exact_window_width_line_p : 1;
+ bool_bf exact_window_width_line_p : 1;
- /* 1 means this row currently shows the cursor in the right fringe. */
- unsigned cursor_in_fringe_p : 1;
+ /* True means this row currently shows the cursor in the right fringe. */
+ bool_bf cursor_in_fringe_p : 1;
- /* 1 means the last glyph in the row is part of an ellipsis. */
- unsigned ends_in_ellipsis_p : 1;
+ /* True means the last glyph in the row is part of an ellipsis. */
+ bool_bf ends_in_ellipsis_p : 1;
- /* Non-zero means display a bitmap on X frames indicating that this
+ /* True means display a bitmap on X frames indicating that this
the first line of the buffer. */
- unsigned indicate_bob_p : 1;
+ bool_bf indicate_bob_p : 1;
- /* Non-zero means display a bitmap on X frames indicating that this
+ /* True means display a bitmap on X frames indicating that this
the top line of the window, but not start of the buffer. */
- unsigned indicate_top_line_p : 1;
+ bool_bf indicate_top_line_p : 1;
- /* Non-zero means display a bitmap on X frames indicating that this
+ /* True means display a bitmap on X frames indicating that this
the last line of the buffer. */
- unsigned indicate_eob_p : 1;
+ bool_bf indicate_eob_p : 1;
- /* Non-zero means display a bitmap on X frames indicating that this
+ /* True means display a bitmap on X frames indicating that this
the bottom line of the window, but not end of the buffer. */
- unsigned indicate_bottom_line_p : 1;
+ bool_bf indicate_bottom_line_p : 1;
- /* Non-zero means the row was reversed to display text in a
+ /* True means the row was reversed to display text in a
right-to-left paragraph. */
- unsigned reversed_p : 1;
+ bool_bf reversed_p : 1;
/* Continuation lines width at the start of the row. */
int continuation_lines_width;
@@ -1107,10 +1107,10 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
/* Set and query the enabled_p flag of glyph row ROW in MATRIX. */
#define SET_MATRIX_ROW_ENABLED_P(MATRIX, ROW, VALUE) \
- (MATRIX_ROW ((MATRIX), (ROW))->enabled_p = (VALUE) != 0)
+ (MATRIX_ROW (MATRIX, ROW)->enabled_p = (VALUE))
#define MATRIX_ROW_ENABLED_P(MATRIX, ROW) \
- (MATRIX_ROW ((MATRIX), (ROW))->enabled_p)
+ (MATRIX_ROW (MATRIX, ROW)->enabled_p)
/* Non-zero if ROW displays text. Value is non-zero if the row is
blank but displays a line end. */
@@ -1188,12 +1188,12 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
|| ((ROW)->start.overlay_string_index >= 0 \
&& (ROW)->start.string_pos.charpos > 0))
-/* Non-zero means ROW overlaps its predecessor. */
+/* True means ROW overlaps its predecessor. */
#define MATRIX_ROW_OVERLAPS_PRED_P(ROW) \
((ROW)->phys_ascent > (ROW)->ascent)
-/* Non-zero means ROW overlaps its successor. */
+/* True means ROW overlaps its successor. */
#define MATRIX_ROW_OVERLAPS_SUCC_P(ROW) \
((ROW)->phys_height - (ROW)->phys_ascent \
@@ -1203,8 +1203,7 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
extern struct glyph space_glyph;
-/* Non-zero means last display completed. Zero means it was
- preempted. */
+/* True means last display completed. False means it was preempted. */
extern bool display_completed;
@@ -1300,24 +1299,24 @@ struct glyph_string
/* Start and end glyph indices in a glyph-string. */
int cmp_from, cmp_to;
- /* 1 means this glyph strings face has to be drawn to the right end
+ /* True means this glyph strings face has to be drawn to the right end
of the window's drawing area. */
- unsigned extends_to_end_of_line_p : 1;
+ bool_bf extends_to_end_of_line_p : 1;
- /* 1 means the background of this string has been drawn. */
- unsigned background_filled_p : 1;
+ /* True means the background of this string has been drawn. */
+ bool_bf background_filled_p : 1;
- /* 1 means glyph string must be drawn with 16-bit functions. */
- unsigned two_byte_p : 1;
+ /* True means glyph string must be drawn with 16-bit functions. */
+ bool_bf two_byte_p : 1;
- /* 1 means that the original font determined for drawing this glyph
+ /* True means that the original font determined for drawing this glyph
string could not be loaded. The member `font' has been set to
the frame's default font in this case. */
- unsigned font_not_found_p : 1;
+ bool_bf font_not_found_p : 1;
- /* 1 means that the face in which this glyph string is drawn has a
+ /* True means that the face in which this glyph string is drawn has a
stipple pattern. */
- unsigned stippled_p : 1;
+ bool_bf stippled_p : 1;
#define OVERLAPS_PRED (1 << 0)
#define OVERLAPS_SUCC (1 << 1)
@@ -1332,10 +1331,10 @@ struct glyph_string
respectively. */
unsigned for_overlaps : 3;
- /* 1 means that all glyphs in this glyph string has the flag
+ /* True means that all glyphs in this glyph string has the flag
padding_p set, and thus must be drawn one by one to have 1-pixel
width even though the logical width in the font is zero. */
- unsigned padding_p : 1;
+ bool_bf padding_p : 1;
/* The GC to use for drawing this glyph string. */
#if defined (HAVE_X_WINDOWS)
@@ -1348,7 +1347,7 @@ struct glyph_string
/* A pointer to the first glyph in the string. This glyph
corresponds to char2b[0]. Needed to draw rectangles if
- font_not_found_p is 1. */
+ font_not_found_p is true. */
struct glyph *first_glyph;
/* Image, if any. */
@@ -1480,7 +1479,7 @@ struct glyph_string
&& FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (W))) \
&& !NILP (BVAR (XBUFFER ((W)->contents), mode_line_format)) \
&& WINDOW_PIXEL_HEIGHT (W) > WINDOW_FRAME_LINE_HEIGHT (W)) \
- : 0)
+ : false)
/* Value is true if window W wants a header line and is large enough
to accommodate it. */
@@ -1494,7 +1493,7 @@ struct glyph_string
> (WINDOW_WANTS_MODELINE_P (W) \
? (2 * WINDOW_FRAME_LINE_HEIGHT (W)) \
: WINDOW_FRAME_LINE_HEIGHT (W)))) \
- : 0)
+ : false)
/* Return proper value to be used as baseline offset of font that has
ASCENT and DESCENT to draw characters by the font at the vertical
@@ -1656,54 +1655,54 @@ struct face
/* Style of underlining. */
ENUM_BF (face_underline_type) underline_type : 1;
- /* If `box' above specifies a 3D type, 1 means use box_color for
+ /* If `box' above specifies a 3D type, true means use box_color for
drawing shadows. */
- unsigned use_box_color_for_shadows_p : 1;
+ bool_bf use_box_color_for_shadows_p : 1;
/* Non-zero if text in this face should be underlined, overlined,
strike-through or have a box drawn around it. */
- unsigned underline_p : 1;
- unsigned overline_p : 1;
- unsigned strike_through_p : 1;
+ bool_bf underline_p : 1;
+ bool_bf overline_p : 1;
+ bool_bf strike_through_p : 1;
- /* 1 means that the colors specified for this face could not be
+ /* True means that the colors specified for this face could not be
loaded, and were replaced by default colors, so they shouldn't be
freed. */
- unsigned foreground_defaulted_p : 1;
- unsigned background_defaulted_p : 1;
+ bool_bf foreground_defaulted_p : 1;
+ bool_bf background_defaulted_p : 1;
- /* 1 means that either no color is specified for underlining or that
+ /* True means that either no color is specified for underlining or that
the specified color couldn't be loaded. Use the foreground
color when drawing in that case. */
- unsigned underline_defaulted_p : 1;
+ bool_bf underline_defaulted_p : 1;
- /* 1 means that either no color is specified for the corresponding
+ /* True means that either no color is specified for the corresponding
attribute or that the specified color couldn't be loaded.
Use the foreground color when drawing in that case. */
- unsigned overline_color_defaulted_p : 1;
- unsigned strike_through_color_defaulted_p : 1;
- unsigned box_color_defaulted_p : 1;
+ bool_bf overline_color_defaulted_p : 1;
+ bool_bf strike_through_color_defaulted_p : 1;
+ bool_bf box_color_defaulted_p : 1;
/* TTY appearances. Colors are found in `lface' with empty color
string meaning the default color of the TTY. */
- unsigned tty_bold_p : 1;
- unsigned tty_italic_p : 1;
- unsigned tty_underline_p : 1;
- unsigned tty_reverse_p : 1;
+ bool_bf tty_bold_p : 1;
+ bool_bf tty_italic_p : 1;
+ bool_bf tty_underline_p : 1;
+ bool_bf tty_reverse_p : 1;
- /* 1 means that colors of this face may not be freed because they
+ /* True means that colors of this face may not be freed because they
have been copied bitwise from a base face (see
realize_x_face). */
- unsigned colors_copied_bitwise_p : 1;
+ bool_bf colors_copied_bitwise_p : 1;
/* If non-zero, use overstrike (to simulate bold-face). */
- unsigned overstrike : 1;
+ bool_bf overstrike : 1;
/* NOTE: this is not used yet, but eventually this impl should be done
similarly to overstrike */
#ifdef HAVE_NS
/* If non-zero, use geometric rotation (to simulate italic). */
- unsigned synth_ital : 1;
+ bool_bf synth_ital : 1;
#endif
/* The hash value of this face. */
@@ -1791,7 +1790,7 @@ struct face_cache
/* Flag indicating that attributes of the `menu' face have been
changed. */
- unsigned menu_face_changed_p : 1;
+ bool_bf menu_face_changed_p : 1;
};
@@ -1799,10 +1798,10 @@ struct face_cache
using X resources of FACE. */
#define PREPARE_FACE_FOR_DISPLAY(F, FACE) \
+ do { \
if ((FACE)->gc == 0) \
prepare_face_for_display ((F), (FACE)); \
- else \
- (void) 0
+ } while (false)
/* Return a pointer to the face with ID on frame F, or null if such a
face doesn't exist. */
@@ -1828,7 +1827,7 @@ struct face_cache
#else /* not HAVE_WINDOW_SYSTEM */
-#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) 1
+#define FACE_SUITABLE_FOR_ASCII_CHAR_P(FACE, CHAR) true
#define FACE_FOR_CHAR(F, FACE, CHAR, POS, OBJECT) ((FACE)->id)
#endif /* not HAVE_WINDOW_SYSTEM */
@@ -1926,9 +1925,9 @@ struct bidi_string_data {
ptrdiff_t schars; /* the number of characters in the string,
excluding the terminating null */
ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */
- unsigned from_disp_str : 1; /* 1 means the string comes from a
+ bool_bf from_disp_str : 1; /* True means the string comes from a
display property */
- unsigned unibyte : 1; /* 1 means the string is unibyte */
+ bool_bf unibyte : 1; /* True means the string is unibyte */
};
/* Data type for reordering bidirectional text. */
@@ -1971,10 +1970,10 @@ struct bidi_it {
struct window *w; /* the window being displayed */
bidi_dir_t paragraph_dir; /* current paragraph direction */
ptrdiff_t separator_limit; /* where paragraph separator should end */
- unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */
- unsigned first_elt : 1; /* if non-zero, examine current char first */
- unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */
- unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
+ bool_bf prev_was_pdf : 1; /* if true, previous char was PDF */
+ bool_bf first_elt : 1; /* if true, examine current char first */
+ bool_bf new_paragraph : 1; /* if true, we expect a new paragraph */
+ bool_bf frame_window_p : 1; /* true if displaying on a GUI frame */
};
/* Value is non-zero when the bidi iterator is at base paragraph
@@ -2002,8 +2001,8 @@ struct draw_fringe_bitmap_params
int wd, h, dh;
int x, y;
int bx, nx, by, ny;
- unsigned cursor_p : 1;
- unsigned overlay_p : 1;
+ bool_bf cursor_p : 1;
+ bool_bf overlay_p : 1;
struct face *face;
};
@@ -2238,30 +2237,30 @@ struct it
/* Position at which redisplay end trigger functions should be run. */
ptrdiff_t redisplay_end_trigger_charpos;
- /* 1 means multibyte characters are enabled. */
- unsigned multibyte_p : 1;
+ /* True means multibyte characters are enabled. */
+ bool_bf multibyte_p : 1;
- /* 1 means window has a mode line at its top. */
- unsigned header_line_p : 1;
+ /* True means window has a mode line at its top. */
+ bool_bf header_line_p : 1;
- /* 1 means `string' is the value of a `display' property.
+ /* True means `string' is the value of a `display' property.
Don't handle some `display' properties in these strings. */
- unsigned string_from_display_prop_p : 1;
+ bool_bf string_from_display_prop_p : 1;
- /* 1 means `string' comes from a `line-prefix' or `wrap-prefix'
+ /* True means `string' comes from a `line-prefix' or `wrap-prefix'
property. */
- unsigned string_from_prefix_prop_p : 1;
+ bool_bf string_from_prefix_prop_p : 1;
- /* 1 means we are iterating an object that came from a value of a
+ /* True means we are iterating an object that came from a value of a
`display' property. */
- unsigned from_disp_prop_p : 1;
+ bool_bf from_disp_prop_p : 1;
/* When METHOD == next_element_from_display_vector,
- this is 1 if we're doing an ellipsis. Otherwise meaningless. */
- unsigned ellipsis_p : 1;
+ this is true if we're doing an ellipsis. Otherwise meaningless. */
+ bool_bf ellipsis_p : 1;
/* True means cursor shouldn't be displayed here. */
- unsigned avoid_cursor_p : 1;
+ bool_bf avoid_cursor_p : 1;
/* Display table in effect or null for none. */
struct Lisp_Char_Table *dp;
@@ -2375,13 +2374,13 @@ struct it
enum glyph_row_area area;
enum it_method method;
bidi_dir_t paragraph_embedding;
- unsigned multibyte_p : 1;
- unsigned string_from_display_prop_p : 1;
- unsigned string_from_prefix_prop_p : 1;
- unsigned display_ellipsis_p : 1;
- unsigned avoid_cursor_p : 1;
- unsigned bidi_p : 1;
- unsigned from_disp_prop_p : 1;
+ bool_bf multibyte_p : 1;
+ bool_bf string_from_display_prop_p : 1;
+ bool_bf string_from_prefix_prop_p : 1;
+ bool_bf display_ellipsis_p : 1;
+ bool_bf avoid_cursor_p : 1;
+ bool_bf bidi_p : 1;
+ bool_bf from_disp_prop_p : 1;
enum line_wrap_method line_wrap;
/* Properties from display property that are reset by another display
@@ -2407,46 +2406,46 @@ struct it
int face_id;
/* Setting of buffer-local variable selective-display-ellipsis. */
- unsigned selective_display_ellipsis_p : 1;
+ bool_bf selective_display_ellipsis_p : 1;
- /* 1 means control characters are translated into the form `^C'
+ /* True means control characters are translated into the form `^C'
where the `^' can be replaced by a display table entry. */
- unsigned ctl_arrow_p : 1;
+ bool_bf ctl_arrow_p : 1;
- /* Non-zero means that the current face has a box. */
- unsigned face_box_p : 1;
+ /* True means that the current face has a box. */
+ bool_bf face_box_p : 1;
/* Non-null means that the current character is the first in a run
of characters with box face. */
- unsigned start_of_box_run_p : 1;
+ bool_bf start_of_box_run_p : 1;
- /* Non-zero means that the current character is the last in a run
+ /* True means that the current character is the last in a run
of characters with box face. */
- unsigned end_of_box_run_p : 1;
+ bool_bf end_of_box_run_p : 1;
- /* 1 means overlay strings at end_charpos have been processed. */
- unsigned overlay_strings_at_end_processed_p : 1;
+ /* True means overlay strings at end_charpos have been processed. */
+ bool_bf overlay_strings_at_end_processed_p : 1;
- /* 1 means to ignore overlay strings at current pos, as they have
+ /* True means to ignore overlay strings at current pos, as they have
already been processed. */
- unsigned ignore_overlay_strings_at_pos_p : 1;
+ bool_bf ignore_overlay_strings_at_pos_p : 1;
- /* 1 means the actual glyph is not available in the current
+ /* True means the actual glyph is not available in the current
system. */
- unsigned glyph_not_available_p : 1;
+ bool_bf glyph_not_available_p : 1;
- /* 1 means the next line in display_line continues a character
+ /* True means the next line in display_line continues a character
consisting of more than one glyph, and some glyphs of this
character have been put on the previous line. */
- unsigned starts_in_middle_of_char_p : 1;
+ bool_bf starts_in_middle_of_char_p : 1;
- /* If 1, saved_face_id contains the id of the face in front of text
+ /* If true, saved_face_id contains the id of the face in front of text
skipped due to selective display. */
- unsigned face_before_selective_p : 1;
+ bool_bf face_before_selective_p : 1;
- /* If 1, adjust current glyph so it does not increase current row
+ /* If true, adjust current glyph so it does not increase current row
descent/ascent (line-height property). Reset after this glyph. */
- unsigned constrain_row_ascent_descent_p : 1;
+ bool_bf constrain_row_ascent_descent_p : 1;
enum line_wrap_method line_wrap;
@@ -2614,9 +2613,9 @@ struct it
/* Face of the right fringe glyph. */
unsigned right_user_fringe_face_id : FACE_ID_BITS;
- /* Non-zero means we need to reorder bidirectional text for display
+ /* True means we need to reorder bidirectional text for display
in the visual order. */
- unsigned bidi_p : 1;
+ bool_bf bidi_p : 1;
/* For iterating over bidirectional text. */
struct bidi_it bidi_it;
@@ -2636,7 +2635,7 @@ struct it
#define ITERATOR_AT_END_P(IT) ((IT)->what == IT_EOB)
-/* Non-zero means IT is at the end of a line. This is the case if it
+/* True means IT is at the end of a line. This is the case if it
is either on a newline or on a carriage return and selective
display hides the rest of the line. */
@@ -2651,19 +2650,14 @@ struct it
#define PRODUCE_GLYPHS(IT) \
do { \
if ((IT)->glyph_row != NULL && (IT)->bidi_p) \
- { \
- if ((IT)->bidi_it.paragraph_dir == R2L) \
- (IT)->glyph_row->reversed_p = 1; \
- else \
- (IT)->glyph_row->reversed_p = 0; \
- } \
+ (IT)->glyph_row->reversed_p = (IT)->bidi_it.paragraph_dir == R2L; \
if (FRAME_RIF ((IT)->f) != NULL) \
FRAME_RIF ((IT)->f)->produce_glyphs ((IT)); \
else \
produce_glyphs ((IT)); \
if ((IT)->glyph_row != NULL) \
- inhibit_free_realized_faces = 1; \
- } while (0)
+ inhibit_free_realized_faces = true; \
+ } while (false)
/* Bit-flags indicating what operation move_it_to should perform. */
@@ -2707,13 +2701,13 @@ typedef struct {
/* Nonzero if part of the text currently shown in
its mouse-face is beyond the window end. */
- unsigned mouse_face_past_end : 1;
+ bool_bf mouse_face_past_end : 1;
- /* Nonzero means defer mouse-motion highlighting. */
- unsigned mouse_face_defer : 1;
+ /* True means defer mouse-motion highlighting. */
+ bool_bf mouse_face_defer : 1;
- /* Nonzero means that the mouse highlight should not be shown. */
- unsigned mouse_face_hidden : 1;
+ /* True means that the mouse highlight should not be shown. */
+ bool_bf mouse_face_hidden : 1;
} Mouse_HLInfo;
INLINE void
@@ -2728,9 +2722,9 @@ reset_mouse_highlight (Mouse_HLInfo *hlinfo)
hlinfo->mouse_face_mouse_frame = NULL;
hlinfo->mouse_face_window = Qnil;
hlinfo->mouse_face_overlay = Qnil;
- hlinfo->mouse_face_past_end = 0;
- hlinfo->mouse_face_hidden = 0;
- hlinfo->mouse_face_defer = 0;
+ hlinfo->mouse_face_past_end = false;
+ hlinfo->mouse_face_hidden = false;
+ hlinfo->mouse_face_defer = false;
}
/***********************************************************************
@@ -2798,8 +2792,8 @@ struct redisplay_interface
void (*update_window_begin_hook) (struct window *w);
/* Function to call after window W has been updated in window-based
- redisplay. CURSOR_ON_P non-zero means switch cursor on.
- MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W
+ redisplay. CURSOR_ON_P true means switch cursor on.
+ MOUSE_FACE_OVERWRITTEN_P true means that some lines in W
that contained glyphs in mouse-face were overwritten, so we
have to update the mouse highlight. */
void (*update_window_end_hook) (struct window *w, bool cursor_on_p,
@@ -2848,8 +2842,8 @@ struct redisplay_interface
int width, int height);
/* Draw specified cursor CURSOR_TYPE of width CURSOR_WIDTH
- at row GLYPH_ROW on window W if ON_P is 1. If ON_P is
- 0, don't draw cursor. If ACTIVE_P is 1, system caret
+ at row GLYPH_ROW on window W if ON_P is true. If ON_P is
+ false, don't draw cursor. If ACTIVE_P is true, system caret
should track this cursor (when applicable). */
void (*draw_window_cursor) (struct window *w,
struct glyph_row *glyph_row,
@@ -2949,11 +2943,11 @@ struct image
/* True if this image has a `transparent' background -- that is, is
uses an image mask. The accessor macro for this is
`IMAGE_BACKGROUND_TRANSPARENT'. */
- unsigned background_transparent : 1;
+ bool_bf background_transparent : 1;
/* True if the `background' and `background_transparent' fields are
valid, respectively. */
- unsigned background_valid : 1, background_transparent_valid : 1;
+ bool_bf background_valid : 1, background_transparent_valid : 1;
/* Width and height of the image. */
int width, height;
@@ -2996,8 +2990,8 @@ struct image
/* Reference to the type of the image. */
struct image_type *type;
- /* 1 means that loading the image failed. Don't try again. */
- unsigned load_failed_p;
+ /* True means that loading the image failed. Don't try again. */
+ bool load_failed_p;
/* A place for image types to store additional data. It is marked
during GC. */
@@ -3201,7 +3195,7 @@ void move_it_past_eol (struct it *);
void move_it_in_display_line (struct it *it,
ptrdiff_t to_charpos, int to_x,
enum move_operation_enum op);
-int in_display_vector_p (struct it *);
+bool in_display_vector_p (struct it *);
int frame_mode_line_height (struct frame *);
extern Lisp_Object Qtool_bar;
extern bool redisplaying_p;
@@ -3270,7 +3264,7 @@ extern void note_mouse_highlight (struct frame *, int, int);
extern void x_clear_window_mouse_face (struct window *);
extern void cancel_mouse_face (struct frame *);
extern int clear_mouse_face (Mouse_HLInfo *);
-extern int cursor_in_mouse_face_p (struct window *w);
+extern bool cursor_in_mouse_face_p (struct window *w);
extern void tty_draw_row_with_mouse_face (struct window *, struct glyph_row *,
int, int, enum draw_glyphs_face);
extern void display_tty_menu_item (const char *, int, int, int, int, int);
diff --git a/src/dispnew.c b/src/dispnew.c
index 94929600286..967fffe469b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -561,12 +561,12 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
w->window_end_valid = 0;
while (i < matrix->nrows)
- matrix->rows[i++].enabled_p = 0;
+ matrix->rows[i++].enabled_p = false;
}
else
{
for (i = 0; i < matrix->nrows; ++i)
- matrix->rows[i].enabled_p = 0;
+ matrix->rows[i].enabled_p = false;
}
}
else if (matrix == w->desired_matrix)
@@ -576,7 +576,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
had better be the case when we adjust matrices between
redisplays. */
for (i = 0; i < matrix->nrows; ++i)
- matrix->rows[i].enabled_p = 0;
+ matrix->rows[i].enabled_p = false;
}
}
@@ -684,7 +684,7 @@ clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
eassert (end >= 0 && end <= matrix->nrows);
for (; start < end; ++start)
- matrix->rows[start].enabled_p = 0;
+ matrix->rows[start].enabled_p = false;
}
@@ -864,7 +864,7 @@ blank_row (struct window *w, struct glyph_row *row, int y)
if (row->y + row->height > max_y)
row->visible_height -= row->y + row->height - max_y;
- row->enabled_p = 1;
+ row->enabled_p = true;
}
@@ -1062,7 +1062,7 @@ prepare_desired_row (struct glyph_row *row)
bool rp = row->reversed_p;
clear_glyph_row (row);
- row->enabled_p = 1;
+ row->enabled_p = true;
row->reversed_p = rp;
}
}
@@ -2416,7 +2416,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
/* Only when a desired row has been displayed, we want
the corresponding frame row to be updated. */
- frame_row->enabled_p = 1;
+ frame_row->enabled_p = true;
/* Maybe insert a vertical border between horizontally adjacent
windows. */
@@ -2564,7 +2564,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_
assign_row (current_row, desired_row);
/* Enable current_row to mark it as valid. */
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
current_row->mouse_face_p = mouse_face_p;
/* If we are called on frame matrices, perform analogous operations
@@ -2606,7 +2606,7 @@ mirror_make_current (struct window *w, int frame_row)
assign_row (current_row, desired_row);
else
swap_glyph_pointers (desired_row, current_row);
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
/* Set the Y coordinate of the mode/header line's row.
It is needed in draw_row_with_mouse_face to find the
@@ -2661,7 +2661,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
/* RETAINED_P is zero for empty lines. */
if (!retained_p[copy_from[i]])
- new_rows[i].enabled_p = 0;
+ new_rows[i].enabled_p = false;
}
/* Do the same for window matrices, if MATRIX is a frame matrix. */
@@ -2796,7 +2796,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
/* If frame line is empty, window line is empty, too. */
if (!retained_p[copy_from[i]])
- m->rows[window_to].enabled_p = 0;
+ m->rows[window_to].enabled_p = false;
}
else if (to_inside_window_p)
{
@@ -2821,7 +2821,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
/* If frame line is empty, window line is empty, too. */
if (!retained_p[copy_from[i]])
- m->rows[window_to].enabled_p = 0;
+ m->rows[window_to].enabled_p = false;
}
sync_p = 1;
}
@@ -3432,7 +3432,7 @@ update_window (struct window *w, bool force_p)
in the first redisplay. */
if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
for (i = vpos + 1; i < w->current_matrix->nrows - 1; ++i)
- MATRIX_ROW (w->current_matrix, i)->enabled_p = 0;
+ SET_MATRIX_ROW_ENABLED_P (w->current_matrix, i, false);
}
/* Was display preempted? */
@@ -4069,14 +4069,14 @@ scrolling_window (struct window *w, bool header_line_p)
&& row_equal_p (c, d, 1))
{
assign_row (c, d);
- d->enabled_p = 0;
+ d->enabled_p = false;
}
else
break;
}
/* Give up if some rows in the desired matrix are not enabled. */
- if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
+ if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
return -1;
first_old = first_new = i;
@@ -4089,7 +4089,7 @@ scrolling_window (struct window *w, bool header_line_p)
{
int bottom;
- if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
+ if (! MATRIX_ROW_ENABLED_P (desired_matrix, i))
return 0;
bottom = MATRIX_ROW_BOTTOM_Y (MATRIX_ROW (desired_matrix, i));
if (bottom <= yb)
@@ -4121,7 +4121,7 @@ scrolling_window (struct window *w, bool header_line_p)
j = last_old;
while (i - 1 > first_new
&& j - 1 > first_old
- && MATRIX_ROW (current_matrix, j - 1)->enabled_p
+ && MATRIX_ROW_ENABLED_P (current_matrix, j - 1)
&& (MATRIX_ROW (current_matrix, j - 1)->y
== MATRIX_ROW (desired_matrix, i - 1)->y)
&& !MATRIX_ROW (desired_matrix, i - 1)->redraw_fringe_bitmaps_p
@@ -4198,7 +4198,7 @@ scrolling_window (struct window *w, bool header_line_p)
for (i = first_old; i < last_old; ++i)
{
- if (MATRIX_ROW (current_matrix, i)->enabled_p)
+ if (MATRIX_ROW_ENABLED_P (current_matrix, i))
{
entry = add_row_entry (MATRIX_ROW (current_matrix, i));
old_lines[i] = entry;
@@ -4391,7 +4391,7 @@ scrolling_window (struct window *w, bool header_line_p)
preceding for-loop, we no longer have such an overlap,
and thus the assigned row should always be enabled. */
eassert (to->enabled_p);
- from->enabled_p = 0;
+ from->enabled_p = false;
to->overlapped_p = to_overlapped_p;
}
}
@@ -4761,7 +4761,7 @@ update_frame_line (struct frame *f, int vpos)
olen--;
}
- current_row->enabled_p = 1;
+ current_row->enabled_p = true;
current_row->used[TEXT_AREA] = desired_row->used[TEXT_AREA];
/* If desired line is empty, just clear the line. */
diff --git a/src/disptab.h b/src/disptab.h
index e02bab04bbc..e2e30b08d45 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -80,7 +80,7 @@ extern Lisp_Object Qdisplay_table;
SET_GLYPH_CHAR ((g), XINT ((base)[GLYPH_CHAR (g)])); \
if (!GLYPH_CHAR_VALID_P (g)) \
SET_GLYPH_CHAR (g, ' '); \
- } while (0)
+ } while (false)
/* Assuming that GLYPH_SIMPLE_P (BASE, LEN, G) is 0,
return the length and the address of the character-sequence
diff --git a/src/editfns.c b/src/editfns.c
index f67b95a8e81..8568a61c13f 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3636,8 +3636,8 @@ usage: (format STRING &rest OBJECTS) */)
struct info
{
ptrdiff_t start, end;
- unsigned converted_to_string : 1;
- unsigned intervals : 1;
+ bool_bf converted_to_string : 1;
+ bool_bf intervals : 1;
} *info = 0;
/* It should not be necessary to GCPRO ARGS, because
@@ -4214,7 +4214,7 @@ usage: (format STRING &rest OBJECTS) */)
if (buf == initial_buffer)
{
buf = xmalloc (bufsize);
- sa_must_free = 1;
+ sa_must_free = true;
buf_save_value_index = SPECPDL_INDEX ();
record_unwind_protect_ptr (xfree, buf);
memcpy (buf, initial_buffer, used);
diff --git a/src/fileio.c b/src/fileio.c
index dba4dfdac98..02bde865644 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2114,7 +2114,7 @@ entries (depending on how Emacs was built). */)
{
struct timespec atime = get_stat_atime (&st);
struct timespec mtime = get_stat_mtime (&st);
- if (set_file_times (ofd, SSDATA (encoded_newname), atime, mtime))
+ if (set_file_times (ofd, SSDATA (encoded_newname), atime, mtime) != 0)
xsignal2 (Qfile_date_error,
build_string ("Cannot set file date"), newname);
}
@@ -3184,7 +3184,7 @@ Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of
encoded_absname = ENCODE_FILE (absname);
{
- if (set_file_times (-1, SSDATA (encoded_absname), t, t))
+ if (set_file_times (-1, SSDATA (encoded_absname), t, t) != 0)
{
#ifdef MSDOS
/* Setting times on a directory always fails. */
diff --git a/src/font.h b/src/font.h
index 539ebeba52a..2c7456a2f29 100644
--- a/src/font.h
+++ b/src/font.h
@@ -117,7 +117,7 @@ enum font_property_index
font. */
FONT_AVGWIDTH_INDEX,
-#if 0
+#if false
/* The following two members are to substitute for the above 6
members (FONT_WEIGHT_INDEX to FONT_AVGWIDTH_INDEX excluding
FONT_SIZE_INDEX) if it is found that font-entities consumes too
@@ -201,38 +201,38 @@ enum font_property_index
? (XINT (AREF ((font), FONT_WIDTH_INDEX)) >> 8) : -1)
/* Return the symbolic weight value of FONT. */
#define FONT_WEIGHT_SYMBOLIC(font) \
- font_style_symbolic (font, FONT_WEIGHT_INDEX, 0)
+ font_style_symbolic (font, FONT_WEIGHT_INDEX, false)
/* Return the symbolic slant value of FONT. */
#define FONT_SLANT_SYMBOLIC(font) \
- font_style_symbolic (font, FONT_SLANT_INDEX, 0)
+ font_style_symbolic (font, FONT_SLANT_INDEX, false)
/* Return the symbolic width value of FONT. */
#define FONT_WIDTH_SYMBOLIC(font) \
- font_style_symbolic (font, FONT_WIDTH_INDEX, 0)
+ font_style_symbolic (font, FONT_WIDTH_INDEX, false)
/* Return the face-weight corresponding to the weight of FONT. */
#define FONT_WEIGHT_FOR_FACE(font) \
- font_style_symbolic (font, FONT_WEIGHT_INDEX, 1)
+ font_style_symbolic (font, FONT_WEIGHT_INDEX, true)
/* Return the face-slant corresponding to the slant of FONT. */
#define FONT_SLANT_FOR_FACE(font) \
- font_style_symbolic (font, FONT_SLANT_INDEX, 1)
+ font_style_symbolic (font, FONT_SLANT_INDEX, true)
/* Return the face-swidth corresponding to the slant of FONT. */
#define FONT_WIDTH_FOR_FACE(font) \
- font_style_symbolic (font, FONT_WIDTH_INDEX, 1)
+ font_style_symbolic (font, FONT_WIDTH_INDEX, true)
/* Return the numeric weight value corresponding ot the symbol NAME. */
#define FONT_WEIGHT_NAME_NUMERIC(name) \
- (font_style_to_value (FONT_WEIGHT_INDEX, (name), 0) >> 8)
+ (font_style_to_value (FONT_WEIGHT_INDEX, (name), false) >> 8)
/* Return the numeric slant value corresponding ot the symbol NAME. */
#define FONT_SLANT_NAME_NUMERIC(name) \
- (font_style_to_value (FONT_SLANT_INDEX, (name), 0) >> 8)
+ (font_style_to_value (FONT_SLANT_INDEX, (name), false) >> 8)
/* Return the numeric width value corresponding ot the symbol NAME. */
#define FONT_WIDTH_NAME_NUMERIC(name) \
- (font_style_to_value (FONT_WIDTH_INDEX, (name), 0) >> 8)
+ (font_style_to_value (FONT_WIDTH_INDEX, (name), false) >> 8)
/* Set the font property PROP of FONT to VAL. PROP is one of
style-related font property index (FONT_WEIGHT/SLANT/WIDTH_INDEX).
VAL (integer or symbol) is the numeric or symbolic style value. */
#define FONT_SET_STYLE(font, prop, val) \
- ASET ((font), prop, make_number (font_style_to_value (prop, val, 1)))
+ ASET ((font), prop, make_number (font_style_to_value (prop, val, true)))
#define FONT_WIDTH(f) ((f)->max_width)
#define FONT_HEIGHT(f) ((f)->height)
@@ -424,19 +424,19 @@ struct font_bitmap
/* Predicates to check various font-related objects. */
-/* 1 iff X is one of font-spec, font-entity, and font-object. */
+/* True iff X is one of font-spec, font-entity, and font-object. */
#define FONTP(x) PSEUDOVECTORP (x, PVEC_FONT)
-/* 1 iff X is font-spec. */
+/* True iff X is font-spec. */
#define FONT_SPEC_P(x) \
(FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX)
-/* 1 iff X is font-entity. */
+/* True iff X is font-entity. */
#define FONT_ENTITY_P(x) \
(FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX)
-/* 1 iff X is font-object. */
+/* True iff X is font-object. */
#define FONT_OBJECT_P(x) \
(FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX)
-/* 1 iff ENTITY can't be loaded. */
+/* True iff ENTITY can't be loaded. */
#define FONT_ENTITY_NOT_LOADABLE(entity) \
EQ (AREF (entity, FONT_OBJLIST_INDEX), Qt)
@@ -448,19 +448,22 @@ struct font_bitmap
/* Check macros for various font-related objects. */
#define CHECK_FONT(x) \
- do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (0)
+ do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (false)
#define CHECK_FONT_SPEC(x) \
- do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } while (0)
+ do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } \
+ while (false)
#define CHECK_FONT_ENTITY(x) \
- do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } while (0)
+ do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } \
+ while (false)
#define CHECK_FONT_OBJECT(x) \
- do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } while (0)
+ do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } \
+ while (false)
#define CHECK_FONT_GET_OBJECT(x, font) \
do { \
CHECK_FONT_OBJECT (x); \
font = XFONT_OBJECT (x); \
- } while (0)
+ } while (false)
#define XFONT_SPEC(p) \
(eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike))
@@ -848,12 +851,12 @@ extern void font_deferred_log (const char *, Lisp_Object, Lisp_Object);
do { \
if (! EQ (Vfont_log, Qt)) \
font_add_log ((ACTION), (ARG), (RESULT)); \
- } while (0)
+ } while (false)
#define FONT_DEFERRED_LOG(ACTION, ARG, RESULT) \
do { \
if (! EQ (Vfont_log, Qt)) \
font_deferred_log ((ACTION), (ARG), (RESULT)); \
- } while (0)
+ } while (false)
#endif /* not EMACS_FONT_H */
diff --git a/src/frame.h b/src/frame.h
index 0f6a674dc06..91b8ca04903 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -177,46 +177,46 @@ struct frame
struct glyph_matrix *desired_matrix;
struct glyph_matrix *current_matrix;
- /* 1 means that glyphs on this frame have been initialized so it can
+ /* True means that glyphs on this frame have been initialized so it can
be used for output. */
- unsigned glyphs_initialized_p : 1;
+ bool_bf glyphs_initialized_p : 1;
- /* Set to non-zero in change_frame_size when size of frame changed
+ /* Set to true in change_frame_size when size of frame changed
Clear the frame in clear_garbaged_frames if set. */
- unsigned resized_p : 1;
+ bool_bf resized_p : 1;
- /* Set to non-zero if the default face for the frame has been
+ /* Set to true if the default face for the frame has been
realized. Reset to zero whenever the default face changes.
Used to see the difference between a font change and face change. */
- unsigned default_face_done_p : 1;
+ bool_bf default_face_done_p : 1;
- /* Set to non-zero if this frame has already been hscrolled during
+ /* Set to true if this frame has already been hscrolled during
current redisplay. */
- unsigned already_hscrolled_p : 1;
+ bool_bf already_hscrolled_p : 1;
- /* Set to non-zero when current redisplay has updated frame. */
- unsigned updated_p : 1;
+ /* Set to true when current redisplay has updated frame. */
+ bool_bf updated_p : 1;
#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
- /* Set to non-zero to minimize tool-bar height even when
+ /* Set to true to minimize tool-bar height even when
auto-resize-tool-bar is set to grow-only. */
- unsigned minimize_tool_bar_window_p : 1;
+ bool_bf minimize_tool_bar_window_p : 1;
#endif
#if defined (USE_GTK) || defined (HAVE_NS)
- /* Nonzero means using a tool bar that comes from the toolkit. */
- unsigned external_tool_bar : 1;
+ /* True means using a tool bar that comes from the toolkit. */
+ bool_bf external_tool_bar : 1;
#endif
- /* Nonzero means that fonts have been loaded since the last glyph
+ /* True means that fonts have been loaded since the last glyph
matrix adjustments. */
- unsigned fonts_changed : 1;
+ bool_bf fonts_changed : 1;
- /* Nonzero means that cursor type has been changed. */
- unsigned cursor_type_changed : 1;
+ /* True means that cursor type has been changed. */
+ bool_bf cursor_type_changed : 1;
/* True if it needs to be redisplayed. */
- unsigned redisplay : 1;
+ bool_bf redisplay : 1;
/* Margin at the top of the frame. Used to display the tool-bar. */
int tool_bar_lines;
@@ -353,8 +353,8 @@ struct frame
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS) || defined (USE_GTK)
- /* Nonzero means using a menu bar that comes from the X toolkit. */
- unsigned external_menu_bar : 1;
+ /* True means using a menu bar that comes from the X toolkit. */
+ bool_bf external_menu_bar : 1;
#endif
/* Next two bitfields are mutually exclusive. They might both be
@@ -371,45 +371,45 @@ struct frame
updating it. */
unsigned visible : 2;
- /* Nonzero if the frame is currently iconified. Do not
+ /* True if the frame is currently iconified. Do not
set this directly, use SET_FRAME_ICONIFIED instead. */
- unsigned iconified : 1;
+ bool_bf iconified : 1;
- /* Nonzero if this frame should be redrawn. */
- unsigned garbaged : 1;
+ /* True if this frame should be redrawn. */
+ bool_bf garbaged : 1;
- /* 0 means, if this frame has just one window,
+ /* False means, if this frame has just one window,
show no modeline for that window. */
- unsigned wants_modeline : 1;
+ bool_bf wants_modeline : 1;
- /* Non-0 means raise this frame to the top of the heap when selected. */
- unsigned auto_raise : 1;
+ /* True means raise this frame to the top of the heap when selected. */
+ bool_bf auto_raise : 1;
- /* Non-0 means lower this frame to the bottom of the stack when left. */
- unsigned auto_lower : 1;
+ /* True means lower this frame to the bottom of the stack when left. */
+ bool_bf auto_lower : 1;
/* True if frame's root window can't be split. */
- unsigned no_split : 1;
+ bool_bf no_split : 1;
/* If this is set, then Emacs won't change the frame name to indicate
the current buffer, etcetera. If the user explicitly sets the frame
name, this gets set. If the user sets the name to Qnil, this is
cleared. */
- unsigned explicit_name : 1;
+ bool_bf explicit_name : 1;
- /* Nonzero if size of some window on this frame has changed. */
- unsigned window_sizes_changed : 1;
+ /* True if size of some window on this frame has changed. */
+ bool_bf window_sizes_changed : 1;
- /* Nonzero if the mouse has moved on this display device
+ /* True if the mouse has moved on this display device
since the last time we checked. */
- unsigned mouse_moved : 1;
+ bool_bf mouse_moved : 1;
- /* Nonzero means that the pointer is invisible. */
- unsigned pointer_invisible : 1;
+ /* True means that the pointer is invisible. */
+ bool_bf pointer_invisible : 1;
- /* Nonzero means that all windows except mini-window and
+ /* True means that all windows except mini-window and
selected window on this frame have frozen window starts. */
- unsigned frozen_window_starts : 1;
+ bool_bf frozen_window_starts : 1;
/* Nonzero if we should actually display the scroll bars on this frame. */
enum vertical_scroll_bar_type vertical_scroll_bar_type;
@@ -606,17 +606,17 @@ default_pixels_per_inch_y (void)
#define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
#define FRAME_X_P(f) ((f)->output_method == output_x_window)
#ifndef HAVE_NTGUI
-#define FRAME_W32_P(f) (0)
+#define FRAME_W32_P(f) false
#else
#define FRAME_W32_P(f) ((f)->output_method == output_w32)
#endif
#ifndef MSDOS
-#define FRAME_MSDOS_P(f) (0)
+#define FRAME_MSDOS_P(f) false
#else
#define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
#endif
#ifndef HAVE_NS
-#define FRAME_NS_P(f) (0)
+#define FRAME_NS_P(f) false
#else
#define FRAME_NS_P(f) ((f)->output_method == output_ns)
#endif
@@ -634,7 +634,7 @@ default_pixels_per_inch_y (void)
#define FRAME_WINDOW_P(f) FRAME_NS_P(f)
#endif
#ifndef FRAME_WINDOW_P
-#define FRAME_WINDOW_P(f) ((void) (f), 0)
+#define FRAME_WINDOW_P(f) ((void) (f), false)
#endif
/* Dots per inch of the screen the frame F is on. */
@@ -669,14 +669,14 @@ default_pixels_per_inch_y (void)
(&(F)->output_data.tty->display_info->mouse_highlight)
#endif
-/* Nonzero if frame F is still alive (not deleted). */
+/* True if frame F is still alive (not deleted). */
#define FRAME_LIVE_P(f) ((f)->terminal != 0)
-/* Nonzero if frame F is a minibuffer-only frame. */
+/* True if frame F is a minibuffer-only frame. */
#define FRAME_MINIBUF_ONLY_P(f) \
EQ (FRAME_ROOT_WINDOW (f), FRAME_MINIBUF_WINDOW (f))
-/* Nonzero if frame F contains it's own minibuffer window. Frame always has
+/* True if frame F contains it's own minibuffer window. Frame always has
minibuffer window, but it could use minibuffer window of another frame. */
#define FRAME_HAS_MINIBUF_P(f) \
(WINDOWP (f->minibuffer_window) \
@@ -714,12 +714,12 @@ default_pixels_per_inch_y (void)
/* Pixel height of frame F's menu bar. */
#define FRAME_MENU_BAR_HEIGHT(f) (f)->menu_bar_height
-/* Nonzero if this frame should display a tool bar
+/* True if this frame should display a tool bar
in a way that does not use any text lines. */
#if defined (USE_GTK) || defined (HAVE_NS)
#define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
#else
-#define FRAME_EXTERNAL_TOOL_BAR(f) 0
+#define FRAME_EXTERNAL_TOOL_BAR(f) false
#endif
/* Number of lines of frame F used for the tool-bar. */
@@ -736,40 +736,40 @@ default_pixels_per_inch_y (void)
#define FRAME_TOP_MARGIN_HEIGHT(F) \
(FRAME_MENU_BAR_HEIGHT (F) + FRAME_TOOL_BAR_HEIGHT (F))
-/* Nonzero if this frame should display a menu bar
+/* True if this frame should display a menu bar
in a way that does not use any text lines. */
#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS) || defined (USE_GTK)
#define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
#else
-#define FRAME_EXTERNAL_MENU_BAR(f) 0
+#define FRAME_EXTERNAL_MENU_BAR(f) false
#endif
#define FRAME_VISIBLE_P(f) (f)->visible
-/* Nonzero if frame F is currently visible but hidden. */
+/* True if frame F is currently visible but hidden. */
#define FRAME_OBSCURED_P(f) ((f)->visible > 1)
-/* Nonzero if frame F is currently iconified. */
+/* True if frame F is currently iconified. */
#define FRAME_ICONIFIED_P(f) (f)->iconified
/* Mark frame F as currently garbaged. */
#define SET_FRAME_GARBAGED(f) \
(frame_garbaged = true, fset_redisplay (f), f->garbaged = true)
-/* Nonzero if frame F is currently garbaged. */
+/* True if frame F is currently garbaged. */
#define FRAME_GARBAGED_P(f) (f)->garbaged
-/* Nonzero means do not allow splitting this frame's window. */
+/* True means do not allow splitting this frame's window. */
#define FRAME_NO_SPLIT_P(f) (f)->no_split
/* Not really implemented. */
#define FRAME_WANTS_MODELINE_P(f) (f)->wants_modeline
-/* Nonzero if all windows except selected window and mini window
+/* True if all windows except selected window and mini window
are frozen on frame F. */
#define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
-/* Nonzero if a size change has been requested for frame F
+/* True if a size change has been requested for frame F
but not yet really put into effect. This can be true temporarily
when an X event comes in at a bad time. */
#define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
@@ -888,8 +888,6 @@ default_pixels_per_inch_y (void)
#define FRAME_CURSOR_X_LIMIT(f) \
(FRAME_COLS (f) + FRAME_LEFT_SCROLL_BAR_COLS (f))
-/* Nonzero if frame F has scroll bars. */
-
#define FRAME_SCROLL_BARS(f) (f->scroll_bars)
#define FRAME_CONDEMNED_SCROLL_BARS(f) (f->condemned_scroll_bars)
@@ -934,7 +932,7 @@ default_pixels_per_inch_y (void)
#define FOR_EACH_FRAME(list_var, frame_var) \
for ((list_var) = Vframe_list; \
(CONSP (list_var) \
- && (frame_var = XCAR (list_var), 1)); \
+ && (frame_var = XCAR (list_var), true)); \
list_var = XCDR (list_var))
/* Reflect mouse movement when a complete frame update is performed. */
@@ -950,7 +948,7 @@ default_pixels_per_inch_y (void)
hlinfo->mouse_face_mouse_y); \
unblock_input (); \
} \
- } while (0)
+ } while (true)
/* Set visibility of frame F.
We call redisplay_other_windows to make sure the frame gets redisplayed
@@ -978,7 +976,7 @@ extern Lisp_Object Qtty_color_mode;
extern Lisp_Object Qterminal;
extern Lisp_Object Qnoelisp;
-/* Nonzero means there is at least one garbaged frame. */
+/* True means there is at least one garbaged frame. */
extern bool frame_garbaged;
extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
diff --git a/src/fringe.c b/src/fringe.c
index db4f92d6ce4..409c444a317 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -83,7 +83,7 @@ struct fringe_bitmap
unsigned width : 8;
unsigned period : 8;
unsigned align : 2;
- unsigned dynamic : 1;
+ bool_bf dynamic : 1;
};
@@ -1664,7 +1664,7 @@ If BITMAP already exists, the existing definition is replaced. */)
Fput (bitmap, Qfringe, make_number (n));
}
- fb.dynamic = 1;
+ fb.dynamic = true;
xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
fb.bits = b = (unsigned short *) (xfb + 1);
diff --git a/src/gnutls.h b/src/gnutls.h
index 4adaad4897d..e8a50d7cd1f 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -57,19 +57,19 @@ typedef enum
do { \
if ((level) <= (max)) \
gnutls_log_function (level, "(Emacs) " string); \
- } while (0)
+ } while (false)
#define GNUTLS_LOG2(level, max, string, extra) \
do { \
if ((level) <= (max)) \
gnutls_log_function2 (level, "(Emacs) " string, extra); \
- } while (0)
+ } while (false)
#define GNUTLS_LOG2i(level, max, string, extra) \
do { \
if ((level) <= (max)) \
gnutls_log_function2i (level, "(Emacs) " string, extra); \
- } while (0)
+ } while (false)
extern ptrdiff_t
emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte);
diff --git a/src/image.c b/src/image.c
index 38a92277299..e1c6e5df3cd 100644
--- a/src/image.c
+++ b/src/image.c
@@ -264,7 +264,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
#ifdef HAVE_X_WINDOWS
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
- dpyinfo->bitmaps[id - 1].have_mask = 0;
+ dpyinfo->bitmaps[id - 1].have_mask = false;
dpyinfo->bitmaps[id - 1].depth = 1;
#endif /* HAVE_X_WINDOWS */
@@ -339,7 +339,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
id = x_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
- dpyinfo->bitmaps[id - 1].have_mask = 0;
+ dpyinfo->bitmaps[id - 1].have_mask = false;
dpyinfo->bitmaps[id - 1].refcount = 1;
dpyinfo->bitmaps[id - 1].file = xlispstrdup (file);
dpyinfo->bitmaps[id - 1].depth = 1;
@@ -515,7 +515,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
width, height);
XFreeGC (FRAME_X_DISPLAY (f), gc);
- dpyinfo->bitmaps[id - 1].have_mask = 1;
+ dpyinfo->bitmaps[id - 1].have_mask = true;
dpyinfo->bitmaps[id - 1].mask = mask;
XDestroyImage (ximg);
@@ -3446,7 +3446,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
id = x_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
- dpyinfo->bitmaps[id - 1].have_mask = 1;
+ dpyinfo->bitmaps[id - 1].have_mask = true;
dpyinfo->bitmaps[id - 1].mask = mask;
dpyinfo->bitmaps[id - 1].file = NULL;
dpyinfo->bitmaps[id - 1].height = attrs.height;
@@ -3974,7 +3974,7 @@ xpm_load_image (struct frame *f,
Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int);
Lisp_Object frame, color_symbols, color_table;
int best_key;
- bool have_mask = 0;
+ bool have_mask = false;
XImagePtr ximg = NULL, mask_img = NULL;
#define match() \
@@ -4146,7 +4146,7 @@ xpm_load_image (struct frame *f,
#ifndef HAVE_NS
XPutPixel (mask_img, x, y,
(!EQ (color_val, Qt) ? PIX_MASK_DRAW
- : (have_mask = 1, PIX_MASK_RETAIN)));
+ : (have_mask = true, PIX_MASK_RETAIN)));
#else
if (EQ (color_val, Qt))
ns_set_alpha (ximg, x, y, 0);
diff --git a/src/intervals.h b/src/intervals.h
index 40f32645ba0..816ea105bd7 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -42,19 +42,19 @@ struct interval
struct interval *interval;
Lisp_Object obj;
} up;
- unsigned int up_obj : 1;
+ bool_bf up_obj : 1;
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
/* The remaining components are `properties' of the interval.
The first four are duplicates for things which can be on the list,
for purposes of speed. */
- unsigned int write_protect : 1; /* Non-zero means can't modify. */
- unsigned int visible : 1; /* Zero means don't display. */
- unsigned int front_sticky : 1; /* Non-zero means text inserted just
+ bool_bf write_protect : 1; /* True means can't modify. */
+ bool_bf visible : 1; /* False means don't display. */
+ bool_bf front_sticky : 1; /* True means text inserted just
before this interval goes into it. */
- unsigned int rear_sticky : 1; /* Likewise for just after it. */
+ bool_bf rear_sticky : 1; /* Likewise for just after it. */
Lisp_Object plist; /* Other properties. */
};
@@ -116,7 +116,7 @@ struct interval
/* Test what type of parent we have. Three possibilities: another
interval, a buffer or string object, or NULL. */
-#define INTERVAL_HAS_PARENT(i) ((i)->up_obj == 0 && (i)->up.interval != 0)
+#define INTERVAL_HAS_PARENT(i) (! (i)->up_obj && (i)->up.interval != 0)
#define INTERVAL_HAS_OBJECT(i) ((i)->up_obj)
/* Use these macros to get parent of an interval.
@@ -126,9 +126,9 @@ struct interval
progress. */
#define INTERVAL_PARENT(i) \
- (eassert ((i) != 0 && (i)->up_obj == 0), (i)->up.interval)
+ (eassert ((i) != 0 && ! (i)->up_obj), (i)->up.interval)
-#define GET_INTERVAL_OBJECT(d,s) (eassert ((s)->up_obj == 1), (d) = (s)->up.obj)
+#define GET_INTERVAL_OBJECT(d,s) (eassert ((s)->up_obj), (d) = (s)->up.obj)
/* Use these functions to set Lisp_Object
or pointer slots of struct interval. */
@@ -136,7 +136,7 @@ struct interval
INLINE void
set_interval_parent (INTERVAL i, INTERVAL parent)
{
- i->up_obj = 0;
+ i->up_obj = false;
i->up.interval = parent;
}
@@ -154,33 +154,33 @@ set_interval_plist (INTERVAL i, Lisp_Object plist)
/* Reset this interval to its vanilla, or no-property state. */
#define RESET_INTERVAL(i) \
-{ \
+ do { \
(i)->total_length = (i)->position = 0; \
(i)->left = (i)->right = NULL; \
set_interval_parent (i, NULL); \
- (i)->write_protect = 0; \
- (i)->visible = 0; \
- (i)->front_sticky = (i)->rear_sticky = 0; \
+ (i)->write_protect = false; \
+ (i)->visible = false; \
+ (i)->front_sticky = (i)->rear_sticky = false; \
set_interval_plist (i, Qnil); \
-}
+ } while (false)
/* Copy the cached property values of interval FROM to interval TO. */
#define COPY_INTERVAL_CACHE(from,to) \
-{ \
+ do { \
(to)->write_protect = (from)->write_protect; \
(to)->visible = (from)->visible; \
(to)->front_sticky = (from)->front_sticky; \
(to)->rear_sticky = (from)->rear_sticky; \
-}
+ } while (false)
/* Copy only the set bits of FROM's cache. */
-#define MERGE_INTERVAL_CACHE(from,to) \
-{ \
- if ((from)->write_protect) (to)->write_protect = 1; \
- if ((from)->visible) (to)->visible = 1; \
- if ((from)->front_sticky) (to)->front_sticky = 1; \
- if ((from)->rear_sticky) (to)->rear_sticky = 1; \
-}
+#define MERGE_INTERVAL_CACHE(from,to) \
+ do { \
+ if ((from)->write_protect) (to)->write_protect = true; \
+ if ((from)->visible) (to)->visible = true; \
+ if ((from)->front_sticky) (to)->front_sticky = true; \
+ if ((from)->rear_sticky) (to)->rear_sticky = true; \
+ } while (false)
/* Is this interval visible? Replace later with cache access. */
#define INTERVAL_VISIBLE_P(i) \
@@ -198,7 +198,7 @@ set_interval_plist (INTERVAL i, Lisp_Object plist)
should stick to it. Now we have Vtext_property_default_nonsticky,
so these macros are unreliable now and never used. */
-#if 0
+#if false
#define FRONT_STICKY_P(i) \
(i && ! NILP (textget ((i)->plist, Qfront_sticky)))
#define END_NONSTICKY_P(i) \
diff --git a/src/keyboard.h b/src/keyboard.h
index 33a2d535cd6..9785b961a28 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -169,7 +169,7 @@ struct kboard
char kbd_queue_has_data;
/* True means echo each character as typed. */
- unsigned immediate_echo : 1;
+ bool_bf immediate_echo : 1;
/* If we have echoed a prompt string specified by the user,
this is its length in characters. Otherwise this is -1. */
diff --git a/src/keymap.h b/src/keymap.h
index eca0f1b4108..feccb129b75 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
We need one more byte for string terminator `\0'. */
#define KEY_DESCRIPTION_SIZE ((2 * 6) + 1 + (CHARACTERBITS / 3) + 1 + 1)
-#define KEYMAPP(m) (!NILP (get_keymap (m, 0, 0)))
+#define KEYMAPP(m) (!NILP (get_keymap (m, false, false)))
extern Lisp_Object Qkeymap, Qmenu_bar;
extern Lisp_Object Qremap;
extern Lisp_Object Qmenu_item;
diff --git a/src/lisp.h b/src/lisp.h
index c4b36557eac..1e68b152dfc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <setjmp.h>
#include <stdalign.h>
#include <stdarg.h>
-#include <stdbool.h>
#include <stddef.h>
#include <float.h>
#include <inttypes.h>
@@ -170,7 +169,7 @@ typedef EMACS_UINT uprintmax_t;
for COND to call external functions or access volatile storage. */
#ifndef ENABLE_CHECKING
-# define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles. */
+# define eassert(cond) ((void) (false && (cond))) /* Check COND compiles. */
# define eassume(cond) assume (cond)
#else /* ENABLE_CHECKING */
@@ -251,20 +250,20 @@ enum Lisp_Bits
On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
a. unnecessary, because the top bits of an EMACS_INT are unused, and
b. slower, because it typically requires extra masking.
- So, default USE_LSB_TAG to 1 only on hosts where it might be useful. */
+ So, default USE_LSB_TAG to true only on hosts where it might be useful. */
# if VAL_MAX < UINTPTR_MAX
-# define USE_LSB_TAG 1
+# define USE_LSB_TAG true
# endif
# endif
# endif
#endif
#ifdef USE_LSB_TAG
# undef USE_LSB_TAG
-enum enum_USE_LSB_TAG { USE_LSB_TAG = 1 };
-# define USE_LSB_TAG 1
+enum enum_USE_LSB_TAG { USE_LSB_TAG = true };
+# define USE_LSB_TAG true
#else
-enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
-# define USE_LSB_TAG 0
+enum enum_USE_LSB_TAG { USE_LSB_TAG = false };
+# define USE_LSB_TAG false
#endif
#ifndef alignas
@@ -356,7 +355,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
/* When compiling via gcc -O0, define the key operations as macros, as
Emacs is too slow otherwise. To disable this optimization, compile
- with -DINLINING=0. */
+ with -DINLINING=false. */
#if (defined __NO_INLINE__ \
&& ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \
&& ! (defined INLINING && ! INLINING))
@@ -550,14 +549,14 @@ typedef struct { EMACS_INT i; } Lisp_Object;
#define LISP_INITIALLY_ZERO {0}
#undef CHECK_LISP_OBJECT_TYPE
-enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 };
+enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = true };
#else /* CHECK_LISP_OBJECT_TYPE */
/* If a struct type is not wanted, define Lisp_Object as just a number. */
typedef EMACS_INT Lisp_Object;
#define LISP_INITIALLY_ZERO 0
-enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 };
+enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = false };
#endif /* CHECK_LISP_OBJECT_TYPE */
/* Convert a Lisp_Object to the corresponding EMACS_INT and vice versa.
@@ -736,7 +735,7 @@ make_natnum (EMACS_INT n)
/* Return true if X and Y are the same object. */
LISP_MACRO_DEFUN (EQ, bool, (Lisp_Object x, Lisp_Object y), (x, y))
-/* Value is non-zero if I doesn't fit into a Lisp fixnum. It is
+/* Value is true if I doesn't fit into a Lisp fixnum. It is
written this way so that it also works if I is of unsigned
type or if I is a NaN. */
@@ -1085,17 +1084,23 @@ STRING_MULTIBYTE (Lisp_Object str)
((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1))
/* Mark STR as a unibyte string. */
-#define STRING_SET_UNIBYTE(STR) \
- do { if (EQ (STR, empty_multibyte_string)) \
- (STR) = empty_unibyte_string; \
- else XSTRING (STR)->size_byte = -1; } while (0)
+#define STRING_SET_UNIBYTE(STR) \
+ do { \
+ if (EQ (STR, empty_multibyte_string)) \
+ (STR) = empty_unibyte_string; \
+ else \
+ XSTRING (STR)->size_byte = -1; \
+ } while (false)
/* Mark STR as a multibyte string. Assure that STR contains only
ASCII characters in advance. */
-#define STRING_SET_MULTIBYTE(STR) \
- do { if (EQ (STR, empty_unibyte_string)) \
- (STR) = empty_multibyte_string; \
- else XSTRING (STR)->size_byte = XSTRING (STR)->size; } while (0)
+#define STRING_SET_MULTIBYTE(STR) \
+ do { \
+ if (EQ (STR, empty_unibyte_string)) \
+ (STR) = empty_multibyte_string; \
+ else \
+ XSTRING (STR)->size_byte = XSTRING (STR)->size; \
+ } while (false)
/* Convenience functions for dealing with Lisp strings. */
@@ -1348,14 +1353,14 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
/* Compute A OP B, using the unsigned comparison operator OP. A and B
should be integer expressions. This is not the same as
mathematical comparison; for example, UNSIGNED_CMP (0, <, -1)
- returns 1. For efficiency, prefer plain unsigned comparison if A
+ returns true. For efficiency, prefer plain unsigned comparison if A
and B's sizes both fit (after integer promotion). */
#define UNSIGNED_CMP(a, op, b) \
(max (sizeof ((a) + 0), sizeof ((b) + 0)) <= sizeof (unsigned) \
? ((a) + (unsigned) 0) op ((b) + (unsigned) 0) \
: ((a) + (uintmax_t) 0) op ((b) + (uintmax_t) 0))
-/* Nonzero iff C is an ASCII character. */
+/* True iff C is an ASCII character. */
#define ASCII_CHAR_P(c) UNSIGNED_CMP (c, <, 0x80)
/* A char-table is a kind of vectorlike, with contents are like a
@@ -1536,7 +1541,7 @@ enum symbol_redirect
struct Lisp_Symbol
{
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
/* Indicates where the value can be found:
0 : it's a plain var, the value is in the `value' field.
@@ -1554,9 +1559,9 @@ struct Lisp_Symbol
enum symbol_interned. */
unsigned interned : 2;
- /* Non-zero means that this variable has been explicitly declared
+ /* True means that this variable has been explicitly declared
special (with `defvar' etc), and shouldn't be lexically bound. */
- unsigned declared_special : 1;
+ bool_bf declared_special : 1;
/* The symbol's name, as a Lisp string. */
Lisp_Object name;
@@ -1654,7 +1659,7 @@ SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object sym)
LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, (Lisp_Object sym), (sym))
#define DEFSYM(sym, name) \
- do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
+ do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (false)
/***********************************************************************
@@ -1832,22 +1837,22 @@ SXHASH_REDUCE (EMACS_UINT x)
struct Lisp_Misc_Any /* Supertype of all Misc types. */
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
unsigned spacer : 15;
};
struct Lisp_Marker
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
unsigned spacer : 13;
/* This flag is temporarily used in the functions
decode/encode_coding_object to record that the marker position
must be adjusted after the conversion. */
- unsigned int need_adjustment : 1;
- /* 1 means normal insertion at the marker's position
+ bool_bf need_adjustment : 1;
+ /* True means normal insertion at the marker's position
leaves the marker after the inserted text. */
- unsigned int insertion_type : 1;
+ bool_bf insertion_type : 1;
/* This is the buffer that the marker points into, or 0 if it points nowhere.
Note: a chain of markers can contain markers pointing into different
buffers (the chain is per buffer_text rather than per buffer, so it's
@@ -1893,7 +1898,7 @@ struct Lisp_Overlay
*/
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
unsigned spacer : 15;
struct Lisp_Overlay *next;
Lisp_Object start;
@@ -1971,7 +1976,7 @@ typedef void (*voidfuncptr) (void);
struct Lisp_Save_Value
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS);
/* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of
@@ -2047,7 +2052,7 @@ XSAVE_OBJECT (Lisp_Object obj, int n)
struct Lisp_Free
{
ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
- unsigned gcmarkbit : 1;
+ bool_bf gcmarkbit : 1;
unsigned spacer : 15;
union Lisp_Misc *chain;
};
@@ -2116,8 +2121,8 @@ struct Lisp_Intfwd
/* Boolean forwarding pointer to an int variable.
This is like Lisp_Intfwd except that the ostensible
- "value" of the symbol is t if the int variable is nonzero,
- nil if it is zero. */
+ "value" of the symbol is t if the bool variable is true,
+ nil if it is false. */
struct Lisp_Boolfwd
{
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
@@ -2170,15 +2175,15 @@ struct Lisp_Buffer_Objfwd
struct Lisp_Buffer_Local_Value
{
- /* 1 means that merely setting the variable creates a local
+ /* True means that merely setting the variable creates a local
binding for the current buffer. */
- unsigned int local_if_set : 1;
- /* 1 means this variable can have frame-local bindings, otherwise, it is
+ bool_bf local_if_set : 1;
+ /* True means this variable can have frame-local bindings, otherwise, it is
can have buffer-local bindings. The two cannot be combined. */
- unsigned int frame_local : 1;
- /* 1 means that the binding now loaded was found.
+ bool_bf frame_local : 1;
+ /* True means that the binding now loaded was found.
Presumably equivalent to (defcell!=valcell). */
- unsigned int found : 1;
+ bool_bf found : 1;
/* If non-NULL, a forwarding to the C var where it should also be set. */
union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */
/* The buffer or frame for which the loaded binding was found. */
@@ -2373,7 +2378,7 @@ INLINE bool
PSEUDOVECTORP (Lisp_Object a, int code)
{
if (! VECTORLIKEP (a))
- return 0;
+ return false;
else
{
/* Converting to struct vectorlike_header * avoids aliasing issues. */
@@ -2541,18 +2546,22 @@ CHECK_NATNUM (Lisp_Object x)
? MOST_NEGATIVE_FIXNUM \
: (lo)), \
make_number (min (hi, MOST_POSITIVE_FIXNUM))); \
- } while (0)
+ } while (false)
#define CHECK_TYPE_RANGED_INTEGER(type, x) \
do { \
if (TYPE_SIGNED (type)) \
CHECK_RANGED_INTEGER (x, TYPE_MINIMUM (type), TYPE_MAXIMUM (type)); \
else \
CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type)); \
- } while (0)
+ } while (false)
-#define CHECK_NUMBER_COERCE_MARKER(x) \
- do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \
- else CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); } while (0)
+#define CHECK_NUMBER_COERCE_MARKER(x) \
+ do { \
+ if (MARKERP ((x))) \
+ XSETFASTINT (x, marker_position (x)); \
+ else \
+ CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); \
+ } while (false)
INLINE double
XFLOATINT (Lisp_Object n)
@@ -2566,9 +2575,13 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x);
}
-#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
- do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \
- else CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); } while (0)
+#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
+ do { \
+ if (MARKERP (x)) \
+ XSETFASTINT (x, marker_position (x)); \
+ else \
+ CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); \
+ } while (false)
/* Since we can't assign directly to the CAR or CDR fields of a cons
cell, use these when checking that those fields contain numbers. */
@@ -2701,34 +2714,34 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
do { \
static struct Lisp_Objfwd o_fwd; \
defvar_lisp (&o_fwd, lname, &globals.f_ ## vname); \
- } while (0)
+ } while (false)
#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
do { \
static struct Lisp_Objfwd o_fwd; \
defvar_lisp_nopro (&o_fwd, lname, &globals.f_ ## vname); \
- } while (0)
+ } while (false)
#define DEFVAR_BOOL(lname, vname, doc) \
do { \
static struct Lisp_Boolfwd b_fwd; \
defvar_bool (&b_fwd, lname, &globals.f_ ## vname); \
- } while (0)
+ } while (false)
#define DEFVAR_INT(lname, vname, doc) \
do { \
static struct Lisp_Intfwd i_fwd; \
defvar_int (&i_fwd, lname, &globals.f_ ## vname); \
- } while (0)
+ } while (false)
#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \
do { \
static struct Lisp_Objfwd o_fwd; \
defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \
- } while (0)
+ } while (false)
#define DEFVAR_KBOARD(lname, vname, doc) \
do { \
static struct Lisp_Kboard_Objfwd ko_fwd; \
defvar_kboard (&ko_fwd, lname, offsetof (KBOARD, vname ## _)); \
- } while (0)
+ } while (false)
/* Save and restore the instruction and environment pointers,
without affecting the signal mask. */
@@ -2812,7 +2825,7 @@ union specbinding
} let;
struct {
ENUM_BF (specbind_tag) kind : CHAR_BIT;
- unsigned debug_on_exit : 1;
+ bool_bf debug_on_exit : 1;
Lisp_Object function;
Lisp_Object *args;
ptrdiff_t nargs;
@@ -2869,7 +2882,7 @@ struct handler
/* Most global vars are reset to their value via the specpdl mechanism,
but a few others are handled by storing their value here. */
-#if 1 /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but they're defined later. */
+#if true /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but defined later. */
struct gcpro *gcpro;
#endif
sys_jmp_buf jmp;
@@ -2917,7 +2930,7 @@ extern char *stack_bottom;
Unless that is impossible, of course.
But it is very desirable to avoid creating loops where QUIT is impossible.
- Exception: if you set immediate_quit to nonzero,
+ Exception: if you set immediate_quit to true,
then the handler that responds to the C-g does the quit itself.
This is a good thing to do around a loop that has no side effects
and (in particular) cannot call arbitrary Lisp code.
@@ -2935,10 +2948,10 @@ extern void process_quit_flag (void);
process_quit_flag (); \
else if (pending_signals) \
process_pending_signals (); \
- } while (0)
+ } while (false)
-/* Nonzero if ought to quit now. */
+/* True if ought to quit now. */
#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
@@ -3121,9 +3134,9 @@ extern int gcpro_level;
gcprolist = &gcpro6; }
#define UNGCPRO \
- ((--gcpro_level != gcpro1.level) \
- ? (emacs_abort (), 0) \
- : ((gcprolist = gcpro1.next), 0))
+ (--gcpro_level != gcpro1.level \
+ ? emacs_abort () \
+ : (void) (gcprolist = gcpro1.next))
#endif /* DEBUG_GCPRO */
#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
@@ -3131,14 +3144,14 @@ extern int gcpro_level;
/* Evaluate expr, UNGCPRO, and then return the value of expr. */
#define RETURN_UNGCPRO(expr) \
-do \
+ do \
{ \
Lisp_Object ret_ungc_val; \
ret_ungc_val = (expr); \
UNGCPRO; \
return ret_ungc_val; \
} \
-while (0)
+ while (false)
/* Call staticpro (&var) to protect static variable `var'. */
@@ -4390,13 +4403,13 @@ enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 };
extern void *record_xmalloc (size_t);
#define USE_SAFE_ALLOCA \
- ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = 0
+ ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = false
/* SAFE_ALLOCA allocates a simple buffer. */
#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA \
? alloca (size) \
- : (sa_must_free = 1, record_xmalloc (size)))
+ : (sa_must_free = true, record_xmalloc (size)))
/* SAFE_NALLOCA sets BUF to a newly allocated array of MULTIPLIER *
NITEMS items, each of the same type as *BUF. MULTIPLIER must
@@ -4409,20 +4422,20 @@ extern void *record_xmalloc (size_t);
else \
{ \
(buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \
- sa_must_free = 1; \
+ sa_must_free = true; \
record_unwind_protect_ptr (xfree, buf); \
} \
- } while (0)
+ } while (false)
/* SAFE_FREE frees xmalloced memory and enables GC as needed. */
#define SAFE_FREE() \
do { \
if (sa_must_free) { \
- sa_must_free = 0; \
+ sa_must_free = false; \
unbind_to (sa_count, Qnil); \
} \
- } while (0)
+ } while (false)
/* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */
@@ -4430,39 +4443,40 @@ extern void *record_xmalloc (size_t);
#define SAFE_ALLOCA_LISP(buf, nelt) \
do { \
if ((nelt) < MAX_ALLOCA / word_size) \
- buf = alloca ((nelt) * word_size); \
+ (buf) = alloca ((nelt) * word_size); \
else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \
{ \
Lisp_Object arg_; \
- buf = xmalloc ((nelt) * word_size); \
+ (buf) = xmalloc ((nelt) * word_size); \
arg_ = make_save_memory (buf, nelt); \
- sa_must_free = 1; \
+ sa_must_free = true; \
record_unwind_protect (free_save_value, arg_); \
} \
else \
memory_full (SIZE_MAX); \
- } while (0)
+ } while (false)
/* Loop over all tails of a list, checking for cycles.
FIXME: Make tortoise and n internal declarations.
FIXME: Unroll the loop body so we don't need `n'. */
#define FOR_EACH_TAIL(hare, list, tortoise, n) \
- for (tortoise = hare = (list), n = true; \
+ for ((tortoise) = (hare) = (list), (n) = true; \
CONSP (hare); \
- (hare = XCDR (hare), n = !n, \
- (n \
- ? ((EQ (hare, tortoise) \
- && (xsignal1 (Qcircular_list, (list)), 0))) \
+ (hare = XCDR (hare), (n) = !(n), \
+ ((n) \
+ ? (EQ (hare, tortoise) \
+ ? xsignal1 (Qcircular_list, list) \
+ : (void) 0) \
/* Move tortoise before the next iteration, in case */ \
/* the next iteration does an Fsetcdr. */ \
- : (tortoise = XCDR (tortoise), 0))))
+ : (void) ((tortoise) = XCDR (tortoise)))))
/* Do a `for' loop over alist values. */
#define FOR_EACH_ALIST_VALUE(head_var, list_var, value_var) \
- for (list_var = head_var; \
- (CONSP (list_var) && (value_var = XCDR (XCAR (list_var)), 1)); \
- list_var = XCDR (list_var))
+ for ((list_var) = (head_var); \
+ (CONSP (list_var) && ((value_var) = XCDR (XCAR (list_var)), true)); \
+ (list_var) = XCDR (list_var))
/* Check whether it's time for GC, and run it if so. */
@@ -4498,14 +4512,14 @@ functionp (Lisp_Object object)
if (SUBRP (object))
return XSUBR (object)->max_args != UNEVALLED;
else if (COMPILEDP (object))
- return 1;
+ return true;
else if (CONSP (object))
{
Lisp_Object car = XCAR (object);
return EQ (car, Qlambda) || EQ (car, Qclosure);
}
else
- return 0;
+ return false;
}
INLINE_HEADER_END
diff --git a/src/macfont.m b/src/macfont.m
index 10623eb12fe..d129b330774 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -95,11 +95,11 @@ struct macfont_info
struct macfont_cache *cache;
struct macfont_metrics **metrics;
short metrics_nrows;
- unsigned synthetic_italic_p : 1;
- unsigned synthetic_bold_p : 1;
+ bool_bf synthetic_italic_p : 1;
+ bool_bf synthetic_bold_p : 1;
unsigned spacing : 2;
unsigned antialias : 2;
- unsigned color_bitmap_p : 1;
+ bool_bf color_bitmap_p : 1;
};
/* Values for the `spacing' member in `struct macfont_info'. */
diff --git a/src/process.h b/src/process.h
index 37d220e987c..00fd6be9e49 100644
--- a/src/process.h
+++ b/src/process.h
@@ -138,23 +138,23 @@ struct Lisp_Process
0 = nil, 1 = t, 2 = other. */
unsigned int adaptive_read_buffering : 2;
/* Skip reading this process on next read. */
- unsigned int read_output_skip : 1;
- /* Non-nil means kill silently if Emacs is exited.
+ bool_bf read_output_skip : 1;
+ /* True means kill silently if Emacs is exited.
This is the inverse of the `query-on-exit' flag. */
- unsigned int kill_without_query : 1;
- /* Non-nil if communicating through a pty. */
- unsigned int pty_flag : 1;
+ bool_bf kill_without_query : 1;
+ /* True if communicating through a pty. */
+ bool_bf pty_flag : 1;
/* Flag to set coding-system of the process buffer from the
coding_system used to decode process output. */
- unsigned int inherit_coding_system_flag : 1;
+ bool_bf inherit_coding_system_flag : 1;
/* Whether the process is alive, i.e., can be waited for. Running
processes can be waited for, but exited and fake processes cannot. */
- unsigned int alive : 1;
+ bool_bf alive : 1;
/* Record the process status in the raw form in which it comes from `wait'.
This is to avoid consing in a signal handler. The `raw_status_new'
flag indicates that `raw_status' contains a new status that still
needs to be synced to `status'. */
- unsigned int raw_status_new : 1;
+ bool_bf raw_status_new : 1;
int raw_status;
#ifdef HAVE_GNUTLS
@@ -164,7 +164,7 @@ struct Lisp_Process
gnutls_anon_client_credentials_t gnutls_anon_cred;
int gnutls_log_level;
int gnutls_handshakes_tried;
- unsigned int gnutls_p : 1;
+ bool_bf gnutls_p : 1;
#endif
};
diff --git a/src/region-cache.c b/src/region-cache.c
index be7d50a50e4..8481a820301 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -716,8 +716,9 @@ region_cache_forward (struct buffer *buf, struct region_cache *c,
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)
+int
+region_cache_backward (struct buffer *buf, struct region_cache *c,
+ ptrdiff_t pos, ptrdiff_t *next)
{
revalidate_region_cache (buf, c);
diff --git a/src/region-cache.h b/src/region-cache.h
index e4c6b59ee95..1a26938a39e 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -89,24 +89,19 @@ extern void invalidate_region_cache (struct buffer *BUF,
/* The scanning functions.
Basically, if you're scanning forward/backward from position POS,
- and region_cache_forward/backward returns true, you can skip all
- the text between POS and *NEXT. And if the function returns false,
+ and region_cache_forward/backward returns nonzero, you can skip all
+ the text between POS and *NEXT. And if the function returns zero,
you should examine all the text from POS to *NEXT, and call
know_region_cache depending on what you find there; this way, you
might be able to avoid scanning it again. */
-/* 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. */
-extern int region_cache_forward (struct buffer *BUF,
- struct region_cache *CACHE,
- ptrdiff_t POS,
- ptrdiff_t *NEXT);
-
-/* 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
- position before POS where the knowledge changes. */
-extern int region_cache_backward (struct buffer *BUF,
- struct region_cache *CACHE,
- ptrdiff_t POS,
- ptrdiff_t *NEXT);
+extern int region_cache_forward (struct buffer *buf, struct region_cache *c,
+ ptrdiff_t pos, ptrdiff_t *next);
+
+/* Likewise, except before POS rather than after POS. */
+extern int region_cache_backward (struct buffer *buf, struct region_cache *c,
+ ptrdiff_t pos, ptrdiff_t *next);
diff --git a/src/syntax.h b/src/syntax.h
index 73fbb153338..63cb0e96139 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -99,7 +99,7 @@ syntax_property_entry (int c, bool via_property)
INLINE Lisp_Object
SYNTAX_ENTRY (int c)
{
- return syntax_property_entry (c, 0);
+ return syntax_property_entry (c, false);
}
/* Extract the information from the entry for character C
@@ -114,7 +114,7 @@ syntax_property_with_flags (int c, bool via_property)
INLINE int
SYNTAX_WITH_FLAGS (int c)
{
- return syntax_property_with_flags (c, 0);
+ return syntax_property_with_flags (c, false);
}
INLINE enum syntaxcode
@@ -125,7 +125,7 @@ syntax_property (int c, bool via_property)
INLINE enum syntaxcode
SYNTAX (int c)
{
- return syntax_property (c, 0);
+ return syntax_property (c, false);
}
@@ -146,7 +146,8 @@ extern char const syntax_code_spec[16];
for the object recorded in gl_state with SETUP_SYNTAX_TABLE_FOR_OBJECT.
The value is meant for use in code that does nothing when
- parse_sexp_lookup_properties is 0, so return 0 in that case, for speed. */
+ parse_sexp_lookup_properties is false, so return 0 in that case,
+ for speed. */
INLINE ptrdiff_t
SYNTAX_TABLE_BYTE_TO_CHAR (ptrdiff_t bytepos)
@@ -172,7 +173,7 @@ INLINE void
UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos)
{
if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
- update_syntax_table (charpos + gl_state.offset, 1, 0, gl_state.object);
+ update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object);
}
/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
@@ -182,7 +183,7 @@ INLINE void
UPDATE_SYNTAX_TABLE_BACKWARD (ptrdiff_t charpos)
{
if (parse_sexp_lookup_properties && charpos < gl_state.b_property)
- update_syntax_table (charpos + gl_state.offset, -1, 0, gl_state.object);
+ update_syntax_table (charpos + gl_state.offset, -1, false, gl_state.object);
}
/* Make syntax table good for CHARPOS. */
@@ -199,7 +200,7 @@ UPDATE_SYNTAX_TABLE (ptrdiff_t charpos)
INLINE void
SETUP_BUFFER_SYNTAX_TABLE (void)
{
- gl_state.use_global = 0;
+ gl_state.use_global = false;
gl_state.current_syntax_table = BVAR (current_buffer, syntax_table);
}
diff --git a/src/syssignal.h b/src/syssignal.h
index 45ea8f1af3c..370948c429b 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <signal.h>
-#include <stdbool.h>
extern void init_signals (bool);
diff --git a/src/systime.h b/src/systime.h
index a9bdf53b09f..ecb8e2183f4 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -57,10 +57,10 @@ invalid_timespec (void)
return make_timespec (0, -1);
}
-/* Return 1 if TIME is a valid timespec. This currently doesn't worry
+/* Return true if TIME is a valid timespec. This currently doesn't worry
about whether tv_nsec is less than TIMESPEC_RESOLUTION; leap seconds
might cause a problem if it did. */
-INLINE int
+INLINE bool
timespec_valid_p (struct timespec t)
{
return t.tv_nsec >= 0;
diff --git a/src/syswait.h b/src/syswait.h
index 4ae9129d7ed..c56f2eec2a2 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_SYSWAIT_H
#define EMACS_SYSWAIT_H
-#include <stdbool.h>
#include <sys/types.h>
#ifdef HAVE_SYS_WAIT_H /* We have sys/wait.h with POSIXoid definitions. */
diff --git a/src/term.c b/src/term.c
index 7b6cb41e23d..43ce58c5ca2 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3027,7 +3027,7 @@ save_and_enable_current_matrix (struct frame *f)
/* Make sure every row is enabled, or else update_frame will not
redraw them. (Rows that are identical to what is already on
screen will not be redrawn anyway.) */
- to->enabled_p = 1;
+ to->enabled_p = true;
to->hash = from->hash;
}
diff --git a/src/termchar.h b/src/termchar.h
index feb89e02d0e..5ded6c82aea 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -54,7 +54,8 @@ struct tty_display_info
struct emacs_tty *old_tty; /* The initial tty mode bits */
- unsigned term_initted : 1; /* 1 if we have been through init_sys_modes. */
+ bool_bf term_initted : 1; /* True if we have been through
+ init_sys_modes. */
int reference_count; /* Number of frames that are on this display. */
@@ -166,12 +167,12 @@ struct tty_display_info
int RPov; /* # chars to start a TS_repeat */
- unsigned delete_in_insert_mode : 1; /* delete mode == insert mode */
+ bool_bf delete_in_insert_mode : 1; /* delete mode == insert mode */
- unsigned costs_set : 1; /* Nonzero if costs have been calculated. */
+ bool_bf costs_set : 1; /* True if costs have been calculated. */
- unsigned insert_mode : 1; /* Nonzero when in insert mode. */
- unsigned standout_mode : 1; /* Nonzero when in standout mode. */
+ bool_bf insert_mode : 1; /* True when in insert mode. */
+ bool_bf standout_mode : 1; /* True when in standout mode. */
/* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
keep 0200 bit in input chars. 0 to ignore the 0200 bit. */
@@ -189,33 +190,33 @@ struct tty_display_info
/* Flag used in tty_show/hide_cursor. */
- unsigned cursor_hidden : 1;
+ bool_bf cursor_hidden : 1;
- /* Nonzero means use ^S/^Q for flow control. */
+ /* True means use ^S/^Q for flow control. */
- unsigned flow_control : 1;
+ bool_bf flow_control : 1;
- /* Non-zero means we are displaying a TTY menu on this tty. */
- unsigned showing_menu : 1;
+ /* True means we are displaying a TTY menu on this tty. */
+ bool_bf showing_menu : 1;
- /* Nonzero means spaces in the text must actually be output;
+ /* True means spaces in the text must actually be output;
can't just skip over some columns to leave them blank. */
- unsigned must_write_spaces : 1;
+ bool_bf must_write_spaces : 1;
- /* Nonzero if TTY can insert and delete lines. */
- unsigned line_ins_del_ok : 1;
+ /* True if TTY can insert and delete lines. */
+ bool_bf line_ins_del_ok : 1;
- /* Nonzero if TTY can insert and delete chars. */
- unsigned char_ins_del_ok : 1;
+ /* True if TTY can insert and delete chars. */
+ bool_bf char_ins_del_ok : 1;
- /* Nonzero if TTY supports setting the scroll window. */
- unsigned scroll_region_ok : 1;
+ /* True if TTY supports setting the scroll window. */
+ bool_bf scroll_region_ok : 1;
- /* Nonzero if TTY remembers lines scrolled off bottom. */
- unsigned memory_below_frame : 1;
+ /* True if TTY remembers lines scrolled off bottom. */
+ bool_bf memory_below_frame : 1;
/* Cost of setting the scroll window, measured in characters. */
- int scroll_region_cost;
+ int scroll_region_cost;
};
/* A chain of structures for all tty devices currently in use. */
diff --git a/src/unexelf.c b/src/unexelf.c
index e2412393286..94c9c02f70d 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -393,7 +393,6 @@ temacs:
#include <fcntl.h>
#include <limits.h>
#include <memory.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/stat.h>
diff --git a/src/window.h b/src/window.h
index b91161f4d32..05b4680471b 100644
--- a/src/window.h
+++ b/src/window.h
@@ -287,78 +287,78 @@ struct window
int header_line_height;
/* Z - the buffer position of the last glyph in the current
- matrix of W. Only valid if window_end_valid is nonzero. */
+ matrix of W. Only valid if window_end_valid is true. */
ptrdiff_t window_end_pos;
/* Glyph matrix row of the last glyph in the current matrix
- of W. Only valid if window_end_valid is nonzero. */
+ of W. Only valid if window_end_valid is true. */
int window_end_vpos;
- /* Non-zero if this window is a minibuffer window. */
- unsigned mini : 1;
+ /* True if this window is a minibuffer window. */
+ bool_bf mini : 1;
/* Meaningful only if contents is a window, non-zero if this
internal window is used in horizontal combination. */
- unsigned horizontal : 1;
+ bool_bf horizontal : 1;
- /* Non-zero means must regenerate mode line of this window. */
- unsigned update_mode_line : 1;
+ /* True means must regenerate mode line of this window. */
+ bool_bf update_mode_line : 1;
- /* Non-nil if the buffer was "modified" when the window
+ /* True if the buffer was "modified" when the window
was last updated. */
- unsigned last_had_star : 1;
+ bool_bf last_had_star : 1;
- /* Non-zero means current value of `start'
+ /* True means current value of `start'
was the beginning of a line when it was chosen. */
- unsigned start_at_line_beg : 1;
+ bool_bf start_at_line_beg : 1;
- /* Non-zero means next redisplay must use the value of start
+ /* True means next redisplay must use the value of start
set up for it in advance. Set by scrolling commands. */
- unsigned force_start : 1;
+ bool_bf force_start : 1;
- /* Non-zero means we have explicitly changed the value of start,
+ /* True means we have explicitly changed the value of start,
but that the next redisplay is not obliged to use the new value.
This is used in Fdelete_other_windows to force a call to
Vwindow_scroll_functions; also by Frecenter with argument. */
- unsigned optional_new_start : 1;
+ bool_bf optional_new_start : 1;
- /* Non-zero means the cursor is currently displayed. This can be
+ /* True means the cursor is currently displayed. This can be
set to zero by functions overpainting the cursor image. */
- unsigned phys_cursor_on_p : 1;
+ bool_bf phys_cursor_on_p : 1;
- /* 0 means cursor is logically on, 1 means it's off. Used for
+ /* False means cursor is logically on, true means it's off. Used for
blinking cursor. */
- unsigned cursor_off_p : 1;
+ bool_bf cursor_off_p : 1;
/* Value of cursor_off_p as of the last redisplay. */
- unsigned last_cursor_off_p : 1;
+ bool_bf last_cursor_off_p : 1;
- /* 1 means desired matrix has been build and window must be
+ /* True means desired matrix has been build and window must be
updated in update_frame. */
- unsigned must_be_updated_p : 1;
+ bool_bf must_be_updated_p : 1;
/* Flag indicating that this window is not a real one.
Currently only used for menu bar windows of frames. */
- unsigned pseudo_window_p : 1;
+ bool_bf pseudo_window_p : 1;
- /* Non-zero means fringes are drawn outside display margins.
+ /* True means fringes are drawn outside display margins.
Otherwise draw them between margin areas and text. */
- unsigned fringes_outside_margins : 1;
+ bool_bf fringes_outside_margins : 1;
- /* Nonzero if window_end_pos and window_end_vpos are truly valid.
- This is zero if nontrivial redisplay is preempted since in that case
+ /* True if window_end_pos and window_end_vpos are truly valid.
+ This is false if nontrivial redisplay is preempted since in that case
the frame image that window_end_pos did not get onto the frame. */
- unsigned window_end_valid : 1;
+ bool_bf window_end_valid : 1;
/* True if it needs to be redisplayed. */
- unsigned redisplay : 1;
+ bool_bf redisplay : 1;
/* Amount by which lines of this window are scrolled in
y-direction (smooth scrolling). */
int vscroll;
/* Z_BYTE - buffer position of the last glyph in the current matrix of W.
- Should be nonnegative, and only valid if window_end_valid is nonzero. */
+ Should be nonnegative, and only valid if window_end_valid is true. */
ptrdiff_t window_end_bytepos;
};
@@ -412,7 +412,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
w->next_buffers = val;
}
-/* 1 if W is a minibuffer window. */
+/* True if W is a minibuffer window. */
#define MINI_WINDOW_P(W) ((W)->mini)
@@ -443,17 +443,17 @@ wset_next_buffers (struct window *w, Lisp_Object val)
/* A handy macro. */
-/* Non-zero if W is leaf (carry the buffer). */
+/* Non-nil if W is leaf (carry the buffer). */
#define WINDOW_LEAF_P(W) \
(BUFFERP ((W)->contents))
-/* Non-zero if W is a member of horizontal combination. */
+/* True if W is a member of horizontal combination. */
#define WINDOW_HORIZONTAL_COMBINATION_P(W) \
(WINDOWP ((W)->contents) && (W)->horizontal)
-/* Non-zero if W is a member of vertical combination. */
+/* True if W is a member of vertical combination. */
#define WINDOW_VERTICAL_COMBINATION_P(W) \
(WINDOWP ((W)->contents) && !(W)->horizontal)
@@ -563,7 +563,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
(FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
+ WINDOW_RIGHT_PIXEL_EDGE (W))
-/* 1 if W is a menu bar window. */
+/* True if W is a menu bar window. */
#if defined (HAVE_X_WINDOWS) && ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
#define WINDOW_MENU_BAR_P(W) \
@@ -571,16 +571,16 @@ wset_next_buffers (struct window *w, Lisp_Object val)
&& (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window))
#else
/* No menu bar windows if X toolkit is in use. */
-#define WINDOW_MENU_BAR_P(W) (0)
+#define WINDOW_MENU_BAR_P(W) false
#endif
-/* 1 if W is a tool bar window. */
+/* True if W is a tool bar window. */
#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
#define WINDOW_TOOL_BAR_P(W) \
(WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
&& (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
#else
-#define WINDOW_TOOL_BAR_P(W) (0)
+#define WINDOW_TOOL_BAR_P(W) false
#endif
/* Return the frame y-position at which window W starts.
@@ -600,24 +600,24 @@ wset_next_buffers (struct window *w, Lisp_Object val)
? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
+ WINDOW_BOTTOM_PIXEL_EDGE (W))
-/* 1 if window W takes up the full width of its frame. */
+/* True if window W takes up the full width of its frame. */
#define WINDOW_FULL_WIDTH_P(W) \
(WINDOW_PIXEL_WIDTH (W) \
== (WINDOW_PIXEL_WIDTH \
(XWINDOW (FRAME_ROOT_WINDOW (WINDOW_XFRAME (W)))))) \
-/* 1 if window W's has no other windows to its left in its frame. */
+/* True if window W's has no other windows to its left in its frame. */
#define WINDOW_LEFTMOST_P(W) \
(WINDOW_LEFT_PIXEL_EDGE (W) == 0)
-/* 1 if window W's has no other windows to its right in its frame. */
+/* True if window W's has no other windows to its right in its frame. */
#define WINDOW_RIGHTMOST_P(W) \
(WINDOW_RIGHT_PIXEL_EDGE (W) \
== (WINDOW_RIGHT_PIXEL_EDGE \
(XWINDOW (FRAME_ROOT_WINDOW (WINDOW_XFRAME (W)))))) \
-/* 1 if window W's has no other windows below it in its frame
+/* True if window W's has no other windows below it in its frame
(the minibuffer window is not counted in this respect). */
#define WINDOW_BOTTOMMOST_P(W) \
(WINDOW_BOTTOM_PIXEL_EDGE (W) \
@@ -882,7 +882,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
#define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
(window_box_left ((W), TEXT_AREA) + (X))
-/* Nonzero if the background of the window W's fringe that is adjacent to
+/* True if the background of the window W's fringe that is adjacent to
a scroll bar is extended to the gap between the fringe and the bar. */
#define WINDOW_FRINGE_EXTENDED_P(w) \
diff --git a/src/xdisp.c b/src/xdisp.c
index 3974810908a..97fa0ce5fe7 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -984,7 +984,7 @@ static void append_stretch_glyph (struct it *, Lisp_Object,
static void produce_special_glyphs (struct it *, enum display_element_type);
static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face);
-static int coords_in_mouse_face_p (struct window *, int, int);
+static bool coords_in_mouse_face_p (struct window *, int, int);
@@ -9469,9 +9469,9 @@ move_it_by_lines (struct it *it, ptrdiff_t dvpos)
}
}
-/* Return 1 if IT points into the middle of a display vector. */
+/* Return true if IT points into the middle of a display vector. */
-int
+bool
in_display_vector_p (struct it *it)
{
return (it->method == GET_FROM_DISPLAY_VECTOR
@@ -11939,7 +11939,7 @@ display_tool_bar_line (struct it *it, int height)
/* Don't extend on a previously drawn tool bar items (Bug#16058). */
clear_glyph_row (row);
- row->enabled_p = 1;
+ row->enabled_p = true;
row->y = it->current_y;
/* Note that this isn't made use of if the face hasn't a box,
@@ -12771,7 +12771,7 @@ static ptrdiff_t debug_delta, debug_delta_bytes;
static ptrdiff_t debug_end_vpos;
/* Append a string to W->desired_matrix->method. FMT is a printf
- format string. If trace_redisplay_p is non-zero also printf the
+ format string. If trace_redisplay_p is true also printf the
resulting string to stderr. */
static void debug_method_add (struct window *, char const *, ...)
@@ -13556,7 +13556,7 @@ redisplay_internal (void)
cancel:
/* Text changed drastically or point moved off of line. */
- SET_MATRIX_ROW_ENABLED_P (w->desired_matrix, this_line_vpos, 0);
+ SET_MATRIX_ROW_ENABLED_P (w->desired_matrix, this_line_vpos, false);
}
CHARPOS (this_line_start_pos) = 0;
@@ -16742,7 +16742,7 @@ try_window_reusing_current_matrix (struct window *w)
/* Disable lines that must be updated. */
for (i = 0; i < nrows_scrolled; ++i)
- (start_row + i)->enabled_p = 0;
+ (start_row + i)->enabled_p = false;
/* Re-compute Y positions. */
min_y = WINDOW_HEADER_LINE_HEIGHT (w);
@@ -16922,7 +16922,7 @@ try_window_reusing_current_matrix (struct window *w)
/* Disable rows not reused. */
for (row -= nrows_scrolled; row < bottom_row; ++row)
- row->enabled_p = 0;
+ row->enabled_p = false;
/* Point may have moved to a different line, so we cannot assume that
the previous cursor position is valid; locate the correct row. */
@@ -17207,7 +17207,7 @@ sync_frame_with_window_matrix_rows (struct window *w)
/* Disable frame rows whose corresponding window rows have
been disabled in try_window_id. */
if (!window_row->enabled_p)
- frame_row->enabled_p = 0;
+ frame_row->enabled_p = false;
++window_row, ++frame_row;
}
@@ -17950,7 +17950,7 @@ try_window_id (struct window *w)
the current matrix? I don't think so, so we mark rows
displayed invalid in the current matrix by setting their
enabled_p flag to zero. */
- MATRIX_ROW (w->current_matrix, it.vpos)->enabled_p = 0;
+ SET_MATRIX_ROW_ENABLED_P (w->current_matrix, it.vpos, false);
if (display_line (&it))
last_text_row_at_end = it.glyph_row - 1;
}
@@ -20773,7 +20773,7 @@ display_menu_bar (struct window *w)
{
struct glyph_row *row = it.glyph_row + i;
clear_glyph_row (row);
- row->enabled_p = 1;
+ row->enabled_p = true;
row->full_width_p = 1;
}
@@ -20883,7 +20883,7 @@ display_tty_menu_item (const char *item_text, int width, int face_id,
row->full_width_p = 1;
saved_reversed = row->reversed_p;
row->reversed_p = 0;
- row->enabled_p = 1;
+ row->enabled_p = true;
/* Arrange for the menu item glyphs to start at (X,Y) and have the
desired face. */
@@ -21049,7 +21049,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
init_iterator (&it, w, -1, -1, NULL, face_id);
/* Don't extend on a previously drawn mode-line.
This may happen if called from pos_visible_p. */
- it.glyph_row->enabled_p = 0;
+ it.glyph_row->enabled_p = false;
prepare_desired_row (it.glyph_row);
it.glyph_row->mode_line_p = 1;
@@ -27088,9 +27088,9 @@ clear_mouse_face (Mouse_HLInfo *hlinfo)
return cleared;
}
-/* Return non-zero if the coordinates HPOS and VPOS on windows W are
+/* Return true if the coordinates HPOS and VPOS on windows W are
within the mouse face on that window. */
-static int
+static bool
coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
{
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
@@ -27098,48 +27098,48 @@ coords_in_mouse_face_p (struct window *w, int hpos, int vpos)
/* Quickly resolve the easy cases. */
if (!(WINDOWP (hlinfo->mouse_face_window)
&& XWINDOW (hlinfo->mouse_face_window) == w))
- return 0;
+ return false;
if (vpos < hlinfo->mouse_face_beg_row
|| vpos > hlinfo->mouse_face_end_row)
- return 0;
+ return false;
if (vpos > hlinfo->mouse_face_beg_row
&& vpos < hlinfo->mouse_face_end_row)
- return 1;
+ return true;
if (!MATRIX_ROW (w->current_matrix, vpos)->reversed_p)
{
if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
{
if (hlinfo->mouse_face_beg_col <= hpos && hpos < hlinfo->mouse_face_end_col)
- return 1;
+ return true;
}
else if ((vpos == hlinfo->mouse_face_beg_row
&& hpos >= hlinfo->mouse_face_beg_col)
|| (vpos == hlinfo->mouse_face_end_row
&& hpos < hlinfo->mouse_face_end_col))
- return 1;
+ return true;
}
else
{
if (hlinfo->mouse_face_beg_row == hlinfo->mouse_face_end_row)
{
if (hlinfo->mouse_face_end_col < hpos && hpos <= hlinfo->mouse_face_beg_col)
- return 1;
+ return true;
}
else if ((vpos == hlinfo->mouse_face_beg_row
&& hpos <= hlinfo->mouse_face_beg_col)
|| (vpos == hlinfo->mouse_face_end_row
&& hpos > hlinfo->mouse_face_end_col))
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* EXPORT:
- Non-zero if physical cursor of window W is within mouse face. */
+ True if physical cursor of window W is within mouse face. */
-int
+bool
cursor_in_mouse_face_p (struct window *w)
{
int hpos = w->phys_cursor.hpos;
diff --git a/src/xmenu.c b/src/xmenu.c
index fb3baa01ef4..216772edcd8 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1647,7 +1647,7 @@ xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
#endif
wv_title->name = SSDATA (title);
- wv_title->enabled = TRUE;
+ wv_title->enabled = true;
wv_title->button_type = BUTTON_TYPE_NONE;
wv_title->help = Qnil;
wv_title->next = wv_sep1;
diff --git a/src/xterm.c b/src/xterm.c
index 8498382511b..20157acca2e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -133,9 +133,9 @@ extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
/* Default to using XIM if available. */
#ifdef USE_XIM
-int use_xim = 1;
+bool use_xim = true;
#else
-int use_xim = 0; /* configure --without-xim */
+bool use_xim = false; /* configure --without-xim */
#endif
/* Non-zero means that a HELP_EVENT has been generated since Emacs
@@ -6172,7 +6172,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
#ifdef USE_GTK
/* Don't pass keys to GTK. A Tab will shift focus to the
tool bar in GTK 2.4. Keys will still go to menus and
- dialogs because in that case popup_activated is TRUE
+ dialogs because in that case popup_activated is nonzero
(see above). */
*finish = X_EVENT_DROP;
#endif
@@ -10092,12 +10092,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "false")
|| !strcmp (SSDATA (value), "off")))
- use_xim = 0;
+ use_xim = false;
#else
if (STRINGP (value)
&& (!strcmp (SSDATA (value), "true")
|| !strcmp (SSDATA (value), "on")))
- use_xim = 1;
+ use_xim = true;
#endif
}
diff --git a/src/xterm.h b/src/xterm.h
index eff75403476..e79eecadc34 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -50,7 +50,7 @@ typedef GtkWidget *xt_or_gtk_widget;
#define XtParent(x) (gtk_widget_get_parent (x))
#undef XSync
#define XSync(d, b) do { gdk_window_process_all_updates (); \
- XSync (d, b); } while (0)
+ XSync (d, b); } while (false)
#endif /* USE_GTK */
/* True iff GTK's version is at least I.J.K. */
@@ -62,7 +62,7 @@ typedef GtkWidget *xt_or_gtk_widget;
< GTK_MINOR_VERSION + ((k) \
<= GTK_MICRO_VERSION)))
# else
-# define GTK_CHECK_VERSION(i, j, k) 0
+# define GTK_CHECK_VERSION(i, j, k) false
# endif
#endif
@@ -115,7 +115,7 @@ struct xim_inst_t
struct x_bitmap_record
{
Pixmap pixmap;
- int have_mask;
+ bool have_mask;
Pixmap mask;
char *file;
int refcount;
@@ -400,7 +400,7 @@ struct x_display_info
#ifdef HAVE_X_I18N
/* Whether or not to use XIM if we have it. */
-extern int use_xim;
+extern bool use_xim;
#endif
/* This is a chain of structures for all the X displays currently in use. */
@@ -488,9 +488,9 @@ struct x_output
/* The handle box that makes the tool bar detachable. */
GtkWidget *handlebox_widget;
#endif
- /* Non-zero if tool bar is packed into the hbox widget (i.e. vertical). */
- bool toolbar_in_hbox;
- bool toolbar_is_packed;
+ /* True if tool bar is packed into the hbox widget (i.e. vertical). */
+ bool_bf toolbar_in_hbox : 1;
+ bool_bf toolbar_is_packed : 1;
/* The last size hints set. */
GdkGeometry size_hints;
@@ -551,9 +551,6 @@ struct x_output
mapped to display an hourglass cursor. */
Window hourglass_window;
- /* Non-zero means hourglass cursor is currently displayed. */
- unsigned hourglass_p : 1;
-
/* These are the current window manager hints. It seems that
XSetWMHints, when presented with an unset bit in the `flags'
member of the hints structure, does not leave the corresponding
@@ -579,15 +576,28 @@ struct x_output
int id;
#endif
- /* Nonzero means our parent is another application's window
+ /* True means hourglass cursor is currently displayed. */
+ bool_bf hourglass_p : 1;
+
+ /* True means our parent is another application's window
and was explicitly specified. */
- unsigned explicit_parent : 1;
+ bool_bf explicit_parent : 1;
+
+ /* True means tried already to make this frame visible. */
+ bool_bf asked_for_visible : 1;
+
+ /* True if this frame was ever previously visible. */
+ bool_bf has_been_visible : 1;
- /* Nonzero means tried already to make this frame visible. */
- unsigned asked_for_visible : 1;
+ /* Xt waits for a ConfigureNotify event from the window manager in
+ EmacsFrameSetCharSize when the shell widget is resized. For some
+ window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
+ arrive for an unknown reason and Emacs hangs in Xt. If this is
+ false, tell Xt not to wait. */
+ bool_bf wait_for_wm : 1;
- /* Nonzero if this frame was ever previously visible. */
- unsigned has_been_visible : 1;
+ /* True if _NET_WM_STATE_HIDDEN is set for this frame. */
+ bool_bf net_wm_state_hidden_seen : 1;
#ifdef HAVE_X_I18N
/* Input context (currently, this means Compose key handler setup). */
@@ -608,13 +618,6 @@ struct x_output
They are changed only when a different background is involved. */
unsigned long relief_background;
- /* Xt waits for a ConfigureNotify event from the window manager in
- EmacsFrameSetCharSize when the shell widget is resized. For some
- window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
- arrive for an unknown reason and Emacs hangs in Xt. If this is
- zero, tell Xt not to wait. */
- int wait_for_wm;
-
/* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the
two might differ by a pixel, depending on WM */
int x_pixels_outer_diff;
@@ -632,9 +635,6 @@ struct x_output
/* The offset we need to add to compensate for type A WMs. */
int move_offset_top;
int move_offset_left;
-
- /* Non-zero if _NET_WM_STATE_HIDDEN is set for this frame. */
- unsigned net_wm_state_hidden_seen : 1;
};
#define No_Cursor (None)
@@ -827,7 +827,7 @@ struct scroll_bar
do { \
Window window = XtWindow (w); \
ptr->x_window = window; \
-} while (0)
+ } while (false)
#endif /* USE_X_TOOLKIT */