Commit 96c06863 authored by Paul Eggert's avatar Paul Eggert

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.
parent 5ae811dd
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
2013-12-14 Dani Moncayo <dmoncayo@gmail.com>
* configure.ac (srcdir) [MINGW32]: Convert to an absolute MSYS
......
......@@ -4067,7 +4067,7 @@ case $opsys in
cygwin )
AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
dnl multi-line AC_DEFINEs are hard. :(
AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)])
AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
......@@ -4080,7 +4080,7 @@ case $opsys in
dnl Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
dnl But we don't have to block SIGCHLD because it is blocked in the
dnl implementation of grantpt.
AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)])
AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
......@@ -4099,7 +4099,7 @@ case $opsys in
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
dnl if HAVE_POSIX_OPENPT
if test "x$ac_cv_func_posix_openpt" = xyes; then
AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (0)])
AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
dnl if HAVE_GETPT
elif test "x$ac_cv_func_getpt" = xyes; then
......@@ -4232,7 +4232,7 @@ case $opsys in
# error "not ia64"
#endif
]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
[do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)],
[do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (false)],
[Mark a secondary stack, like the register stack on the ia64.]), [])
;;
......
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* emacsclient.c, etags.c, hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* emacsclient.c (message):
* etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* hexl.c (un_flag, iso_flag, endian):
* pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* etags.c (bool): Remove.
* 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.
* pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* ebrowse.c (xstrdup):
......
This diff is collapsed.
This diff is collapsed.
......@@ -37,12 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define DEFAULT_GROUPING 0x01
#define DEFAULT_BASE 16
#undef TRUE
#undef FALSE
#define TRUE (1)
#define FALSE (0)
int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
int base = DEFAULT_BASE;
bool un_flag = false, iso_flag = false, endian = true;
int group_by = DEFAULT_GROUPING;
char *progname;
......@@ -83,7 +79,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de"))
{
un_flag = TRUE;
un_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-hex"))
......@@ -93,7 +89,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-iso"))
{
iso_flag = TRUE;
iso_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-oct"))
......@@ -103,12 +99,12 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-big-endian"))
{
endian = 1;
endian = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-little-endian"))
{
endian = 0;
endian = false;
--argc; argv++;
}
else if (!strcmp (*argv, "-group-by-8-bits"))
......@@ -129,7 +125,7 @@ main (int argc, char **argv)
else if (!strcmp (*argv, "-group-by-64-bits"))
{
group_by = 0x07;
endian = 0;
endian = false;
--argc; argv++;
}
else
......
......@@ -124,7 +124,7 @@ static char *find_crlf (char *, int);
#endif
char pop_error[ERROR_MAX];
int pop_debug = 0;
bool pop_debug = false;
/*
* Function: pop_open (char *host, char *username, char *password,
......@@ -269,8 +269,8 @@ pop_open (char *host, char *username, char *password, int flags)
server->data = 0;
server->buffer_index = 0;
server->buffer_size = GETLINE_MIN;
server->in_multi = 0;
server->trash_started = 0;
server->in_multi = false;
server->trash_started = false;
if (getok (server))
return (0);
......@@ -686,7 +686,7 @@ pop_multi_first (popserver server, const char *command, char **response)
else if (0 == strncmp (*response, "+OK", 3))
{
for (*response += 3; **response == ' '; (*response)++) /* empty */;
server->in_multi = 1;
server->in_multi = true;
return (0);
}
else
......@@ -728,7 +728,7 @@ pop_multi_next (popserver server, char **line)
if (! fromserver[1])
{
*line = 0;
server->in_multi = 0;
server->in_multi = false;
return (0);
}
else
......@@ -1546,7 +1546,7 @@ pop_trash (popserver server)
/* avoid recursion; sendline can call pop_trash */
if (server->trash_started)
return;
server->trash_started = 1;
server->trash_started = true;
sendline (server, "RSET");
sendline (server, "QUIT");
......
......@@ -27,15 +27,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* size when it needs to grow */
extern char pop_error[];
extern int pop_debug;
extern bool pop_debug;
struct _popserver
{
int file, data;
char *buffer;
int buffer_size, buffer_index;
int in_multi;
int trash_started;
bool_bf in_multi : 1;
bool_bf trash_started : 1;
};
typedef struct _popserver *popserver;
......@@ -73,4 +73,3 @@ extern int pop_last (popserver server);
extern int pop_reset (popserver server);
extern int pop_quit (popserver server);
extern void pop_close (popserver);
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* lwlib.c (safe_strdup): Prefer tail calls.
......
......@@ -83,8 +83,8 @@ typedef struct _XlwMenu_part
int horizontal;
/* True means top_shadow_color and/or bottom_shadow_color must be freed. */
unsigned free_top_shadow_color_p : 1;
unsigned free_bottom_shadow_color_p : 1;
bool_bf free_top_shadow_color_p : 1;
bool_bf free_bottom_shadow_color_p : 1;
/* State of the XlwMenu */
int top_depth;
......
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
......
......@@ -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. */
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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 */
......@@ -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,