aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.h
diff options
context:
space:
mode:
authorPaul Eggert2013-12-14 13:36:44 -0800
committerPaul Eggert2013-12-14 13:36:44 -0800
commit96c0686368d8b7d481cb40239db896ff37df416a (patch)
tree84d8ee02271476dd4aaaee52c5302f2c576089ef /src/character.h
parent5ae811ddef14ea1989088c259a9ed2d14d5332b4 (diff)
downloademacs-96c0686368d8b7d481cb40239db896ff37df416a.tar.gz
emacs-96c0686368d8b7d481cb40239db896ff37df416a.zip
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/character.h')
-rw-r--r--src/character.h36
1 files changed, 18 insertions, 18 deletions
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
91 do { \ 91 do { \
92 if (! ASCII_CHAR_P (c)) \ 92 if (! ASCII_CHAR_P (c)) \
93 c = CHAR_TO_BYTE8 (c); \ 93 c = CHAR_TO_BYTE8 (c); \
94 } while (0) 94 } while (false)
95 95
96 96
97/* If C is not ASCII, make it multibyte. Assumes C < 256. */ 97/* If C is not ASCII, make it multibyte. Assumes C < 256. */
@@ -123,14 +123,14 @@ INLINE_HEADER_BEGIN
123 Lisp_Object tmp = XCAR (x); \ 123 Lisp_Object tmp = XCAR (x); \
124 CHECK_CHARACTER (tmp); \ 124 CHECK_CHARACTER (tmp); \
125 XSETCAR ((x), tmp); \ 125 XSETCAR ((x), tmp); \
126 } while (0) 126 } while (false)
127 127
128#define CHECK_CHARACTER_CDR(x) \ 128#define CHECK_CHARACTER_CDR(x) \
129 do { \ 129 do { \
130 Lisp_Object tmp = XCDR (x); \ 130 Lisp_Object tmp = XCDR (x); \
131 CHECK_CHARACTER (tmp); \ 131 CHECK_CHARACTER (tmp); \
132 XSETCDR ((x), tmp); \ 132 XSETCDR ((x), tmp); \
133 } while (0) 133 } while (false)
134 134
135/* Nonzero iff C is a character of code less than 0x100. */ 135/* Nonzero iff C is a character of code less than 0x100. */
136#define SINGLE_BYTE_CHAR_P(c) UNSIGNED_CMP (c, <, 0x100) 136#define SINGLE_BYTE_CHAR_P(c) UNSIGNED_CMP (c, <, 0x100)
@@ -209,7 +209,7 @@ INLINE_HEADER_BEGIN
209 verify (sizeof (c) <= sizeof (unsigned)); \ 209 verify (sizeof (c) <= sizeof (unsigned)); \
210 (p) += char_string (c, p); \ 210 (p) += char_string (c, p); \
211 } \ 211 } \
212 } while (0) 212 } while (false)
213 213
214 214
215/* Nonzero iff BYTE starts a non-ASCII character in a multibyte 215/* Nonzero iff BYTE starts a non-ASCII character in a multibyte
@@ -274,7 +274,7 @@ INLINE_HEADER_BEGIN
274 do { \ 274 do { \
275 if ((p) < (limit)) \ 275 if ((p) < (limit)) \
276 (p) += BYTES_BY_CHAR_HEAD (*(p)); \ 276 (p) += BYTES_BY_CHAR_HEAD (*(p)); \
277 } while (0) 277 } while (false)
278 278
279 279
280/* If P is after LIMIT, advance P to the previous character boundary. 280/* If P is after LIMIT, advance P to the previous character boundary.
@@ -291,7 +291,7 @@ INLINE_HEADER_BEGIN
291 } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \ 291 } while (chp >= limit && ! CHAR_HEAD_P (*chp)); \
292 (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \ 292 (p) = (BYTES_BY_CHAR_HEAD (*chp) == (p) - chp) ? chp : (p) - 1; \
293 } \ 293 } \
294 } while (0) 294 } while (false)
295 295
296/* Return the character code of character whose multibyte form is at 296/* Return the character code of character whose multibyte form is at
297 P. Note that this macro unifies CJK characters whose codepoints 297 P. Note that this macro unifies CJK characters whose codepoints
@@ -382,7 +382,7 @@ INLINE_HEADER_BEGIN
382 BYTEIDX++; \ 382 BYTEIDX++; \
383 } \ 383 } \
384 } \ 384 } \
385 while (0) 385 while (false)
386 386
387/* Like FETCH_STRING_CHAR_ADVANCE, but return a multibyte character 387/* Like FETCH_STRING_CHAR_ADVANCE, but return a multibyte character
388 even if STRING is unibyte. */ 388 even if STRING is unibyte. */
@@ -406,7 +406,7 @@ INLINE_HEADER_BEGIN
406 MAKE_CHAR_MULTIBYTE (OUTPUT); \ 406 MAKE_CHAR_MULTIBYTE (OUTPUT); \
407 } \ 407 } \
408 } \ 408 } \
409 while (0) 409 while (false)
410 410
411 411
412/* Like FETCH_STRING_CHAR_ADVANCE, but assumes STRING is multibyte. */ 412/* Like FETCH_STRING_CHAR_ADVANCE, but assumes STRING is multibyte. */
@@ -421,7 +421,7 @@ INLINE_HEADER_BEGIN
421 BYTEIDX += fetch_len; \ 421 BYTEIDX += fetch_len; \
422 CHARIDX++; \ 422 CHARIDX++; \
423 } \ 423 } \
424 while (0) 424 while (false)
425 425
426 426
427/* Like FETCH_STRING_CHAR_ADVANCE, but fetch character from the current 427/* Like FETCH_STRING_CHAR_ADVANCE, but fetch character from the current
@@ -445,7 +445,7 @@ INLINE_HEADER_BEGIN
445 BYTEIDX++; \ 445 BYTEIDX++; \
446 } \ 446 } \
447 } \ 447 } \
448 while (0) 448 while (false)
449 449
450 450
451/* Like FETCH_CHAR_ADVANCE, but assumes the current buffer is multibyte. */ 451/* Like FETCH_CHAR_ADVANCE, but assumes the current buffer is multibyte. */
@@ -460,7 +460,7 @@ INLINE_HEADER_BEGIN
460 BYTEIDX += chlen; \ 460 BYTEIDX += chlen; \
461 CHARIDX++; \ 461 CHARIDX++; \
462 } \ 462 } \
463 while (0) 463 while (false)
464 464
465 465
466/* Increment the buffer byte position POS_BYTE of the current buffer to 466/* Increment the buffer byte position POS_BYTE of the current buffer to
@@ -470,7 +470,7 @@ INLINE_HEADER_BEGIN
470 do { \ 470 do { \
471 unsigned char *chp = BYTE_POS_ADDR (pos_byte); \ 471 unsigned char *chp = BYTE_POS_ADDR (pos_byte); \
472 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ 472 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
473 } while (0) 473 } while (false)
474 474
475 475
476/* Decrement the buffer byte position POS_BYTE of the current buffer to 476/* Decrement the buffer byte position POS_BYTE of the current buffer to
@@ -490,7 +490,7 @@ INLINE_HEADER_BEGIN
490 chp--; \ 490 chp--; \
491 pos_byte--; \ 491 pos_byte--; \
492 } \ 492 } \
493 } while (0) 493 } while (false)
494 494
495/* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */ 495/* Increment both CHARPOS and BYTEPOS, each in the appropriate way. */
496 496
@@ -503,7 +503,7 @@ INLINE_HEADER_BEGIN
503 else \ 503 else \
504 INC_POS ((bytepos)); \ 504 INC_POS ((bytepos)); \
505 } \ 505 } \
506 while (0) 506 while (false)
507 507
508 508
509/* Decrement both CHARPOS and BYTEPOS, each in the appropriate way. */ 509/* Decrement both CHARPOS and BYTEPOS, each in the appropriate way. */
@@ -517,7 +517,7 @@ INLINE_HEADER_BEGIN
517 else \ 517 else \
518 DEC_POS ((bytepos)); \ 518 DEC_POS ((bytepos)); \
519 } \ 519 } \
520 while (0) 520 while (false)
521 521
522 522
523/* Increment the buffer byte position POS_BYTE of the current buffer to 523/* Increment the buffer byte position POS_BYTE of the current buffer to
@@ -529,7 +529,7 @@ INLINE_HEADER_BEGIN
529 do { \ 529 do { \
530 unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \ 530 unsigned char *chp = BUF_BYTE_ADDRESS (buf, pos_byte); \
531 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \ 531 pos_byte += BYTES_BY_CHAR_HEAD (*chp); \
532 } while (0) 532 } while (false)
533 533
534 534
535/* Decrement the buffer byte position POS_BYTE of the current buffer to 535/* Decrement the buffer byte position POS_BYTE of the current buffer to
@@ -548,7 +548,7 @@ INLINE_HEADER_BEGIN
548 chp--; \ 548 chp--; \
549 pos_byte--; \ 549 pos_byte--; \
550 } \ 550 } \
551 } while (0) 551 } while (false)
552 552
553 553
554/* Return a non-outlandish value for the tab width. */ 554/* Return a non-outlandish value for the tab width. */
@@ -602,7 +602,7 @@ sanitize_char_width (EMACS_INT width)
602 : 0) 602 : 0)
603 603
604/* If C is a high surrogate, return 1. If C is a low surrogate, 604/* If C is a high surrogate, return 1. If C is a low surrogate,
605 return 0. Otherwise, return 0. */ 605 return 2. Otherwise, return 0. */
606 606
607#define CHAR_SURROGATE_PAIR_P(c) \ 607#define CHAR_SURROGATE_PAIR_P(c) \
608 ((c) < 0xD800 ? 0 \ 608 ((c) < 0xD800 ? 0 \