Commit 7cded46f authored by Paul Eggert's avatar Paul Eggert

lread.c, macros.c, marker.c, menu.c, minibuf.c: Use bool for booleans.

* lread.c (load_each_byte, new_backquote_flag, readchar)
(read_filtered_event, lisp_file_lexically_bound_p)
(safe_to_load_version, Fload, complete_filename_p, openp)
(build_load_history, readevalloop, read_escape, read1)
(string_to_number, read_vector, read_list):
* macros.c (Fstart_kbd_macro):
* marker.c (CONSIDER):
* menu.c (parse_single_submenu, digest_single_submenu)
(find_and_return_menu_selection, Fx_popup_menu):
* minibuf.c (read_minibuf_noninteractive, read_minibuf)
(Ftry_completion):
* nsmenu.m (ns_update_menubar, runMenuAt:forFrame:keymaps:):
(ns_menu_show):
* xmenu.c (set_frame_menubar, create_and_show_popup_menu)
(xmenu_show, xdialog_show):
Use bool for booleans.
* lread.c (safe_to_load_version): Rename from safe_to_load_p,
as it's not a predicate.  All uses changed.  Omit unnecessary
buffer termination.
parent 549c3414
2012-10-11 Paul Eggert <eggert@cs.ucla.edu>
lread.c, macros.c, marker.c, menu.c, minibuf.c: Use bool for booleans.
* lread.c (load_each_byte, new_backquote_flag, readchar)
(read_filtered_event, lisp_file_lexically_bound_p)
(safe_to_load_version, Fload, complete_filename_p, openp)
(build_load_history, readevalloop, read_escape, read1)
(string_to_number, read_vector, read_list):
* macros.c (Fstart_kbd_macro):
* marker.c (CONSIDER):
* menu.c (parse_single_submenu, digest_single_submenu)
(find_and_return_menu_selection, Fx_popup_menu):
* minibuf.c (read_minibuf_noninteractive, read_minibuf)
(Ftry_completion):
* nsmenu.m (ns_update_menubar, runMenuAt:forFrame:keymaps:):
(ns_menu_show):
* xmenu.c (set_frame_menubar, create_and_show_popup_menu)
(xmenu_show, xdialog_show):
Use bool for booleans.
* lread.c (safe_to_load_version): Rename from safe_to_load_p,
as it's not a predicate. All uses changed. Omit unnecessary
buffer termination.
2012-10-11 Dmitry Antipov <dmantipov@yandex.ru>
* editfns.c (save_excursion_save): Use nil if mark points to nowhere.
......
......@@ -3027,7 +3027,7 @@ extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
} while (0)
extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object *, Lisp_Object);
Lisp_Object string_to_number (char const *, int, int);
extern Lisp_Object string_to_number (char const *, int, bool);
extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
Lisp_Object);
extern void dir_warning (const char *, Lisp_Object);
......
This diff is collapsed.
......@@ -84,7 +84,7 @@ macro before appending to it. */)
{
ptrdiff_t i;
EMACS_INT len;
int cvt;
bool cvt;
/* Check the type of last-kbd-macro in case Lisp code changed it. */
CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
......
......@@ -91,7 +91,7 @@ clear_charpos_cache (struct buffer *b)
#define CONSIDER(CHARPOS, BYTEPOS) \
{ \
ptrdiff_t this_charpos = (CHARPOS); \
int changed = 0; \
bool changed = 0; \
\
if (this_charpos == charpos) \
{ \
......@@ -190,7 +190,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
if (charpos - best_below < best_above - charpos)
{
int record = charpos - best_below > 5000;
bool record = charpos - best_below > 5000;
while (best_below != charpos)
{
......@@ -215,7 +215,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
}
else
{
int record = best_above - charpos > 5000;
bool record = best_above - charpos > 5000;
while (best_above != charpos)
{
......@@ -335,7 +335,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
if (bytepos - best_below_byte < best_above_byte - bytepos)
{
int record = bytepos - best_below_byte > 5000;
bool record = bytepos - best_below_byte > 5000;
while (best_below_byte < bytepos)
{
......@@ -362,7 +362,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
}
else
{
int record = best_above_byte - bytepos > 5000;
bool record = best_above_byte - bytepos > 5000;
while (best_above_byte > bytepos)
{
......@@ -479,10 +479,10 @@ live_buffer (Lisp_Object buffer)
static Lisp_Object
set_marker_internal (Lisp_Object marker, Lisp_Object position,
Lisp_Object buffer, int restricted)
Lisp_Object buffer, bool restricted)
{
register struct Lisp_Marker *m;
register struct buffer *b = live_buffer (buffer);
struct Lisp_Marker *m;
struct buffer *b = live_buffer (buffer);
CHECK_MARKER (marker);
m = XMARKER (marker);
......
......@@ -519,14 +519,15 @@ list_of_panes (Lisp_Object menu)
/* Set up data in menu_items for a menu bar item
whose event type is ITEM_KEY (with string ITEM_NAME)
and whose contents come from the list of keymaps MAPS. */
int
parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps)
bool
parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name,
Lisp_Object maps)
{
Lisp_Object length;
EMACS_INT len;
Lisp_Object *mapvec;
ptrdiff_t i;
int top_level_items = 0;
bool top_level_items = 0;
USE_SAFE_ALLOCA;
length = Flength (maps);
......@@ -616,13 +617,13 @@ free_menubar_widget_value_tree (widget_value *wv)
in menu_items starting at index START, up to index END. */
widget_value *
digest_single_submenu (int start, int end, int top_level_items)
digest_single_submenu (int start, int end, bool top_level_items)
{
widget_value *wv, *prev_wv, *save_wv, *first_wv;
int i;
int submenu_depth = 0;
widget_value **submenu_stack;
int panes_seen = 0;
bool panes_seen = 0;
submenu_stack = alloca (menu_items_used * sizeof *submenu_stack);
wv = xmalloc_widget_value ();
......@@ -668,7 +669,7 @@ digest_single_submenu (int start, int end, int top_level_items)
Lisp_Object pane_name;
const char *pane_string;
panes_seen++;
panes_seen = 1;
pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
......@@ -735,7 +736,7 @@ digest_single_submenu (int start, int end, int top_level_items)
Lisp_Object help;
/* All items should be contained in panes. */
if (panes_seen == 0)
if (! panes_seen)
emacs_abort ();
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
......@@ -957,9 +958,9 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
#ifdef HAVE_NS
/* As above, but return the menu selection instead of storing in kb buffer.
If keymaps==1, return full prefixes to selection. */
If KEYMAPS, return full prefixes to selection. */
Lisp_Object
find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data)
find_and_return_menu_selection (FRAME_PTR f, bool keymaps, void *client_data)
{
Lisp_Object prefix, entry;
int i;
......@@ -999,7 +1000,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data)
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
if (aref_addr (menu_items, i) == client_data)
{
if (keymaps != 0)
if (keymaps)
{
int j;
......@@ -1071,8 +1072,8 @@ no quit occurs and `x-popup-menu' returns nil. */)
Lisp_Object selection = Qnil;
FRAME_PTR f = NULL;
Lisp_Object x, y, window;
int keymaps = 0;
int for_click = 0;
bool keymaps = 0;
bool for_click = 0;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
struct gcpro gcpro1;
......@@ -1083,7 +1084,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
#ifdef HAVE_MENUS
{
int get_current_pos_p = 0;
bool get_current_pos_p = 0;
/* FIXME!! check_w32 (); or check_x (); or check_ns (); */
/* Decode the first argument: find the window and the coordinates. */
......
......@@ -29,7 +29,7 @@ extern void init_menu_items (void);
extern void finish_menu_items (void) ATTRIBUTE_CONST;
extern void discard_menu_items (void);
extern void save_menu_items (void);
extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
extern bool parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
extern void list_of_panes (Lisp_Object);
#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) \
|| defined (HAVE_NS)
......@@ -38,7 +38,7 @@ extern void update_submenu_strings (widget_value *);
extern void find_and_call_menu_selection (FRAME_PTR, int,
Lisp_Object, void *);
extern widget_value *xmalloc_widget_value (void);
extern widget_value *digest_single_submenu (int, int, int);
extern widget_value *digest_single_submenu (int, int, bool);
#endif
#ifdef HAVE_X_WINDOWS
......@@ -47,8 +47,8 @@ extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y);
extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int,
Lisp_Object, const char **);
extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int,
extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, bool, bool,
Lisp_Object, const char **);
extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int,
extern Lisp_Object xmenu_show (FRAME_PTR, int, int, bool, bool,
Lisp_Object, const char **, Time);
#endif /* MENU_H */
......@@ -173,17 +173,6 @@ without invoking the usual minibuffer commands. */)
static Lisp_Object read_minibuf_unwind (Lisp_Object);
static Lisp_Object run_exit_minibuf_hook (Lisp_Object);
static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object,
Lisp_Object,
int, Lisp_Object,
Lisp_Object, Lisp_Object,
int, int);
static Lisp_Object read_minibuf_noninteractive (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
int, Lisp_Object,
Lisp_Object, Lisp_Object,
int, int);
static Lisp_Object string_to_object (Lisp_Object, Lisp_Object);
/* Read a Lisp object from VAL and return it. If VAL is an empty
......@@ -233,10 +222,10 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
static Lisp_Object
read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
Lisp_Object prompt, Lisp_Object backup_n,
int expflag,
bool expflag,
Lisp_Object histvar, Lisp_Object histpos,
Lisp_Object defalt,
int allow_props, int inherit_input_method)
bool allow_props, bool inherit_input_method)
{
ptrdiff_t size, len;
char *line;
......@@ -376,23 +365,23 @@ If the current buffer is not a minibuffer, return its entire contents. */)
beginning of INITIAL if N <= 0.
Normally return the result as a string (the text that was read),
but if EXPFLAG is nonzero, read it and return the object read.
but if EXPFLAG, read it and return the object read.
If HISTVAR is given, save the value read on that history only if it doesn't
match the front of that history list exactly. The value is pushed onto
the list as the string that was read.
DEFALT specifies the default value for the sake of history commands.
If ALLOW_PROPS is nonzero, we do not throw away text properties.
If ALLOW_PROPS, do not throw away text properties.
if INHERIT_INPUT_METHOD is nonzero, the minibuffer inherits the
if INHERIT_INPUT_METHOD, the minibuffer inherits the
current input method. */
static Lisp_Object
read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
int expflag,
bool expflag,
Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
int allow_props, int inherit_input_method)
bool allow_props, bool inherit_input_method)
{
Lisp_Object val;
ptrdiff_t count = SPECPDL_INDEX ();
......@@ -1447,7 +1436,7 @@ is used to further constrain the set of candidates. */)
if (bestmatchsize != SCHARS (eltstring)
|| bestmatchsize != matchsize)
/* Don't count the same string multiple times. */
matchcount++;
matchcount += matchcount <= 1;
bestmatchsize = matchsize;
if (matchsize <= SCHARS (string)
/* If completion-ignore-case is non-nil, don't
......
......@@ -181,7 +181,8 @@
/* Fully parse one or more of the submenus. */
int n = 0;
int *submenu_start, *submenu_end;
int *submenu_top_level_items, *submenu_n_panes;
bool *submenu_top_level_items;
int *submenu_n_panes;
struct buffer *prev = current_buffer;
Lisp_Object buffer;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
......@@ -740,7 +741,7 @@ - (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame
/* run a menu in popup mode */
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (int)keymaps
keymaps: (bool)keymaps
{
EmacsView *view = FRAME_NS_VIEW (f);
NSEvent *e, *event;
......@@ -779,7 +780,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
========================================================================== */
Lisp_Object
ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
Lisp_Object title, const char **error)
{
EmacsMenu *pmenu;
......@@ -801,7 +802,7 @@ - (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
#if 0
/* FIXME: a couple of one-line differences prevent reuse */
wv = digest_single_submenu (0, menu_items_used, Qnil);
wv = digest_single_submenu (0, menu_items_used, 0);
#else
{
widget_value *save_wv = 0, *prev_wv = 0;
......
......@@ -161,7 +161,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
- (void) clear;
- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
keymaps: (int)keymaps;
keymaps: (bool)keymaps;
@end
......@@ -792,7 +792,7 @@ extern void free_frame_tool_bar (FRAME_PTR f);
extern void find_and_call_menu_selection (FRAME_PTR f,
int menu_bar_items_used, Lisp_Object vector, void *client_data);
extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f,
int keymaps,
bool keymaps,
void *client_data);
extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
Lisp_Object header);
......
......@@ -111,7 +111,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
static Lisp_Object Qdebug_on_next_call;
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object,
static Lisp_Object xdialog_show (FRAME_PTR, bool, Lisp_Object, Lisp_Object,
const char **);
#endif
......@@ -930,7 +930,8 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
widget_value *wv, *first_wv, *prev_wv = 0;
int i;
int *submenu_start, *submenu_end;
int *submenu_top_level_items, *submenu_n_panes;
bool *submenu_top_level_items;
int *submenu_n_panes;
if (! FRAME_X_P (f))
emacs_abort ();
......@@ -1346,8 +1347,8 @@ free_frame_menubar (FRAME_PTR f)
/* F is the frame the menu is for.
X and Y are the frame-relative specified position,
relative to the inside upper left corner of the frame F.
FOR_CLICK is nonzero if this menu was invoked for a mouse click.
KEYMAPS is 1 if this menu was specified with keymaps;
FOR_CLICK is true if this menu was invoked for a mouse click.
KEYMAPS is true if this menu was specified with keymaps;
in that case, we return a list containing the chosen item's value
and perhaps also the pane's prefix.
TITLE is the specified menu title.
......@@ -1427,14 +1428,14 @@ pop_down_menu (Lisp_Object arg)
menu_item_selection will be set to the selection. */
static void
create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
int for_click, Time timestamp)
bool for_click, Time timestamp)
{
int i;
GtkWidget *menu;
GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */
struct next_popup_x_y popup_x_y;
ptrdiff_t specpdl_count = SPECPDL_INDEX ();
int use_pos_func = ! for_click;
bool use_pos_func = ! for_click;
#ifdef HAVE_GTK3
/* Always use position function for Gtk3. Otherwise menus may become
......@@ -1539,7 +1540,7 @@ pop_down_menu (Lisp_Object arg)
menu_item_selection will be set to the selection. */
static void
create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
int x, int y, int for_click, Time timestamp)
int x, int y, bool for_click, Time timestamp)
{
int i;
Arg av[2];
......@@ -1623,7 +1624,7 @@ cleanup_widget_value_tree (Lisp_Object arg)
}
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
Lisp_Object title, const char **error_name, Time timestamp)
{
int i;
......@@ -1878,7 +1879,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
if (menu_item_selection == aref_addr (menu_items, i))
{
if (keymaps != 0)
if (keymaps)
{
int j;
......@@ -2011,7 +2012,7 @@ static const char * button_names [] = {
static Lisp_Object
xdialog_show (FRAME_PTR f,
int keymaps,
bool keymaps,
Lisp_Object title,
Lisp_Object header,
const char **error_name)
......@@ -2277,7 +2278,7 @@ pop_down_menu (Lisp_Object arg)
Lisp_Object
xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
Lisp_Object title, const char **error_name, Time timestamp)
{
Window root;
......@@ -2528,7 +2529,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
{
entry
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
if (keymaps != 0)
if (keymaps)
{
entry = Fcons (entry, Qnil);
if (!NILP (pane_prefix))
......
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