summaryrefslogtreecommitdiff
path: root/src/indent.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-09-24 14:38:23 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-09-24 14:38:23 -0700
commit578098f346bf9e1f23ca86ed764fc00b035b427f (patch)
tree19d59f89e4a3dfcab6b7a054d6d8522ca686fe06 /src/indent.c
parent9a48e1689182ec87974c04429ca82f5015d6f5e2 (diff)
downloademacs-578098f346bf9e1f23ca86ed764fc00b035b427f.tar.gz
image.c, indent.c: Use bool for booleans.
* dispextern.h (struct image_type): Members valid_p, load, init now return bool, not int. All uses changed. * image.c: Omit unnecessary static decls. (x_create_bitmap_mask, x_build_heuristic_mask): Return void, not int, since callers don't care about the return value. (x_create_bitmap_mask, define_image_type, valid_image_p) (struct image_keyword, parse_image_spec, image_spec_value) (check_image_size, image_background) (image_background_transparent, x_clear_image_1) (postprocess_image, lookup_image, x_check_image_size) (x_create_x_image_and_pixmap, xbm_image_p) (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data) (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color) (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p) (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color) (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load) (png_image_p, init_png_functions, png_load_body, png_load) (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load) (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p) (init_gif_functions, gif_load, imagemagick_image_p) (imagemagick_load_image, imagemagick_load, svg_image_p) (init_svg_functions, svg_load, svg_load_image, gs_image_p) (gs_load): * nsimage.m (ns_load_image): * nsterm.m (ns_defined_color): * xfaces.c (tty_lookup_color, tty_defined_color, defined_color): * xfns.c (x_defined_color): * xterm.c (x_alloc_lighter_color_for_widget) (x_alloc_nearest_color_1, x_alloc_nearest_color) (x_alloc_lighter_color): * indent.c (disptab_matches_widthtab, current_column) (scan_for_column, string_display_width, indented_beyond_p) (compute_motion, vmotion, Fvertical_motion): Use bool for booleans.
Diffstat (limited to 'src/indent.c')
-rw-r--r--src/indent.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/src/indent.c b/src/indent.c
index 053643e6319..b368a7aeb09 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -115,7 +115,7 @@ character_width (int c, struct Lisp_Char_Table *dp)
for characters as WIDTHTAB. We use this to decide when to
invalidate the buffer's width_run_cache. */
-int
+bool
disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab)
{
int i;
@@ -320,14 +320,14 @@ invalidate_current_column (void)
ptrdiff_t
current_column (void)
{
- register ptrdiff_t col;
- register unsigned char *ptr, *stop;
- register int tab_seen;
+ ptrdiff_t col;
+ unsigned char *ptr, *stop;
+ bool tab_seen;
ptrdiff_t post_tab;
- register int c;
+ int c;
int tab_width = SANE_TAB_WIDTH (current_buffer);
- int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
- register struct Lisp_Char_Table *dp = buffer_display_table ();
+ bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
+ struct Lisp_Char_Table *dp = buffer_display_table ();
if (PT == last_known_column_point
&& MODIFF == last_known_column_modified)
@@ -512,9 +512,9 @@ static void
scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
{
int tab_width = SANE_TAB_WIDTH (current_buffer);
- register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
- register struct Lisp_Char_Table *dp = buffer_display_table ();
- int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
+ struct Lisp_Char_Table *dp = buffer_display_table ();
+ bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
struct composition_it cmp_it;
Lisp_Object window;
struct window *w;
@@ -722,14 +722,14 @@ current_column_1 (void)
static double
string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
{
- register int col;
- register unsigned char *ptr, *stop;
- register int tab_seen;
+ int col;
+ unsigned char *ptr, *stop;
+ bool tab_seen;
int post_tab;
- register int c;
+ int c;
int tab_width = SANE_TAB_WIDTH (current_buffer);
- int ctl_arrow = !NILP (current_buffer->ctl_arrow);
- register struct Lisp_Char_Table *dp = buffer_display_table ();
+ bool ctl_arrow = !NILP (current_buffer->ctl_arrow);
+ struct Lisp_Char_Table *dp = buffer_display_table ();
int b, e;
if (NILP (end))
@@ -945,7 +945,7 @@ position_indentation (ptrdiff_t pos_byte)
Blank lines are treated as if they had the same indentation as the
preceding line. */
-int
+bool
indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column)
{
ptrdiff_t val;
@@ -1047,11 +1047,11 @@ static struct position val_compute_motion;
can't hit the requested column exactly (because of a tab or other
multi-column character), overshoot.
- DID_MOTION is 1 if FROMHPOS has already accounted for overlay strings
+ DID_MOTION is true if FROMHPOS has already accounted for overlay strings
at FROM. This is the case if FROMVPOS and FROMVPOS came from an
earlier call to compute_motion. The other common case is that FROMHPOS
is zero and FROM is a position that "belongs" at column zero, but might
- be shifted by overlay strings; in this case DID_MOTION should be 0.
+ be shifted by overlay strings; in this case DID_MOTION should be false.
WIDTH is the number of columns available to display text;
compute_motion uses this to handle continuation lines and such.
@@ -1104,17 +1104,20 @@ static struct position val_compute_motion;
the scroll bars if they are turned on. */
struct position *
-compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, ptrdiff_t to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, ptrdiff_t hscroll, int tab_offset, struct window *win)
+compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
+ bool did_motion, ptrdiff_t to,
+ EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width,
+ ptrdiff_t hscroll, int tab_offset, struct window *win)
{
- register EMACS_INT hpos = fromhpos;
- register EMACS_INT vpos = fromvpos;
+ EMACS_INT hpos = fromhpos;
+ EMACS_INT vpos = fromvpos;
- register ptrdiff_t pos;
+ ptrdiff_t pos;
ptrdiff_t pos_byte;
- register int c = 0;
+ int c = 0;
int tab_width = SANE_TAB_WIDTH (current_buffer);
- register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
- register struct Lisp_Char_Table *dp = window_display_table (win);
+ bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
+ struct Lisp_Char_Table *dp = window_display_table (win);
EMACS_INT selective
= (INTEGERP (BVAR (current_buffer, selective_display))
? XINT (BVAR (current_buffer, selective_display))
@@ -1139,7 +1142,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
ptrdiff_t next_width_run = from;
Lisp_Object window;
- int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
/* If previous char scanned was a wide character,
this is the column where it ended. Otherwise, this is 0. */
EMACS_INT wide_column_end_hpos = 0;
@@ -1308,7 +1311,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
if (hpos > width)
{
EMACS_INT total_width = width + continuation_glyph_width;
- int truncate = 0;
+ bool truncate = 0;
if (!NILP (Vtruncate_partial_width_windows)
&& (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))))
@@ -1827,7 +1830,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
PTRDIFF_MAX)
: !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
Lisp_Object window;
- int did_motion;
+ bool did_motion;
/* This is the object we use for fetching character properties. */
Lisp_Object text_prop_object;
@@ -2017,8 +2020,8 @@ whether or not it is currently displayed in some window. */)
{
ptrdiff_t it_start, it_overshoot_count = 0;
int first_x;
- int overshoot_handled = 0;
- int disp_string_at_start_p = 0;
+ bool overshoot_handled = 0;
+ bool disp_string_at_start_p = 0;
itdata = bidi_shelve_cache ();
SET_TEXT_POS (pt, PT, PT_BYTE);