Commit 578098f3 authored by Paul Eggert's avatar Paul Eggert

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.
parent 9a48e168
2012-09-24 Paul Eggert <eggert@cs.ucla.edu>
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.
2012-09-24 Chong Yidong <cyd@gnu.org>
* chartab.c (Fset_char_table_default): Obsolete function removed.
......
......@@ -2757,19 +2757,19 @@ struct image_type
Lisp_Object *type;
/* Check that SPEC is a valid image specification for the given
image type. Value is non-zero if SPEC is valid. */
int (* valid_p) (Lisp_Object spec);
image type. Value is true if SPEC is valid. */
bool (* valid_p) (Lisp_Object spec);
/* Load IMG which is used on frame F from information contained in
IMG->spec. Value is non-zero if successful. */
int (* load) (struct frame *f, struct image *img);
IMG->spec. Value is true if successful. */
bool (* load) (struct frame *f, struct image *img);
/* Free resources of image IMG which is used on frame F. */
void (* free) (struct frame *f, struct image *img);
/* Initialization function (used for dynamic loading of image
libraries on Windows), or NULL if none. */
int (* init) (void);
bool (* init) (void);
/* Next in list of all supported image types. */
struct image_type *next;
......@@ -3169,7 +3169,7 @@ extern ptrdiff_t x_create_bitmap_from_xpm_data (struct frame *, const char **);
extern void x_destroy_bitmap (struct frame *, ptrdiff_t);
#endif
extern void x_destroy_all_bitmaps (Display_Info *);
extern int x_create_bitmap_mask (struct frame *, ptrdiff_t);
extern void x_create_bitmap_mask (struct frame *, ptrdiff_t);
extern Lisp_Object x_find_image_file (Lisp_Object);
void x_kill_gs_process (Pixmap, struct frame *);
......@@ -3177,7 +3177,7 @@ struct image_cache *make_image_cache (void);
void free_image_cache (struct frame *);
void clear_image_caches (Lisp_Object);
void mark_image_cache (struct image_cache *);
int valid_image_p (Lisp_Object);
bool valid_image_p (Lisp_Object);
void prepare_image_for_display (struct frame *, struct image *);
ptrdiff_t lookup_image (struct frame *, Lisp_Object);
......
This diff is collapsed.
......@@ -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);
......
......@@ -27,7 +27,7 @@ struct position
};
struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos,
EMACS_INT fromhpos, int did_motion,
EMACS_INT fromhpos, bool did_motion,
ptrdiff_t to, EMACS_INT tovpos,
EMACS_INT tohpos,
EMACS_INT width, ptrdiff_t hscroll,
......@@ -45,8 +45,8 @@ extern ptrdiff_t last_known_column_point;
/* Return true if the display table DISPTAB specifies the same widths
for characters as WIDTHTAB. We use this to decide when to
invalidate the buffer's column_cache. */
int disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
struct Lisp_Vector *widthtab);
bool disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
struct Lisp_Vector *widthtab);
/* Recompute BUF's width table, using the display table DISPTAB. */
void recompute_width_table (struct buffer *buf,
......
......@@ -3257,7 +3257,7 @@ extern void keys_of_keyboard (void);
/* Defined in indent.c. */
extern ptrdiff_t current_column (void);
extern void invalidate_current_column (void);
extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
extern bool indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
extern void syms_of_indent (void);
/* Defined in frame.c. */
......
......@@ -78,7 +78,7 @@ Updated by Christian Limpach (chris@nice.ch)
return [EmacsImage allocInitFromFile: file];
}
int
bool
ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data)
{
......
......@@ -749,11 +749,11 @@ extern Lisp_Object ns_cursor_type_to_lisp (int arg);
extern void ns_set_name_as_filename (struct frame *f);
extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
extern int
extern bool
ns_defined_color (struct frame *f,
const char *name,
XColor *color_def, int alloc,
char makeIndex);
XColor *color_def, bool alloc,
bool makeIndex);
extern void
ns_query_color (void *col, XColor *color_def, int setPixel);
......@@ -799,8 +799,8 @@ struct image;
extern void *ns_image_from_XBM (unsigned char *bits, int width, int height);
extern void *ns_image_for_XPM (int width, int height, int depth);
extern void *ns_image_from_file (Lisp_Object file);
extern int ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data);
extern bool ns_load_image (struct frame *f, struct image *img,
Lisp_Object spec_file, Lisp_Object spec_data);
extern int ns_image_width (void *img);
extern int ns_image_height (void *img);
extern unsigned long ns_get_pixel (void *img, int x, int y);
......
......@@ -1575,18 +1575,18 @@ Free a pool and temporary objects it refers to (callable from C)
}
int
bool
ns_defined_color (struct frame *f,
const char *name,
XColor *color_def,
int alloc,
char makeIndex)
bool alloc,
bool makeIndex)
/* --------------------------------------------------------------------------
Return 1 if named color found, and set color_def rgb accordingly.
Return true if named color found, and set color_def rgb accordingly.
If makeIndex and alloc are nonzero put the color in the color_table,
and set color_def pixel to the resulting index.
If makeIndex is zero, set color_def pixel to ARGB.
Return 0 if not found
Return false if not found
-------------------------------------------------------------------------- */
{
NSColor *col;
......
......@@ -991,7 +991,7 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
non-zero, then the `standard' definition of the same color is
returned in it. */
static int
static bool
tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
XColor *std_color)
{
......@@ -1052,11 +1052,11 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
/* A version of defined_color for non-X frames. */
static int
static bool
tty_defined_color (struct frame *f, const char *color_name,
XColor *color_def, int alloc)
XColor *color_def, bool alloc)
{
int status = 1;
bool status = 1;
/* Defaults. */
color_def->pixel = FACE_TTY_DEFAULT_COLOR;
......@@ -1084,13 +1084,13 @@ tty_defined_color (struct frame *f, const char *color_name,
/* Decide if color named COLOR_NAME is valid for the display
associated with the frame F; if so, return the rgb values in
COLOR_DEF. If ALLOC is nonzero, allocate a new colormap cell.
COLOR_DEF. If ALLOC, allocate a new colormap cell.
This does the right thing for any type of frame. */
static int
static bool
defined_color (struct frame *f, const char *color_name, XColor *color_def,
int alloc)
bool alloc)
{
if (!FRAME_WINDOW_P (f))
return tty_defined_color (f, color_name, color_def, alloc);
......
......@@ -575,15 +575,15 @@ gamma_correct (struct frame *f, XColor *color)
/* Decide if color named COLOR_NAME is valid for use on frame F. If
so, return the RGB values in COLOR. If ALLOC_P is non-zero,
allocate the color. Value is zero if COLOR_NAME is invalid, or
so, return the RGB values in COLOR. If ALLOC_P,
allocate the color. Value is false if COLOR_NAME is invalid, or
no color could be allocated. */
int
bool
x_defined_color (struct frame *f, const char *color_name,
XColor *color, int alloc_p)
XColor *color, bool alloc_p)
{
int success_p = 0;
bool success_p = 0;
Display *dpy = FRAME_X_DISPLAY (f);
Colormap cmap = FRAME_X_COLORMAP (f);
......@@ -592,7 +592,7 @@ x_defined_color (struct frame *f, const char *color_name,
success_p = xg_check_special_colors (f, color_name, color);
#endif
if (!success_p)
success_p = XParseColor (dpy, cmap, color_name, color);
success_p = XParseColor (dpy, cmap, color_name, color) != 0;
if (success_p && alloc_p)
success_p = x_alloc_nearest_color (f, cmap, color);
unblock_input ();
......
......@@ -287,7 +287,7 @@ enum xembed_message
/* Used in x_flush. */
static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
static void x_set_window_size_1 (struct frame *, int, int, int);
static void x_raise_frame (struct frame *);
static void x_lower_frame (struct frame *);
......@@ -899,8 +899,8 @@ static void x_compute_glyph_string_overhangs (struct glyph_string *);
static void x_set_cursor_gc (struct glyph_string *);
static void x_set_mode_line_face_gc (struct glyph_string *);
static void x_set_mouse_face_gc (struct glyph_string *);
static int x_alloc_lighter_color (struct frame *, Display *, Colormap,
unsigned long *, double, int);
static bool x_alloc_lighter_color (struct frame *, Display *, Colormap,
unsigned long *, double, int);
static void x_setup_relief_color (struct frame *, struct relief *,
double, int, unsigned long);
static void x_setup_relief_colors (struct glyph_string *);
......@@ -1469,9 +1469,9 @@ x_frame_of_widget (Widget widget)
If this produces the same color as PIXEL, try a color where all RGB
values have DELTA added. Return the allocated color in *PIXEL.
DISPLAY is the X display, CMAP is the colormap to operate on.
Value is non-zero if successful. */
Value is true if successful. */
int
bool
x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap,
unsigned long *pixel, double factor, int delta)
{
......@@ -1696,15 +1696,15 @@ x_query_color (struct frame *f, XColor *color)
/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an
exact match can't be allocated, try the nearest color available.
Value is non-zero if successful. Set *COLOR to the color
Value is true if successful. Set *COLOR to the color
allocated. */
static int
static bool
x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
{
int rc;
bool rc;
rc = XAllocColor (dpy, cmap, color);
rc = XAllocColor (dpy, cmap, color) != 0;
if (rc == 0)
{
/* If we got to this point, the colormap is full, so we're going
......@@ -1735,7 +1735,7 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
color->red = cells[nearest].red;
color->green = cells[nearest].green;
color->blue = cells[nearest].blue;
rc = XAllocColor (dpy, cmap, color);
rc = XAllocColor (dpy, cmap, color) != 0;
}
else
{
......@@ -1768,10 +1768,10 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
/* Allocate the color COLOR->pixel on frame F, colormap CMAP. If an
exact match can't be allocated, try the nearest color available.
Value is non-zero if successful. Set *COLOR to the color
Value is true if successful. Set *COLOR to the color
allocated. */
int
bool
x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color)
{
gamma_correct (f, color);
......@@ -1821,12 +1821,12 @@ x_copy_color (struct frame *f, long unsigned int pixel)
DISPLAY is the X display, CMAP is the colormap to operate on.
Value is non-zero if successful. */
static int
static bool
x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta)
{
XColor color, new;
long bright;
int success_p;
bool success_p;
/* Get RGB color values. */
color.pixel = *pixel;
......
......@@ -962,11 +962,11 @@ extern XtAppContext Xt_app_con;
extern void x_activate_timeout_atimer (void);
#endif
#ifdef USE_LUCID
extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
unsigned long *,
double, int);
extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
unsigned long *,
double, int);
#endif
extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
extern void x_query_color (struct frame *f, XColor *);
extern void x_clear_area (Display *, Window, int, int, int, int, int);
#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
......@@ -1034,7 +1034,7 @@ extern void xic_set_statusarea (struct frame *);
extern void xic_set_xfontset (struct frame *, const char *);
extern int x_pixel_width (struct frame *);
extern int x_pixel_height (struct frame *);
extern int x_defined_color (struct frame *, const char *, XColor *, int);
extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
#ifdef HAVE_X_I18N
extern void free_frame_xic (struct frame *);
# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment