summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-09-04 10:10:06 -0600
committerTom Tromey <tromey@redhat.com>2012-09-04 10:10:06 -0600
commitbf69f522a9e135f9aa483cedd53e71e915f2bf75 (patch)
tree3f73c47fb863ef87f420de1d30858da821072bd9 /src
parent303324a9232dbc89369faceb6b3530740d0fc1bd (diff)
parent6ec9a5a7b5efb129807f567709ca858211ed7840 (diff)
downloademacs-bf69f522a9e135f9aa483cedd53e71e915f2bf75.tar.gz
merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit4
-rw-r--r--src/ChangeLog737
-rw-r--r--src/Makefile.in27
-rw-r--r--src/alloc.c121
-rw-r--r--src/atimer.c2
-rw-r--r--src/atimer.h3
-rw-r--r--src/bidi.c63
-rw-r--r--src/buffer.c167
-rw-r--r--src/buffer.h48
-rw-r--r--src/bytecode.c4
-rw-r--r--src/callint.c16
-rw-r--r--src/callproc.c36
-rw-r--r--src/casefiddle.c13
-rw-r--r--src/casetab.c4
-rw-r--r--src/category.c8
-rw-r--r--src/category.h12
-rw-r--r--src/ccl.h2
-rw-r--r--src/character.c16
-rw-r--r--src/character.h3
-rw-r--r--src/charset.c32
-rw-r--r--src/charset.h41
-rw-r--r--src/chartab.c19
-rw-r--r--src/cmds.c8
-rw-r--r--src/coding.c371
-rw-r--r--src/coding.h49
-rw-r--r--src/composite.c22
-rw-r--r--src/composite.h13
-rw-r--r--src/conf_post.h3
-rw-r--r--src/data.c55
-rw-r--r--src/dbusbind.c13
-rw-r--r--src/dired.c38
-rw-r--r--src/dispextern.h41
-rw-r--r--src/dispnew.c351
-rw-r--r--src/doc.c40
-rw-r--r--src/editfns.c108
-rw-r--r--src/emacs.c84
-rw-r--r--src/eval.c96
-rw-r--r--src/fileio.c14
-rw-r--r--src/firstfile.c5
-rw-r--r--src/fns.c54
-rw-r--r--src/font.c14
-rw-r--r--src/font.h1
-rw-r--r--src/fontset.c134
-rw-r--r--src/frame.c20
-rw-r--r--src/frame.h71
-rw-r--r--src/gtkutil.c11
-rw-r--r--src/gtkutil.h4
-rw-r--r--src/image.c43
-rw-r--r--src/insdel.c80
-rw-r--r--src/intervals.c58
-rw-r--r--src/intervals.h14
-rw-r--r--src/keyboard.c52
-rw-r--r--src/keymap.c15
-rw-r--r--src/lisp.h162
-rw-r--r--src/lread.c25
-rw-r--r--src/makefile.w32-in31
-rw-r--r--src/menu.c17
-rw-r--r--src/minibuf.c3
-rw-r--r--src/msdos.c9
-rw-r--r--src/nsmenu.m101
-rw-r--r--src/nsterm.h38
-rw-r--r--src/nsterm.m7
-rw-r--r--src/print.c11
-rw-r--r--src/process.c47
-rw-r--r--src/process.h4
-rw-r--r--src/ralloc.c45
-rw-r--r--src/sysdep.c24
-rw-r--r--src/systime.h4
-rw-r--r--src/term.c17
-rw-r--r--src/textprop.c4
-rw-r--r--src/undo.c2
-rw-r--r--src/w32.c6
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32font.h4
-rw-r--r--src/w32term.h5
-rw-r--r--src/w32uniscribe.c67
-rw-r--r--src/w32xfns.c2
-rw-r--r--src/widget.c2
-rw-r--r--src/window.c103
-rw-r--r--src/window.h1
-rw-r--r--src/xdisp.c47
-rw-r--r--src/xfaces.c72
-rw-r--r--src/xfont.c9
-rw-r--r--src/xgselect.c52
-rw-r--r--src/xgselect.h2
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c13
-rw-r--r--src/xterm.h29
88 files changed, 2452 insertions, 1777 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index b703842f4cf..de980c6345f 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -18,9 +18,9 @@
# Boston, MA 02110-1301, USA.
# Force loading of symbols, enough to give us VALBITS etc.
-set main
+set $dummy = main + 8
# With some compilers, we need this to give us struct Lisp_Symbol etc.:
-set Fmake_symbol
+set $dummy = Fmake_symbol + 8
# Find lwlib source files too.
dir ../lwlib
diff --git a/src/ChangeLog b/src/ChangeLog
index 1e25015da20..a8d6a4026a0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,738 @@
+2012-09-04 Paul Eggert <eggert@cs.ucla.edu>
+
+ Be more systematic about _setjmp vs setjmp.
+ * alloc.c (test_setjmp, mark_stack):
+ * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]:
+ (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]:
+ (png_load, my_error_exit, jpeg_load):
+ * process.c (send_process_trap, send_process):
+ Uniformly prefer _setjmp and _longjmp to setjmp and longjmp.
+ The underscored versions are up to 30x faster on some hosts.
+ Formerly, the code used setjmp+longjmp sometimes and
+ _setjmp+_longjmp at other times, with no particular reason to
+ prefer setjmp+longjmp.
+
+2012-09-03 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix minor problem found by static checking.
+ * buffer.c (Fdelete_all_overlays): Return nil.
+
+2012-09-03 Martin Rudalics <rudalics@gmx.at>
+
+ * buffer.c (Fdelete_all_overlays): New function.
+
+2012-09-03 Chong Yidong <cyd@gnu.org>
+
+ * gtkutil.c: Add extern decl for Qxft.
+
+2012-09-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ * emacs.c, eval.c: Use bool for boolean.
+ * emacs.c (initialized, inhibit_window_system, running_asynch_code):
+ (malloc_using_checking) [DOUG_LEA_MALLOC]:
+ (display_arg) [HAVE_X_WINDOWS || HAVE_NS]:
+ (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch)
+ (main, decode_env_path, Fdaemon_initialized):
+ * eval.c (call_debugger, Finteractive_p, interactive_p):
+ (unwind_to_catch, Fsignal, wants_debugger, skip_debugger)
+ (maybe_call_debugger, Fbacktrace):
+ * process.c (read_process_output, exec_sentinel):
+ Use bool for booleans.
+ * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X.
+ All callers changed.
+ * eval.c (interactive_p): Omit always-true boolean argument
+ EXCLUDE_SUBRS_P. All callers changed.
+ * dispextern.h, lisp.h: Reflect above API changes.
+ * firstfile.c (dummy): Use the address of 'main', whose signature
+ won't change, instead of the address of 'initialize', whose
+ signature just changed from int to bool.
+ * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ...
+ * msdos.c (fatal_error_in_progress): ... from here.
+ * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead
+ of incrementing it.
+ (redisplay_internal, unwind_redisplay): Simply clear
+ REDISPLAYING_P when unwinding, instead of saving its previous,
+ always-false value and then restoring it.
+
+ Clean up some extern decls.
+ Mostly, this hoists extern decls out of .c files and into .h files.
+ That way, we're more likely to catch errors if the interfaces change.
+ * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not
+ declare xg_mark_data.
+ * dispextern.h (x_frame_parm_handlers):
+ * font.h (Qxft):
+ * lisp.h (Qlexical_binding, Qinternal_interpreter_environment)
+ (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold)
+ (Qultra_bold, Qoblique, Qitalic):
+ Move extern decl here from .c file.
+ * alloc.c (xg_mark_data) [USE_GTK]:
+ * doc.c (Qclosure):
+ * eval.c (Qlexical_binding):
+ * fns.c (time) [!HAVE_UNISTD_H]:
+ * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light)
+ (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic):
+ * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]:
+ * lread.c (Qinternal_interpreter_environment):
+ * minibuf.c (Qbuffer):
+ * process.c (QCfamily, QCfilter):
+ * widget.c (free_frame_faces):
+ * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]:
+ * xfont.c (x_clear_errors):
+ * xterm.c (x_frame_parm_handlers):
+ Remove now-redundant extern decls.
+ * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]:
+ * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic):
+ Now static.
+ * xfaces.c: Remove unnecessary static decls.
+ * xterm.c (updating_frame): Remove decl of nonexistent object.
+
+ * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS)
+ when building globals.h, as the objects that are not built on
+ this host are not needed to compile C files on this host.
+
+2012-09-02 Jan Djärv <jan.h.d@swipnet.se>
+
+ * gtkutil.h: Remove prototype for x_wm_set_size_hint.
+
+ * frame.h: Add missing prototype for x_wm_set_size_hint.
+
+2012-09-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean.
+ * doc.c (read_bytecode_char, get_doc_string, reread_doc_file)
+ (Fdocumentation, Fdocumentation_property, Fsnarf_documentation)
+ (Fsubstitute_command_keys):
+ * editfns.c (region_limit, find_field, Fconstrain_to_field)
+ (save_excursion_save, save_excursion_restore)
+ (disassemble_lisp_time, decode_time_components, emacs_nmemftime)
+ (format_time_string, general_insert_function)
+ (make_buffer_string, make_buffer_string_both)
+ (Fsubst_char_in_region, Ftranslate_region_internal, Fformat):
+ * insdel.c (check_markers, gap_left, adjust_markers_for_insert)
+ (copy_text, insert_1, insert_1_both, insert_from_string)
+ (insert_from_string_before_markers, insert_from_string_1)
+ (insert_from_buffer, insert_from_buffer_1, replace_range)
+ (replace_range_2, del_range_1, del_range_byte, del_range_both)
+ (del_range_2, modify_region):
+ * intervals.c (intervals_equal, balance_possible_root_interval)
+ (adjust_intervals_for_insertion, merge_properties_sticky)
+ (graft_intervals_into_buffer, lookup_char_property)
+ (adjust_for_invis_intang, set_point_both)
+ (get_property_and_range, compare_string_intervals)
+ (set_intervals_multibyte_1, set_intervals_multibyte):
+ * keyboard.c (decode_timer):
+ Use bool for boolean.
+ * intervals.h, lisp.h, systime.h: Reflect above API changes.
+ * editfns.c (struct info): Use 1-bit unsigned bitfields for booleans.
+
+2012-09-02 Chong Yidong <cyd@gnu.org>
+
+ * keymap.c (push_key_description): Print M-TAB as C-M-i
+ (Bug#11758).
+
+2012-09-02 Juanma Barranquero <lekktu@gmail.com>
+
+ * makefile.w32-in (CCL_H, W32FONT_H): New macros.
+ (ATIMER_H, FONT_H, $(BLD)/alloc.$(O), $(BLD)/callproc.$(O))
+ ($(BLD)/editfns.$(O), $(BLD)/ccl.$(O), $(BLD)/chartab.$(O))
+ ($(BLD)/coding.$(O), $(BLD)/sysdep.$(O), $(BLD)/fontset.$(O))
+ ($(BLD)/sysdep.$(O), $(BLD)/w32fns.$(O), $(BLD)/keyboard.$(O))
+ ($(BLD)/w32term.$(O), $(BLD)/w32menu.$(O), $(BLD)/process.$(O))
+ ($(BLD)/w32font.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies.
+
+2012-09-01 Eli Zaretskii <eliz@gnu.org>
+
+ * w32uniscribe.c (uniscribe_shape): Handle correctly the case of
+ more than one grapheme cluster passed to the shaper: compute the
+ offset adjustment values separately for each cluster. (Bug#11860)
+
+ * image.c: Restore mistakenly removed inclusion of w32.h. Without
+ it, GCC doesn't see prototypes of w32_delayed_load, and complains
+ about implicit conversions from integer to pointer.
+
+2012-09-01 Daniel Colascione <dancol@dancol.org>
+
+ * w32fns.c (x_display_info_for_name): Prevent crash if w32 window
+ system used too early.
+
+2012-09-01 Paul Eggert <eggert@cs.ucla.edu>
+
+ Better seed support for (random).
+ * emacs.c (main): Call init_random.
+ * fns.c (Frandom): Set the seed from a string argument, if given.
+ Remove long-obsolete Gentzel cruft.
+ * lisp.h, sysdep.c (seed_random): Now takes address and size, not long.
+ (init_random): New function.
+
+2012-09-01 Daniel Colascione <dancol@dancol.org>
+
+ * xterm.h: Add header guards. Declare x_menubar_window_to_frame.
+ Remove x_set_frame_alpha, x_bitmap_icon, x_make_frame_visible,
+ x_make_frame_invisible, x_iconify_frame, x_free_frame_resources,
+ x_wm_set_size_hint, x_query_colors, x_real_positions,
+ x_set_menu_bar_lines, x_char_width, x_char_height, x_sync,
+ x_set_tool_bar_lines, x_activate_menubar, and free_frame_menubar,
+ all of which have been moved to common code.
+
+ * xfaces.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * w32xfns.c (x_sync): Correct definition of x_sync (a no-op here)
+ to match header.
+
+ * w32term.h (FRAME_X_WINDOW): Use FRAME_W32_WINDOW instead of
+ directly accessing frame internals.
+
+ * w32font.h: Include font.h. Define syms_of_w32font and
+ globals_of_w32font.
+
+ * process.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * nsterm.h: Remove declarations now in frame.h. Define
+ FRAME_X_SCREEN, FRAME_X_VISUAL.
+
+ * menu.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * keyboard.h: Declare ignore_mouse_drag_p whenever we have a
+ window system.
+
+ * keyboard.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * image.c: Include TERM_HEADER instead of listing all possible
+ window-system headers. Declare Vlibrary_cache when compiling for
+ Windows.
+
+ * gtkutil.h (xg_list_node_): Include xterm.h to pick up needed
+ window system declarations.
+
+ * frame.h: Move common functions here: set_frame_menubar,
+ x_set_window_size, x_sync, x_get_focus_frame,
+ x_set_mouse_position, x_set_mouse_pixel_position,
+ x_make_frame_visible, x_make_frame_invisible, x_iconify_frame,
+ x_char_width, x_char_height, x_pixel_width, x_pixel_height,
+ x_set_frame_alpha, x_set_menu_bar_lines, x_set_tool_bar_lines,
+ x_activate_menubar, x_real_positions, x_bitmap_icon,
+ x_set_menu_bar_lines, free_frame_menubar, x_free_frame_resources,
+ and x_query_colors.
+
+ * frame.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * font.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * emacs.c: Include TERM_HEADER.
+
+ * dispnew.c: Include TERM_HEADER instead of listing all possible
+ window-system headers.
+
+ * ccl.h: Include character.h.
+
+ * Makefile.in: Define WINDOW_SYSTEM_OBJ to hold objects needed for
+ the current window system; include in list of objects to link into
+ Emacs.
+
+2012-08-31 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Remove mark_ttys function and fix tty_display_info initialization.
+ * lisp.h (mark_ttys): Remove prototype.
+ * alloc.c (Fgarbage_collect): Remove redundant (and the only) call
+ to mark_ttys because all possible values of 'top_frame' slot are
+ the frames which are reachable from Vframe_list.
+ * term.c (mark_ttys): Remove.
+ (init_tty): Safely initialize 'top_frame' slot with Qnil.
+
+2012-08-31 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Change struct frame bitfields from unsigned char to unsigned.
+ * frame.h (struct frame): Change type of 'display_preempted',
+ 'visible', 'iconified', 'has_minibuffer', 'wants_modeline',
+ 'auto_raise', 'auto_lower', 'no_split', 'explicit_name',
+ 'window_sizes_changed', 'mouse_moved' and 'pointer_invisible'
+ bitfields from unsigned char to unsigned.
+
+2012-08-31 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Remove unused member of struct x_output and struct w32_output.
+ * xterm.h (struct x_output): Remove unused field 'needs_exposure'.
+ * w32term.h (struct w32_output): Likewise.
+
+2012-08-30 Jan Djärv <jan.h.d@swipnet.se>
+
+ * gtkutil.c (x_wm_set_size_hint): Use 1 col for base_width so it
+ does not become zero (Bug#12234).
+
+2012-08-30 Paul Eggert <eggert@cs.ucla.edu>
+
+ * dispnew.c (update_frame_1): Pacify gcc -Wstrict-overflow
+ for GCC 4.7.1 x86-64.
+
+2012-08-30 Glenn Morris <rgm@gnu.org>
+
+ * lread.c (init_lread): For out-of-tree builds, only add the
+ source directory's site-lisp dir to the load-path if it exists,
+ consistent with in-tree builds. (Bug#12302)
+
+2012-08-28 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
+ button_values to NULL. Call setStykeMask so dialogs get a close button.
+ (windowShouldClose:): Set window_closed.
+ (dealloc): New member, free button_values.
+ (process_dialog:): Make member function. Remove window argument,
+ replace window with self. Count buttons and allocate and store values
+ in button_values.
+ (addButton:value:row:): value is int with the name tag. Call setTag
+ with tag. Remove return self, declare return value as void.
+ (addString:row:): Remove return self, declare return value as void.
+ (addSplit): Remove return self, declare return value as void.
+ (clicked:): Remove return self, declare return value as void.
+ Set dialog_return to button_values[seltag]. Code formatting change.
+ (initFromContents:isQuestion:): Adjust call to process_dialog.
+ Code formatting change.
+ (timeout_handler:): Set timer_fired to YES.
+ (runDialogAt:): Set timer_fired to NO.
+ Handle click on close button as quit.
+
+ * nsterm.h (EmacsDialogPanel): Make timer_fired BOOL.
+ Add window_closed and button_values. Add void as return value for
+ add(Button|String|Split). addButton takes int instead of Lisp_Object.
+ Add process_dialog as new member.
+
+2012-08-28 Eli Zaretskii <eliz@gnu.org>
+
+ * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it
+ is not one of the heaps we manage. (Bug#12242)
+
+2012-08-28 Glenn Morris <rgm@gnu.org>
+
+ * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747)
+
+2012-08-28 Martin Rudalics <rudalics@gmx.at>
+
+ * window.c (Fset_window_configuration): Remove handling of
+ auto-buffer-name window parameter. Install revision of reverted
+ fix.
+
+2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Do not allow to set major mode for a dead buffer.
+ * buffer.c (Fset_buffer_major_mode): Signal an error
+ if the buffer is dead.
+ (Fother_buffer, other_buffer_safely): Remove redundant
+ nested declaration.
+
+2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Always use set_buffer_if_live to restore original buffer at unwind.
+ * buffer.h (record_unwind_current_buffer): New function.
+ * bytecode.c, dispnew.c, editfns.c, fileio.c, fns.c, insdel.c:
+ * keyboard.c, keymap.c, minibuf.c, print.c, process.c, textprop.c:
+ * undo.c, window.c: Adjust users.
+ * buffer.c (set_buffer_if_live): Fix comment.
+
+2012-08-28 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix usage of set_buffer_internal.
+ * buffer.h (set_buffer_internal): Make it BUFFER_INLINE.
+ * buffer.c (set_buffer_if_live): Use set_buffer_internal.
+ * coding.c (decode_coding): Omit redundant test.
+ * fileio.c (decide_coding_unwind): Likewise.
+ * fns.c (secure_hash): Likewise.
+ * insdel.c (modify_region): Likewise.
+ * keyboard.c (command_loop_1): Likewise.
+ * print.c (PRINTFINISH): Likewise.
+ * xdisp.c (run_window_scroll_functions): Use set_buffer_internal.
+
+2012-08-27 Paul Eggert <eggert@cs.ucla.edu>
+
+ * dispnew.c: Use bool for boolean.
+ (frame_garbaged, display_completed, delayed_size_change)
+ (fonts_changed_p, add_window_display_history)
+ (add_frame_display_history, verify_row_hash)
+ (adjust_glyph_matrix, clear_window_matrices, glyph_row_slice_p)
+ (row_equal_p, realloc_glyph_pool)
+ (allocate_matrices_for_frame_redisplay)
+ (showing_window_margins_p)
+ (adjust_frame_glyphs_for_frame_redisplay)
+ (build_frame_matrix_from_leaf_window, make_current)
+ (mirrored_line_dance, mirror_line_dance, update_frame)
+ (update_window_tree, update_single_window)
+ (check_current_matrix_flags, update_window, update_text_area)
+ (update_window_line, set_window_update_flags, scrolling_window)
+ (update_frame_1, scrolling, buffer_posn_from_coords)
+ (do_pending_window_change, change_frame_size)
+ (change_frame_size_1, sit_for):
+ Use bool for boolean.
+ (clear_glyph_matrix_rows): Rename from enable_glyph_matrix_rows,
+ and remove last int (actually boolean) argument, which was always 0.
+ All callers changed.
+ * dispextern.h, frame.h, lisp.h: Reflect above API changes.
+ * dispextern.h (struct composition_it): Use bool for boolean.
+ (struct glyph_matrix): Don't assume buffer sizes can fit in 'int'.
+ (struct bidi_it): Use unsigned:1, not int, for boolean prev_was_pdf.
+ * dired.c (file_name_completion):
+ Use bool for boolean. (This was missed in an earlier change.)
+
+2012-08-27 Martin Rudalics <rudalics@gmx.at>
+
+ * window.c (Fset_window_configuration): Revert first part of
+ last change.
+
+2012-08-27 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.h (NSPanel): New class variable dialog_return.
+
+ * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
+ dialog_return.
+ (windowShouldClose:): Use stop instead of stopModalWithCode.
+ (clicked:): Ditto, and also set dialog_return (Bug#12258).
+ (timeout_handler:): Use stop instead of abortModal. Send a dummy
+ event.
+ (runDialogAt:): Make ret Lisp_Object. Set it from dialog_return when
+ modal loop returns.
+
+2012-08-27 Paul Eggert <eggert@cs.ucla.edu>
+
+ * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
+ * composite.c (find_composition, composition_gstring_p)
+ (composition_reseat_it, find_automatic_composition):
+ * data.c (let_shadows_buffer_binding_p)
+ (let_shadows_global_binding_p, set_internal, make_blv)
+ (Fmake_variable_buffer_local, Fmake_local_variable)
+ (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
+ (cons_to_signed, arith_driver):
+ * dbusbind.c (xd_in_read_queued_messages):
+ * dired.c (directory_files_internal, file_name_completion):
+ Use bool for booleans.
+ * dired.c (file_name_completion):
+ * process.h (fd_callback):
+ Omit int (actually boolean) argument. It wasn't being used.
+ All uses changed.
+ * composite.h, lisp.h: Reflect above API changes.
+
+ * cmds.c, coding.c: Use bool for booleans.
+ * cmds.c (move_point, Fself_insert_command):
+ * coding.h (struct composition status, struct coding_system):
+ * coding.c (detect_coding_utf_8, encode_coding_utf_8)
+ (detect_coding_utf_16, encode_coding_utf_16, detect_coding_emacs_mule)
+ (emacs_mule_char, decode_coding_emacs_mule)
+ (encode_coding_emacs_mule, detect_coding_iso_2022)
+ (decode_coding_iso_2022, encode_invocation_designation)
+ (encode_designation_at_bol, encode_coding_iso_2022)
+ (detect_coding_sjis, detect_coding_big5, decode_coding_sjis)
+ (decode_coding_big5, encode_coding_sjis, encode_coding_big5)
+ (detect_coding_ccl, encode_coding_ccl, decode_coding_raw_text)
+ (encode_coding_raw_text, detect_coding_charset)
+ (decode_coding_charset, encode_coding_charset, detect_eol)
+ (detect_coding, get_translation_table, produce_chars)
+ (consume_chars, reused_workbuf_in_use)
+ (make_conversion_work_buffer, code_conversion_save)
+ (decode_coding_object, encode_coding_object)
+ (detect_coding_system, char_encodable_p)
+ (Funencodable_char_position, code_convert_region)
+ (code_convert_string, code_convert_string_norecord)
+ (Fset_coding_system_priority):
+ * fileio.c (Finsert_file_contents):
+ Use bool for booleans.
+ * coding.h, lisp.h: Reflect above API changes.
+ * coding.c: Remove unnecessary static function decls.
+ (detect_coding): Use unsigned, not signed, to copy an unsigned field.
+ (decode_coding, encode_coding, decode_coding_gap): Return 'void',
+ not a boolean 'int', since callers never look at the return value.
+ (ALLOC_CONVERSION_WORK_AREA): Assume caller returns 'void', not 'int'.
+ * coding.h (decoding_buffer_size, encoding_buffer_size)
+ (emacs_mule_string_char): Remove unused extern decls.
+ (struct iso_2022_spec, struct coding_system):
+ Use 'unsigned int : 1' for boolean fields, since there's more than one.
+ (struct emacs_mule_spec): Remove unused field 'full_support'.
+ All initializations removed.
+ * cmds.c (internal_self_insert): Don't assume EMACS_INT fits in 'int'.
+
+2012-08-27 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix spare memory change (Bug#12286).
+ * alloc.c (mark_maybe_pointer): Handle MEM_TYPE_SPARE.
+ (valid_lisp_object_p): Likewise.
+
+2012-08-27 Martin Rudalics <rudalics@gmx.at>
+
+ * window.c (Fset_window_configuration): Record any window's old
+ buffer if it's replaced (see Bug#8789). If the new current
+ buffer doesn't appear in the selected window, go to its old
+ point (Bug#12208).
+
+2012-08-27 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Special MEM_TYPE_SPARE to denote reserved memory.
+ * alloc.c (enum mem_type): New memory type.
+ (refill_memory_reserve): Use new type for spare memory.
+ This prevents live_cons_p and live_string_p from incorrect
+ detection of uninitialized objects from spare memory as live.
+
+2012-08-26 Paul Eggert <eggert@cs.ucla.edu>
+
+ Spelling fixes.
+ * Makefile.in (.PHONY): versioclean -> versionclean.
+
+ Remove unused external symbols.
+ * data.c (Qcons, Qfloat, Qmisc, Qstring, Qvector):
+ * window.c (Qwindow_valid_p, decode_valid_window):
+ Now static, not extern.
+ * data.c (Qinterval): Remove; unused.
+ (syms_of_data): Do not define 'interval'.
+ * lisp.h (Qinteger, Qstring, Qmisc, Qvector, Qfloat, Qcons):
+ * window.h (decode_valid_window):
+ Remove decls.
+
+ * character.c, charset.c, chartab.c: Use bool for booleans.
+ * character.c (lisp_string_width, string_count_byte8)
+ (string_escape_byte8):
+ * charset.c (charset_map_loaded, load_charset_map, read_hex):
+ (load_charset_map_from_file, map_charset_chars)
+ (Fdefine_charset_internal, define_charset_internal)
+ (Fdeclare_equiv_charset, find_charsets_in_text)
+ (Ffind_charset_region, char_charset, Fiso_charset):
+ * chartab.c (sub_char_table_ref, sub_char_table_ref_and_range)
+ (sub_char_table_set, sub_char_table_set_range)
+ (char_table_set_range, optimize_sub_char_table)
+ (map_sub_char_table):
+ Use bool for boolean.
+ * character.c (str_to_unibyte): Omit last boolean argument; it was
+ always 0. All callers changed.
+ * character.h, charset.h: Adjust to match previous changes.
+ * character.h (char_printable_p): Remove decl of nonexistent function.
+ * charset.h (struct charset): Members code_linear_p, iso_chars_96,
+ ascii_compatible_p, supplementary_p, compact_codes_p, unified_p
+ are all boolean, so make them single-bit bitfields.
+
+ * lisp.h (ASET): Remove attempt to detect side effects.
+ It was meant to be temporary and it often doesn't work,
+ because when IDX has side effects the behavior of IDX==IDX
+ is undefined. See Stefan Monnier in
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00762.html>.
+
+2012-08-26 Barry OReilly <gundaetiapo@gmail.com> (tiny change)
+
+ * lisp.h (functionp): New function (extracted from Ffunctionp).
+ (FUNCTIONP): Use it.
+ * eval.c (Ffunctionp): Use it.
+
+2012-08-25 Paul Eggert <eggert@cs.ucla.edu>
+
+ * xgselect.c (xg_select): Use auto storage for the GPollFD buffer
+ as that's faster and simpler than static storage. Don't bother
+ with the g_main_context_query overhead if g_main_context_pending
+ says no events are pending.
+ (gfds, gfds_size): Remove these static vars.
+ (xgselect_initialize): Remove; no longer needed.
+ All uses and decls removed.
+
+ * emacs.c (fatal_error_signal_hook): Remove.
+ All uses removed. This leftover from old code was always 0.
+
+ * casefiddle.c, casetab.c, category.c: Use bool for boolean.
+ * casefiddle.c (casify_object, casify_region):
+ * casetab.c (set_case_table):
+ * category.c, category.h (word_boundary_p):
+ * category.h (CHAR_HAS_CATEGORY):
+ Use bool for booleans, instead of int.
+
+2012-08-25 Eli Zaretskii <eliz@gnu.org>
+
+ * makefile.w32-in ($(BLD)/alloc.$(O)): Depend on $(GNU_LIB)/execinfo.h.
+
+2012-08-25 Paul Eggert <eggert@cs.ucla.edu>
+
+ On assertion failure, print backtrace if available.
+ * alloc.c [ENABLE_CHECKING]: Include <execinfo.h>.
+ (die) [ENABLE_CHECKING]: Print a backtrace if available.
+ * Makefile.in (LIB_EXECINFO): New macro.
+ (LIBES): Use it.
+
+ * bytecode.c, callint.c, callproc.c: Use bool for boolean.
+ * bytecode.c (exec_byte_code):
+ * callint.c (check_mark, Fcall_interactively):
+ * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1)
+ (getenv_internal, sync_process_alive, call_process_exited):
+ * lisp.h (USE_SAFE_ALLOCA):
+ Use bool for booleans, instead of int.
+ * lisp.h, process.h: Adjust prototypes to match above changes.
+ * callint.c (Fcall_interactively): Don't assume the mark's
+ offset fits in 'int'.
+
+2012-08-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ * buffer.c, buffer.h: Use bool for boolean.
+ * buffer.c (reset_buffer_local_variables)
+ (buffer_lisp_local_variables, Fset_buffer_modified_p)
+ (Frestore_buffer_modified_p, Fset_buffer_multibyte):
+ (overlays_at, overlays_in, mouse_face_overlay_overlaps)
+ (overlay_touches_p, overlay_strings, Foverlay_put)
+ (report_overlay_modification, call_overlay_mod_hooks):
+ (mmap_enlarge, mmap_set_vars):
+ * buffer.h (buffer_has_overlays, uppercasep, lowercasep):
+ Use bool for booleans, instead of int.
+ * buffer.c (compact_buffer, mmap_free_1): Return void, not int,
+ since the 1-or-0 return value is always ignored anyway.
+ (mmap_initialized_p):
+ * buffer.h (struct buffer_text.inhibit_shrinking): Now bool, not int.
+ * buffer.h, lisp.h: Adjust prototypes to match above changes.
+
+2012-08-23 Paul Eggert <eggert@cs.ucla.edu>
+
+ * bidi.c: Use bool for boolean.
+ This is a bit more readable, and makes the text segment of bidi.o
+ 0.4% smaller on my platform (GCC 4.7.1 x86-64, Fedora 15).
+ Presumably it's faster too.
+ (bidi_initialized, bidi_ignore_explicit_marks_for_paragraph_level):
+ Now bool.
+ (bidi_cache_find_level_change, bidi_cache_iterator_state)
+ (bidi_unshelve_cache, bidi_init_it, bidi_count_bytes)
+ (bidi_char_at_pos, bidi_fetch_char, bidi_paragraph_init)
+ (bidi_explicit_dir_char, bidi_level_of_next_char)
+ (bidi_find_other_level_edge, bidi_move_to_visually_next):
+ Use bool for booleans, instead of int.
+ * dispextern.h (bidi_init_it, bidi_paragraph_init)
+ (bidi_unshelve_cache): Adjust decls to match code.
+
+2012-08-23 Martin Rudalics <rudalics@gmx.at>
+
+ * keyboard.c (Fposn_at_x_y): Do not allow internal window as
+ argument.
+
+2012-08-23 Paul Eggert <eggert@cs.ucla.edu>
+
+ * atimer.c, atimer.h (turn_on_atimers): Use bool for boolean.
+ * atimer.h: Include <stdbool.h>.
+
+2012-08-22 Dan Nicolaescu <dann@gnu.org>
+
+ * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to
+ compile time tests instead of run time tests on systems that do
+ not use them.
+ (FRAME_MAC_P): Remove leftover from deleted code.
+ * frame.c (syms_of_frame): Remove leftover from deleted code.
+
+2012-08-22 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.m (insertText:): Don't clear modifiers if code is space.
+
+2012-08-22 Paul Eggert <eggert@cs.ucla.edu>
+
+ * fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
+ Otherwise, the compiler complains about (A?B:C) where B is void
+ and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12.
+ (fontset_add): Return void, for FONTSET_ADD.
+
+2012-08-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ * alloc.c: Use bool for booleans.
+ (gc_in_progress, abort_on_gc)
+ (setjmp_tested_p) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]:
+ (dont_register_blocks) [GC_MALLOC_CHECK]:
+ (suppress_checking) [ENABLE_CHECKING]: Now bool, not int.
+ (check_string_bytes, make_specified_string, memory_full)
+ (live_string_p, live_cons_p, live_symbol_p, live_float_p)
+ (live_misc_p, live_vector_p, live_buffer_p, mark_maybe_object)
+ (mark_stack, valid_pointer_p, make_pure_string)
+ (Fgarbage_collect, survives_gc_p, gc_sweep):
+ Use bool for booleans, instead of int.
+ (test_setjmp) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]:
+ Remove unused local.
+ * alloc.c (PURE_POINTER_P):
+ * lisp.h (STRING_MULTIBYTE): Document that it returns a boolean.
+ * editfns.c (Fformat):
+ * fileio.c (Fexpand_file_name, Fsubstitute_in_file_name)
+ (Fdo_auto_save):
+ * fns.c (sweep_weak_table):
+ * lisp.h (suppress_checking, push_message, survives_gc_p)
+ (make_pure_string, gc_in_progress, abort_on_gc):
+ * lread.c (readchar, read1):
+ * print.c (Fprin1_to_string):
+ * xdisp.c (push_message):
+ Use bool for booleans affected directly or indirectly by
+ alloc.c's changes.
+
+ Make recently-introduced setters macros.
+ * fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii)
+ (set_fontset_base, set_fontset_frame, set_fontset_nofont_face)
+ (set_fontset_default, set_fontset_fallback): Rename from their
+ upper-case counterparts, and make them functions rather than macros.
+ This is more consistent with the other recently-introduced setters.
+ These don't need to be inline, since they're local.
+
+2012-08-21 Jan Djärv <jan.h.d@swipnet.se>
+
+ * nsterm.m (fd_handler:): Alloc and release a NSAutoreleasePool in
+ the loop (Bug#12247).
+
+2012-08-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ * lisp.h (vcopy): Use memcpy rather than our own loop.
+ This fixes a performance regression introduced by the recent
+ addition of vcopy. This means 'vcopy' will need to be modified
+ for a copying collector, but that's OK. Also, tighten the
+ checking in the assertion.
+
+2012-08-21 Eli Zaretskii <eliz@gnu.org>
+
+ * w32uniscribe.c (uniscribe_shape): Fix producing gstring
+ components for RTL text (Bug#11860). Adjust X-OFFSET of each
+ non-base glyph for the width of the base character, according to
+ what x_draw_composite_glyph_string_foreground expects.
+ Generate WADJUST value according to composition_gstring_width's
+ expectations, to produce correct width of the composed character.
+ Reverse the sign of the DU offset produced by ScriptPlace.
+
+2012-08-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ * dbusbind.c (xd_remove_watch): Do not assume C99 comments.
+
+2012-08-21 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Avoid direct writes to contents member of struct Lisp_Vector.
+ * lisp.h (vcopy): New function to copy data into vector.
+ * dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET.
+ * fns.c (Ffillarray): Use ASET.
+ * keyboard.c (timer_check_2): Use AREF and ASET.
+ (append_tool_bar_item, Frecent_keys): Use vcopy.
+ * lread.c (read_vector): Use ASET.
+ * msdos.c (Frecent_doskeys): Use vcopy.
+ * xface.c (Finternal_copy_lisp_face): Use vcopy.
+ (Finternal_merge_in_global_face): Use ASET and vcopy.
+ * xfont.c (xfont_list_pattern): Likewise.
+
+2012-08-21 Martin Rudalics <rudalics@gmx.at>
+
+ * window.c (Fwindow_point): For the selected window always return
+ the position of its buffer's point.
+ (Fset_window_point): For the selected window always go in its
+ buffer to the specified position.
+
+2012-08-21 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Setter macros for fontsets.
+ * fontset.c (SET_FONTSET_ID, SET_FONTSET_NAME, SET_FONTSET_ASCII)
+ (SET_FONTSET_BASE, SET_FONTSET_FRAME, SET_FONTSET_NOFONT_FACE)
+ (SET_FONTSET_DEFAULT, SET_FONTSET_FALLBACK): New macros.
+ Adjust users.
+
+2012-08-20 Glenn Morris <rgm@gnu.org>
+
+ * Makefile.in (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)):
+ Don't assume that `ln -f' works.
+
+2012-08-20 Eli Zaretskii <eliz@gnu.org>
+
+ * .gdbinit: Use "set $dummy = ..." to avoid warnings from GDB 7.5
+ and later about non-assignments with no effect. See discussion at
+ http://sourceware.org/ml/gdb-patches/2012-08/msg00518.html for
+ details.
+
2012-08-20 Dmitry Antipov <dmantipov@yandex.ru>
Inline setter functions for Lisp_Objects slots of struct specbinding.
@@ -42,6 +777,8 @@
Rely on <config.h> + <unistd.h> to declare 'environ',
as gnulib does this if the system doesn't.
* callproc.c, editfns.c, process.c (environ) [!USE_CRT_DLL]:
+ Remove declaration. MS-Windows declares it on stdlib.h which is
+ included by conf_post.h.
* emacs.c (environ) [DOUG_LEA_MALLOC]:
* vm-limit.c (environ) [ORDINARY_LINK]: Remove decl.
* vm-limit.c: Include <unistd.h>, for 'environ'.
diff --git a/src/Makefile.in b/src/Makefile.in
index 01034ca98d5..24c8b94b590 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -159,6 +159,8 @@ DBUS_LIBS = @DBUS_LIBS@
## dbusbind.o if HAVE_DBUS, else empty.
DBUS_OBJ = @DBUS_OBJ@
+LIB_EXECINFO=@LIB_EXECINFO@
+
SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
SETTINGS_LIBS = @SETTINGS_LIBS@
@@ -209,8 +211,8 @@ LIBXMENU=@LIBXMENU@
## xmenu.o if HAVE_X_WINDOWS, else empty.
XMENU_OBJ=@XMENU_OBJ@
-## xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
-## xsettings.o xgselect.o if HAVE_X_WINDOWS, else empty.
+## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if
+## HAVE_X_WINDOWS, else empty.
XOBJ=@XOBJ@
TOOLKIT_LIBW=@TOOLKIT_LIBW@
@@ -245,6 +247,9 @@ WIDGET_OBJ=@WIDGET_OBJ@
## sheap.o if CYGWIN, otherwise empty.
CYGWIN_OBJ=@CYGWIN_OBJ@
+## fontset.o fringe.o image.o if we have any window system
+WINDOW_SYSTEM_OBJ=@WINDOW_SYSTEM_OBJ@
+
## dosfns.o msdos.o w16select.o if MSDOS.
MSDOS_OBJ =
## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS.
@@ -253,7 +258,6 @@ MSDOS_X_OBJ =
ns_appdir=@ns_appdir@
ns_appbindir=@ns_appbindir@
ns_appsrc=@ns_appsrc@
-## fontset.o fringe.o image.o if HAVE_NS, else empty.
NS_OBJ=@NS_OBJ@
## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o if HAVE_NS.
NS_OBJC_OBJ=@NS_OBJC_OBJ@
@@ -338,7 +342,8 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
process.o gnutls.o callproc.o \
region-cache.o sound.o atimer.o thread.o systhread.o \
doprnt.o intervals.o textprop.o composite.o xml.o \
- $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ)
+ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
+ $(WINDOW_SYSTEM_OBJ)
obj = $(base_obj) $(NS_OBJC_OBJ)
## Object files used on some machine or other.
@@ -383,6 +388,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
## with GCC, we might need LIB_GCC again after them.
LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
$(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \
+ $(LIB_EXECINFO) \
$(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
$(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
@@ -402,11 +408,13 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
if test "$(CANNOT_DUMP)" = "yes"; then \
- ln -f temacs$(EXEEXT) emacs$(EXEEXT); \
+ rm -f emacs$(EXEEXT); \
+ ln temacs$(EXEEXT) emacs$(EXEEXT); \
else \
LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
- ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
+ rm -f bootstrap-emacs$(EXEEXT); \
+ ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
fi
## We run make-docfile twice because the command line may get too long
@@ -440,7 +448,7 @@ GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m)
gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES)
@rm -f gl-tmp
- $(libsrc)/make-docfile -d $(srcdir) -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
+ $(libsrc)/make-docfile -d $(srcdir) -g $(obj) > gl-tmp
$(srcdir)/../build-aux/move-if-change gl-tmp globals.h
echo timestamp > $@
@@ -497,7 +505,7 @@ doc.o: buildobj.h
@ns_frag@
.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
-.PHONY: versioclean extraclean frc
+.PHONY: versionclean extraclean frc
mostlyclean:
rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a
@@ -600,7 +608,8 @@ $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
if test "$(CANNOT_DUMP)" = "yes"; then \
- ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
+ rm -f bootstrap-emacs$(EXEEXT); \
+ ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
else \
$(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
diff --git a/src/alloc.c b/src/alloc.c
index a8830684580..859961781e0 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -69,6 +69,9 @@ extern void *sbrk ();
#include <fcntl.h>
+#ifdef USE_GTK
+# include "gtkutil.h"
+#endif
#ifdef WINDOWSNT
#include "w32.h"
#endif
@@ -173,15 +176,15 @@ EMACS_INT gc_relative_threshold;
EMACS_INT memory_full_cons_threshold;
-/* Nonzero during GC. */
+/* True during GC. */
-int gc_in_progress;
+bool gc_in_progress;
-/* Nonzero means abort if try to GC.
+/* True means abort if try to GC.
This is for code which is written on the assumption that
no GC will happen, so as to verify that assumption. */
-int abort_on_gc;
+bool abort_on_gc;
/* Number of live and free conses etc. */
@@ -223,7 +226,7 @@ static ptrdiff_t pure_size;
static ptrdiff_t pure_bytes_used_before_overflow;
-/* Value is non-zero if P points into pure space. */
+/* True if P points into pure space. */
#define PURE_POINTER_P(P) \
((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size)
@@ -305,7 +308,9 @@ enum mem_type
and runtime slowdown. Minor but pointless. */
MEM_TYPE_VECTORLIKE,
/* Special type to denote vector blocks. */
- MEM_TYPE_VECTOR_BLOCK
+ MEM_TYPE_VECTOR_BLOCK,
+ /* Special type to denote reserved memory. */
+ MEM_TYPE_SPARE
};
static void *lisp_malloc (size_t, enum mem_type);
@@ -387,13 +392,13 @@ static struct mem_node mem_z;
static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t);
static void lisp_free (void *);
-static int live_vector_p (struct mem_node *, void *);
-static int live_buffer_p (struct mem_node *, void *);
-static int live_string_p (struct mem_node *, void *);
-static int live_cons_p (struct mem_node *, void *);
-static int live_symbol_p (struct mem_node *, void *);
-static int live_float_p (struct mem_node *, void *);
-static int live_misc_p (struct mem_node *, void *);
+static bool live_vector_p (struct mem_node *, void *);
+static bool live_buffer_p (struct mem_node *, void *);
+static bool live_string_p (struct mem_node *, void *);
+static bool live_cons_p (struct mem_node *, void *);
+static bool live_symbol_p (struct mem_node *, void *);
+static bool live_float_p (struct mem_node *, void *);
+static bool live_misc_p (struct mem_node *, void *);
static void mark_maybe_object (Lisp_Object);
static void mark_memory (void *, void *);
#if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -1232,7 +1237,7 @@ static void (*old_free_hook) (void*, const void*);
#endif
#ifdef GC_MALLOC_CHECK
-static int dont_register_blocks;
+static bool dont_register_blocks;
#endif
static size_t bytes_used_when_reconsidered;
@@ -1819,11 +1824,11 @@ check_sblock (struct sblock *b)
/* Check validity of Lisp strings' string_bytes member. ALL_P
- non-zero means check all strings, otherwise check only most
+ means check all strings, otherwise check only most
recently allocated strings. Used for hunting a bug. */
static void
-check_string_bytes (int all_p)
+check_string_bytes (bool all_p)
{
if (all_p)
{
@@ -2428,9 +2433,9 @@ make_string_from_bytes (const char *contents,
Lisp_Object
make_specified_string (const char *contents,
- ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte)
+ ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
{
- register Lisp_Object val;
+ Lisp_Object val;
if (nchars < 0)
{
@@ -3085,7 +3090,7 @@ sweep_vectors (void)
for (block = vector_blocks; block; block = *bprev)
{
- int free_this_block = 0;
+ bool free_this_block = 0;
for (vector = (struct Lisp_Vector *) block->data;
VECTOR_IN_BLOCK (vector, block); vector = next)
@@ -3751,7 +3756,7 @@ void
memory_full (size_t nbytes)
{
/* Do not go into hysterics merely because a large request failed. */
- int enough_free_memory = 0;
+ bool enough_free_memory = 0;
if (SPARE_MEMORY < nbytes)
{
void *p;
@@ -3814,22 +3819,22 @@ refill_memory_reserve (void)
spare_memory[0] = malloc (SPARE_MEMORY);
if (spare_memory[1] == 0)
spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block),
- MEM_TYPE_CONS);
+ MEM_TYPE_SPARE);
if (spare_memory[2] == 0)
spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block),
- MEM_TYPE_CONS);
+ MEM_TYPE_SPARE);
if (spare_memory[3] == 0)
spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block),
- MEM_TYPE_CONS);
+ MEM_TYPE_SPARE);
if (spare_memory[4] == 0)
spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block),
- MEM_TYPE_CONS);
+ MEM_TYPE_SPARE);
if (spare_memory[5] == 0)
spare_memory[5] = lisp_malloc (sizeof (struct string_block),
- MEM_TYPE_STRING);
+ MEM_TYPE_SPARE);
if (spare_memory[6] == 0)
spare_memory[6] = lisp_malloc (sizeof (struct string_block),
- MEM_TYPE_STRING);
+ MEM_TYPE_SPARE);
if (spare_memory[0] && spare_memory[1] && spare_memory[5])
Vmemory_full = Qnil;
#endif
@@ -4244,7 +4249,7 @@ mem_delete_fixup (struct mem_node *x)
/* Value is non-zero if P is a pointer to a live Lisp string on
the heap. M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_string_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_STRING)
@@ -4267,7 +4272,7 @@ live_string_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live Lisp cons on
the heap. M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_cons_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_CONS)
@@ -4293,7 +4298,7 @@ live_cons_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live Lisp symbol on
the heap. M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_symbol_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_SYMBOL)
@@ -4319,7 +4324,7 @@ live_symbol_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live Lisp float on
the heap. M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_float_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_FLOAT)
@@ -4343,7 +4348,7 @@ live_float_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live Lisp Misc on
the heap. M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_misc_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_MISC)
@@ -4369,7 +4374,7 @@ live_misc_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live vector-like object.
M is a pointer to the mem_block for P. */
-static inline int
+static inline bool
live_vector_p (struct mem_node *m, void *p)
{
if (m->type == MEM_TYPE_VECTOR_BLOCK)
@@ -4405,7 +4410,7 @@ live_vector_p (struct mem_node *m, void *p)
/* Value is non-zero if P is a pointer to a live buffer. M is a
pointer to the mem_block for P. */
-static inline int
+static inline bool
live_buffer_p (struct mem_node *m, void *p)
{
/* P must point to the start of the block, and the buffer
@@ -4485,7 +4490,7 @@ mark_maybe_object (Lisp_Object obj)
if (m != MEM_NIL)
{
- int mark_p = 0;
+ bool mark_p = 0;
switch (XTYPE (obj))
{
@@ -4559,6 +4564,7 @@ mark_maybe_pointer (void *p)
switch (m->type)
{
case MEM_TYPE_NON_LISP:
+ case MEM_TYPE_SPARE:
/* Nothing to do; not a pointer to Lisp memory. */
break;
@@ -4705,7 +4711,8 @@ mark_memory (void *start, void *end)
#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
-static int setjmp_tested_p, longjmps_done;
+static bool setjmp_tested_p;
+static int longjmps_done;
#define SETJMP_WILL_LIKELY_WORK "\
\n\
@@ -4749,14 +4756,13 @@ test_setjmp (void)
char buf[10];
register int x;
jmp_buf jbuf;
- int result = 0;
/* Arrange for X to be put in a register. */
sprintf (buf, "1");
x = strlen (buf);
x = 2 * x - 1;
- setjmp (jbuf);
+ _setjmp (jbuf);
if (longjmps_done == 1)
{
/* Came here after the longjmp at the end of the function.
@@ -4781,7 +4787,7 @@ test_setjmp (void)
++longjmps_done;
x = 2;
if (longjmps_done == 1)
- longjmp (jbuf, 1);
+ _longjmp (jbuf, 1);
}
#endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */
@@ -4908,7 +4914,7 @@ flush_stack_call_func (void (*func) (void *arg), void *arg)
Lisp_Object o;
jmp_buf j;
} j;
- volatile int stack_grows_down_p = (char *) &j > (char *) stack_bottom;
+ volatile bool stack_grows_down_p = (char *) &j > (char *) stack_bottom;
#endif
/* This trick flushes the register windows so that all the state of
the process is contained in the stack. */
@@ -4942,7 +4948,7 @@ flush_stack_call_func (void (*func) (void *arg), void *arg)
}
#endif /* GC_SETJMP_WORKS */
- setjmp (j.j);
+ _setjmp (j.j);
end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
#endif /* not GC_SAVE_REGISTERS_ON_STACK */
#endif /* not HAVE___BUILTIN_UNWIND_INIT */
@@ -4970,7 +4976,7 @@ valid_pointer_p (void *p)
if (pipe (fd) == 0)
{
- int valid = (emacs_write (fd[1], (char *) p, 16) == 16);
+ bool valid = emacs_write (fd[1], (char *) p, 16) == 16;
emacs_close (fd[1]);
emacs_close (fd[0]);
return valid;
@@ -5022,6 +5028,7 @@ valid_lisp_object_p (Lisp_Object obj)
switch (m->type)
{
case MEM_TYPE_NON_LISP:
+ case MEM_TYPE_SPARE:
return 0;
case MEM_TYPE_BUFFER:
@@ -5191,7 +5198,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
/* Return a string allocated in pure space. DATA is a buffer holding
NCHARS characters, and NBYTES bytes of string data. MULTIBYTE
- non-zero means make the result string multibyte.
+ means make the result string multibyte.
Must get an error if pure storage is full, since if it cannot hold
a large string it may be able to hold conses that point to that
@@ -5199,7 +5206,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
Lisp_Object
make_pure_string (const char *data,
- ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte)
+ ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
{
Lisp_Object string;
struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
@@ -5394,11 +5401,11 @@ returns nil, because real GC can't be done.
See Info node `(elisp)Garbage Collection'. */)
(void)
{
- register struct specbinding *bind;
- register struct buffer *nextb;
+ struct specbinding *bind;
+ struct buffer *nextb;
char stack_top_variable;
ptrdiff_t i;
- int message_p;
+ bool message_p;
ptrdiff_t count = SPECPDL_INDEX ();
EMACS_TIME start;
Lisp_Object retval = Qnil;
@@ -5473,13 +5480,9 @@ See Info node `(elisp)Garbage Collection'. */)
mark_threads ();
mark_terminals ();
mark_kboards ();
- mark_ttys ();
#ifdef USE_GTK
- {
- extern void xg_mark_data (void);
- xg_mark_data ();
- }
+ xg_mark_data ();
#endif
#ifdef HAVE_WINDOW_SYSTEM
@@ -6181,10 +6184,10 @@ mark_terminals (void)
/* Value is non-zero if OBJ will survive the current GC because it's
either marked or does not need to be marked to survive. */
-int
+bool
survives_gc_p (Lisp_Object obj)
{
- int survives_p;
+ bool survives_p;
switch (XTYPE (obj))
{
@@ -6429,7 +6432,7 @@ gc_sweep (void)
/* Check if the symbol was created during loadup. In such a case
it might be pointed to by pure bytecode which we don't trace,
so we conservatively assume that it is live. */
- int pure_p = PURE_POINTER_P (XSTRING (sym->s.name));
+ bool pure_p = PURE_POINTER_P (XSTRING (sym->s.name));
if (!sym->s.gcmarkbit && !pure_p)
{
@@ -6654,13 +6657,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
}
#ifdef ENABLE_CHECKING
-int suppress_checking;
+
+# include <execinfo.h>
+
+bool suppress_checking;
void
die (const char *msg, const char *file, int line)
{
+ enum { NPOINTERS_MAX = 500 };
+ void *buffer[NPOINTERS_MAX];
+ int npointers;
fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
file, line, msg);
+ npointers = backtrace (buffer, NPOINTERS_MAX);
+ backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
abort ();
}
#endif
diff --git a/src/atimer.c b/src/atimer.c
index d67e1375f9a..eb3136ae55d 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -408,7 +408,7 @@ do_pending_atimers (void)
some systems like HPUX (see process.c). */
void
-turn_on_atimers (int on)
+turn_on_atimers (bool on)
{
if (on)
{
diff --git a/src/atimer.h b/src/atimer.h
index 4282bab49ba..6d441d71641 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define EMACS_ATIMER_H
#include "systime.h" /* for EMACS_TIME */
+#include <stdbool.h>
/* Forward declaration. */
@@ -74,7 +75,7 @@ struct atimer *start_atimer (enum atimer_type, EMACS_TIME,
void cancel_atimer (struct atimer *);
void do_pending_atimers (void);
void init_atimer (void);
-void turn_on_atimers (int);
+void turn_on_atimers (bool);
void stop_other_atimers (struct atimer *);
Lisp_Object unwind_stop_other_atimers (Lisp_Object);
diff --git a/src/bidi.c b/src/bidi.c
index 4df585d4f48..6b3ac53d318 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -63,7 +63,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "buffer.h"
#include "dispextern.h"
-static int bidi_initialized = 0;
+static bool bidi_initialized = 0;
static Lisp_Object bidi_type_table, bidi_mirror_table;
@@ -82,10 +82,10 @@ typedef enum {
/* UAX#9 says to search only for L, AL, or R types of characters, and
ignore RLE, RLO, LRE, and LRO, when determining the base paragraph
level. Yudit indeed ignores them. This variable is therefore set
- by default to ignore them, but setting it to zero will take them
- into account. */
-extern int bidi_ignore_explicit_marks_for_paragraph_level EXTERNALLY_VISIBLE;
-int bidi_ignore_explicit_marks_for_paragraph_level = 1;
+ by default to ignore them, but clearing it will take them into
+ account. */
+extern bool bidi_ignore_explicit_marks_for_paragraph_level EXTERNALLY_VISIBLE;
+bool bidi_ignore_explicit_marks_for_paragraph_level = 1;
static Lisp_Object paragraph_start_re, paragraph_separate_re;
static Lisp_Object Qparagraph_start, Qparagraph_separate;
@@ -438,7 +438,7 @@ bidi_cache_search (ptrdiff_t charpos, int level, int dir)
that is lower than LEVEL, and return its cache slot index. DIR is
the direction to search, starting with the last used cache slot.
If DIR is zero, we search backwards from the last occupied cache
- slot. BEFORE, if non-zero, means return the index of the slot that
+ slot. BEFORE means return the index of the slot that
is ``before'' the level change in the search direction. That is,
given the cached levels like this:
@@ -448,9 +448,9 @@ bidi_cache_search (ptrdiff_t charpos, int level, int dir)
and assuming we are at the position cached at the slot marked with
C, searching backwards (DIR = -1) for LEVEL = 2 will return the
index of slot B or A, depending whether BEFORE is, respectively,
- non-zero or zero. */
+ true or false. */
static ptrdiff_t
-bidi_cache_find_level_change (int level, int dir, int before)
+bidi_cache_find_level_change (int level, int dir, bool before)
{
if (bidi_cache_idx)
{
@@ -512,7 +512,7 @@ bidi_cache_ensure_space (ptrdiff_t idx)
}
static inline void
-bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
+bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
{
ptrdiff_t idx;
@@ -690,11 +690,11 @@ bidi_shelve_cache (void)
/* Restore the cache state from a copy stashed away by
bidi_shelve_cache, and free the buffer used to stash that copy.
- JUST_FREE non-zero means free the buffer, but don't restore the
+ JUST_FREE means free the buffer, but don't restore the
cache; used when the corresponding iterator is discarded instead of
being restored. */
void
-bidi_unshelve_cache (void *databuf, int just_free)
+bidi_unshelve_cache (void *databuf, bool just_free)
{
unsigned char *p = databuf;
@@ -802,7 +802,7 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it)
/* Initialize the bidi iterator from buffer/string position CHARPOS. */
void
-bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p,
+bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, bool frame_window_p,
struct bidi_it *bidi_it)
{
if (! bidi_initialized)
@@ -872,11 +872,10 @@ bidi_line_init (struct bidi_it *bidi_it)
/* Count bytes in string S between BEG/BEGBYTE and END. BEG and END
are zero-based character positions in S, BEGBYTE is byte position
- corresponding to BEG. UNIBYTE, if non-zero, means S is a unibyte
- string. */
+ corresponding to BEG. UNIBYTE means S is a unibyte string. */
static inline ptrdiff_t
bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
- const ptrdiff_t begbyte, const ptrdiff_t end, int unibyte)
+ const ptrdiff_t begbyte, const ptrdiff_t end, bool unibyte)
{
ptrdiff_t pos = beg;
const unsigned char *p = s + begbyte, *start = p;
@@ -900,10 +899,10 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
/* Fetch and returns the character at byte position BYTEPOS. If S is
non-NULL, fetch the character from string S; otherwise fetch the
- character from the current buffer. UNIBYTE non-zero means S is a
+ character from the current buffer. UNIBYTE means S is a
unibyte string. */
static inline int
-bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
+bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
{
if (s)
{
@@ -923,9 +922,9 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
specifies the character position of the next display string, or -1
if not yet computed. When the next character is at or beyond that
position, the function updates DISP_POS with the position of the
- next display string. DISP_PROP non-zero means that there's really
+ next display string. *DISP_PROP non-zero means that there's really
a display string at DISP_POS, as opposed to when we searched till
- DISP_POS without finding one. If DISP_PROP is 2, it means the
+ DISP_POS without finding one. If *DISP_PROP is 2, it means the
display spec is of the form `(space ...)', which is replaced with
u+2029 to handle it as a paragraph separator. STRING->s is the C
string to iterate, or NULL if iterating over a buffer or a Lisp
@@ -933,7 +932,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
static inline int
bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
int *disp_prop, struct bidi_string_data *string,
- int frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
+ bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
{
int ch;
ptrdiff_t endpos
@@ -1134,7 +1133,7 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
R2L, just use that. Otherwise, determine the paragraph direction
from the first strong directional character of the paragraph.
- NO_DEFAULT_P non-zero means don't default to L2R if the paragraph
+ NO_DEFAULT_P means don't default to L2R if the paragraph
has no strong directional characters and both DIR and
bidi_it->paragraph_dir are NEUTRAL_DIR. In that case, search back
in the buffer until a paragraph is found with a strong character,
@@ -1145,10 +1144,10 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
direction as the preceding paragraph, even though Emacs generally
views the separator as not belonging to any paragraph. */
void
-bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
+bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
{
ptrdiff_t bytepos = bidi_it->bytepos;
- int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring);
+ bool string_p = bidi_it->string.s || STRINGP (bidi_it->string.lstring);
ptrdiff_t pstartbyte;
/* Note that begbyte is a byte position, while end is a character
position. Yes, this is ugly, but we are trying to avoid costly
@@ -1221,8 +1220,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
bidi_it->separator_limit = -1;
bidi_it->new_paragraph = 0;
- /* The following loop is run more than once only if NO_DEFAULT_P
- is non-zero, and only if we are iterating on a buffer. */
+ /* The following loop is run more than once only if NO_DEFAULT_P,
+ and only if we are iterating on a buffer. */
do {
ptrdiff_t pos1;
@@ -1320,7 +1319,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
The rest of this file constitutes the core of the UBA implementation.
***********************************************************************/
-static inline int
+static inline bool
bidi_explicit_dir_char (int ch)
{
bidi_type_t ch_type;
@@ -1345,7 +1344,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
int current_level;
int new_level;
bidi_dir_t override;
- int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring);
+ bool string_p = bidi_it->string.s || STRINGP (bidi_it->string.lstring);
/* If reseat()'ed, don't advance, so as to start iteration from the
position where we were reseated. bidi_it->bytepos can be less
@@ -2189,7 +2188,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
ptrdiff_t nc = bidi_it->nchars;
struct bidi_string_data bs = bidi_it->string;
bidi_type_t chtype;
- int fwp = bidi_it->frame_window_p;
+ bool fwp = bidi_it->frame_window_p;
int dpp = bidi_it->disp_prop;
if (bidi_it->nchars <= 0)
@@ -2268,8 +2267,8 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
return level;
}
-/* Move to the other edge of a level given by LEVEL. If END_FLAG is
- non-zero, we are at the end of a level, and we need to prepare to
+/* Move to the other edge of a level given by LEVEL. If END_FLAG,
+ we are at the end of a level, and we need to prepare to
resume the scan of the lower level.
If this level's other edge is cached, we simply jump to it, filling
@@ -2289,7 +2288,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
function moves to point C, whereas the UAX#9 ``level 2 run'' ends
at point B. */
static void
-bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, int end_flag)
+bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag)
{
int dir = end_flag ? -bidi_it->scan_dir : bidi_it->scan_dir;
ptrdiff_t idx;
@@ -2363,7 +2362,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
scanning the text whenever we find a level change. */
if (new_level != old_level)
{
- int ascending = new_level > old_level;
+ bool ascending = new_level > old_level;
int level_to_search = ascending ? old_level + 1 : old_level;
int incr = ascending ? 1 : -1;
int expected_next_level = old_level + incr;
diff --git a/src/buffer.c b/src/buffer.c
index 6f748158e21..ef87f40e81a 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -108,10 +108,10 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
int last_per_buffer_idx;
static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
- int after, Lisp_Object arg1,
+ bool after, Lisp_Object arg1,
Lisp_Object arg2, Lisp_Object arg3);
static void swap_out_buffer_local_variables (struct buffer *b);
-static void reset_buffer_local_variables (struct buffer *b, int permanent_too);
+static void reset_buffer_local_variables (struct buffer *, bool);
/* Alist of all buffer names vs the buffers. */
/* This used to be a variable, but is no longer,
@@ -153,7 +153,7 @@ static void alloc_buffer_text (struct buffer *, ptrdiff_t);
static void free_buffer_text (struct buffer *b);
static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
-static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
+static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
/* These setters are used only in this file, so they can be private. */
static inline void
@@ -977,15 +977,13 @@ reset_buffer (register struct buffer *b)
it does not treat permanent locals consistently.
Instead, use Fkill_all_local_variables.
- If PERMANENT_TOO is 1, then we reset permanent
- buffer-local variables. If PERMANENT_TOO is 0,
- we preserve those. */
+ If PERMANENT_TOO, reset permanent buffer-local variables.
+ If not, preserve those. */
static void
-reset_buffer_local_variables (register struct buffer *b, int permanent_too)
+reset_buffer_local_variables (struct buffer *b, bool permanent_too)
{
- register int offset;
- int i;
+ int offset, i;
/* Reset the major mode to Fundamental, together with all the
things that depend on the major mode.
@@ -1251,14 +1249,14 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
/* Return an alist of the Lisp-level buffer-local bindings of
buffer BUF. That is, don't include the variables maintained
in special slots in the buffer object.
- If CLONE is zero elements of the form (VAR . unbound) are replaced
+ If not CLONE, replace elements of the form (VAR . unbound)
by VAR. */
static Lisp_Object
-buffer_lisp_local_variables (struct buffer *buf, int clone)
+buffer_lisp_local_variables (struct buffer *buf, bool clone)
{
Lisp_Object result = Qnil;
- register Lisp_Object tail;
+ Lisp_Object tail;
for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
{
Lisp_Object val, elt;
@@ -1349,11 +1347,9 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
1, 1, 0,
doc: /* Mark current buffer as modified or unmodified according to FLAG.
A non-nil FLAG means mark the buffer modified. */)
- (register Lisp_Object flag)
+ (Lisp_Object flag)
{
- register int already;
- register Lisp_Object fn;
- Lisp_Object buffer, window;
+ Lisp_Object fn, buffer, window;
#ifdef CLASH_DETECTION
/* If buffer becoming modified, lock the file.
@@ -1363,7 +1359,7 @@ A non-nil FLAG means mark the buffer modified. */)
/* Test buffer-file-name so that binding it to nil is effective. */
if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
{
- already = SAVE_MODIFF < MODIFF;
+ bool already = SAVE_MODIFF < MODIFF;
if (!already && !NILP (flag))
lock_file (fn);
else if (already && NILP (flag))
@@ -1430,7 +1426,7 @@ state of the current buffer. Use with care. */)
/* Test buffer-file-name so that binding it to nil is effective. */
if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
{
- int already = SAVE_MODIFF < MODIFF;
+ bool already = SAVE_MODIFF < MODIFF;
if (!already && !NILP (flag))
lock_file (fn);
else if (already && NILP (flag))
@@ -1555,7 +1551,6 @@ list first, followed by the list of all buffers. If no other buffer
exists, return the buffer `*scratch*' (creating it if necessary). */)
(register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
{
- Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
Lisp_Object tail, buf, pred;
Lisp_Object notsogood = Qnil;
@@ -1626,7 +1621,6 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
Lisp_Object
other_buffer_safely (Lisp_Object buffer)
{
- Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
Lisp_Object tail, buf;
tail = Vbuffer_alist;
@@ -1674,7 +1668,7 @@ No argument or nil as argument means do this for the current buffer. */)
/* Truncate undo list and shrink the gap of BUFFER. */
-int
+void
compact_buffer (struct buffer *buffer)
{
/* Verify indirection counters. */
@@ -1716,9 +1710,7 @@ compact_buffer (struct buffer *buffer)
}
}
buffer->text->compact = buffer->text->modiff;
- return 1;
}
- return 0;
}
DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
@@ -2068,8 +2060,10 @@ the current buffer's major mode. */)
CHECK_BUFFER (buffer);
- if (STRINGP (BVAR (XBUFFER (buffer), name))
- && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
+ if (NILP (BVAR (XBUFFER (buffer), name)))
+ error ("Attempt to set major mode for a dead buffer");
+
+ if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
function = find_symbol_value (intern ("initial-major-mode"));
else
{
@@ -2103,22 +2097,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
XSETBUFFER (buf, current_buffer);
return buf;
}
-
-/* Set the current buffer to B.
-
- We previously set windows_or_buffers_changed here to invalidate
- global unchanged information in beg_unchanged and end_unchanged.
- This is no longer necessary because we now compute unchanged
- information on a buffer-basis. Every action affecting other
- windows than the selected one requires a select_window at some
- time, and that increments windows_or_buffers_changed. */
-
-void
-set_buffer_internal (register struct buffer *b)
-{
- if (current_buffer != b)
- set_buffer_internal_1 (b);
-}
/* Set the current buffer to B, and do not set windows_or_buffers_changed.
This is used by redisplay. */
@@ -2224,13 +2202,13 @@ ends when the current command terminates. Use `switch-to-buffer' or
return buffer;
}
-/* Set the current buffer to BUFFER provided it is alive. */
+/* Set the current buffer to BUFFER provided if it is alive. */
Lisp_Object
set_buffer_if_live (Lisp_Object buffer)
{
if (! NILP (BVAR (XBUFFER (buffer), name)))
- Fset_buffer (buffer);
+ set_buffer_internal (XBUFFER (buffer));
return Qnil;
}
@@ -2469,8 +2447,8 @@ current buffer is cleared. */)
struct Lisp_Marker *tail, *markers;
struct buffer *other;
ptrdiff_t begv, zv;
- int narrowed = (BEG != BEGV || Z != ZV);
- int modified_p = !NILP (Fbuffer_modified_p (Qnil));
+ bool narrowed = (BEG != BEGV || Z != ZV);
+ bool modified_p = !NILP (Fbuffer_modified_p (Qnil));
Lisp_Object old_undo = BVAR (current_buffer, undo_list);
struct gcpro gcpro1;
@@ -2819,19 +2797,19 @@ swap_out_buffer_local_variables (struct buffer *b)
*VEC_PTR and *LEN_PTR should contain a valid vector and size
when this function is called.
- If EXTEND is non-zero, we make the vector bigger if necessary.
- If EXTEND is zero, we never extend the vector,
- and we store only as many overlays as will fit.
- But we still return the total number of overlays.
+ If EXTEND, make the vector bigger if necessary.
+ If not, never extend the vector,
+ and store only as many overlays as will fit.
+ But still return the total number of overlays.
- If CHANGE_REQ is true, then any position written into *PREV_PTR or
+ If CHANGE_REQ, any position written into *PREV_PTR or
*NEXT_PTR is guaranteed to be not equal to POS, unless it is the
default (BEGV or ZV). */
ptrdiff_t
-overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
+overlays_at (EMACS_INT pos, bool extend, Lisp_Object **vec_ptr,
ptrdiff_t *len_ptr,
- ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req)
+ ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, bool change_req)
{
Lisp_Object overlay, start, end;
struct Lisp_Overlay *tail;
@@ -2840,7 +2818,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
Lisp_Object *vec = *vec_ptr;
ptrdiff_t next = ZV;
ptrdiff_t prev = BEGV;
- int inhibit_storing = 0;
+ bool inhibit_storing = 0;
for (tail = current_buffer->overlays_before; tail; tail = tail->next)
{
@@ -2957,13 +2935,13 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
*VEC_PTR and *LEN_PTR should contain a valid vector and size
when this function is called.
- If EXTEND is non-zero, we make the vector bigger if necessary.
- If EXTEND is zero, we never extend the vector,
- and we store only as many overlays as will fit.
- But we still return the total number of overlays. */
+ If EXTEND, make the vector bigger if necessary.
+ If not, never extend the vector,
+ and store only as many overlays as will fit.
+ But still return the total number of overlays. */
static ptrdiff_t
-overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
+overlays_in (EMACS_INT beg, EMACS_INT end, bool extend,
Lisp_Object **vec_ptr, ptrdiff_t *len_ptr,
ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr)
{
@@ -2974,8 +2952,8 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
Lisp_Object *vec = *vec_ptr;
ptrdiff_t next = ZV;
ptrdiff_t prev = BEGV;
- int inhibit_storing = 0;
- int end_is_Z = end == Z;
+ bool inhibit_storing = 0;
+ bool end_is_Z = end == Z;
for (tail = current_buffer->overlays_before; tail; tail = tail->next)
{
@@ -3076,10 +3054,10 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
}
-/* Return non-zero if there exists an overlay with a non-nil
+/* Return true if there exists an overlay with a non-nil
`mouse-face' property overlapping OVERLAY. */
-int
+bool
mouse_face_overlay_overlaps (Lisp_Object overlay)
{
ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay));
@@ -3108,7 +3086,7 @@ mouse_face_overlay_overlaps (Lisp_Object overlay)
/* Fast function to just test if we're at an overlay boundary. */
-int
+bool
overlay_touches_p (ptrdiff_t pos)
{
Lisp_Object overlay;
@@ -3325,7 +3303,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
Lisp_Object overlay, window, str;
struct Lisp_Overlay *ov;
ptrdiff_t startpos, endpos;
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
overlay_heads.used = overlay_heads.bytes = 0;
overlay_tails.used = overlay_tails.bytes = 0;
@@ -4093,6 +4071,26 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
return unbind_to (count, Qnil);
}
+
+DEFUN ("delete-all-overlays", Fdelete_all_overlays, Sdelete_all_overlays, 0, 1, 0,
+ doc: /* Delete all overlays of BUFFER.
+BUFFER omitted or nil means delete all overlays of the current
+buffer. */)
+ (Lisp_Object buffer)
+{
+ register struct buffer *buf;
+
+ if (NILP (buffer))
+ buf = current_buffer;
+ else
+ {
+ CHECK_BUFFER (buffer);
+ buf = XBUFFER (buffer);
+ }
+
+ delete_all_overlays (buf);
+ return Qnil;
+}
/* Overlay dissection functions. */
@@ -4319,7 +4317,7 @@ VALUE will be returned.*/)
(Lisp_Object overlay, Lisp_Object prop, Lisp_Object value)
{
Lisp_Object tail, buffer;
- int changed;
+ bool changed;
CHECK_OVERLAY (overlay);
@@ -4394,7 +4392,7 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
and the insert-after-hooks of overlay ending at START.
This is called both before and after the modification.
- AFTER is nonzero when we call after the modification.
+ AFTER is true when we call after the modification.
ARG1, ARG2, ARG3 are arguments to pass to the hook functions.
When AFTER is nonzero, they are the start position,
@@ -4402,13 +4400,13 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
and the length of deleted or replaced old text. */
void
-report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
+report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
{
Lisp_Object prop, overlay;
struct Lisp_Overlay *tail;
- /* 1 if this change is an insertion. */
- int insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
+ /* True if this change is an insertion. */
+ bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
overlay = Qnil;
@@ -4528,7 +4526,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
}
static void
-call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after,
+call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after,
Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
{
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -4687,7 +4685,7 @@ static int mmap_page_size;
/* 1 means mmap has been initialized. */
-static int mmap_initialized_p;
+static bool mmap_initialized_p;
/* Value is X rounded up to the next multiple of N. */
@@ -4783,9 +4781,9 @@ mmap_find (void *start, void *end)
/* Unmap a region. P is a pointer to the start of the user-araa of
- the region. Value is non-zero if successful. */
+ the region. */
-static int
+static void
mmap_free_1 (struct mmap_region *r)
{
if (r->next)
@@ -4796,24 +4794,19 @@ mmap_free_1 (struct mmap_region *r)
mmap_regions = r->next;
if (munmap (r, r->nbytes_mapped) == -1)
- {
- fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
- return 0;
- }
-
- return 1;
+ fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
}
/* Enlarge region R by NPAGES pages. NPAGES < 0 means shrink R.
- Value is non-zero if successful. */
+ Value is true if successful. */
-static int
+static bool
mmap_enlarge (struct mmap_region *r, int npages)
{
char *region_end = (char *) r + r->nbytes_mapped;
size_t nbytes;
- int success = 0;
+ bool success = 0;
if (npages < 0)
{
@@ -4863,17 +4856,16 @@ mmap_enlarge (struct mmap_region *r, int npages)
}
-/* Set or reset variables holding references to mapped regions. If
- RESTORE_P is zero, set all variables to null. If RESTORE_P is
- non-zero, set all variables to the start of the user-areas
- of mapped regions.
+/* Set or reset variables holding references to mapped regions.
+ If not RESTORE_P, set all variables to null. If RESTORE_P, set all
+ variables to the start of the user-areas of mapped regions.
This function is called from Fdump_emacs to ensure that the dumped
Emacs doesn't contain references to memory that won't be mapped
when Emacs starts. */
void
-mmap_set_vars (int restore_p)
+mmap_set_vars (bool restore_p)
{
struct mmap_region *r;
@@ -6312,6 +6304,7 @@ and `bury-buffer-internal'. */);
defsubr (&Soverlayp);
defsubr (&Smake_overlay);
defsubr (&Sdelete_overlay);
+ defsubr (&Sdelete_all_overlays);
defsubr (&Smove_overlay);
defsubr (&Soverlay_start);
defsubr (&Soverlay_end);
diff --git a/src/buffer.h b/src/buffer.h
index de7ca7eb2e7..e603486418b 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -471,7 +471,7 @@ struct buffer_text
/* Usually 0. Temporarily set to 1 in decode_coding_gap to
prevent Fgarbage_collect from shrinking the gap and losing
not-yet-decoded bytes. */
- int inhibit_shrinking;
+ bool inhibit_shrinking;
};
/* Most code should use this macro to access Lisp fields in struct buffer. */
@@ -1002,23 +1002,46 @@ extern struct buffer buffer_local_symbols;
extern void delete_all_overlays (struct buffer *);
extern void reset_buffer (struct buffer *);
-extern int compact_buffer (struct buffer *);
+extern void compact_buffer (struct buffer *);
extern void evaporate_overlays (ptrdiff_t);
-extern ptrdiff_t overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
- ptrdiff_t *len_ptr, ptrdiff_t *next_ptr,
- ptrdiff_t *prev_ptr, int change_req);
+extern ptrdiff_t overlays_at (EMACS_INT, bool, Lisp_Object **,
+ ptrdiff_t *, ptrdiff_t *, ptrdiff_t *, bool);
extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *);
extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **);
extern void validate_region (Lisp_Object *, Lisp_Object *);
-extern void set_buffer_internal (struct buffer *);
extern void set_buffer_internal_1 (struct buffer *);
extern void set_buffer_temp (struct buffer *);
extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
extern void record_buffer (Lisp_Object);
extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int);
extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
-extern void mmap_set_vars (int);
+extern void mmap_set_vars (bool);
+
+/* Set the current buffer to B.
+
+ We previously set windows_or_buffers_changed here to invalidate
+ global unchanged information in beg_unchanged and end_unchanged.
+ This is no longer necessary because we now compute unchanged
+ information on a buffer-basis. Every action affecting other
+ windows than the selected one requires a select_window at some
+ time, and that increments windows_or_buffers_changed. */
+
+BUFFER_INLINE void
+set_buffer_internal (struct buffer *b)
+{
+ if (current_buffer != b)
+ set_buffer_internal_1 (b);
+}
+
+/* Arrange to go back to the original buffer after the next
+ call to unbind_to if the original buffer is still alive. */
+
+BUFFER_INLINE void
+record_unwind_current_buffer (void)
+{
+ record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+}
/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
If NEXTP is non-NULL, return next overlay there.
@@ -1063,7 +1086,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i)
/* Non-zero if current buffer has overlays. */
-BUFFER_INLINE int
+BUFFER_INLINE bool
buffer_has_overlays (void)
{
return current_buffer->overlays_before || current_buffer->overlays_after;
@@ -1239,7 +1262,7 @@ downcase (int c)
}
/* 1 if C is upper case. */
-BUFFER_INLINE int uppercasep (int c) { return downcase (c) != c; }
+BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; }
/* Upcase a character C known to be not upper case. */
BUFFER_INLINE int
@@ -1251,8 +1274,11 @@ upcase1 (int c)
}
/* 1 if C is lower case. */
-BUFFER_INLINE int lowercasep (int c)
-{ return !uppercasep (c) && upcase1 (c) != c; }
+BUFFER_INLINE bool
+lowercasep (int c)
+{
+ return !uppercasep (c) && upcase1 (c) != c;
+}
/* Upcase a character C, or make no change if that cannot be done. */
BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); }
diff --git a/src/bytecode.c b/src/bytecode.c
index d61e37d7886..be5b7ea6137 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -550,7 +550,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
if (INTEGERP (args_template))
{
ptrdiff_t at = XINT (args_template);
- int rest = at & 128;
+ bool rest = (at & 128) != 0;
int mandatory = at & 127;
ptrdiff_t nonrest = at >> 8;
eassert (mandatory <= nonrest);
@@ -1048,7 +1048,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
CASE (Bsave_current_buffer): /* Obsolete since ??. */
CASE (Bsave_current_buffer_1):
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
NEXT;
CASE (Bsave_window_excursion): /* Obsolete since 24.1. */
diff --git a/src/callint.c b/src/callint.c
index 36a59e812f2..b11545ddea2 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -150,7 +150,7 @@ static const char *callint_argfuns[]
= {"", "point", "mark", "region-beginning", "region-end"};
static void
-check_mark (int for_region)
+check_mark (bool for_region)
{
Lisp_Object tem;
tem = Fmarker_buffer (BVAR (current_buffer, mark));
@@ -273,11 +273,11 @@ invoke it. If KEYS is omitted or nil, the return value of
signed char *varies;
ptrdiff_t i, nargs;
- int foo;
- int arg_from_tty = 0;
+ ptrdiff_t mark;
+ bool arg_from_tty = 0;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
ptrdiff_t key_count;
- int record_then_fail = 0;
+ bool record_then_fail = 0;
Lisp_Object save_this_command, save_last_command;
Lisp_Object save_this_original_command, save_real_this_command;
@@ -685,7 +685,7 @@ invoke it. If KEYS is omitted or nil, the return value of
goto have_prefix_arg;
case 'n': /* Read number from minibuffer. */
{
- int first = 1;
+ bool first = 1;
do
{
Lisp_Object str;
@@ -726,11 +726,11 @@ invoke it. If KEYS is omitted or nil, the return value of
check_mark (1);
set_marker_both (point_marker, Qnil, PT, PT_BYTE);
/* visargs[i+1] = Qnil; */
- foo = marker_position (BVAR (current_buffer, mark));
+ mark = marker_position (BVAR (current_buffer, mark));
/* visargs[i] = Qnil; */
- args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark);
+ args[i] = PT < mark ? point_marker : BVAR (current_buffer, mark);
varies[i] = 3;
- args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark);
+ args[++i] = PT > mark ? point_marker : BVAR (current_buffer, mark);
varies[i] = 4;
break;
diff --git a/src/callproc.c b/src/callproc.c
index 4bf1da04e1a..2e9a8950700 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -77,7 +77,7 @@ static Lisp_Object Vtemp_file_name_pattern;
/* True if we are about to fork off a synchronous process or if we
are waiting for it. */
-int synch_process_alive;
+bool synch_process_alive;
/* Nonzero => this is a string explaining death of synchronous subprocess. */
const char *synch_process_death;
@@ -94,8 +94,8 @@ int synch_process_retcode;
On MSDOS, delete the temporary file on any kind of termination.
On Unix, kill the process and any children on termination by signal. */
-/* Nonzero if this is termination due to exit. */
-static int call_process_exited;
+/* True if this is termination due to exit. */
+static bool call_process_exited;
static Lisp_Object
call_process_kill (Lisp_Object fdpid)
@@ -190,7 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail;
- int display_p;
+ bool display_p;
int fd[2];
int filefd;
#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
@@ -217,7 +217,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
struct coding_system argument_coding; /* coding-system of arguments */
/* Set to the return value of Ffind_operation_coding_system. */
Lisp_Object coding_systems;
- int output_to_buffer = 1;
+ bool output_to_buffer = 1;
/* Qt denotes that Ffind_operation_coding_system is not yet called. */
coding_systems = Qt;
@@ -241,7 +241,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* If arguments are supplied, we may have to encode them. */
if (nargs >= 5)
{
- int must_encode = 0;
+ bool must_encode = 0;
Lisp_Object coding_attrs;
for (i = 4; i < nargs; i++)
@@ -610,12 +610,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
Lisp_Object volatile buffer_volatile = buffer;
Lisp_Object volatile coding_systems_volatile = coding_systems;
Lisp_Object volatile current_dir_volatile = current_dir;
- int volatile display_p_volatile = display_p;
+ bool volatile display_p_volatile = display_p;
+ bool volatile output_to_buffer_volatile = output_to_buffer;
+ bool volatile sa_must_free_volatile = sa_must_free;
int volatile fd1_volatile = fd1;
int volatile fd_error_volatile = fd_error;
int volatile fd_output_volatile = fd_output;
- int volatile output_to_buffer_volatile = output_to_buffer;
- int volatile sa_must_free_volatile = sa_must_free;
ptrdiff_t volatile sa_count_volatile = sa_count;
unsigned char const **volatile new_argv_volatile = new_argv;
@@ -766,11 +766,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (output_to_buffer)
{
- register int nread;
- int first = 1;
+ int nread;
+ bool first = 1;
EMACS_INT total_read = 0;
int carryover = 0;
- int display_on_the_fly = display_p;
+ bool display_on_the_fly = display_p;
struct coding_system saved_coding;
saved_coding = process_coding;
@@ -1086,7 +1086,7 @@ static char **
add_env (char **env, char **new_env, char *string)
{
char **ep;
- int ok = 1;
+ bool ok = 1;
if (string == NULL)
return new_env;
@@ -1126,8 +1126,7 @@ add_env (char **env, char **new_env, char *string)
Therefore, the superior process must save and restore the value
of environ around the vfork and the call to this function.
- SET_PGRP is nonzero if we should put the subprocess into a separate
- process group.
+ If SET_PGRP, put the subprocess into a separate process group.
CURRENT_DIR is an elisp string giving the path of the current
directory the subprocess should have. Since we can't really signal
@@ -1135,7 +1134,8 @@ add_env (char **env, char **new_env, char *string)
executable directory by the parent. */
int
-child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir)
+child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
+ Lisp_Object current_dir)
{
char **env;
char *pwd_var;
@@ -1394,7 +1394,7 @@ relocate_fd (int fd, int minfd)
}
#endif /* not WINDOWSNT */
-static int
+static bool
getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
ptrdiff_t *valuelen, Lisp_Object env)
{
@@ -1429,7 +1429,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
return 0;
}
-static int
+static bool
getenv_internal (const char *var, ptrdiff_t varlen, char **value,
ptrdiff_t *valuelen, Lisp_Object frame)
{
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 81e84252b72..1102054b153 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -35,8 +35,8 @@ Lisp_Object Qidentity;
static Lisp_Object
casify_object (enum case_action flag, Lisp_Object obj)
{
- register int c, c1;
- register int inword = flag == CASE_DOWN;
+ int c, c1;
+ bool inword = flag == CASE_DOWN;
/* If the case table is flagged as modified, rescan it. */
if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
@@ -47,7 +47,8 @@ casify_object (enum case_action flag, Lisp_Object obj)
int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
| CHAR_SHIFT | CHAR_CTL | CHAR_META);
int flags = XINT (obj) & flagbits;
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte = ! NILP (BVAR (current_buffer,
+ enable_multibyte_characters));
/* If the character has higher bits set
above the flags, return it unchanged.
@@ -189,9 +190,9 @@ The argument object is not altered--the value is a copy. */)
static void
casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
{
- register int c;
- register int inword = flag == CASE_DOWN;
- register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ int c;
+ bool inword = flag == CASE_DOWN;
+ bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
ptrdiff_t start, end;
ptrdiff_t start_byte;
diff --git a/src/casetab.c b/src/casetab.c
index a163d5204f8..3e22d0d0b77 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -79,7 +79,7 @@ This is the one used for new buffers. */)
return Vascii_downcase_table;
}
-static Lisp_Object set_case_table (Lisp_Object table, int standard);
+static Lisp_Object set_case_table (Lisp_Object, bool);
DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0,
doc: /* Select a new case table for the current buffer.
@@ -113,7 +113,7 @@ See `set-case-table' for more info on case tables. */)
}
static Lisp_Object
-set_case_table (Lisp_Object table, int standard)
+set_case_table (Lisp_Object table, bool standard)
{
Lisp_Object up, canon, eqv;
diff --git a/src/category.c b/src/category.c
index 1c9085fd558..80dc6938d8b 100644
--- a/src/category.c
+++ b/src/category.c
@@ -406,17 +406,17 @@ then delete CATEGORY from the category set instead of adding it. */)
return Qnil;
}
-/* Return 1 if there is a word boundary between two word-constituent
- characters C1 and C2 if they appear in this order, else return 0.
+/* Return true if there is a word boundary between two word-constituent
+ characters C1 and C2 if they appear in this order.
Use the macro WORD_BOUNDARY_P instead of calling this function
directly. */
-int
+bool
word_boundary_p (int c1, int c2)
{
Lisp_Object category_set1, category_set2;
Lisp_Object tail;
- int default_result;
+ bool default_result;
if (EQ (CHAR_TABLE_REF (Vchar_script_table, c1),
CHAR_TABLE_REF (Vchar_script_table, c2)))
diff --git a/src/category.h b/src/category.h
index 9fb981ed383..17cd203db45 100644
--- a/src/category.h
+++ b/src/category.h
@@ -77,14 +77,14 @@ INLINE_HEADER_BEGIN
/* Return the category set of character C in the current category table. */
#define CATEGORY_SET(c) char_category_set (c)
-/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
+/* Return true if CATEGORY_SET contains CATEGORY.
The faster version of `!NILP (Faref (category_set, category))'. */
#define CATEGORY_MEMBER(category, category_set) \
((XCATEGORY_SET (category_set)->data[(category) / 8] \
>> ((category) % 8)) & 1)
-/* Return 1 if category set of CH contains CATEGORY, else return 0. */
-CATEGORY_INLINE int
+/* Return true if category set of CH contains CATEGORY. */
+CATEGORY_INLINE bool
CHAR_HAS_CATEGORY (int ch, int category)
{
Lisp_Object category_set = CATEGORY_SET (ch);
@@ -108,14 +108,14 @@ CHAR_HAS_CATEGORY (int ch, int category)
#define CATEGORY_TABLE_VERSION (table) \
Fchar_table_extra_slot (table, make_number (1))
-/* Return 1 if there is a word boundary between two word-constituent
- characters C1 and C2 if they appear in this order, else return 0.
+/* Return true if there is a word boundary between two
+ word-constituent characters C1 and C2 if they appear in this order.
There is no word boundary between two word-constituent ASCII and
Latin-1 characters. */
#define WORD_BOUNDARY_P(c1, c2) \
(!(SINGLE_BYTE_CHAR_P (c1) && SINGLE_BYTE_CHAR_P (c2)) \
&& word_boundary_p (c1, c2))
-extern int word_boundary_p (int, int);
+extern bool word_boundary_p (int, int);
INLINE_HEADER_END
diff --git a/src/ccl.h b/src/ccl.h
index 71139175be5..cc5daf11e1c 100644
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -26,6 +26,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_CCL_H
#define EMACS_CCL_H
+#include "character.h" /* For MAX_MULTIBYTE_LENGTH */
+
/* Macros for exit status of CCL program. */
#define CCL_STAT_SUCCESS 0 /* Terminated successfully. */
#define CCL_STAT_SUSPEND_BY_SRC 1 /* Terminated by empty input. */
diff --git a/src/character.c b/src/character.c
index b2acf36ec15..cfaaf8eeca9 100644
--- a/src/character.c
+++ b/src/character.c
@@ -427,7 +427,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t precision,
/* This set multibyte to 0 even if STRING is multibyte when it
contains only ascii and eight-bit-graphic, but that's
intentional. */
- int multibyte = len < SBYTES (string);
+ bool multibyte = len < SBYTES (string);
unsigned char *str = SDATA (string);
ptrdiff_t i = 0, i_byte = 0;
ptrdiff_t width = 0;
@@ -765,13 +765,10 @@ str_as_unibyte (unsigned char *str, ptrdiff_t bytes)
corresponding byte and store in DST. CHARS is the number of
characters in SRC. The value is the number of bytes stored in DST.
Usually, the value is the same as CHARS, but is less than it if SRC
- contains a non-ASCII, non-eight-bit character. If ACCEPT_LATIN_1
- is nonzero, a Latin-1 character is accepted and converted to a byte
- of that character code.
- Note: Currently the arg ACCEPT_LATIN_1 is not used. */
+ contains a non-ASCII, non-eight-bit character. */
ptrdiff_t
-str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, int accept_latin_1)
+str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars)
{
ptrdiff_t i;
@@ -781,8 +778,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
- else if (! ASCII_CHAR_P (c)
- && (! accept_latin_1 || c >= 0x100))
+ else if (! ASCII_CHAR_P (c))
return i;
*dst++ = c;
}
@@ -793,7 +789,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
static ptrdiff_t
string_count_byte8 (Lisp_Object string)
{
- int multibyte = STRING_MULTIBYTE (string);
+ bool multibyte = STRING_MULTIBYTE (string);
ptrdiff_t nbytes = SBYTES (string);
unsigned char *p = SDATA (string);
unsigned char *pend = p + nbytes;
@@ -825,7 +821,7 @@ string_escape_byte8 (Lisp_Object string)
{
ptrdiff_t nchars = SCHARS (string);
ptrdiff_t nbytes = SBYTES (string);
- int multibyte = STRING_MULTIBYTE (string);
+ bool multibyte = STRING_MULTIBYTE (string);
ptrdiff_t byte8_count;
const unsigned char *src, *src_end;
unsigned char *dst;
diff --git a/src/character.h b/src/character.h
index 332dfee373a..70d4e67a978 100644
--- a/src/character.h
+++ b/src/character.h
@@ -676,7 +676,6 @@ extern int string_char (const unsigned char *,
const unsigned char **, int *);
extern int translate_char (Lisp_Object, int c);
-extern int char_printable_p (int c);
extern void parse_str_as_multibyte (const unsigned char *,
ptrdiff_t, ptrdiff_t *, ptrdiff_t *);
extern ptrdiff_t count_size_as_multibyte (const unsigned char *, ptrdiff_t);
@@ -685,7 +684,7 @@ extern ptrdiff_t str_as_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t,
extern ptrdiff_t str_to_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t);
extern ptrdiff_t str_as_unibyte (unsigned char *, ptrdiff_t);
extern ptrdiff_t str_to_unibyte (const unsigned char *, unsigned char *,
- ptrdiff_t, int);
+ ptrdiff_t);
extern ptrdiff_t strwidth (const char *, ptrdiff_t);
extern ptrdiff_t c_string_width (const unsigned char *, ptrdiff_t, int,
ptrdiff_t *, ptrdiff_t *);
diff --git a/src/charset.c b/src/charset.c
index 3e286fa947d..0673790e91c 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -215,7 +215,7 @@ static struct
/* Set to 1 to warn that a charset map is loaded and thus a buffer
text and a string data may be relocated. */
-int charset_map_loaded;
+bool charset_map_loaded;
struct charset_map_entries
{
@@ -256,7 +256,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
{
Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
unsigned max_code = CHARSET_MAX_CODE (charset);
- int ascii_compatible_p = charset->ascii_compatible_p;
+ bool ascii_compatible_p = charset->ascii_compatible_p;
int min_char, max_char, nonascii_min_char;
int i;
unsigned char *fast_map = charset->fast_map;
@@ -423,7 +423,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
paying attention to comment character '#'. */
static inline unsigned
-read_hex (FILE *fp, int *eof, int *overflow)
+read_hex (FILE *fp, bool *eof, bool *overflow)
{
int c;
unsigned n;
@@ -512,7 +512,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
{
unsigned from, to, c;
int idx;
- int eof = 0, overflow = 0;
+ bool eof = 0, overflow = 0;
from = read_hex (fp, &eof, &overflow);
if (eof)
@@ -717,10 +717,8 @@ map_charset_chars (void (*c_function)(Lisp_Object, Lisp_Object), Lisp_Object fun
Lisp_Object arg, struct charset *charset, unsigned from, unsigned to)
{
Lisp_Object range;
- int partial;
-
- partial = (from > CHARSET_MIN_CODE (charset)
- || to < CHARSET_MAX_CODE (charset));
+ bool partial = (from > CHARSET_MIN_CODE (charset)
+ || to < CHARSET_MAX_CODE (charset));
if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
{
@@ -855,7 +853,7 @@ usage: (define-charset-internal ...) */)
struct charset charset;
int id;
int dimension;
- int new_definition_p;
+ bool new_definition_p;
int nchars;
if (nargs != charset_arg_max)
@@ -1250,7 +1248,7 @@ define_charset_internal (Lisp_Object name,
const char *code_space_chars,
unsigned min_code, unsigned max_code,
int iso_final, int iso_revision, int emacs_mule_id,
- int ascii_compatible, int supplementary,
+ bool ascii_compatible, bool supplementary,
int code_offset)
{
const unsigned char *code_space = (const unsigned char *) code_space_chars;
@@ -1448,7 +1446,7 @@ if CHARSET is designated instead. */)
(Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset)
{
int id;
- int chars_flag;
+ bool chars_flag;
CHECK_CHARSET_GET_ID (charset, id);
check_iso_charset_parameter (dimension, chars, final_char);
@@ -1499,7 +1497,9 @@ string_xstring_p (Lisp_Object string)
It may lookup a translation table TABLE if supplied. */
static void
-find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte)
+find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars,
+ ptrdiff_t nbytes, Lisp_Object charsets,
+ Lisp_Object table, bool multibyte)
{
const unsigned char *pend = ptr + nbytes;
@@ -1549,7 +1549,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
ptrdiff_t from, from_byte, to, stop, stop_byte;
int i;
Lisp_Object val;
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
validate_region (&beg, &end);
from = XFASTINT (beg);
@@ -1735,7 +1735,7 @@ decode_char (struct charset *charset, unsigned int code)
/* Variable used temporarily by the macro ENCODE_CHAR. */
Lisp_Object charset_work;
-/* Return a code-point of CHAR in CHARSET. If CHAR doesn't belong to
+/* Return a code-point of C in CHARSET. If C doesn't belong to
CHARSET, return CHARSET_INVALID_CODE (CHARSET). If STRICT is true,
use CHARSET's strict_max_char instead of max_char. */
@@ -1978,7 +1978,7 @@ is specified. */)
struct charset *
char_charset (int c, Lisp_Object charset_list, unsigned int *code_return)
{
- int maybe_null = 0;
+ bool maybe_null = 0;
if (NILP (charset_list))
charset_list = Vcharset_ordered_list;
@@ -2106,7 +2106,7 @@ DIMENSION, CHARS, and FINAL-CHAR. */)
(Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
{
int id;
- int chars_flag;
+ bool chars_flag;
check_iso_charset_parameter (dimension, chars, final_char);
chars_flag = XFASTINT (chars) == 96;
diff --git a/src/charset.h b/src/charset.h
index 4ef8ddc2c33..50d230489fe 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -173,12 +173,24 @@ struct charset
check if a code-point is in a valid range. */
unsigned char *code_space_mask;
- /* 1 if there's no gap in code-points. */
- int code_linear_p;
+ /* True if there's no gap in code-points. */
+ unsigned code_linear_p : 1;
- /* If the charset is treated as 94-chars in ISO-2022, the value is 0.
- If the charset is treated as 96-chars in ISO-2022, the value is 1. */
- int iso_chars_96;
+ /* True if the charset is treated as 96 chars in ISO-2022
+ as opposed to 94 chars. */
+ unsigned iso_chars_96 : 1;
+
+ /* True if the charset is compatible with ASCII. */
+ unsigned ascii_compatible_p : 1;
+
+ /* True if the charset is supplementary. */
+ unsigned supplementary_p : 1;
+
+ /* True if all the code points are representable by Lisp_Int. */
+ unsigned compact_codes_p : 1;
+
+ /* True if the charset is unified with Unicode. */
+ unsigned unified_p : 1;
/* ISO final byte of the charset: 48..127. It may be -1 if the
charset doesn't conform to ISO-2022. */
@@ -192,15 +204,6 @@ struct charset
version. Otherwise, -1. */
int emacs_mule_id;
- /* Nonzero if the charset is compatible with ASCII. */
- int ascii_compatible_p;
-
- /* Nonzero if the charset is supplementary. */
- int supplementary_p;
-
- /* Nonzero if all the code points are representable by Lisp_Int. */
- int compact_codes_p;
-
/* The method for encoding/decoding characters of the charset. */
enum charset_method method;
@@ -239,8 +242,6 @@ struct charset
/* Offset value to calculate a character code from code-point, and
visa versa. */
int code_offset;
-
- int unified_p;
};
/* Hash table of charset symbols vs. the corresponding attribute
@@ -456,7 +457,7 @@ extern Lisp_Object charset_work;
/* Set to 1 when a charset map is loaded to warn that a buffer text
and a string data may be relocated. */
-extern int charset_map_loaded;
+extern bool charset_map_loaded;
/* Set CHARSET to the charset highest priority of C, CODE to the
@@ -474,10 +475,10 @@ extern int charset_map_loaded;
macro ISO_CHARSET_TABLE (DIMENSION, CHARS, FINAL_CHAR). */
extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
-/* A charset of type iso2022 who has DIMENSION, CHARS, and FINAL
+/* A charset of type iso2022 who has DIMENSION, CHARS_96, and FINAL
(final character). */
#define ISO_CHARSET_TABLE(dimension, chars_96, final) \
- iso_charset_table[(dimension) - 1][(chars_96)][(final)]
+ iso_charset_table[(dimension) - 1][chars_96][final]
/* Nonzero if the charset who has FAST_MAP may contain C. */
#define CHARSET_FAST_MAP_REF(c, fast_map) \
@@ -495,7 +496,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
-/* 1 if CHARSET may contain the character C. */
+/* True if CHARSET may contain the character C. */
#define CHAR_CHARSET_P(c, charset) \
((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p) \
|| ((CHARSET_UNIFIED_P (charset) \
diff --git a/src/chartab.c b/src/chartab.c
index 711a49ed397..c14df0ebac6 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -200,7 +200,7 @@ copy_char_table (Lisp_Object table)
}
static Lisp_Object
-sub_char_table_ref (Lisp_Object table, int c, int is_uniprop)
+sub_char_table_ref (Lisp_Object table, int c, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
int depth = XINT (tbl->depth);
@@ -245,7 +245,7 @@ char_table_ref (Lisp_Object table, int c)
static Lisp_Object
sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to,
- Lisp_Object defalt, int is_uniprop)
+ Lisp_Object defalt, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
int depth = XINT (tbl->depth);
@@ -320,7 +320,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
int chartab_idx = CHARTAB_IDX (c, 0, 0), idx;
Lisp_Object val;
- int is_uniprop = UNIPROP_TABLE_P (table);
+ bool is_uniprop = UNIPROP_TABLE_P (table);
val = tbl->contents[chartab_idx];
if (*from < 0)
@@ -382,7 +382,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
static void
-sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
+sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
int depth = XINT ((tbl)->depth);
@@ -438,7 +438,7 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
static void
sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
- int is_uniprop)
+ bool is_uniprop)
{
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
int depth = XINT ((tbl)->depth);
@@ -484,7 +484,7 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
char_table_set (table, from, val);
else
{
- int is_uniprop = UNIPROP_TABLE_P (table);
+ bool is_uniprop = UNIPROP_TABLE_P (table);
int lim = CHARTAB_IDX (to, 0, 0);
int i, c;
@@ -683,7 +683,8 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
int depth = XINT (tbl->depth);
Lisp_Object elt, this;
- int i, optimizable;
+ int i;
+ bool optimizable;
elt = XSUB_CHAR_TABLE (table)->contents[0];
if (SUB_CHAR_TABLE_P (elt))
@@ -762,7 +763,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
int chars_in_block;
int from = XINT (XCAR (range)), to = XINT (XCDR (range));
int i, c;
- int is_uniprop = UNIPROP_TABLE_P (top);
+ bool is_uniprop = UNIPROP_TABLE_P (top);
uniprop_decoder_t decoder = UNIPROP_GET_DECODER (top);
if (SUB_CHAR_TABLE_P (table))
@@ -811,7 +812,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
this = XCHAR_TABLE (top)->defalt;
if (!EQ (val, this))
{
- int different_value = 1;
+ bool different_value = 1;
if (NILP (val))
{
diff --git a/src/cmds.c b/src/cmds.c
index b416135ee9e..90d3cd6dced 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -47,10 +47,10 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
return make_number (PT + XINT (n));
}
-/* Add N to point; or subtract N if FORWARD is zero. N defaults to 1.
+/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
Validate the new location. Return nil. */
static Lisp_Object
-move_point (Lisp_Object n, int forward)
+move_point (Lisp_Object n, bool forward)
{
/* This used to just set point to point + XINT (n), and then check
to see if it was within boundaries. But now that SET_PT can
@@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the
At the end, it runs `post-self-insert-hook'. */)
(Lisp_Object n)
{
- int remove_boundary = 1;
+ bool remove_boundary = 1;
CHECK_NATNUM (n);
if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
@@ -438,7 +438,7 @@ internal_self_insert (int c, EMACS_INT n)
: UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
== Sword))
{
- int modiff = MODIFF;
+ EMACS_INT modiff = MODIFF;
Lisp_Object sym;
sym = call0 (Qexpand_abbrev);
diff --git a/src/coding.c b/src/coding.c
index 971686dc180..02e7b34695e 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -147,18 +147,18 @@ STRUCT CODING_SYSTEM
CODING conforms to the format of XXX, and update the members of
DETECT_INFO.
- Return 1 if the byte sequence conforms to XXX, otherwise return 0.
+ Return true if the byte sequence conforms to XXX.
Below is the template of these functions. */
#if 0
-static int
+static bool
detect_coding_XXX (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
...;
@@ -212,7 +212,7 @@ decode_coding_XXXX (struct coding_system *coding)
/* A buffer to produce decoded characters. */
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
while (1)
{
@@ -260,7 +260,7 @@ decode_coding_XXXX (struct coding_system *coding)
static void
encode_coding_XXX (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf->charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -651,8 +651,8 @@ static struct coding_system coding_categories[coding_category_max];
/* Safely get one byte from the source text pointed by SRC which ends
at SRC_END, and set C to that byte. If there are not enough bytes
- in the source, it jumps to `no_more_source'. If multibytep is
- nonzero, and a multibyte character is found at SRC, set C to the
+ in the source, it jumps to 'no_more_source'. If MULTIBYTEP,
+ and a multibyte character is found at SRC, set C to the
negative value of the character code. The caller should declare
and set these variables appropriately in advance:
src, src_end, multibytep */
@@ -685,7 +685,7 @@ static struct coding_system coding_categories[coding_category_max];
/* Safely get two bytes from the source text pointed by SRC which ends
at SRC_END, and set C1 and C2 to those bytes while skipping the
heading multibyte characters. If there are not enough bytes in the
- source, it jumps to `no_more_source'. If multibytep is nonzero and
+ source, it jumps to 'no_more_source'. If MULTIBYTEP and
a multibyte character is found for C2, set C2 to the negative value
of the character code. The caller should declare and set these
variables appropriately in advance:
@@ -746,8 +746,8 @@ static struct coding_system coding_categories[coding_category_max];
/* Store a byte C in the place pointed by DST and increment DST to the
- next free point, and increment PRODUCED_CHARS. If MULTIBYTEP is
- nonzero, store in an appropriate multibyte from. The caller should
+ next free point, and increment PRODUCED_CHARS. If MULTIBYTEP,
+ store in an appropriate multibyte form. The caller should
declare and set the variables `dst' and `multibytep' appropriately
in advance. */
@@ -806,83 +806,6 @@ static struct coding_system coding_categories[coding_category_max];
} while (0)
-/* Prototypes for static functions. */
-static void record_conversion_result (struct coding_system *coding,
- enum coding_result_code result);
-static int detect_coding_utf_8 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_utf_8 (struct coding_system *);
-static int encode_coding_utf_8 (struct coding_system *);
-
-static int detect_coding_utf_16 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_utf_16 (struct coding_system *);
-static int encode_coding_utf_16 (struct coding_system *);
-
-static int detect_coding_iso_2022 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_iso_2022 (struct coding_system *);
-static int encode_coding_iso_2022 (struct coding_system *);
-
-static int detect_coding_emacs_mule (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_emacs_mule (struct coding_system *);
-static int encode_coding_emacs_mule (struct coding_system *);
-
-static int detect_coding_sjis (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_sjis (struct coding_system *);
-static int encode_coding_sjis (struct coding_system *);
-
-static int detect_coding_big5 (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_big5 (struct coding_system *);
-static int encode_coding_big5 (struct coding_system *);
-
-static int detect_coding_ccl (struct coding_system *,
- struct coding_detection_info *info);
-static void decode_coding_ccl (struct coding_system *);
-static int encode_coding_ccl (struct coding_system *);
-
-static void decode_coding_raw_text (struct coding_system *);
-static int encode_coding_raw_text (struct coding_system *);
-
-static void coding_set_source (struct coding_system *);
-static ptrdiff_t coding_change_source (struct coding_system *);
-static void coding_set_destination (struct coding_system *);
-static ptrdiff_t coding_change_destination (struct coding_system *);
-static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t);
-static void coding_alloc_by_making_gap (struct coding_system *,
- ptrdiff_t, ptrdiff_t);
-static unsigned char *alloc_destination (struct coding_system *,
- ptrdiff_t, unsigned char *);
-static void setup_iso_safe_charsets (Lisp_Object);
-static ptrdiff_t encode_designation_at_bol (struct coding_system *,
- int *, int *, unsigned char *);
-static int detect_eol (const unsigned char *,
- ptrdiff_t, enum coding_category);
-static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
-static void decode_eol (struct coding_system *);
-static Lisp_Object get_translation_table (Lisp_Object, int, int *);
-static Lisp_Object get_translation (Lisp_Object, int *, int *);
-static int produce_chars (struct coding_system *, Lisp_Object, int);
-static inline void produce_charset (struct coding_system *, int *,
- ptrdiff_t);
-static void produce_annotation (struct coding_system *, ptrdiff_t);
-static int decode_coding (struct coding_system *);
-static inline int *handle_composition_annotation (ptrdiff_t, ptrdiff_t,
- struct coding_system *,
- int *, ptrdiff_t *);
-static inline int *handle_charset_annotation (ptrdiff_t, ptrdiff_t,
- struct coding_system *,
- int *, ptrdiff_t *);
-static void consume_chars (struct coding_system *, Lisp_Object, int);
-static int encode_coding (struct coding_system *);
-static Lisp_Object make_conversion_work_buffer (int);
-static Lisp_Object code_conversion_restore (Lisp_Object);
-static inline int char_encodable_p (int, Lisp_Object);
-static Lisp_Object make_subsidiaries (Lisp_Object);
-
static void
record_conversion_result (struct coding_system *coding,
enum coding_result_code result)
@@ -1264,8 +1187,7 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
/*** 3. UTF-8 ***/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in UTF-8. If it is, return 1, else
- return 0. */
+ Return true if a text is encoded in UTF-8. */
#define UTF_8_1_OCTET_P(c) ((c) < 0x80)
#define UTF_8_EXTRA_OCTET_P(c) (((c) & 0xC0) == 0x80)
@@ -1278,16 +1200,16 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
#define UTF_8_BOM_2 0xBB
#define UTF_8_BOM_3 0xBF
-static int
+static bool
detect_coding_utf_8 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
- int bom_found = 0;
- int found = 0;
+ bool bom_found = 0;
+ bool found = 0;
detect_info->checked |= CATEGORY_MASK_UTF_8;
/* A coding system of this category is always ASCII compatible. */
@@ -1371,10 +1293,10 @@ decode_coding_utf_8 (struct coding_system *coding)
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
if (bom != utf_without_bom)
@@ -1513,10 +1435,10 @@ decode_coding_utf_8 (struct coding_system *coding)
}
-static int
+static bool
encode_coding_utf_8 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -1577,8 +1499,7 @@ encode_coding_utf_8 (struct coding_system *coding)
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in one of UTF-16 based coding systems.
- If it is, return 1, else return 0. */
+ Return true if a text is encoded in one of UTF-16 based coding systems. */
#define UTF_16_HIGH_SURROGATE_P(val) \
(((val) & 0xFC00) == 0xD800)
@@ -1587,13 +1508,13 @@ encode_coding_utf_8 (struct coding_system *coding)
(((val) & 0xFC00) == 0xDC00)
-static int
+static bool
detect_coding_utf_16 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
int c1, c2;
detect_info->checked |= CATEGORY_MASK_UTF_16;
@@ -1680,12 +1601,12 @@ decode_coding_utf_16 (struct coding_system *coding)
/* We may produces at most 3 chars in one loop. */
int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
int surrogate = CODING_UTF_16_SURROGATE (coding);
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr1 = -1, byte_after_cr2 = -1;
if (bom == utf_with_bom)
@@ -1795,17 +1716,17 @@ decode_coding_utf_16 (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_utf_16 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
int safe_room = 8;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
- int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
+ bool big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
ptrdiff_t produced_chars = 0;
int c;
@@ -1930,16 +1851,15 @@ char emacs_mule_bytes[256];
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in `emacs-mule'. If it is, return 1,
- else return 0. */
+ Return true if a text is encoded in 'emacs-mule'. */
-static int
+static bool
detect_coding_emacs_mule (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int c;
int found = 0;
@@ -2029,12 +1949,12 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
{
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base = src;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
int charset_ID;
unsigned code;
int c;
int consumed_chars = 0;
- int mseq_found = 0;
+ bool mseq_found = 0;
ONE_MORE_BYTE (c);
if (c < 0)
@@ -2411,12 +2331,12 @@ decode_coding_emacs_mule (struct coding_system *coding)
/* We can produce up to 2 characters in a loop. */
- 1;
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status;
@@ -2657,10 +2577,10 @@ decode_coding_emacs_mule (struct coding_system *coding)
} while (0);
-static int
+static bool
encode_coding_emacs_mule (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -2722,7 +2642,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
if (preferred_charset_id >= 0)
{
- int result;
+ bool result;
charset = CHARSET_FROM_ID (preferred_charset_id);
CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -3017,17 +2937,17 @@ setup_iso_safe_charsets (Lisp_Object attrs)
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in one of ISO-2022 based coding systems.
- If it is, return 1, else return 0. */
+ Return true if a text is encoded in one of ISO-2022 based coding
+ systems. */
-static int
+static bool
detect_coding_iso_2022 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base = src;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
- int single_shifting = 0;
+ bool multibytep = coding->src_multibyte;
+ bool single_shifting = 0;
int id;
int c, c1;
ptrdiff_t consumed_chars = 0;
@@ -3390,8 +3310,6 @@ detect_coding_iso_2022 (struct coding_system *coding,
/* Finish the current composition as invalid. */
-static int finish_composition (int *, struct composition_status *);
-
static int
finish_composition (int *charbuf, struct composition_status *cmp_status)
{
@@ -3541,7 +3459,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
/* Charsets invoked to graphic plane 0 and 1 respectively. */
int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0);
int charset_id_1 = CODING_ISO_INVOKED_CHARSET (coding, 1);
@@ -3553,8 +3471,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
int i;
@@ -4282,7 +4200,7 @@ encode_invocation_designation (struct charset *charset,
struct coding_system *coding,
unsigned char *dst, ptrdiff_t *p_nchars)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
ptrdiff_t produced_chars = *p_nchars;
int reg; /* graphic register number */
int id = CHARSET_ID (charset);
@@ -4380,7 +4298,7 @@ encode_designation_at_bol (struct coding_system *coding,
int r[4];
int c, found = 0, reg;
ptrdiff_t produced_chars = 0;
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
Lisp_Object attrs;
Lisp_Object charset_list;
@@ -4422,21 +4340,21 @@ encode_designation_at_bol (struct coding_system *coding,
/* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions". */
-static int
+static bool
encode_coding_iso_2022 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
int safe_room = 16;
- int bol_designation
+ bool bol_designation
= (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL
&& CODING_ISO_BOL (coding));
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, eol_type, charset_list;
- int ascii_compatible;
+ bool ascii_compatible;
int c;
int preferred_charset_id = -1;
@@ -4523,8 +4441,9 @@ encode_coding_iso_2022 (struct coding_system *coding)
CODING_ISO_DESIGNATION (coding, i)
= CODING_ISO_INITIAL (coding, i);
}
- bol_designation
- = CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL;
+ bol_designation = ((CODING_ISO_FLAGS (coding)
+ & CODING_ISO_FLAG_DESIGNATE_AT_BOL)
+ != 0);
}
else if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_RESET_AT_CNTL)
ENCODE_RESET_PLANE_AND_REGISTER ();
@@ -4551,7 +4470,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
if (preferred_charset_id >= 0)
{
- int result;
+ bool result;
charset = CHARSET_FROM_ID (preferred_charset_id);
CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -4631,16 +4550,15 @@ encode_coding_iso_2022 (struct coding_system *coding)
*/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in SJIS. If it is, return
- CATEGORY_MASK_SJIS, else return 0. */
+ Return true if a text is encoded in SJIS. */
-static int
+static bool
detect_coding_sjis (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
int c;
@@ -4688,16 +4606,15 @@ detect_coding_sjis (struct coding_system *coding,
}
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in BIG5. If it is, return
- CATEGORY_MASK_BIG5, else return 0. */
+ Return true if a text is encoded in BIG5. */
-static int
+static bool
detect_coding_big5 (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
int c;
@@ -4735,8 +4652,7 @@ detect_coding_big5 (struct coding_system *coding,
return 1;
}
-/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".
- If SJIS_P is 1, decode SJIS text, else decode BIG5 test. */
+/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions". */
static void
decode_coding_sjis (struct coding_system *coding)
@@ -4750,15 +4666,15 @@ decode_coding_sjis (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_kanji, *charset_kana;
struct charset *charset_kanji2;
Lisp_Object attrs, charset_list, val;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -4868,14 +4784,14 @@ decode_coding_big5 (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_big5;
Lisp_Object attrs, charset_list, val;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -4957,13 +4873,12 @@ decode_coding_big5 (struct coding_system *coding)
`japanese-jisx0208', `chinese-big5-1', and `chinese-big5-2'. We
are sure that all these charsets are registered as official charset
(i.e. do not have extended leading-codes). Characters of other
- charsets are produced without any encoding. If SJIS_P is 1, encode
- SJIS text, else encode BIG5 text. */
+ charsets are produced without any encoding. */
-static int
+static bool
encode_coding_sjis (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -4971,7 +4886,7 @@ encode_coding_sjis (struct coding_system *coding)
int safe_room = 4;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list, val;
- int ascii_compatible;
+ bool ascii_compatible;
struct charset *charset_kanji, *charset_kana;
struct charset *charset_kanji2;
int c;
@@ -5054,10 +4969,10 @@ encode_coding_sjis (struct coding_system *coding)
return 0;
}
-static int
+static bool
encode_coding_big5 (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5065,7 +4980,7 @@ encode_coding_big5 (struct coding_system *coding)
int safe_room = 4;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list, val;
- int ascii_compatible;
+ bool ascii_compatible;
struct charset *charset_big5;
int c;
@@ -5130,17 +5045,16 @@ encode_coding_big5 (struct coding_system *coding)
/*** 10. CCL handlers ***/
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in a coding system of which
- encoder/decoder are written in CCL program. If it is, return
- CATEGORY_MASK_CCL, else return 0. */
+ Return true if a text is encoded in a coding system of which
+ encoder/decoder are written in CCL program. */
-static int
+static bool
detect_coding_ccl (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
int found = 0;
unsigned char *valids;
@@ -5182,7 +5096,7 @@ decode_coding_ccl (struct coding_system *coding)
int *charbuf = coding->charbuf + coding->charbuf_used;
int *charbuf_end = coding->charbuf + coding->charbuf_size;
ptrdiff_t consumed_chars = 0;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
struct ccl_program *ccl = &coding->spec.ccl->ccl;
int source_charbuf[1024];
int source_byteidx[1025];
@@ -5243,11 +5157,11 @@ decode_coding_ccl (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_ccl (struct coding_system *coding)
{
struct ccl_program *ccl = &coding->spec.ccl->ccl;
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5308,7 +5222,6 @@ encode_coding_ccl (struct coding_system *coding)
return 0;
}
-
/*** 10, 11. no-conversion handlers ***/
@@ -5317,8 +5230,8 @@ encode_coding_ccl (struct coding_system *coding)
static void
decode_coding_raw_text (struct coding_system *coding)
{
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
coding->chars_at_source = 1;
coding->consumed_char = coding->src_chars;
@@ -5333,10 +5246,10 @@ decode_coding_raw_text (struct coding_system *coding)
record_conversion_result (coding, CODING_RESULT_SUCCESS);
}
-static int
+static bool
encode_coding_raw_text (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = coding->charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5414,21 +5327,20 @@ encode_coding_raw_text (struct coding_system *coding)
}
/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
- Check if a text is encoded in a charset-based coding system. If it
- is, return 1, else return 0. */
+ Return true if a text is encoded in a charset-based coding system. */
-static int
+static bool
detect_coding_charset (struct coding_system *coding,
struct coding_detection_info *detect_info)
{
const unsigned char *src = coding->source, *src_base;
const unsigned char *src_end = coding->source + coding->src_bytes;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
ptrdiff_t consumed_chars = 0;
Lisp_Object attrs, valids, name;
int found = 0;
ptrdiff_t head_ascii = coding->head_ascii;
- int check_latin_extra = 0;
+ bool check_latin_extra = 0;
detect_info->checked |= CATEGORY_MASK_CHARSET;
@@ -5532,14 +5444,14 @@ decode_coding_charset (struct coding_system *coding)
int *charbuf_end
= coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
ptrdiff_t consumed_chars = 0, consumed_chars_base;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
Lisp_Object attrs = CODING_ID_ATTRS (coding->id);
Lisp_Object valids;
ptrdiff_t char_offset = coding->produced_char;
ptrdiff_t last_offset = char_offset;
int last_id = charset_ascii;
- int eol_dos =
- !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+ bool eol_dos
+ = !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
int byte_after_cr = -1;
valids = AREF (attrs, coding_attr_charset_valids);
@@ -5648,10 +5560,10 @@ decode_coding_charset (struct coding_system *coding)
coding->charbuf_used = charbuf - coding->charbuf;
}
-static int
+static bool
encode_coding_charset (struct coding_system *coding)
{
- int multibytep = coding->dst_multibyte;
+ bool multibytep = coding->dst_multibyte;
int *charbuf = coding->charbuf;
int *charbuf_end = charbuf + coding->charbuf_used;
unsigned char *dst = coding->destination + coding->produced;
@@ -5659,7 +5571,7 @@ encode_coding_charset (struct coding_system *coding)
int safe_room = MAX_MULTIBYTE_LENGTH;
ptrdiff_t produced_chars = 0;
Lisp_Object attrs, charset_list;
- int ascii_compatible;
+ bool ascii_compatible;
int c;
CODING_GET_INFO (coding, attrs, charset_list);
@@ -5865,7 +5777,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
coding->encoder = encode_coding_emacs_mule;
coding->common_flags
|= (CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK);
- coding->spec.emacs_mule.full_support = 1;
if (! NILP (AREF (attrs, coding_attr_emacs_mule_full))
&& ! EQ (CODING_ATTR_CHARSET_LIST (attrs), Vemacs_mule_charset_list))
{
@@ -5883,7 +5794,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
coding->max_charset_id = max_charset_id;
coding->safe_charsets = SDATA (safe_charsets);
- coding->spec.emacs_mule.full_support = 1;
}
coding->spec.emacs_mule.cmp_status.state = COMPOSING_NO;
coding->spec.emacs_mule.cmp_status.method = COMPOSITION_NO;
@@ -6216,11 +6126,9 @@ detect_eol (const unsigned char *source, ptrdiff_t src_bytes,
if ((1 << category) & CATEGORY_MASK_UTF_16)
{
- int msb, lsb;
-
- msb = category == (coding_category_utf_16_le
- | coding_category_utf_16_le_nosig);
- lsb = 1 - msb;
+ bool msb = category == (coding_category_utf_16_le
+ | coding_category_utf_16_le_nosig);
+ bool lsb = !msb;
while (src + 1 < src_end)
{
@@ -6335,7 +6243,7 @@ static void
detect_coding (struct coding_system *coding)
{
const unsigned char *src, *src_end;
- int saved_mode = coding->mode;
+ unsigned int saved_mode = coding->mode;
coding->consumed = coding->consumed_char = 0;
coding->produced = coding->produced_char = 0;
@@ -6350,7 +6258,7 @@ detect_coding (struct coding_system *coding)
{
int c, i;
struct coding_detection_info detect_info;
- int null_byte_found = 0, eight_bit_found = 0;
+ bool null_byte_found = 0, eight_bit_found = 0;
detect_info.checked = detect_info.found = detect_info.rejected = 0;
for (src = coding->source; src < src_end; src++)
@@ -6609,11 +6517,11 @@ decode_eol (struct coding_system *coding)
/* Return a translation table (or list of them) from coding system
- attribute vector ATTRS for encoding (ENCODEP is nonzero) or
- decoding (ENCODEP is zero). */
+ attribute vector ATTRS for encoding (if ENCODEP) or decoding (if
+ not ENCODEP). */
static Lisp_Object
-get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
+get_translation_table (Lisp_Object attrs, bool encodep, int *max_lookup)
{
Lisp_Object standard, translation_table;
Lisp_Object val;
@@ -6743,7 +6651,7 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
static int
produce_chars (struct coding_system *coding, Lisp_Object translation_table,
- int last_block)
+ bool last_block)
{
unsigned char *dst = coding->destination + coding->produced;
unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -6846,7 +6754,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
{
if (coding->src_multibyte)
{
- int multibytep = 1;
+ bool multibytep = 1;
ptrdiff_t consumed_chars = 0;
while (1)
@@ -6882,7 +6790,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
else
while (src < src_end)
{
- int multibytep = 1;
+ bool multibytep = 1;
int c = *src++;
if (dst >= dst_end - 1)
@@ -7018,7 +6926,7 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
if (! coding->charbuf) \
{ \
record_conversion_result (coding, CODING_RESULT_INSUFFICIENT_MEM); \
- return coding->result; \
+ return; \
} \
coding->charbuf_size = size; \
} while (0)
@@ -7079,7 +6987,7 @@ produce_annotation (struct coding_system *coding, ptrdiff_t pos)
CODING->dst_object.
*/
-static int
+static void
decode_coding (struct coding_system *coding)
{
Lisp_Object attrs;
@@ -7098,8 +7006,7 @@ decode_coding (struct coding_system *coding)
undo_list = Qt;
if (BUFFERP (coding->dst_object))
{
- if (current_buffer != XBUFFER (coding->dst_object))
- set_buffer_internal (XBUFFER (coding->dst_object));
+ set_buffer_internal (XBUFFER (coding->dst_object));
if (GPT != PT)
move_gap_both (PT, PT_BYTE);
@@ -7212,7 +7119,6 @@ decode_coding (struct coding_system *coding)
bset_undo_list (current_buffer, undo_list);
record_insert (coding->dst_pos, coding->produced_char);
}
- return coding->result;
}
@@ -7341,7 +7247,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
const unsigned char *src_end = coding->source + coding->src_bytes;
ptrdiff_t pos = coding->src_pos + coding->consumed_char;
ptrdiff_t end_pos = coding->src_pos + coding->src_chars;
- int multibytep = coding->src_multibyte;
+ bool multibytep = coding->src_multibyte;
Lisp_Object eol_type;
int c;
ptrdiff_t stop, stop_composition, stop_charset;
@@ -7488,7 +7394,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
If CODING->dst_object is nil, the encoded data is placed at the
memory area specified by CODING->destination. */
-static int
+static void
encode_coding (struct coding_system *coding)
{
Lisp_Object attrs;
@@ -7530,8 +7436,6 @@ encode_coding (struct coding_system *coding)
if (BUFFERP (coding->dst_object) && coding->produced_char > 0)
insert_from_gap (coding->produced_char, coding->produced);
-
- return (coding->result);
}
@@ -7545,26 +7449,27 @@ static Lisp_Object Vcode_conversion_workbuf_name;
versions of Vcode_conversion_workbuf_name. */
static Lisp_Object Vcode_conversion_reused_workbuf;
-/* 1 iff Vcode_conversion_reused_workbuf is already in use. */
-static int reused_workbuf_in_use;
+/* True iff Vcode_conversion_reused_workbuf is already in use. */
+static bool reused_workbuf_in_use;
/* Return a working buffer of code conversion. MULTIBYTE specifies the
multibyteness of returning buffer. */
static Lisp_Object
-make_conversion_work_buffer (int multibyte)
+make_conversion_work_buffer (bool multibyte)
{
Lisp_Object name, workbuf;
struct buffer *current;
- if (reused_workbuf_in_use++)
+ if (reused_workbuf_in_use)
{
name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
workbuf = Fget_buffer_create (name);
}
else
{
+ reused_workbuf_in_use = 1;
if (NILP (Fbuffer_live_p (Vcode_conversion_reused_workbuf)))
Vcode_conversion_reused_workbuf
= Fget_buffer_create (Vcode_conversion_workbuf_name);
@@ -7606,7 +7511,7 @@ code_conversion_restore (Lisp_Object arg)
}
Lisp_Object
-code_conversion_save (int with_work_buf, int multibyte)
+code_conversion_save (bool with_work_buf, bool multibyte)
{
Lisp_Object workbuf = Qnil;
@@ -7617,7 +7522,7 @@ code_conversion_save (int with_work_buf, int multibyte)
return workbuf;
}
-int
+void
decode_coding_gap (struct coding_system *coding,
ptrdiff_t chars, ptrdiff_t bytes)
{
@@ -7660,7 +7565,6 @@ decode_coding_gap (struct coding_system *coding,
}
unbind_to (count, Qnil);
- return coding->result;
}
@@ -7706,8 +7610,8 @@ decode_coding_object (struct coding_system *coding,
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
- int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
- int need_marker_adjustment = 0;
+ ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+ bool need_marker_adjustment = 0;
Lisp_Object old_deactivate_mark;
old_deactivate_mark = Vdeactivate_mark;
@@ -7894,9 +7798,9 @@ encode_coding_object (struct coding_system *coding,
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
- int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
- int need_marker_adjustment = 0;
- int kill_src_buffer = 0;
+ ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+ bool need_marker_adjustment = 0;
+ bool kill_src_buffer = 0;
Lisp_Object old_deactivate_mark;
old_deactivate_mark = Vdeactivate_mark;
@@ -8172,10 +8076,10 @@ function `define-coding-system'. */)
/* Detect how the bytes at SRC of length SRC_BYTES are encoded. If
- HIGHEST is nonzero, return the coding system of the highest
+ HIGHEST, return the coding system of the highest
priority among the detected coding systems. Otherwise return a
list of detected coding systems sorted by their priorities. If
- MULTIBYTEP is nonzero, it is assumed that the bytes are in correct
+ MULTIBYTEP, it is assumed that the bytes are in correct
multibyte form but contains only ASCII and eight-bit chars.
Otherwise, the bytes are raw bytes.
@@ -8190,7 +8094,7 @@ function `define-coding-system'. */)
Lisp_Object
detect_coding_system (const unsigned char *src,
ptrdiff_t src_chars, ptrdiff_t src_bytes,
- int highest, int multibytep,
+ bool highest, bool multibytep,
Lisp_Object coding_system)
{
const unsigned char *src_end = src + src_bytes;
@@ -8200,7 +8104,7 @@ detect_coding_system (const unsigned char *src,
ptrdiff_t id;
struct coding_detection_info detect_info;
enum coding_category base_category;
- int null_byte_found = 0, eight_bit_found = 0;
+ bool null_byte_found = 0, eight_bit_found = 0;
if (NILP (coding_system))
coding_system = Qundecided;
@@ -8556,7 +8460,7 @@ highest priority. */)
}
-static inline int
+static inline bool
char_encodable_p (int c, Lisp_Object attrs)
{
Lisp_Object tail;
@@ -8728,7 +8632,7 @@ to the string. */)
Lisp_Object positions;
ptrdiff_t from, to;
const unsigned char *p, *stop, *pend;
- int ascii_compatible;
+ bool ascii_compatible;
setup_coding_system (Fcheck_coding_system (coding_system), &coding);
attrs = CODING_ID_ATTRS (coding.id);
@@ -8952,7 +8856,7 @@ is nil. */)
static Lisp_Object
code_convert_region (Lisp_Object start, Lisp_Object end,
Lisp_Object coding_system, Lisp_Object dst_object,
- int encodep, int norecord)
+ bool encodep, bool norecord)
{
struct coding_system coding;
ptrdiff_t from, from_byte, to, to_byte;
@@ -9040,7 +8944,8 @@ not fully specified.) */)
Lisp_Object
code_convert_string (Lisp_Object string, Lisp_Object coding_system,
- Lisp_Object dst_object, int encodep, int nocopy, int norecord)
+ Lisp_Object dst_object, bool encodep, bool nocopy,
+ bool norecord)
{
struct coding_system coding;
ptrdiff_t chars, bytes;
@@ -9088,7 +8993,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system,
Lisp_Object
code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
- int encodep)
+ bool encodep)
{
return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
}
@@ -9489,7 +9394,7 @@ usage: (set-coding-system-priority &rest coding-systems) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
ptrdiff_t i, j;
- int changed[coding_category_max];
+ bool changed[coding_category_max];
enum coding_category priorities[coding_category_max];
memset (changed, 0, sizeof changed);
diff --git a/src/coding.h b/src/coding.h
index 2987f19607b..c45d2ef86e2 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -321,7 +321,7 @@ struct composition_status
{
enum composition_state state;
enum composition_method method;
- int old_form; /* 0:pre-21 form, 1:post-21 form */
+ bool old_form; /* true if pre-21 form */
int length; /* number of elements produced in charbuf */
int nchars; /* number of characters composed */
int ncomps; /* number of composition components */
@@ -350,18 +350,18 @@ struct iso_2022_spec
there was an invalid designation previously. */
int current_designation[4];
- /* Set to 1 temporarily only when graphic register 2 or 3 is invoked
- by single-shift while encoding. */
- int single_shifting;
-
- /* Set to 1 temporarily only when processing at beginning of line. */
- int bol;
-
/* If positive, we are now scanning CTEXT extended segment. */
int ctext_extended_segment_len;
- /* If nonzero, we are now scanning embedded UTF-8 sequence. */
- int embedded_utf_8;
+ /* True temporarily only when graphic register 2 or 3 is invoked by
+ single-shift while encoding. */
+ unsigned single_shifting : 1;
+
+ /* True temporarily only when processing at beginning of line. */
+ unsigned bol : 1;
+
+ /* If true, we are now scanning embedded UTF-8 sequence. */
+ unsigned embedded_utf_8 : 1;
/* The current composition. */
struct composition_status cmp_status;
@@ -369,7 +369,6 @@ struct iso_2022_spec
struct emacs_mule_spec
{
- int full_support;
struct composition_status cmp_status;
};
@@ -470,10 +469,6 @@ struct coding_system
Lisp_Object dst_object;
unsigned char *destination;
- /* Set to 1 if the source of conversion is not in the member
- `charbuf', but at `src_object'. */
- int chars_at_source;
-
/* If an element is non-negative, it is a character code.
If it is in the range -128..-1, it is a 8-bit character code
@@ -489,18 +484,21 @@ struct coding_system
int *charbuf;
int charbuf_size, charbuf_used;
+ /* True if the source of conversion is not in the member
+ `charbuf', but at `src_object'. */
+ unsigned chars_at_source : 1;
+
/* Set to 1 if charbuf contains an annotation. */
- int annotated;
+ unsigned annotated : 1;
unsigned char carryover[64];
int carryover_bytes;
int default_char;
- int (*detector) (struct coding_system *,
- struct coding_detection_info *);
+ bool (*detector) (struct coding_system *, struct coding_detection_info *);
void (*decoder) (struct coding_system *);
- int (*encoder) (struct coding_system *);
+ bool (*encoder) (struct coding_system *);
};
/* Meanings of bits in the member `common_flags' of the structure
@@ -688,22 +686,20 @@ struct coding_system
#define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
/* Extern declarations. */
-extern Lisp_Object code_conversion_save (int, int);
-extern int decoding_buffer_size (struct coding_system *, int);
-extern int encoding_buffer_size (struct coding_system *, int);
+extern Lisp_Object code_conversion_save (bool, bool);
extern void setup_coding_system (Lisp_Object, struct coding_system *);
extern Lisp_Object coding_charset_list (struct coding_system *);
extern Lisp_Object coding_system_charset_list (Lisp_Object);
extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object,
- Lisp_Object, int, int, int);
+ Lisp_Object, bool, bool, bool);
extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
- int);
+ bool);
extern Lisp_Object raw_text_coding_system (Lisp_Object);
extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
extern Lisp_Object complement_process_encoding_system (Lisp_Object);
-extern int decode_coding_gap (struct coding_system *,
- ptrdiff_t, ptrdiff_t);
+extern void decode_coding_gap (struct coding_system *,
+ ptrdiff_t, ptrdiff_t);
extern void decode_coding_object (struct coding_system *,
Lisp_Object, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t, Lisp_Object);
@@ -778,6 +774,5 @@ extern struct coding_system safe_terminal_coding;
extern Lisp_Object Qcoding_system_error;
extern char emacs_mule_bytes[256];
-extern int emacs_mule_string_char (unsigned char *);
#endif /* EMACS_CODING_H */
diff --git a/src/composite.c b/src/composite.c
index 4e90e9bb914..eddabb66d33 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -428,7 +428,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
This doesn't check the validity of composition. */
-int
+bool
find_composition (ptrdiff_t pos, ptrdiff_t limit,
ptrdiff_t *start, ptrdiff_t *end,
Lisp_Object *prop, Lisp_Object object)
@@ -709,7 +709,7 @@ static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
Lisp_Object);
-int
+bool
composition_gstring_p (Lisp_Object gstring)
{
Lisp_Object header;
@@ -1212,11 +1212,13 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
string. In that case, FACE must not be NULL.
If the character is composed, setup members of CMP_IT (id, nglyphs,
- from, to, reversed_p), and return 1. Otherwise, update
- CMP_IT->stop_pos, and return 0. */
+ from, to, reversed_p), and return true. Otherwise, update
+ CMP_IT->stop_pos, and return false. */
-int
-composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, Lisp_Object string)
+bool
+composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
+ ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w,
+ struct face *face, Lisp_Object string)
{
if (endpos < 0)
endpos = NILP (string) ? BEGV : 0;
@@ -1482,10 +1484,10 @@ struct position_record
/* This is like find_composition, but find an automatic composition
instead. It is assured that POS is not within a static
composition. If found, set *GSTRING to the glyph-string
- representing the composition, and return 1. Otherwise, *GSTRING to
- Qnil, and return 0. */
+ representing the composition, and return true. Otherwise, *GSTRING to
+ Qnil, and return false. */
-static int
+static bool
find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
ptrdiff_t *start, ptrdiff_t *end,
Lisp_Object *gstring, Lisp_Object string)
@@ -1498,7 +1500,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
int c;
Lisp_Object window;
struct window *w;
- int need_adjustment = 0;
+ bool need_adjustment = 0;
window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
if (NILP (window))
diff --git a/src/composite.h b/src/composite.h
index 6a7e0a5e2c7..68f5b27ee42 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -223,8 +223,8 @@ extern Lisp_Object Qcomposition;
extern Lisp_Object composition_hash_table;
extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t,
Lisp_Object, Lisp_Object);
-extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
- Lisp_Object *, Lisp_Object);
+extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
+ Lisp_Object *, Lisp_Object);
extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
extern void make_composition_value_copy (Lisp_Object);
extern void compose_region (int, int, Lisp_Object, Lisp_Object,
@@ -310,17 +310,16 @@ struct font_metrics;
extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
-extern int composition_gstring_p (Lisp_Object);
+extern bool composition_gstring_p (Lisp_Object);
extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
struct font_metrics *);
extern void composition_compute_stop_pos (struct composition_it *,
ptrdiff_t, ptrdiff_t, ptrdiff_t,
Lisp_Object);
-extern int composition_reseat_it (struct composition_it *,
- ptrdiff_t, ptrdiff_t, ptrdiff_t,
- struct window *, struct face *,
- Lisp_Object);
+extern bool composition_reseat_it (struct composition_it *, ptrdiff_t,
+ ptrdiff_t, ptrdiff_t, struct window *,
+ struct face *, Lisp_Object);
extern int composition_update_it (struct composition_it *,
ptrdiff_t, ptrdiff_t, Lisp_Object);
diff --git a/src/conf_post.h b/src/conf_post.h
index ead7298e98d..f90ef90fb83 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -178,6 +178,9 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
#endif
#include <string.h>
+/* If you think about removing the line below, note that the
+ MS-Windows build relies on it for declaration of 'environ' needed
+ by a few source files. */
#include <stdlib.h>
#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
diff --git a/src/data.c b/src/data.c
index ac6c7af9d3c..a93cd169bf5 100644
--- a/src/data.c
+++ b/src/data.c
@@ -83,8 +83,8 @@ Lisp_Object Qoverflow_error, Qunderflow_error;
Lisp_Object Qfloatp;
Lisp_Object Qnumberp, Qnumber_or_marker_p;
-Lisp_Object Qinteger, Qinterval, Qfloat, Qvector;
-Lisp_Object Qsymbol, Qstring, Qcons, Qmisc;
+Lisp_Object Qinteger, Qsymbol;
+static Lisp_Object Qcons, Qfloat, Qmisc, Qstring, Qvector;
Lisp_Object Qwindow;
static Lisp_Object Qoverlay, Qwindow_configuration;
static Lisp_Object Qprocess, Qmarker;
@@ -1117,10 +1117,10 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
return newval;
}
-/* Return 1 if SYMBOL currently has a let-binding
+/* Return true if SYMBOL currently has a let-binding
which was made in the buffer that is now current. */
-static int
+static bool
let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
{
struct specbinding *p;
@@ -1139,7 +1139,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
return 0;
}
-static int
+static bool
let_shadows_global_binding_p (Lisp_Object symbol)
{
struct specbinding *p;
@@ -1155,14 +1155,15 @@ let_shadows_global_binding_p (Lisp_Object symbol)
If buffer/frame-locality is an issue, WHERE specifies which context to use.
(nil stands for the current buffer/frame).
- If BINDFLAG is zero, then if this symbol is supposed to become
+ If BINDFLAG is false, then if this symbol is supposed to become
local in every buffer where it is set, then we make it local.
- If BINDFLAG is nonzero, we don't do that. */
+ If BINDFLAG is true, we don't do that. */
void
-set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag)
+set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
+ bool bindflag)
{
- int voide = EQ (newval, Qunbound);
+ bool voide = EQ (newval, Qunbound);
struct Lisp_Symbol *sym;
Lisp_Object tem1;
@@ -1501,7 +1502,8 @@ union Lisp_Val_Fwd
};
static struct Lisp_Buffer_Local_Value *
-make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents)
+make_blv (struct Lisp_Symbol *sym, bool forwarded,
+ union Lisp_Val_Fwd valcontents)
{
struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv);
Lisp_Object symbol;
@@ -1545,7 +1547,7 @@ The function `default-value' gets the default value and `set-default' sets it.
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
- int forwarded IF_LINT (= 0);
+ bool forwarded IF_LINT (= 0);
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
@@ -1617,10 +1619,10 @@ See also `make-variable-buffer-local'.
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument. */)
- (register Lisp_Object variable)
+ (Lisp_Object variable)
{
- register Lisp_Object tem;
- int forwarded IF_LINT (= 0);
+ Lisp_Object tem;
+ bool forwarded IF_LINT (= 0);
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -1804,9 +1806,9 @@ is to set the VARIABLE frame parameter of that frame. See
Note that since Emacs 23.1, variables cannot be both buffer-local and
frame-local any more (buffer-local bindings used to take precedence over
frame-local bindings). */)
- (register Lisp_Object variable)
+ (Lisp_Object variable)
{
- int forwarded;
+ bool forwarded;
union Lisp_Val_Fwd valcontents;
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -2262,7 +2264,7 @@ static Lisp_Object
arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
{
double f1 = 0, f2 = 0;
- int floatp = 0;
+ bool floatp = 0;
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1);
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2);
@@ -2379,7 +2381,7 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
uintmax_t
cons_to_unsigned (Lisp_Object c, uintmax_t max)
{
- int valid = 0;
+ bool valid = 0;
uintmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
@@ -2432,7 +2434,7 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
intmax_t
cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
{
- int valid = 0;
+ bool valid = 0;
intmax_t val IF_LINT (= 0);
if (INTEGERP (c))
{
@@ -2550,14 +2552,11 @@ static Lisp_Object float_arith_driver (double, ptrdiff_t, enum arithop,
static Lisp_Object
arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
{
- register Lisp_Object val;
- ptrdiff_t argnum;
- register EMACS_INT accum = 0;
- register EMACS_INT next;
-
- int overflow = 0;
- ptrdiff_t ok_args;
- EMACS_INT ok_accum;
+ Lisp_Object val;
+ ptrdiff_t argnum, ok_args;
+ EMACS_INT accum = 0;
+ EMACS_INT next, ok_accum;
+ bool overflow = 0;
switch (code)
{
@@ -3130,8 +3129,6 @@ syms_of_data (void)
DEFSYM (Qthread, "thread");
DEFSYM (Qmutex, "mutex");
DEFSYM (Qcondition_variable, "condition-variable");
- /* Used by Fgarbage_collect. */
- DEFSYM (Qinterval, "interval");
DEFSYM (Qmisc, "misc");
DEFSYM (Qdefun, "defun");
diff --git a/src/dbusbind.c b/src/dbusbind.c
index c1b1310454c..901820648cb 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -70,7 +70,7 @@ static Lisp_Object QCdbus_registered_signal;
static Lisp_Object xd_registered_buses;
/* Whether we are reading a D-Bus event. */
-static int xd_in_read_queued_messages = 0;
+static bool xd_in_read_queued_messages = 0;
/* We use "xd_" and "XD_" as prefix for all internal symbols, because
@@ -997,8 +997,7 @@ xd_find_watch_fd (DBusWatch *watch)
}
/* Prototype. */
-static void
-xd_read_queued_messages (int fd, void *data, int for_read);
+static void xd_read_queued_messages (int fd, void *data);
/* Start monitoring WATCH for possible I/O. */
static dbus_bool_t
@@ -1039,11 +1038,13 @@ xd_remove_watch (DBusWatch *watch, void *data)
return;
/* Unset session environment. */
+#if 0
if (XSYMBOL (QCdbus_session_bus) == data)
{
- // XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
- // unsetenv ("DBUS_SESSION_BUS_ADDRESS");
+ XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
+ unsetenv ("DBUS_SESSION_BUS_ADDRESS");
}
+#endif
if (flags & DBUS_WATCH_WRITABLE)
delete_write_fd (fd);
@@ -1684,7 +1685,7 @@ xd_read_message (Lisp_Object bus)
/* Callback called when something is ready to read or write. */
static void
-xd_read_queued_messages (int fd, void *data, int for_read)
+xd_read_queued_messages (int fd, void *data)
{
Lisp_Object busp = xd_registered_buses;
Lisp_Object bus = Qnil;
diff --git a/src/dired.c b/src/dired.c
index 771230717e3..fa293258107 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -109,18 +109,20 @@ directory_files_internal_unwind (Lisp_Object dh)
}
/* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
- When ATTRS is zero, return a list of directory filenames; when
- non-zero, return a list of directory filenames and their attributes.
+ If not ATTRS, return a list of directory filenames;
+ if ATTRS, return a list of directory filenames and their attributes.
In the latter case, ID_FORMAT is passed to Ffile_attributes. */
Lisp_Object
-directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format)
+directory_files_internal (Lisp_Object directory, Lisp_Object full,
+ Lisp_Object match, Lisp_Object nosort, bool attrs,
+ Lisp_Object id_format)
{
DIR *d;
ptrdiff_t directory_nbytes;
Lisp_Object list, dirfilename, encoded_directory;
struct re_pattern_buffer *bufp = NULL;
- int needsep = 0;
+ bool needsep = 0;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
DIRENTRY *dp;
@@ -227,7 +229,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
if (DIRENTRY_NONEMPTY (dp))
{
ptrdiff_t len;
- int wanted = 0;
+ bool wanted = 0;
Lisp_Object name, finalname;
struct gcpro gcpro1, gcpro2;
@@ -381,9 +383,8 @@ which see. */)
}
-static Lisp_Object file_name_completion
- (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag,
- Lisp_Object predicate);
+static Lisp_Object file_name_completion (Lisp_Object, Lisp_Object, bool,
+ Lisp_Object);
DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
2, 3, 0,
@@ -415,7 +416,7 @@ determined by the variable `completion-ignored-extensions', which see. */)
if (!NILP (handler))
return call4 (handler, Qfile_name_completion, file, directory, predicate);
- return file_name_completion (file, directory, 0, 0, predicate);
+ return file_name_completion (file, directory, 0, predicate);
}
DEFUN ("file-name-all-completions", Ffile_name_all_completions,
@@ -439,14 +440,15 @@ These are all file names in directory DIRECTORY which begin with FILE. */)
if (!NILP (handler))
return call3 (handler, Qfile_name_all_completions, file, directory);
- return file_name_completion (file, directory, 1, 0, Qnil);
+ return file_name_completion (file, directory, 1, Qnil);
}
static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr);
static Lisp_Object Qdefault_directory;
static Lisp_Object
-file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate)
+file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
+ Lisp_Object predicate)
{
DIR *d;
ptrdiff_t bestmatchsize = 0;
@@ -458,11 +460,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
Lisp_Object encoded_file;
Lisp_Object encoded_dir;
struct stat st;
- int directoryp;
- /* If includeall is zero, exclude files in completion-ignored-extensions as
+ bool directoryp;
+ /* If not INCLUDEALL, exclude files in completion-ignored-extensions as
well as "." and "..". Until shown otherwise, assume we can't exclude
anything. */
- int includeall = 1;
+ bool includeall = 1;
ptrdiff_t count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -500,7 +502,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
{
DIRENTRY *dp;
ptrdiff_t len;
- int canexclude = 0;
+ bool canexclude = 0;
errno = 0;
dp = readdir (d);
@@ -528,7 +530,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
if (file_name_completion_stat (encoded_dir, dp, &st) < 0)
continue;
- directoryp = S_ISDIR (st.st_mode);
+ directoryp = S_ISDIR (st.st_mode) != 0;
tem = Qnil;
/* If all_flag is set, always include all.
It would not actually be helpful to the user to ignore any possible
@@ -716,7 +718,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
/* This tests that the current file is an exact match
but BESTMATCH is not (it is too long). */
if ((matchsize == SCHARS (name)
- && matchsize + !!directoryp < SCHARS (bestmatch))
+ && matchsize + directoryp < SCHARS (bestmatch))
||
/* If there is no exact match ignoring case,
prefer a match that does not change the case
@@ -728,7 +730,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
either both or neither are exact. */
(((matchsize == SCHARS (name))
==
- (matchsize + !!directoryp == SCHARS (bestmatch)))
+ (matchsize + directoryp == SCHARS (bestmatch)))
&& (cmp = Fcompare_strings (name, zero,
make_number (SCHARS (file)),
file, zero,
diff --git a/src/dispextern.h b/src/dispextern.h
index a25aac96df9..73f3350713f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -671,7 +671,7 @@ struct glyph_matrix
/* Values of BEGV and ZV as of last redisplay. Set in
mark_window_display_accurate_1. */
- int begv, zv;
+ ptrdiff_t begv, zv;
};
@@ -1126,11 +1126,11 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
((ROW)->phys_height - (ROW)->phys_ascent \
> (ROW)->height - (ROW)->ascent)
-/* Non-zero means that fonts have been loaded since the last glyph
+/* True means that fonts have been loaded since the last glyph
matrix adjustments. The function redisplay_internal adjusts glyph
- matrices when this flag is non-zero. */
+ matrices when this flag is true. */
-extern int fonts_changed_p;
+extern bool fonts_changed_p;
/* A glyph for a space. */
@@ -1149,7 +1149,7 @@ extern int updated_area;
/* Non-zero means last display completed. Zero means it was
preempted. */
-extern int display_completed;
+extern bool display_completed;
@@ -1415,7 +1415,7 @@ struct glyph_string
&& !NILP (BVAR (XBUFFER (W->buffer), mode_line_format)) \
&& WINDOW_TOTAL_LINES (W) > 1)
-/* Value is non-zero if window W wants a header line. */
+/* Value is true if window W wants a header line. */
#define WINDOW_WANTS_HEADER_LINE_P(W) \
(!MINI_WINDOW_P ((W)) \
@@ -1856,7 +1856,6 @@ struct bidi_it {
int resolved_level; /* final resolved level of this character */
int invalid_levels; /* how many PDFs to ignore */
int invalid_rl_levels; /* how many PDFs from RLE/RLO to ignore */
- int prev_was_pdf; /* if non-zero, previous char was PDF */
struct bidi_saved_info prev; /* info about previous character */
struct bidi_saved_info last_strong; /* last-seen strong directional char */
struct bidi_saved_info next_for_neutral; /* surrounding characters for... */
@@ -1879,6 +1878,7 @@ struct bidi_it {
struct bidi_string_data string; /* string to reorder */
bidi_dir_t paragraph_dir; /* current paragraph direction */
ptrdiff_t separator_limit; /* where paragraph separator should end */
+ unsigned prev_was_pdf : 1; /* if non-zero, previous char was PDF */
unsigned first_elt : 1; /* if non-zero, examine current char first */
unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */
unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@@ -2085,10 +2085,10 @@ struct composition_it
ptrdiff_t lookback;
/* If non-negative, number of glyphs of the glyph-string. */
int nglyphs;
- /* Nonzero iff the composition is created while buffer is scanned in
+ /* True iff the composition is created while buffer is scanned in
reverse order, and thus the grapheme clusters must be rendered
from the last to the first. */
- int reversed_p;
+ bool reversed_p;
/** The following members contain information about the current
grapheme cluster. */
@@ -3002,14 +3002,14 @@ enum tool_bar_item_image
/* Defined in bidi.c */
-extern void bidi_init_it (ptrdiff_t, ptrdiff_t, int, struct bidi_it *);
+extern void bidi_init_it (ptrdiff_t, ptrdiff_t, bool, struct bidi_it *);
extern void bidi_move_to_visually_next (struct bidi_it *);
-extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
+extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, bool);
extern int bidi_mirror_char (int);
extern void bidi_push_it (struct bidi_it *);
extern void bidi_pop_it (struct bidi_it *);
extern void *bidi_shelve_cache (void);
-extern void bidi_unshelve_cache (void *, int);
+extern void bidi_unshelve_cache (void *, bool);
/* Defined in xdisp.c */
@@ -3055,7 +3055,7 @@ void move_it_in_display_line (struct it *it,
int in_display_vector_p (struct it *);
int frame_mode_line_height (struct frame *);
extern Lisp_Object Qtool_bar;
-extern int redisplaying_p;
+extern bool redisplaying_p;
extern int help_echo_showing_p;
extern int current_mode_line_height, current_header_line_height;
extern Lisp_Object help_echo_string, help_echo_window;
@@ -3251,9 +3251,12 @@ void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
extern Lisp_Object tip_frame;
extern Window tip_window;
+extern frame_parm_handler x_frame_parm_handlers[];
+
extern void start_hourglass (void);
extern void cancel_hourglass (void);
extern int hourglass_shown_p;
+
struct atimer; /* Defined in atimer.h. */
/* If non-null, an asynchronous timer that, when it expires, displays
an hourglass cursor on all frames. */
@@ -3304,7 +3307,7 @@ extern Lisp_Object marginal_area_string (struct window *, enum window_part,
extern void redraw_frame (struct frame *);
extern void cancel_line (int, struct frame *);
extern void init_desired_glyphs (struct frame *);
-extern int update_frame (struct frame *, int, int);
+extern bool update_frame (struct frame *, bool, bool);
extern void bitch_at_user (void);
void adjust_glyphs (struct frame *);
void free_glyphs (struct frame *);
@@ -3320,13 +3323,13 @@ void rotate_matrix (struct glyph_matrix *, int, int, int);
void increment_matrix_positions (struct glyph_matrix *,
int, int, ptrdiff_t, ptrdiff_t);
void blank_row (struct window *, struct glyph_row *, int);
-void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int);
+void clear_glyph_matrix_rows (struct glyph_matrix *, int, int);
void clear_glyph_row (struct glyph_row *);
void prepare_desired_row (struct glyph_row *);
-void set_window_update_flags (struct window *, int);
-void update_single_window (struct window *, int);
-void do_pending_window_change (int);
-void change_frame_size (struct frame *, int, int, int, int, int);
+void set_window_update_flags (struct window *, bool);
+void update_single_window (struct window *, bool);
+void do_pending_window_change (bool);
+void change_frame_size (struct frame *, int, int, bool, bool, bool);
void init_display (void);
void syms_of_display (void);
extern Lisp_Object Qredisplay_dont_pause;
diff --git a/src/dispnew.c b/src/dispnew.c
index 8db4f93dc70..cac4c2da4c4 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -47,17 +47,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "syssignal.h"
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif /* HAVE_X_WINDOWS */
-
-#ifdef HAVE_NTGUI
-#include "w32term.h"
-#endif /* HAVE_NTGUI */
-
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
/* Include systime.h after xterm.h to avoid double inclusion of time.h. */
@@ -88,7 +80,7 @@ static void update_frame_line (struct frame *, int);
static int required_matrix_height (struct window *);
static int required_matrix_width (struct window *);
static void adjust_frame_glyphs (struct frame *);
-static void change_frame_size_1 (struct frame *, int, int, int, int, int);
+static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool);
static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t);
static void fill_up_frame_row_with_spaces (struct glyph_row *, int);
static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
@@ -98,20 +90,20 @@ static void build_frame_matrix_from_leaf_window (struct glyph_matrix *,
static void adjust_frame_message_buffer (struct frame *);
static void adjust_decode_mode_spec_buffer (struct frame *);
static void fill_up_glyph_row_with_spaces (struct glyph_row *);
-static void clear_window_matrices (struct window *, int);
+static void clear_window_matrices (struct window *, bool);
static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int);
-static int scrolling_window (struct window *, int);
-static int update_window_line (struct window *, int, int *);
+static int scrolling_window (struct window *, bool);
+static bool update_window_line (struct window *, int, bool *);
static void mirror_make_current (struct window *, int);
#ifdef GLYPH_DEBUG
static void check_matrix_pointers (struct glyph_matrix *,
struct glyph_matrix *);
#endif
static void mirror_line_dance (struct window *, int, int, int *, char *);
-static int update_window_tree (struct window *, int);
-static int update_window (struct window *, int);
-static int update_frame_1 (struct frame *, int, int);
-static int scrolling (struct frame *);
+static bool update_window_tree (struct window *, bool);
+static bool update_window (struct window *, bool);
+static bool update_frame_1 (struct frame *, bool, bool);
+static bool scrolling (struct frame *);
static void set_window_cursor_after_update (struct window *);
static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
@@ -122,14 +114,14 @@ static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
static EMACS_TIME preemption_period;
static EMACS_TIME preemption_next_check;
-/* Nonzero upon entry to redisplay means do not assume anything about
+/* True upon entry to redisplay means do not assume anything about
current contents of actual terminal frame; clear and redraw it. */
-int frame_garbaged;
+bool frame_garbaged;
-/* Nonzero means last display completed. Zero means it was preempted. */
+/* True means last display completed. False means it was preempted. */
-int display_completed;
+bool display_completed;
Lisp_Object Qdisplay_table, Qredisplay_dont_pause;
@@ -146,13 +138,13 @@ Lisp_Object selected_frame;
struct frame *last_nonminibuf_frame;
-/* 1 means SIGWINCH happened when not safe. */
+/* True means SIGWINCH happened when not safe. */
-static int delayed_size_change;
+static bool delayed_size_change;
/* 1 means glyph initialization has been completed at startup. */
-static int glyphs_initialized_initially_p;
+static bool glyphs_initialized_initially_p;
/* Updated window if != 0. Set by update_window. */
@@ -178,15 +170,15 @@ static int glyph_pool_count;
static struct frame *frame_matrix_frame;
-/* Non-zero means that fonts have been loaded since the last glyph
+/* True means that fonts have been loaded since the last glyph
matrix adjustments. Redisplay must stop, and glyph matrices must
- be adjusted when this flag becomes non-zero during display. The
+ be adjusted when this flag becomes true during display. The
reason fonts can be loaded so late is that fonts of fontsets are
loaded on demand. Another reason is that a line contains many
characters displayed by zero width or very narrow glyphs of
variable-width fonts. */
-int fonts_changed_p;
+bool fonts_changed_p;
/* Convert vpos and hpos from frame to window and vice versa.
This may only be used for terminal frames. */
@@ -222,16 +214,14 @@ static int history_idx;
history. */
static uprintmax_t history_tick;
-
-static void add_frame_display_history (struct frame *, int);
/* Add to the redisplay history how window W has been displayed.
MSG is a trace containing the information how W's glyph matrix
- has been constructed. PAUSED_P non-zero means that the update
+ has been constructed. PAUSED_P means that the update
has been interrupted for pending input. */
static void
-add_window_display_history (struct window *w, const char *msg, int paused_p)
+add_window_display_history (struct window *w, const char *msg, bool paused_p)
{
char *buf;
@@ -254,11 +244,11 @@ add_window_display_history (struct window *w, const char *msg, int paused_p)
/* Add to the redisplay history that frame F has been displayed.
- PAUSED_P non-zero means that the update has been interrupted for
+ PAUSED_P means that the update has been interrupted for
pending input. */
static void
-add_frame_display_history (struct frame *f, int paused_p)
+add_frame_display_history (struct frame *f, bool paused_p)
{
char *buf;
@@ -395,10 +385,10 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
return n;
}
-/* Return non-zero if ROW's hash value is correct, zero if not.
+/* Return true if ROW's hash value is correct.
Optimized away if ENABLE_CHECKING is not defined. */
-static int
+static bool
verify_row_hash (struct glyph_row *row)
{
return row->hash == row_hash (row);
@@ -431,9 +421,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
{
int i;
int new_rows;
- int marginal_areas_changed_p = 0;
- int header_line_changed_p = 0;
- int header_line_p = 0;
+ bool marginal_areas_changed_p = 0;
+ bool header_line_changed_p = 0;
+ bool header_line_p = 0;
int left = -1, right = -1;
int window_width = -1, window_height = -1;
@@ -736,30 +726,28 @@ increment_matrix_positions (struct glyph_matrix *matrix, int start, int end,
}
-/* Enable a range of rows in glyph matrix MATRIX. START and END are
- the row indices of the first and last + 1 row to enable. If
- ENABLED_P is non-zero, enabled_p flags in rows will be set to 1. */
+/* Clear the enable_p flags in a range of rows in glyph matrix MATRIX.
+ START and END are the row indices of the first and last + 1 row to clear. */
void
-enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p)
+clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
{
eassert (start <= end);
eassert (start >= 0 && start < matrix->nrows);
eassert (end >= 0 && end <= matrix->nrows);
for (; start < end; ++start)
- matrix->rows[start].enabled_p = enabled_p != 0;
+ matrix->rows[start].enabled_p = 0;
}
/* Clear MATRIX.
- This empties all rows in MATRIX by setting the enabled_p flag for
- all rows of the matrix to zero. The function prepare_desired_row
- will eventually really clear a row when it sees one with a zero
- enabled_p flag.
+ Empty all rows in MATRIX by clearing their enabled_p flags.
+ The function prepare_desired_row will eventually really clear a row
+ when it sees one with a false enabled_p flag.
- Resets update hints to defaults value. The only update hint
+ Reset update hints to default values. The only update hint
currently present is the flag MATRIX->no_scrolling_p. */
void
@@ -767,7 +755,7 @@ clear_glyph_matrix (struct glyph_matrix *matrix)
{
if (matrix)
{
- enable_glyph_matrix_rows (matrix, 0, matrix->nrows, 0);
+ clear_glyph_matrix_rows (matrix, 0, matrix->nrows);
matrix->no_scrolling_p = 0;
}
}
@@ -853,11 +841,11 @@ clear_desired_matrices (register struct frame *f)
}
-/* Clear matrices in window tree rooted in W. If DESIRED_P is
- non-zero clear desired matrices, otherwise clear current matrices. */
+/* Clear matrices in window tree rooted in W. If DESIRED_P,
+ clear desired matrices, otherwise clear current matrices. */
static void
-clear_window_matrices (struct window *w, int desired_p)
+clear_window_matrices (struct window *w, bool desired_p)
{
while (w)
{
@@ -1109,12 +1097,12 @@ assign_row (struct glyph_row *to, struct glyph_row *from)
/* Test whether the glyph memory of the glyph row WINDOW_ROW, which is
a row in a window matrix, is a slice of the glyph memory of the
glyph row FRAME_ROW which is a row in a frame glyph matrix. Value
- is non-zero if the glyph memory of WINDOW_ROW is part of the glyph
+ is true if the glyph memory of WINDOW_ROW is part of the glyph
memory of FRAME_ROW. */
#ifdef GLYPH_DEBUG
-static int
+static bool
glyph_row_slice_p (struct glyph_row *window_row, struct glyph_row *frame_row)
{
struct glyph *window_glyph_start = window_row->glyphs[0];
@@ -1161,7 +1149,7 @@ prepare_desired_row (struct glyph_row *row)
{
if (!row->enabled_p)
{
- int rp = row->reversed_p;
+ bool rp = row->reversed_p;
clear_glyph_row (row);
row->enabled_p = 1;
@@ -1260,12 +1248,11 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
}
-/* Test two glyph rows A and B for equality. Value is non-zero if A
- and B have equal contents. MOUSE_FACE_P non-zero means compare the
- mouse_face_p flags of A and B, too. */
+/* Return true if the glyph rows A and B have equal contents.
+ MOUSE_FACE_P means compare the mouse_face_p flags of A and B, too. */
-static inline int
-row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
+static inline bool
+row_equal_p (struct glyph_row *a, struct glyph_row *b, bool mouse_face_p)
{
eassert (verify_row_hash (a));
eassert (verify_row_hash (b));
@@ -1380,14 +1367,14 @@ free_glyph_pool (struct glyph_pool *pool)
is changed from a large value to a smaller one. But, if someone
does it once, we can expect that he will do it again.
- Value is non-zero if the pool changed in a way which makes
+ Return true if the pool changed in a way which makes
re-adjusting window glyph matrices necessary. */
-static int
+static bool
realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
{
ptrdiff_t needed;
- int changed_p;
+ bool changed_p;
changed_p = (pool->glyphs == 0
|| matrix_dim.height != pool->nrows
@@ -1561,7 +1548,7 @@ check_matrix_invariants (struct window *w)
X and Y are column/row within the frame glyph matrix where
sub-matrices for the window tree rooted at WINDOW must be
- allocated. DIM_ONLY_P non-zero means that the caller of this
+ allocated. DIM_ONLY_P means that the caller of this
function is only interested in the result matrix dimension, and
matrix adjustments should not be performed.
@@ -1638,7 +1625,7 @@ check_matrix_invariants (struct window *w)
static struct dim
allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
- int dim_only_p, int *window_change_flags)
+ bool dim_only_p, int *window_change_flags)
{
struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
int x0 = x, y0 = y;
@@ -1646,7 +1633,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
struct dim total;
struct dim dim;
struct window *w;
- int in_horz_combination_p;
+ bool in_horz_combination_p;
/* What combination is WINDOW part of? Compute this once since the
result is the same for all windows in the `next' chain. The
@@ -1704,7 +1691,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
/* Actually change matrices, if allowed. Do not consider
CHANGED_LEAF_MATRIX computed above here because the pool
may have been changed which we don't now here. We trust
- that we only will be called with DIM_ONLY_P != 0 when
+ that we only will be called with DIM_ONLY_P when
necessary. */
if (!dim_only_p)
{
@@ -1919,9 +1906,9 @@ adjust_frame_glyphs (struct frame *f)
f->glyphs_initialized_p = 1;
}
-/* Return 1 if any window in the tree has nonzero window margins. See
+/* Return true if any window in the tree has nonzero window margins. See
the hack at the end of adjust_frame_glyphs_for_frame_redisplay. */
-static int
+static bool
showing_window_margins_p (struct window *w)
{
while (w)
@@ -2052,7 +2039,7 @@ static void
adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
{
struct dim matrix_dim;
- int pool_changed_p;
+ bool pool_changed_p;
int window_change_flags;
int top_window_y;
@@ -2468,7 +2455,7 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window
desired frame matrix built. W is a leaf window whose desired or
current matrix is to be added to FRAME_MATRIX. W's flag
must_be_updated_p determines which matrix it contributes to
- FRAME_MATRIX. If must_be_updated_p is non-zero, W's desired matrix
+ FRAME_MATRIX. If W->must_be_updated_p, W's desired matrix
is added to FRAME_MATRIX, otherwise W's current matrix is added.
Adding a desired matrix means setting up used counters and such in
frame rows, while adding a current window matrix to FRAME_MATRIX
@@ -2519,7 +2506,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
{
struct glyph_row *frame_row = frame_matrix->rows + frame_y;
struct glyph_row *window_row = window_matrix->rows + window_y;
- int current_row_p = window_matrix == w->current_matrix;
+ bool current_row_p = window_matrix == w->current_matrix;
/* Fill up the frame row with spaces up to the left margin of the
window row. */
@@ -2692,7 +2679,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_
{
struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
- int mouse_face_p = current_row->mouse_face_p;
+ bool mouse_face_p = current_row->mouse_face_p;
/* Do current_row = desired_row. This exchanges glyph pointers
between both rows, and does a structure assignment otherwise. */
@@ -2789,7 +2776,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
/* Assign new rows, maybe clear lines. */
for (i = 0; i < nlines; ++i)
{
- int enabled_before_p = new_rows[i].enabled_p;
+ bool enabled_before_p = new_rows[i].enabled_p;
eassert (i + unchanged_at_top < matrix->nrows);
eassert (unchanged_at_top + copy_from[i] < matrix->nrows);
@@ -2897,7 +2884,8 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
/* W is a leaf window, and we are working on its current
matrix m. */
struct glyph_matrix *m = w->current_matrix;
- int i, sync_p = 0;
+ int i;
+ bool sync_p = 0;
struct glyph_row *old_rows;
/* Make a copy of the original rows of matrix m. */
@@ -2919,22 +2907,19 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
int window_from = frame_from - m->matrix_y;
/* Is assigned line inside window? */
- int from_inside_window_p
+ bool from_inside_window_p
= window_from >= 0 && window_from < m->matrix_h;
/* Is assigned to line inside window? */
- int to_inside_window_p
+ bool to_inside_window_p
= window_to >= 0 && window_to < m->matrix_h;
if (from_inside_window_p && to_inside_window_p)
{
- /* Enabled setting before assignment. */
- int enabled_before_p;
-
/* Do the assignment. The enabled_p flag is saved
over the assignment because the old redisplay did
that. */
- enabled_before_p = m->rows[window_to].enabled_p;
+ bool enabled_before_p = m->rows[window_to].enabled_p;
m->rows[window_to] = old_rows[window_from];
m->rows[window_to].enabled_p = enabled_before_p;
@@ -3155,17 +3140,16 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
/* Update frame F based on the data in desired matrices.
- If FORCE_P is non-zero, don't let redisplay be stopped by detecting
- pending input. If INHIBIT_HAIRY_ID_P is non-zero, don't try
- scrolling.
+ If FORCE_P, don't let redisplay be stopped by detecting pending input.
+ If INHIBIT_HAIRY_ID_P, don't try scrolling.
- Value is non-zero if redisplay was stopped due to pending input. */
+ Value is true if redisplay was stopped due to pending input. */
-int
-update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
+bool
+update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
{
- /* 1 means display has been paused because of pending input. */
- int paused_p;
+ /* True means display has been paused because of pending input. */
+ bool paused_p;
struct window *root_window = XWINDOW (f->root_window);
if (redisplay_dont_pause)
@@ -3283,13 +3267,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
Window-based updates
************************************************************************/
-/* Perform updates in window tree rooted at W. FORCE_P non-zero means
- don't stop updating when input is pending. */
+/* Perform updates in window tree rooted at W.
+ If FORCE_P, don't stop updating if input is pending. */
-static int
-update_window_tree (struct window *w, int force_p)
+static bool
+update_window_tree (struct window *w, bool force_p)
{
- int paused_p = 0;
+ bool paused_p = 0;
while (w && !paused_p)
{
@@ -3307,11 +3291,11 @@ update_window_tree (struct window *w, int force_p)
}
-/* Update window W if its flag must_be_updated_p is non-zero. If
- FORCE_P is non-zero, don't stop updating if input is pending. */
+/* Update window W if its flag must_be_updated_p is set.
+ If FORCE_P, don't stop updating if input is pending. */
void
-update_single_window (struct window *w, int force_p)
+update_single_window (struct window *w, bool force_p)
{
if (w->must_be_updated_p)
{
@@ -3460,7 +3444,7 @@ redraw_overlapping_rows (struct window *w, int yb)
static void
check_current_matrix_flags (struct window *w)
{
- int last_seen_p = 0;
+ bool last_seen_p = 0;
int i, yb = window_text_bottom_y (w);
for (i = 0; i < w->current_matrix->nrows - 1; ++i)
@@ -3476,14 +3460,14 @@ check_current_matrix_flags (struct window *w)
#endif /* GLYPH_DEBUG */
-/* Update display of window W. FORCE_P non-zero means that we should
- not stop when detecting pending input. */
+/* Update display of window W.
+ If FORCE_P, don't stop updating when input is pending. */
-static int
-update_window (struct window *w, int force_p)
+static bool
+update_window (struct window *w, bool force_p)
{
struct glyph_matrix *desired_matrix = w->desired_matrix;
- int paused_p;
+ bool paused_p;
#if !PERIODIC_PREEMPTION_CHECKING
int preempt_count = baud_rate / 2400 + 1;
#endif
@@ -3506,7 +3490,8 @@ update_window (struct window *w, int force_p)
struct glyph_row *row, *end;
struct glyph_row *mode_line_row;
struct glyph_row *header_line_row;
- int yb, changed_p = 0, mouse_face_overwritten_p = 0;
+ int yb;
+ bool changed_p = 0, mouse_face_overwritten_p = 0;
#if ! PERIODIC_PREEMPTION_CHECKING
int n_updated = 0;
#endif
@@ -3693,15 +3678,15 @@ update_marginal_area (struct window *w, int area, int vpos)
/* Update the display of the text area of row VPOS in window W.
- Value is non-zero if display has changed. */
+ Value is true if display has changed. */
-static int
+static bool
update_text_area (struct window *w, int vpos)
{
struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
- int changed_p = 0;
+ bool changed_p = 0;
/* Let functions in xterm.c know what area subsequent X positions
will be relative to. */
@@ -3751,9 +3736,9 @@ update_text_area (struct window *w, int vpos)
int stop, i, x;
struct glyph *current_glyph = current_row->glyphs[TEXT_AREA];
struct glyph *desired_glyph = desired_row->glyphs[TEXT_AREA];
- int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
+ bool overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
int desired_stop_pos = desired_row->used[TEXT_AREA];
- int abort_skipping = 0;
+ bool abort_skipping = 0;
/* If the desired row extends its face to the text area end, and
unless the current row also does so at the same position,
@@ -3773,7 +3758,7 @@ update_text_area (struct window *w, int vpos)
in common. */
while (i < stop)
{
- int can_skip_p = !abort_skipping;
+ bool can_skip_p = !abort_skipping;
/* Skip over glyphs that both rows have in common. These
don't have to be written. We can't skip if the last
@@ -3847,7 +3832,7 @@ update_text_area (struct window *w, int vpos)
int start_x = x, start_hpos = i;
struct glyph *start = desired_glyph;
int current_x = x;
- int skip_first_p = !can_skip_p;
+ bool skip_first_p = !can_skip_p;
/* Find the next glyph that's equal again. */
while (i < stop
@@ -3938,16 +3923,15 @@ update_text_area (struct window *w, int vpos)
}
-/* Update row VPOS in window W. Value is non-zero if display has been
- changed. */
+/* Update row VPOS in window W. Value is true if display has been changed. */
-static int
-update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
+static bool
+update_window_line (struct window *w, int vpos, bool *mouse_face_overwritten_p)
{
struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
- int changed_p = 0;
+ bool changed_p = 0;
/* Set the row being updated. This is important to let xterm.c
know what line height values are in effect. */
@@ -4095,7 +4079,7 @@ set_window_cursor_after_update (struct window *w)
tree rooted at W. */
void
-set_window_update_flags (struct window *w, int on_p)
+set_window_update_flags (struct window *w, bool on_p)
{
while (w)
{
@@ -4198,7 +4182,7 @@ add_row_entry (struct glyph_row *row)
/* Try to reuse part of the current display of W by scrolling lines.
- HEADER_LINE_P non-zero means W has a header line.
+ HEADER_LINE_P means W has a header line.
The algorithm is taken from Communications of the ACM, Apr78 "A
Technique for Isolating Differences Between Files." It should take
@@ -4224,7 +4208,7 @@ add_row_entry (struct glyph_row *row)
1 if we did scroll. */
static int
-scrolling_window (struct window *w, int header_line_p)
+scrolling_window (struct window *w, bool header_line_p)
{
struct glyph_matrix *desired_matrix = w->desired_matrix;
struct glyph_matrix *current_matrix = w->current_matrix;
@@ -4237,7 +4221,7 @@ scrolling_window (struct window *w, int header_line_p)
struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
/* Skip over rows equal at the start. */
- for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
+ for (i = header_line_p; i < current_matrix->nrows - 1; ++i)
{
struct glyph_row *d = MATRIX_ROW (desired_matrix, i);
struct glyph_row *c = MATRIX_ROW (current_matrix, i);
@@ -4496,7 +4480,7 @@ scrolling_window (struct window *w, int header_line_p)
for (j = nruns - 1; j > i; --j)
{
struct run *p = runs[j];
- int truncated_p = 0;
+ bool truncated_p = 0;
if (p->nrows > 0
&& p->desired_y < r->desired_y + r->height
@@ -4559,7 +4543,7 @@ scrolling_window (struct window *w, int header_line_p)
for (j = 0; j < r->nrows; ++j)
{
struct glyph_row *from, *to;
- int to_overlapped_p;
+ bool to_overlapped_p;
to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
@@ -4594,20 +4578,19 @@ scrolling_window (struct window *w, int header_line_p)
/* Update the desired frame matrix of frame F.
- FORCE_P non-zero means that the update should not be stopped by
- pending input. INHIBIT_HAIRY_ID_P non-zero means that scrolling
- should not be tried.
+ FORCE_P means that the update should not be stopped by pending input.
+ INHIBIT_HAIRY_ID_P means that scrolling should not be tried.
- Value is non-zero if update was stopped due to pending input. */
+ Value is true if update was stopped due to pending input. */
-static int
-update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
+static bool
+update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p)
{
/* Frame matrices to work on. */
struct glyph_matrix *current_matrix = f->current_matrix;
struct glyph_matrix *desired_matrix = f->desired_matrix;
int i;
- int pause_p;
+ bool pause_p;
int preempt_count = baud_rate / 2400 + 1;
eassert (current_matrix && desired_matrix);
@@ -4699,7 +4682,8 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
}
}
- pause_p = (i < FRAME_LINES (f) - 1) ? i : 0;
+ lint_assume (0 <= FRAME_LINES (f));
+ pause_p = 0 < i && i < FRAME_LINES (f) - 1;
/* Now just clean up termcap drivers and set cursor, etc. */
if (!pause_p)
@@ -4809,7 +4793,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
/* Do line insertions/deletions on frame F for frame-based redisplay. */
-static int
+static bool
scrolling (struct frame *frame)
{
int unchanged_at_top, unchanged_at_bottom;
@@ -4952,10 +4936,10 @@ update_frame_line (struct frame *f, int vpos)
struct glyph_matrix *desired_matrix = f->desired_matrix;
struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos);
struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos);
- int must_write_whole_line_p;
- int write_spaces_p = FRAME_MUST_WRITE_SPACES (f);
- int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
- != FACE_TTY_DEFAULT_BG_COLOR);
+ bool must_write_whole_line_p;
+ bool write_spaces_p = FRAME_MUST_WRITE_SPACES (f);
+ bool colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
+ != FACE_TTY_DEFAULT_BG_COLOR);
if (colored_spaces_p)
write_spaces_p = 1;
@@ -5289,7 +5273,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
/* start_display takes into account the header-line row, but IT's
vpos still counts from the glyph row that includes the window's
start position. Adjust for a possible header-line row. */
- it.vpos += WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
+ it.vpos += WINDOW_WANTS_HEADER_LINE_P (w);
x0 = *x;
@@ -5613,12 +5597,12 @@ window_change_signal (int signalnum) /* If we don't have an argument, */
#endif /* SIGWINCH */
-/* Do any change in frame size that was requested by a signal. SAFE
- non-zero means this function is called from a place where it is
- safe to change frame sizes while a redisplay is in progress. */
+/* Do any change in frame size that was requested by a signal.
+ SAFE means this function is called from a place where it is
+ safe to change frame sizes while a redisplay is in progress. */
void
-do_pending_window_change (int safe)
+do_pending_window_change (bool safe)
{
/* If window_change_signal should have run before, run it now. */
if (redisplaying_p && !safe)
@@ -5645,16 +5629,17 @@ do_pending_window_change (int safe)
/* Change the frame height and/or width. Values may be given as zero to
indicate no change is to take place.
- If DELAY is non-zero, then assume we're being called from a signal
- handler, and queue the change for later - perhaps the next
- redisplay. Since this tries to resize windows, we can't call it
+ If DELAY, assume we're being called from a signal handler, and
+ queue the change for later - perhaps the next redisplay.
+ Since this tries to resize windows, we can't call it
from a signal handler.
- SAFE non-zero means this function is called from a place where it's
+ SAFE means this function is called from a place where it's
safe to change frame sizes while a redisplay is in progress. */
void
-change_frame_size (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
+change_frame_size (struct frame *f, int newheight, int newwidth,
+ bool pretend, bool delay, bool safe)
{
Lisp_Object tail, frame;
@@ -5673,7 +5658,8 @@ change_frame_size (register struct frame *f, int newheight, int newwidth, int pr
}
static void
-change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
+change_frame_size_1 (struct frame *f, int newheight, int newwidth,
+ bool pretend, bool delay, bool safe)
{
int new_frame_total_cols;
ptrdiff_t count = SPECPDL_INDEX ();
@@ -5769,7 +5755,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
UNBLOCK_INPUT;
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
run_window_configuration_change_hook (f);
@@ -5929,13 +5915,13 @@ additional wait period, in milliseconds; this is for backwards compatibility.
TIMEOUT is number of seconds to wait (float or integer),
or t to wait forever.
- READING is 1 if reading input.
+ READING is true if reading input.
If DO_DISPLAY is >0 display process output while waiting.
If DO_DISPLAY is >1 perform an initial redisplay before waiting.
*/
Lisp_Object
-sit_for (Lisp_Object timeout, int reading, int do_display)
+sit_for (Lisp_Object timeout, bool reading, int do_display)
{
intmax_t sec;
int nsec;
@@ -6044,8 +6030,7 @@ pass nil for VARIABLE. */)
(Lisp_Object variable)
{
Lisp_Object state, tail, frame, buf;
- Lisp_Object *vecp, *end;
- ptrdiff_t n;
+ ptrdiff_t n, idx;
if (! NILP (variable))
{
@@ -6057,18 +6042,16 @@ pass nil for VARIABLE. */)
else
state = frame_and_buffer_state;
- vecp = XVECTOR (state)->contents;
- end = vecp + ASIZE (state);
-
+ idx = 0;
FOR_EACH_FRAME (tail, frame)
{
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
- if (!EQ (*vecp++, frame))
+ if (!EQ (AREF (state, idx++), frame))
goto changed;
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
- if (!EQ (*vecp++, XFRAME (frame)->name))
+ if (!EQ (AREF (state, idx++), XFRAME (frame)->name))
goto changed;
}
/* Check that the buffer info matches. */
@@ -6078,23 +6061,23 @@ pass nil for VARIABLE. */)
/* Ignore buffers that aren't included in buffer lists. */
if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
continue;
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
- if (!EQ (*vecp++, buf))
+ if (!EQ (AREF (state, idx++), buf))
goto changed;
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
- if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only)))
+ if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), read_only)))
goto changed;
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
- if (!EQ (*vecp++, Fbuffer_modified_p (buf)))
+ if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf)))
goto changed;
}
- if (vecp == end)
+ if (idx == ASIZE (state))
goto changed;
/* Detect deletion of a buffer at the end of the list. */
- if (EQ (*vecp, Qlambda))
+ if (EQ (AREF (state, idx), Qlambda))
return Qnil;
/* Come here if we decide the data has changed. */
@@ -6121,11 +6104,13 @@ pass nil for VARIABLE. */)
}
/* Record the new data in the (possibly reallocated) vector. */
- vecp = XVECTOR (state)->contents;
+ idx = 0;
FOR_EACH_FRAME (tail, frame)
{
- *vecp++ = frame;
- *vecp++ = XFRAME (frame)->name;
+ ASET (state, idx, frame);
+ idx++;
+ ASET (state, idx, XFRAME (frame)->name);
+ idx++;
}
for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
{
@@ -6133,19 +6118,23 @@ pass nil for VARIABLE. */)
/* Ignore buffers that aren't included in buffer lists. */
if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
continue;
- *vecp++ = buf;
- *vecp++ = BVAR (XBUFFER (buf), read_only);
- *vecp++ = Fbuffer_modified_p (buf);
+ ASET (state, idx, buf);
+ idx++;
+ ASET (state, idx, BVAR (XBUFFER (buf), read_only));
+ idx++;
+ ASET (state, idx, Fbuffer_modified_p (buf));
+ idx++;
}
/* Fill up the vector with lambdas (always at least one). */
- *vecp++ = Qlambda;
- while (vecp - XVECTOR (state)->contents
- < ASIZE (state))
- *vecp++ = Qlambda;
+ ASET (state, idx, Qlambda);
+ idx++;
+ while (idx < ASIZE (state))
+ {
+ ASET (state, idx, Qlambda);
+ idx++;
+ }
/* Make sure we didn't overflow the vector. */
- if (vecp - XVECTOR (state)->contents
- > ASIZE (state))
- abort ();
+ eassert (idx <= ASIZE (state));
return Qt;
}
diff --git a/src/doc.c b/src/doc.c
index ed311d918d7..02a5b4b8143 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -37,7 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
Lisp_Object Qfunction_documentation;
-extern Lisp_Object Qclosure;
/* Buffer used for reading from documentation file. */
static char *get_doc_string_buffer;
static ptrdiff_t get_doc_string_buffer_size;
@@ -48,7 +47,7 @@ static unsigned char *read_bytecode_pointer;
If UNREADFLAG is 1, we unread a byte. */
int
-read_bytecode_char (int unreadflag)
+read_bytecode_char (bool unreadflag)
{
if (unreadflag)
{
@@ -70,20 +69,18 @@ read_bytecode_char (int unreadflag)
(e.g. because the file has been modified and the location is stale),
return nil.
- If UNIBYTE is nonzero, always make a unibyte string.
+ If UNIBYTE, always make a unibyte string.
- If DEFINITION is nonzero, assume this is for reading
+ If DEFINITION, assume this is for reading
a dynamic function definition; convert the bytestring
and the constants vector with appropriate byte handling,
and return a cons cell. */
Lisp_Object
-get_doc_string (Lisp_Object filepos, int unibyte, int definition)
+get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
{
- char *from, *to;
- register int fd;
- register char *name;
- register char *p, *p1;
+ char *from, *to, *name, *p, *p1;
+ int fd;
ptrdiff_t minsize;
int offset;
EMACS_INT position;
@@ -302,7 +299,7 @@ read_doc_string (Lisp_Object filepos)
return get_doc_string (filepos, 0, 1);
}
-static int
+static bool
reread_doc_file (Lisp_Object file)
{
#if 0
@@ -335,7 +332,7 @@ string is passed through `substitute-command-keys'. */)
Lisp_Object fun;
Lisp_Object funcar;
Lisp_Object doc;
- int try_reload = 1;
+ bool try_reload = 1;
documentation:
@@ -467,7 +464,7 @@ This differs from `get' in that it can refer to strings stored in the
aren't strings. */)
(Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw)
{
- int try_reload = 1;
+ bool try_reload = 1;
Lisp_Object tem;
documentation_property:
@@ -562,12 +559,11 @@ the same file name is found in the `doc-directory'. */)
{
int fd;
char buf[1024 + 1];
- register int filled;
- register EMACS_INT pos;
- register char *p;
+ int filled;
+ EMACS_INT pos;
Lisp_Object sym;
- char *name;
- int skip_file = 0;
+ char *p, *name;
+ bool skip_file = 0;
CHECK_STRING (filename);
@@ -722,9 +718,9 @@ Otherwise, return a new string, without any text properties. */)
(Lisp_Object string)
{
char *buf;
- int changed = 0;
- register unsigned char *strp;
- register char *bufp;
+ bool changed = 0;
+ unsigned char *strp;
+ char *bufp;
ptrdiff_t idx;
ptrdiff_t bsize;
Lisp_Object tem;
@@ -733,7 +729,7 @@ Otherwise, return a new string, without any text properties. */)
ptrdiff_t length, length_byte;
Lisp_Object name;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- int multibyte;
+ bool multibyte;
ptrdiff_t nchars;
if (NILP (string))
@@ -787,7 +783,7 @@ Otherwise, return a new string, without any text properties. */)
else if (strp[0] == '\\' && strp[1] == '[')
{
ptrdiff_t start_idx;
- int follow_remap = 1;
+ bool follow_remap = 1;
changed = 1;
strp += 2; /* skip \[ */
diff --git a/src/editfns.c b/src/editfns.c
index fa57edead28..a14e043c1bf 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -65,7 +65,7 @@ extern Lisp_Object w32_get_internal_run_time (void);
#endif
static Lisp_Object format_time_string (char const *, ptrdiff_t, EMACS_TIME,
- int, struct tm *);
+ bool, struct tm *);
static int tm_diff (struct tm *, struct tm *);
static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
@@ -246,11 +246,11 @@ The return value is POSITION. */)
/* Return the start or end position of the region.
- BEGINNINGP non-zero means return the start.
+ BEGINNINGP means return the start.
If there is no region active, signal an error. */
static Lisp_Object
-region_limit (int beginningp)
+region_limit (bool beginningp)
{
Lisp_Object m;
@@ -264,7 +264,7 @@ region_limit (int beginningp)
error ("The mark is not set now, so there is no region");
/* Clip to the current narrowing (bug#11770). */
- return make_number ((PT < XFASTINT (m)) == (beginningp != 0)
+ return make_number ((PT < XFASTINT (m)) == beginningp
? PT
: clip_to_bounds (BEGV, XFASTINT (m), ZV));
}
@@ -435,12 +435,12 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned
results; they do not effect boundary behavior.
- If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first
+ If MERGE_AT_BOUNDARY is non-nil, then if POS is at the very first
position of a field, then the beginning of the previous field is
returned instead of the beginning of POS's field (since the end of a
field is actually also the beginning of the next input field, this
behavior is sometimes useful). Additionally in the MERGE_AT_BOUNDARY
- true case, if two fields are separated by a field with the special
+ non-nil case, if two fields are separated by a field with the special
value `boundary', and POS lies within it, then the two separated
fields are considered to be adjacent, and POS between them, when
finding the beginning and ending of the "merged" field.
@@ -455,10 +455,10 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
{
/* Fields right before and after the point. */
Lisp_Object before_field, after_field;
- /* 1 if POS counts as the start of a field. */
- int at_field_start = 0;
- /* 1 if POS counts as the end of a field. */
- int at_field_end = 0;
+ /* True if POS counts as the start of a field. */
+ bool at_field_start = 0;
+ /* True if POS counts as the end of a field. */
+ bool at_field_end = 0;
if (NILP (pos))
XSETFASTINT (pos, PT);
@@ -502,19 +502,19 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
xxxx.yyyy
- In this situation, if merge_at_boundary is true, we consider the
+ In this situation, if merge_at_boundary is non-nil, consider the
`x' and `y' fields as forming one big merged field, and so the end
of the field is the end of `y'.
However, if `x' and `y' are separated by a special `boundary' field
- (a field with a `field' char-property of 'boundary), then we ignore
+ (a field with a `field' char-property of 'boundary), then ignore
this special field when merging adjacent fields. Here's the same
situation, but with a `boundary' field between the `x' and `y' fields:
xxx.BBBByyyy
Here, if point is at the end of `x', the beginning of `y', or
- anywhere in-between (within the `boundary' field), we merge all
+ anywhere in-between (within the `boundary' field), merge all
three fields and consider the beginning as being the beginning of
the `x' field, and the end as being the end of the `y' field. */
@@ -658,7 +658,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */)
{
/* If non-zero, then the original point, before re-positioning. */
ptrdiff_t orig_point = 0;
- int fwd;
+ bool fwd;
Lisp_Object prev_old, prev_new;
if (NILP (new_pos))
@@ -816,8 +816,8 @@ This function does not move point. */)
Lisp_Object
save_excursion_save (void)
{
- int visible = (XBUFFER (XWINDOW (selected_window)->buffer)
- == current_buffer);
+ bool visible = (XBUFFER (XWINDOW (selected_window)->buffer)
+ == current_buffer);
return Fcons (Fpoint_marker (),
Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil),
@@ -831,7 +831,7 @@ save_excursion_restore (Lisp_Object info)
{
Lisp_Object tem, tem1, omark, nmark;
struct gcpro gcpro1, gcpro2, gcpro3;
- int visible_p;
+ bool visible_p;
tem = Fmarker_buffer (XCAR (info));
/* If buffer being returned to is now deleted, avoid error */
@@ -946,13 +946,10 @@ BODY is executed just like `progn'.
usage: (save-current-buffer &rest BODY) */)
(Lisp_Object args)
{
- Lisp_Object val;
ptrdiff_t count = SPECPDL_INDEX ();
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
-
- val = Fprogn (args);
- return unbind_to (count, val);
+ record_unwind_current_buffer ();
+ return unbind_to (count, Fprogn (args));
}
DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0,
@@ -1470,8 +1467,8 @@ make_lisp_time (EMACS_TIME t)
/* Decode a Lisp list SPECIFIED_TIME that represents a time.
Set *PHIGH, *PLOW, *PUSEC, *PPSEC to its parts; do not check their values.
- Return nonzero if successful. */
-static int
+ Return true if successful. */
+static bool
disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh,
Lisp_Object *plow, Lisp_Object *pusec,
Lisp_Object *ppsec)
@@ -1514,8 +1511,8 @@ disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh,
If *DRESULT is not null, store into *DRESULT the number of
seconds since the start of the POSIX Epoch.
- Return nonzero if successful. */
-int
+ Return true if successful. */
+bool
decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec,
Lisp_Object psec,
EMACS_TIME *result, double *dresult)
@@ -1635,7 +1632,7 @@ or (if you need time as a string) `format-time-string'. */)
/* Write information into buffer S of size MAXSIZE, according to the
FORMAT of length FORMAT_LEN, using time information taken from *TP.
- Default to Universal Time if UT is nonzero, local time otherwise.
+ Default to Universal Time if UT, local time otherwise.
Use NS as the number of nanoseconds in the %N directive.
Return the number of bytes written, not including the terminating
'\0'. If S is NULL, nothing will be written anywhere; so to
@@ -1646,7 +1643,7 @@ or (if you need time as a string) `format-time-string'. */)
bytes in FORMAT and it does not support nanoseconds. */
static size_t
emacs_nmemftime (char *s, size_t maxsize, const char *format,
- size_t format_len, const struct tm *tp, int ut, int ns)
+ size_t format_len, const struct tm *tp, bool ut, int ns)
{
size_t total = 0;
@@ -1751,7 +1748,7 @@ usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL) */)
static Lisp_Object
format_time_string (char const *format, ptrdiff_t formatlen,
- EMACS_TIME t, int ut, struct tm *tmp)
+ EMACS_TIME t, bool ut, struct tm *tmp)
{
char buffer[4000];
char *buf = buffer;
@@ -2231,11 +2228,11 @@ general_insert_function (void (*insert_func)
(const char *, ptrdiff_t),
void (*insert_from_string_func)
(Lisp_Object, ptrdiff_t, ptrdiff_t,
- ptrdiff_t, ptrdiff_t, int),
- int inherit, ptrdiff_t nargs, Lisp_Object *args)
+ ptrdiff_t, ptrdiff_t, bool),
+ bool inherit, ptrdiff_t nargs, Lisp_Object *args)
{
ptrdiff_t argnum;
- register Lisp_Object val;
+ Lisp_Object val;
for (argnum = 0; argnum < nargs; argnum++)
{
@@ -2458,7 +2455,7 @@ from adjoining text, if those properties are sticky. */)
/* Return a Lisp_String containing the text of the current buffer from
START to END. If text properties are in use and the current buffer
has properties in the range specified, the resulting string will also
- have them, if PROPS is nonzero.
+ have them, if PROPS is true.
We don't want to use plain old make_string here, because it calls
make_uninit_string, which can cause the buffer arena to be
@@ -2469,7 +2466,7 @@ from adjoining text, if those properties are sticky. */)
buffer substrings. */
Lisp_Object
-make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props)
+make_buffer_string (ptrdiff_t start, ptrdiff_t end, bool props)
{
ptrdiff_t start_byte = CHAR_TO_BYTE (start);
ptrdiff_t end_byte = CHAR_TO_BYTE (end);
@@ -2482,7 +2479,7 @@ make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props)
If text properties are in use and the current buffer
has properties in the range specified, the resulting string will also
- have them, if PROPS is nonzero.
+ have them, if PROPS is true.
We don't want to use plain old make_string here, because it calls
make_uninit_string, which can cause the buffer arena to be
@@ -2494,7 +2491,7 @@ make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props)
Lisp_Object
make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte,
- ptrdiff_t end, ptrdiff_t end_byte, int props)
+ ptrdiff_t end, ptrdiff_t end_byte, bool props)
{
Lisp_Object result, tem, tem1;
@@ -2845,7 +2842,8 @@ Both characters must have the same length of multi-byte form. */)
#define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
int maybe_byte_combining = COMBINING_NO;
ptrdiff_t last_changed = 0;
- int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte_p
+ = !NILP (BVAR (current_buffer, enable_multibyte_characters));
int fromc, toc;
restart:
@@ -3081,8 +3079,8 @@ It returns the number of characters changed. */)
int cnt; /* Number of changes made. */
ptrdiff_t size; /* Size of translate table. */
ptrdiff_t pos, pos_byte, end_pos;
- int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
- int string_multibyte IF_LINT (= 0);
+ bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool string_multibyte IF_LINT (= 0);
validate_region (&start, &end);
if (CHAR_TABLE_P (table))
@@ -3642,20 +3640,20 @@ usage: (format STRING &rest OBJECTS) */)
ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1;
char *p;
Lisp_Object buf_save_value IF_LINT (= {0});
- register char *format, *end, *format_start;
+ char *format, *end, *format_start;
ptrdiff_t formatlen, nchars;
- /* Nonzero if the format is multibyte. */
- int multibyte_format = 0;
- /* Nonzero if the output should be a multibyte string,
+ /* True if the format is multibyte. */
+ bool multibyte_format = 0;
+ /* True if the output should be a multibyte string,
which is true if any of the inputs is one. */
- int multibyte = 0;
+ bool multibyte = 0;
/* When we make a multibyte string, we must pay attention to the
byte combining problem, i.e., a byte may be combined with a
multibyte character of the previous string. This flag tells if we
must consider such a situation or not. */
- int maybe_combine_byte;
+ bool maybe_combine_byte;
Lisp_Object val;
- int arg_intervals = 0;
+ bool arg_intervals = 0;
USE_SAFE_ALLOCA;
/* discarded[I] is 1 if byte I of the format
@@ -3671,8 +3669,8 @@ usage: (format STRING &rest OBJECTS) */)
struct info
{
ptrdiff_t start, end;
- int converted_to_string;
- int intervals;
+ unsigned converted_to_string : 1;
+ unsigned intervals : 1;
} *info = 0;
/* It should not be necessary to GCPRO ARGS, because
@@ -3749,13 +3747,13 @@ usage: (format STRING &rest OBJECTS) */)
digits to print after the '.' for floats, or the max.
number of chars to print from a string. */
- int minus_flag = 0;
- int plus_flag = 0;
- int space_flag = 0;
- int sharp_flag = 0;
- int zero_flag = 0;
+ bool minus_flag = 0;
+ bool plus_flag = 0;
+ bool space_flag = 0;
+ bool sharp_flag = 0;
+ bool zero_flag = 0;
ptrdiff_t field_width;
- int precision_given;
+ bool precision_given;
uintmax_t precision = UINTMAX_MAX;
char *num_end;
char conversion;
@@ -4135,7 +4133,7 @@ usage: (format STRING &rest OBJECTS) */)
char *src = sprintf_buf;
char src0 = src[0];
int exponent_bytes = 0;
- int signedp = src0 == '-' || src0 == '+' || src0 == ' ';
+ bool signedp = src0 == '-' || src0 == '+' || src0 == ' ';
int significand_bytes;
if (zero_flag
&& ((src[signedp] >= '0' && src[signedp] <= '9')
diff --git a/src/emacs.c b/src/emacs.c
index a039e89d48f..3c814a36043 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -31,6 +31,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
+
#ifdef WINDOWSNT
#include <fcntl.h>
#include <windows.h> /* just for w32.h */
@@ -62,20 +66,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "gnutls.h"
#endif
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
-
#if (defined PROFILING \
&& (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
# include <sys/gmon.h>
extern void moncontrol (int mode);
#endif
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif
-
#ifdef HAVE_SETLOCALE
#include <locale.h>
#endif
@@ -99,10 +95,10 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati
/* Empty lisp strings. To avoid having to build any others. */
Lisp_Object empty_unibyte_string, empty_multibyte_string;
-/* Set nonzero after Emacs has started up the first time.
- Prevents reinitialization of the Lisp world and keymaps
- on subsequent starts. */
-int initialized;
+/* Set after Emacs has started up the first time.
+ Prevents reinitialization of the Lisp world and keymaps
+ on subsequent starts. */
+bool initialized;
#ifdef DARWIN_OS
extern void unexec_init_emacs_zone (void);
@@ -116,9 +112,9 @@ static void *malloc_state_ptr;
extern void *malloc_get_state (void);
/* From glibc, a routine that overwrites the malloc internal state. */
extern int malloc_set_state (void*);
-/* Non-zero if the MALLOC_CHECK_ environment variable was set while
+/* True if the MALLOC_CHECK_ environment variable was set while
dumping. Used to work around a bug in glibc's malloc. */
-static int malloc_using_checking;
+static bool malloc_using_checking;
#endif
Lisp_Object Qfile_name_handler_alist;
@@ -127,17 +123,17 @@ Lisp_Object Qrisky_local_variable;
Lisp_Object Qkill_emacs;
-/* If non-zero, Emacs should not attempt to use a window-specific code,
+/* If true, Emacs should not attempt to use a window-specific code,
but instead should use the virtual terminal under which it was started. */
-int inhibit_window_system;
+bool inhibit_window_system;
-/* If non-zero, a filter or a sentinel is running. Tested to save the match
+/* If true, a filter or a sentinel is running. Tested to save the match
data on the first attempt to change it inside asynchronous code. */
-int running_asynch_code;
+bool running_asynch_code;
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
-/* If non-zero, -d was specified, meaning we're using some window system. */
-int display_arg;
+/* If true, -d was specified, meaning we're using some window system. */
+bool display_arg;
#endif
#if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX)
@@ -150,11 +146,11 @@ static void *my_heap_start;
static uprintmax_t heap_bss_diff;
#endif
-/* Nonzero means running Emacs without interactive terminal. */
-int noninteractive;
+/* True means running Emacs without interactive terminal. */
+bool noninteractive;
-/* Nonzero means remove site-lisp directories from load-path. */
-int no_site_lisp;
+/* True means remove site-lisp directories from load-path. */
+bool no_site_lisp;
/* Name for the server started by the daemon.*/
static char *daemon_name;
@@ -272,13 +268,8 @@ section of the Emacs manual or the file BUGS.\n"
/* Signal code for the fatal signal that was received. */
static int fatal_error_code;
-/* Nonzero if handling a fatal error already. */
-int fatal_error_in_progress;
-
-/* If non-null, call this function from fatal_error_signal before
- committing suicide. */
-
-static void (*fatal_error_signal_hook) (void);
+/* True if handling a fatal error already. */
+bool fatal_error_in_progress;
#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
/* When compiled with GTK and running under Gnome,
@@ -316,7 +307,7 @@ fatal_error_signal (int sig)
if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
Fkill_emacs (make_number (sig));
- shut_down_emacs (sig, 0, Qnil);
+ shut_down_emacs (sig, Qnil);
}
/* Signal the same code; this time it will really be fatal.
@@ -327,9 +318,6 @@ fatal_error_signal (int sig)
sigunblock (sigmask (fatal_error_code));
#endif
- if (fatal_error_signal_hook)
- fatal_error_signal_hook ();
-
kill (getpid (), fatal_error_code);
}
@@ -576,7 +564,7 @@ DEFINE_DUMMY_FUNCTION (__main)
Too bad we can't just use getopt for all of this, but we don't have
enough information to do it right. */
-static int
+static bool
argmatch (char **argv, int argc, const char *sstr, const char *lstr,
int minlen, char **valptr, int *skipptr)
{
@@ -680,12 +668,12 @@ int
main (int argc, char **argv)
{
char stack_bottom_variable;
- int do_initial_setlocale;
+ bool do_initial_setlocale;
int skip_args = 0;
#ifdef HAVE_SETRLIMIT
struct rlimit rlim;
#endif
- int no_loadup = 0;
+ bool no_loadup = 0;
char *junk = 0;
char *dname_arg = 0;
#ifdef NS_IMPL_COCOA
@@ -1280,6 +1268,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
init_data ();
init_atimer ();
running_asynch_code = 0;
+ init_random ();
no_loadup
= argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
@@ -1959,7 +1948,7 @@ all of which are called before Emacs is actually killed. */)
x_clipboard_manager_save_all ();
#endif
- shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil);
+ shut_down_emacs (0, STRINGP (arg) ? arg : Qnil);
#ifdef HAVE_NS
ns_release_autorelease_pool (ns_pool);
@@ -1995,7 +1984,7 @@ all of which are called before Emacs is actually killed. */)
and Fkill_emacs. */
void
-shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
+shut_down_emacs (int sig, Lisp_Object stuff)
{
/* Prevent running of hooks from now on. */
Vrun_hooks = Qnil;
@@ -2030,17 +2019,6 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
unlock_all_files ();
#endif
-#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */
-#ifdef HAVE_X_WINDOWS
- /* It's not safe to call intern here. Maybe we are crashing. */
- if (!noninteractive && SYMBOLP (Vinitial_window_system)
- && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1
- && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x'
- && ! no_x)
- Fx_close_current_connection ();
-#endif /* HAVE_X_WINDOWS */
-#endif
-
#ifdef SIGIO
/* There is a tendency for a SIGIO signal to arrive within exit,
and cause a SIGHUP because the input descriptor is already closed. */
@@ -2232,7 +2210,7 @@ decode_env_path (const char *evarname, const char *defalt)
const char *path, *p;
Lisp_Object lpath, element, tem;
#ifdef WINDOWSNT
- int defaulted = 0;
+ bool defaulted = 0;
const char *emacs_dir = egetenv ("emacs_dir");
static const char *emacs_dir_env = "%emacs_dir%/";
const size_t emacs_dir_len = strlen (emacs_dir_env);
@@ -2328,7 +2306,7 @@ from the parent process and its tty file descriptors. */)
(void)
{
int nfd;
- int err = 0;
+ bool err = 0;
if (!IS_DAEMON)
error ("This function can only be called if emacs is run as a daemon");
diff --git a/src/eval.c b/src/eval.c
index c7a35fc91af..ecdbe960a8a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -131,7 +131,7 @@ int handling_signal;
Lisp_Object inhibit_lisp_code;
static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
-static int interactive_p (int);
+static bool interactive_p (void);
static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
/* Functions to set Lisp_Object slots of struct specbinding. */
@@ -213,7 +213,7 @@ restore_stack_limits (Lisp_Object data)
static Lisp_Object
call_debugger (Lisp_Object arg)
{
- int debug_while_redisplaying;
+ bool debug_while_redisplaying;
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object val;
EMACS_INT old_max = max_specpdl_size;
@@ -544,7 +544,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
use `called-interactively-p'. */)
(void)
{
- return interactive_p (1) ? Qt : Qnil;
+ return interactive_p () ? Qt : Qnil;
}
@@ -563,26 +563,23 @@ thinking of using it for any other purpose, it is quite likely that
you're making a mistake. Think: what do you want to do when the
command is called from a keyboard macro?
-This function is meant for implementing advice and other
-function-modifying features. Instead of using this, it is sometimes
-cleaner to give your function an extra optional argument whose
-`interactive' spec specifies non-nil unconditionally (\"p\" is a good
-way to do this), or via (not (or executing-kbd-macro noninteractive)). */)
+Instead of using this function, it is sometimes cleaner to give your
+function an extra optional argument whose `interactive' spec specifies
+non-nil unconditionally (\"p\" is a good way to do this), or via
+\(not (or executing-kbd-macro noninteractive)). */)
(Lisp_Object kind)
{
- return ((INTERACTIVE || !EQ (kind, intern ("interactive")))
- && interactive_p (1)) ? Qt : Qnil;
+ return (((INTERACTIVE || !EQ (kind, intern ("interactive")))
+ && interactive_p ())
+ ? Qt : Qnil);
}
-/* Return 1 if function in which this appears was called using
- call-interactively.
+/* Return true if function in which this appears was called using
+ call-interactively and is not a built-in. */
- EXCLUDE_SUBRS_P non-zero means always return 0 if the function
- called is a built-in. */
-
-static int
-interactive_p (int exclude_subrs_p)
+static bool
+interactive_p (void)
{
struct backtrace *btp;
Lisp_Object fun;
@@ -611,9 +608,9 @@ interactive_p (int exclude_subrs_p)
/* `btp' now points at the frame of the innermost function that isn't
a special form, ignoring frames for Finteractive_p and/or
Fbytecode at the top. If this frame is for a built-in function
- (such as load or eval-region) return nil. */
+ (such as load or eval-region) return false. */
fun = Findirect_function (*btp->function, Qnil);
- if (exclude_subrs_p && SUBRP (fun))
+ if (SUBRP (fun))
return 0;
/* `btp' points to the frame of a Lisp function that called interactive-p.
@@ -1121,7 +1118,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
static _Noreturn void
unwind_to_catch (struct catchtag *catch, Lisp_Object value)
{
- int last_time;
+ bool last_time;
/* Save the value in the tag. */
catch->val = value;
@@ -1470,8 +1467,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object);
-static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
- Lisp_Object data);
+static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig,
+ Lisp_Object data);
void
process_quit_flag (void)
@@ -1576,7 +1573,7 @@ See also the function `condition-case'. */)
if requested". */
|| EQ (h->handler, Qerror)))
{
- int debugger_called
+ bool debugger_called
= maybe_call_debugger (conditions, error_symbol, data);
/* We can't return values to code which signaled an error, but we
can continue code which has signaled a quit. */
@@ -1670,10 +1667,10 @@ signal_error (const char *s, Lisp_Object arg)
}
-/* Return nonzero if LIST is a non-nil atom or
+/* Return true if LIST is a non-nil atom or
a list containing one of CONDITIONS. */
-static int
+static bool
wants_debugger (Lisp_Object list, Lisp_Object conditions)
{
if (NILP (list))
@@ -1693,15 +1690,15 @@ wants_debugger (Lisp_Object list, Lisp_Object conditions)
return 0;
}
-/* Return 1 if an error with condition-symbols CONDITIONS,
+/* Return true if an error with condition-symbols CONDITIONS,
and described by SIGNAL-DATA, should skip the debugger
according to debugger-ignored-errors. */
-static int
+static bool
skip_debugger (Lisp_Object conditions, Lisp_Object data)
{
Lisp_Object tail;
- int first_string = 1;
+ bool first_string = 1;
Lisp_Object error_message;
error_message = Qnil;
@@ -1736,7 +1733,7 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data)
= SIG is the error symbol, and DATA is the rest of the data.
= SIG is nil, and DATA is (SYMBOL . REST-OF-DATA).
This is for memory-full errors only. */
-static int
+static bool
maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
{
Lisp_Object combined_data;
@@ -2252,7 +2249,6 @@ eval_sub (Lisp_Object form)
if (EQ (funcar, Qmacro))
{
ptrdiff_t count = SPECPDL_INDEX ();
- extern Lisp_Object Qlexical_binding;
Lisp_Object exp;
/* Bind lexical-binding during expansion of the macro, so the
macro can know reliably if the code it outputs will be
@@ -2741,33 +2737,9 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
doc: /* Non-nil if OBJECT is a function. */)
(Lisp_Object object)
{
- if (SYMBOLP (object) && !NILP (Ffboundp (object)))
- {
- object = Findirect_function (object, Qt);
-
- if (CONSP (object) && EQ (XCAR (object), Qautoload))
- {
- /* Autoloaded symbols are functions, except if they load
- macros or keymaps. */
- int i;
- for (i = 0; i < 4 && CONSP (object); i++)
- object = XCDR (object);
-
- return (CONSP (object) && !NILP (XCAR (object))) ? Qnil : Qt;
- }
- }
-
- if (SUBRP (object))
- return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil;
- else if (COMPILEDP (object))
+ if (FUNCTIONP (object))
return Qt;
- else if (CONSP (object))
- {
- Lisp_Object car = XCAR (object);
- return (EQ (car, Qlambda) || EQ (car, Qclosure)) ? Qt : Qnil;
- }
- else
- return Qnil;
+ return Qnil;
}
DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
@@ -2984,7 +2956,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
Lisp_Object val, syms_left, next, lexenv;
ptrdiff_t count = SPECPDL_INDEX ();
ptrdiff_t i;
- int optional, rest;
+ bool optional, rest;
if (CONSP (fun))
{
@@ -3470,13 +3442,13 @@ Output stream used is value of `standard-output'. */)
write_string ("(", -1);
if (backlist->nargs == MANY)
{ /* FIXME: Can this happen? */
- int i;
- for (tail = *backlist->args, i = 0;
- !NILP (tail);
- tail = Fcdr (tail), i = 1)
+ bool later_arg = 0;
+ for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail))
{
- if (i) write_string (" ", -1);
+ if (later_arg)
+ write_string (" ", -1);
Fprin1 (Fcar (tail), Qnil);
+ later_arg = 1;
}
}
else
diff --git a/src/fileio.c b/src/fileio.c
index 2f4a2ad2314..7466914af1c 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -766,7 +766,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
#endif /* DOS_NT */
ptrdiff_t length;
Lisp_Object handler, result, handled_name;
- int multibyte;
+ bool multibyte;
Lisp_Object hdir;
CHECK_STRING (name);
@@ -1566,7 +1566,7 @@ those `/' is discarded. */)
char *target = NULL;
int total = 0;
int substituted = 0;
- int multibyte;
+ bool multibyte;
char *xnm;
Lisp_Object handler;
@@ -3142,8 +3142,7 @@ decide_coding_unwind (Lisp_Object unwind_data)
undo_list = XCAR (unwind_data);
buffer = XCDR (unwind_data);
- if (current_buffer != XBUFFER (buffer))
- set_buffer_internal (XBUFFER (buffer));
+ set_buffer_internal (XBUFFER (buffer));
adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
adjust_overlays_for_delete (BEG, Z - BEG);
set_buffer_intervals (current_buffer, NULL);
@@ -3481,7 +3480,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
Lisp_Object workbuf;
struct buffer *buf;
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
workbuf = Fget_buffer_create (build_string (" *code-converting-work*"));
buf = XBUFFER (workbuf);
@@ -3760,7 +3759,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
ptrdiff_t temp;
ptrdiff_t this = 0;
ptrdiff_t this_count = SPECPDL_INDEX ();
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ bool multibyte
+ = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
Lisp_Object conversion_buffer;
struct gcpro gcpro1;
@@ -5306,7 +5306,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
FILE *stream = NULL;
ptrdiff_t count = SPECPDL_INDEX ();
int orig_minibuffer_auto_raise = minibuffer_auto_raise;
- int old_message_p = 0;
+ bool old_message_p = 0;
struct gcpro gcpro1, gcpro2;
if (max_specpdl_size < specpdl_size + 40)
diff --git a/src/firstfile.c b/src/firstfile.c
index 84511cfe0ad..444fb71b55d 100644
--- a/src/firstfile.c
+++ b/src/firstfile.c
@@ -27,7 +27,6 @@ static char _my_begbss[1];
char * my_begbss_static = _my_begbss;
/* Add a dummy reference to ensure emacs.obj is linked in. */
-extern int initialized;
-static int * dummy = &initialized;
+extern int main (int, char **);
+static int (*dummy) (int, char **) = main;
#endif
-
diff --git a/src/fns.c b/src/fns.c
index 79f8e233fb5..4d82e4e6e1d 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -52,10 +52,6 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
static int internal_equal (Lisp_Object , Lisp_Object, int, int);
-
-#ifndef HAVE_UNISTD_H
-extern long time ();
-#endif
DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
doc: /* Return the argument unchanged. */)
@@ -74,32 +70,16 @@ Other values of LIMIT are ignored. */)
(Lisp_Object limit)
{
EMACS_INT val;
- Lisp_Object lispy_val;
if (EQ (limit, Qt))
- {
- EMACS_TIME t = current_emacs_time ();
- seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t));
- }
+ init_random ();
+ else if (STRINGP (limit))
+ seed_random (SSDATA (limit), SBYTES (limit));
+ val = get_random ();
if (NATNUMP (limit) && XFASTINT (limit) != 0)
- {
- /* Try to take our random number from the higher bits of VAL,
- not the lower, since (says Gentzel) the low bits of `random'
- are less random than the higher ones. We do this by using the
- quotient rather than the remainder. At the high end of the RNG
- it's possible to get a quotient larger than n; discarding
- these values eliminates the bias that would otherwise appear
- when using a large n. */
- EMACS_INT denominator = (INTMASK + 1) / XFASTINT (limit);
- do
- val = get_random () / denominator;
- while (val >= XFASTINT (limit));
- }
- else
- val = get_random ();
- XSETINT (lispy_val, val);
- return lispy_val;
+ val %= XFASTINT (limit);
+ return make_number (val);
}
/* Heuristic on how many iterations of a tight loop can be safely done
@@ -1100,7 +1080,7 @@ an error is signaled. */)
{
ptrdiff_t chars = SCHARS (string);
unsigned char *str = xmalloc (chars);
- ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0);
+ ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars);
if (converted < chars)
error ("Can't convert the %"pD"dth character to unibyte", converted);
@@ -2139,12 +2119,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
register ptrdiff_t size, idx;
if (VECTORP (array))
- {
- register Lisp_Object *p = XVECTOR (array)->contents;
- size = ASIZE (array);
- for (idx = 0; idx < size; idx++)
- p[idx] = item;
- }
+ for (idx = 0, size = ASIZE (array); idx < size; idx++)
+ ASET (array, idx, item);
else if (CHAR_TABLE_P (array))
{
int i;
@@ -3971,8 +3947,8 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next)
{
ptrdiff_t i = XFASTINT (idx);
- int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
- int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
+ bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
+ bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
int remove_p;
if (EQ (h->weak, Qkey))
@@ -4660,13 +4636,12 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
{
struct buffer *prev = current_buffer;
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
CHECK_BUFFER (object);
bp = XBUFFER (object);
- if (bp != current_buffer)
- set_buffer_internal (bp);
+ set_buffer_internal (bp);
if (NILP (start))
b = BEGV;
@@ -4753,8 +4728,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
}
object = make_buffer_string (b, e, 0);
- if (prev != current_buffer)
- set_buffer_internal (prev);
+ set_buffer_internal (prev);
/* Discard the unwind protect for recovering the current
buffer. */
specpdl_ptr--;
diff --git a/src/font.c b/src/font.c
index 5b9e4f1cfcf..cf9964f08f3 100644
--- a/src/font.c
+++ b/src/font.c
@@ -38,17 +38,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "fontset.h"
#include "font.h"
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif /* HAVE_X_WINDOWS */
-
-#ifdef HAVE_NTGUI
-#include "w32term.h"
-#endif /* HAVE_NTGUI */
-
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif /* HAVE_NS */
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
Lisp_Object Qopentype;
diff --git a/src/font.h b/src/font.h
index 6e9387f7632..3b90bc2ab8a 100644
--- a/src/font.h
+++ b/src/font.h
@@ -817,6 +817,7 @@ extern struct font_driver xfont_driver;
extern void syms_of_xfont (void);
extern void syms_of_ftxfont (void);
#ifdef HAVE_XFT
+extern Lisp_Object Qxft;
extern struct font_driver xftfont_driver;
extern void syms_of_xftfont (void);
#elif defined HAVE_FREETYPE
diff --git a/src/fontset.c b/src/fontset.c
index c39d68a8ecf..01e38fe45e5 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -185,8 +185,7 @@ void (*check_window_system_func) (void);
/* Prototype declarations for static functions. */
-static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object,
- Lisp_Object);
+static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *,
int, int);
static void reorder_font_vector (Lisp_Object, struct font *);
@@ -213,27 +212,71 @@ fontset_id_valid_p (int id)
/* Return the fontset with ID. No check of ID's validness. */
#define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
-/* Macros to access special values of FONTSET. */
-#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
+/* Access special values of FONTSET. */
-/* Macros to access special values of (base) FONTSET. */
-#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
-#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
-/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */
+#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
+static void
+set_fontset_id (Lisp_Object fontset, Lisp_Object id)
+{
+ set_char_table_extras (fontset, 0, id);
+}
+
+/* Access special values of (base) FONTSET. */
+
+#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
+static void
+set_fontset_name (Lisp_Object fontset, Lisp_Object name)
+{
+ set_char_table_extras (fontset, 1, name);
+}
+
+#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
+static void
+set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii)
+{
+ set_char_table_extras (fontset, 4, ascii);
+}
+
+/* Access special values of (realized) FONTSET. */
+
+#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
+static void
+set_fontset_base (Lisp_Object fontset, Lisp_Object base)
+{
+ set_char_table_extras (fontset, 2, base);
+}
+
+#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
+static void
+set_fontset_frame (Lisp_Object fontset, Lisp_Object frame)
+{
+ set_char_table_extras (fontset, 3, frame);
+}
-/* Macros to access special values of (realized) FONTSET. */
-#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
-#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
-/* #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] */
-#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
-/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */
-#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
+#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
+static void
+set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face)
+{
+ set_char_table_extras (fontset, 5, face);
+}
+
+#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
+static void
+set_fontset_default (Lisp_Object fontset, Lisp_Object def)
+{
+ set_char_table_extras (fontset, 7, def);
+}
/* For both base and realized fontset. */
-#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
-#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
+#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
+static void
+set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
+{
+ set_char_table_extras (fontset, 8, fallback);
+}
+#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
/* Macros for FONT-DEF and RFONT-DEF of fontset. */
#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
@@ -265,7 +308,7 @@ fontset_id_valid_p (int id)
#define RFONT_DEF_NEW(rfont_def, font_def) \
do { \
(rfont_def) = Fmake_vector (make_number (4), Qnil); \
- ASET ((rfont_def), 1, (font_def)); \
+ ASET ((rfont_def), 1, (font_def)); \
RFONT_DEF_SET_SCORE ((rfont_def), 0); \
} while (0)
@@ -307,15 +350,17 @@ fontset_ref (Lisp_Object fontset, int c)
replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
append ELT. */
-#define FONTSET_ADD(fontset, range, elt, add) \
- (NILP (add) \
- ? (NILP (range) \
- ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \
- : Fset_char_table_range ((fontset), (range), \
- Fmake_vector (make_number (1), (elt)))) \
+#define FONTSET_ADD(fontset, range, elt, add) \
+ (NILP (add) \
+ ? (NILP (range) \
+ ? (set_fontset_fallback \
+ (fontset, Fmake_vector (make_number (1), (elt)))) \
+ : ((void) \
+ Fset_char_table_range (fontset, range, \
+ Fmake_vector (make_number (1), elt)))) \
: fontset_add ((fontset), (range), (elt), (add)))
-static Lisp_Object
+static void
fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add)
{
Lisp_Object args[2];
@@ -341,10 +386,9 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec
else
{
args[idx] = FONTSET_FALLBACK (fontset);
- FONTSET_FALLBACK (fontset)
- = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args);
+ set_fontset_fallback
+ (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args));
}
- return Qnil;
}
static int
@@ -485,7 +529,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
if (c >= 0)
char_table_set_range (fontset, from, to, font_group);
else
- FONTSET_FALLBACK (fontset) = font_group;
+ set_fontset_fallback (fontset, font_group);
return font_group;
}
@@ -720,8 +764,9 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
if (! EQ (base_fontset, Vdefault_fontset))
{
if (NILP (FONTSET_DEFAULT (fontset)))
- FONTSET_DEFAULT (fontset)
- = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset);
+ set_fontset_default
+ (fontset,
+ make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
default_rfont_def
= fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0);
@@ -781,16 +826,14 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
fontset = Fmake_char_table (Qfontset, Qnil);
- FONTSET_ID (fontset) = make_number (id);
+ set_fontset_id (fontset, make_number (id));
if (NILP (base))
- {
- FONTSET_NAME (fontset) = name;
- }
+ set_fontset_name (fontset, name);
else
{
- FONTSET_NAME (fontset) = Qnil;
- FONTSET_FRAME (fontset) = frame;
- FONTSET_BASE (fontset) = base;
+ set_fontset_name (fontset, Qnil);
+ set_fontset_frame (fontset, frame);
+ set_fontset_base (fontset, base);
}
ASET (Vfontset_table, id, fontset);
@@ -958,7 +1001,7 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
else
{
face_id = face_for_font (f, Qnil, face);
- FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
+ set_fontset_nofont_face (fontset, make_number (face_id));
}
}
eassert (face_id >= 0);
@@ -1580,7 +1623,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
Lisp_Object tail, fr, alist;
int fontset_id = XINT (FONTSET_ID (fontset));
- FONTSET_ASCII (fontset) = fontname;
+ set_fontset_ascii (fontset, fontname);
name = FONTSET_NAME (fontset);
FOR_EACH_FRAME (tail, fr)
{
@@ -1658,7 +1701,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
len = font_unparse_xlfd (font_spec, 0, xlfd, 256);
if (len < 0)
error ("Invalid fontset name (perhaps too long): %s", SDATA (name));
- FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len);
+ set_fontset_ascii (fontset, make_unibyte_string (xlfd, len));
}
else
{
@@ -1744,7 +1787,7 @@ fontset_from_font (Lisp_Object font_object)
Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
}
- FONTSET_ASCII (fontset) = font_name;
+ set_fontset_ascii (fontset, font_name);
return XINT (FONTSET_ID (fontset));
}
@@ -2161,9 +2204,10 @@ syms_of_fontset (void)
Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
staticpro (&Vdefault_fontset);
- FONTSET_ID (Vdefault_fontset) = make_number (0);
- FONTSET_NAME (Vdefault_fontset)
- = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
+ set_fontset_id (Vdefault_fontset, make_number (0));
+ set_fontset_name
+ (Vdefault_fontset,
+ build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
ASET (Vfontset_table, 0, Vdefault_fontset);
next_fontset_id = 1;
diff --git a/src/frame.c b/src/frame.c
index a00f44a1e5a..968cb4905a2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -30,15 +30,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "lisp.h"
#include "character.h"
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif
-#ifdef WINDOWSNT
-#include "w32term.h"
-#endif
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
+
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
+
#include "buffer.h"
/* These help us bind and responding to switch-frame events. */
#include "commands.h"
@@ -58,11 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "dosfns.h"
#endif
-
-#ifdef HAVE_WINDOW_SYSTEM
-
-#endif
-
#ifdef HAVE_NS
Lisp_Object Qns_parse_geometry;
#endif
@@ -4247,7 +4238,6 @@ syms_of_frame (void)
DEFSYM (Qx, "x");
DEFSYM (Qw32, "w32");
DEFSYM (Qpc, "pc");
- DEFSYM (Qmac, "mac");
DEFSYM (Qns, "ns");
DEFSYM (Qvisible, "visible");
DEFSYM (Qbuffer_predicate, "buffer-predicate");
diff --git a/src/frame.h b/src/frame.h
index 92fbda42c70..1fe3ebd9182 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -34,7 +34,7 @@ INLINE_HEADER_BEGIN
/* Miscellanea. */
/* Nonzero means there is at least one garbaged frame. */
-extern int frame_garbaged;
+extern bool frame_garbaged;
/* The structure representing a frame. */
@@ -361,7 +361,7 @@ struct frame
#endif
/* Nonzero if last attempt at redisplay on this frame was preempted. */
- unsigned char display_preempted : 1;
+ unsigned display_preempted : 1;
/* visible is nonzero if the frame is currently displayed; we check
it to see if we should bother updating the frame's contents.
@@ -391,8 +391,8 @@ struct frame
These two are mutually exclusive. They might both be zero, if the
frame has been made invisible without an icon. */
- unsigned char visible : 2;
- unsigned char iconified : 1;
+ unsigned visible : 2;
+ unsigned iconified : 1;
/* Let's not use bitfields for volatile variables. */
@@ -406,40 +406,40 @@ struct frame
/* True if frame actually has a minibuffer window on it.
0 if using a minibuffer window that isn't on this frame. */
- unsigned char has_minibuffer : 1;
+ unsigned has_minibuffer : 1;
/* 0 means, if this frame has just one window,
show no modeline for that window. */
- unsigned char wants_modeline : 1;
+ unsigned wants_modeline : 1;
/* Non-zero if the hardware device this frame is displaying on can
support scroll bars. */
char can_have_scroll_bars;
/* Non-0 means raise this frame to the top of the heap when selected. */
- unsigned char auto_raise : 1;
+ unsigned auto_raise : 1;
/* Non-0 means lower this frame to the bottom of the stack when left. */
- unsigned char auto_lower : 1;
+ unsigned auto_lower : 1;
/* True if frame's root window can't be split. */
- unsigned char no_split : 1;
+ unsigned no_split : 1;
/* If this is set, then Emacs won't change the frame name to indicate
the current buffer, etcetera. If the user explicitly sets the frame
name, this gets set. If the user sets the name to Qnil, this is
cleared. */
- unsigned char explicit_name : 1;
+ unsigned explicit_name : 1;
/* Nonzero if size of some window on this frame has changed. */
- unsigned char window_sizes_changed : 1;
+ unsigned window_sizes_changed : 1;
/* Nonzero if the mouse has moved on this display device
since the last time we checked. */
- unsigned char mouse_moved :1;
+ unsigned mouse_moved :1;
/* Nonzero means that the pointer is invisible. */
- unsigned char pointer_invisible :1;
+ unsigned pointer_invisible :1;
/* If can_have_scroll_bars is non-zero, this is non-zero if we should
actually display them on this frame. */
@@ -621,11 +621,21 @@ typedef struct frame *FRAME_PTR;
#define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
#define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
#define FRAME_X_P(f) ((f)->output_method == output_x_window)
+#ifndef WINDOWSNT
+#define FRAME_W32_P(f) (0)
+#else
#define FRAME_W32_P(f) ((f)->output_method == output_w32)
+#endif
+#ifndef MSDOS
+#define FRAME_MSDOS_P(f) (0)
+#else
#define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
-#define FRAME_MAC_P(f) ((f)->output_method == output_mac)
+#endif
+#ifndef HAVE_NS
+#define FRAME_NS_P(f) (0)
+#else
#define FRAME_NS_P(f) ((f)->output_method == output_ns)
-
+#endif
/* FRAME_WINDOW_P tests whether the frame is a window, and is
defined to be the predicate for the window system being used. */
@@ -1196,6 +1206,7 @@ extern Lisp_Object Qrun_hook_with_args;
extern void x_set_scroll_bar_default_width (struct frame *);
extern void x_set_offset (struct frame *, int, int, int);
extern void x_wm_set_icon_position (struct frame *, int, int);
+extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position);
extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
@@ -1241,10 +1252,40 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
Lisp_Object component,
Lisp_Object subclass);
+extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
+extern void x_set_window_size (struct frame *f, int change_grav,
+ int cols, int rows);
+extern void x_sync (struct frame *);
+extern Lisp_Object x_get_focus_frame (struct frame *);
+extern void x_set_mouse_position (struct frame *f, int h, int v);
+extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
+extern void x_make_frame_visible (struct frame *f);
+extern void x_make_frame_invisible (struct frame *f);
+extern void x_iconify_frame (struct frame *f);
+extern int x_char_width (struct frame *f);
+extern int x_char_height (struct frame *f);
+extern int x_pixel_width (struct frame *f);
+extern int x_pixel_height (struct frame *f);
+extern void x_set_frame_alpha (struct frame *f);
+extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+extern void x_set_tool_bar_lines (struct frame *f,
+ Lisp_Object value,
+ Lisp_Object oldval);
+extern void x_activate_menubar (struct frame *);
+extern void x_real_positions (struct frame *, int *, int *);
+extern int x_bitmap_icon (struct frame *, Lisp_Object);
+extern void x_set_menu_bar_lines (struct frame *,
+ Lisp_Object,
+ Lisp_Object);
+extern void free_frame_menubar (struct frame *);
+extern void x_free_frame_resources (struct frame *);
+
#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT
extern char *x_get_resource_string (const char *, const char *);
#endif
+extern void x_query_colors (struct frame *f, XColor *, int);
+
/* In xmenu.c */
extern void set_frame_menubar (FRAME_PTR, int, int);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2941605d448..f0d2c022f0c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1348,13 +1348,14 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
size_hints.height_inc = FRAME_LINE_HEIGHT (f);
hint_flags |= GDK_HINT_BASE_SIZE;
- base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0) + FRAME_TOOLBAR_WIDTH (f);
- /* Use one row here so base_height does not become zero.
+ /* Use one row/col here so base_height/width does not become zero.
Gtk+ and/or Unity on Ubuntu 12.04 can't handle it. */
+ base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 1) + FRAME_TOOLBAR_WIDTH (f);
base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 1)
+ FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
check_frame_size (f, &min_rows, &min_cols);
+ if (min_cols > 0) --min_cols; /* We used one col in base_width = ... 1); */
if (min_rows > 0) --min_rows; /* We used one row in base_height = ... 1); */
size_hints.base_width = base_width;
@@ -2018,11 +2019,6 @@ xg_get_file_name (FRAME_PTR f,
#if USE_NEW_GTK_FONT_CHOOSER
-extern Lisp_Object Qxft, Qnormal;
-extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold;
-extern Lisp_Object Qbold, Qextra_bold, Qultra_bold;
-extern Lisp_Object Qoblique, Qitalic;
-
#define XG_WEIGHT_TO_SYMBOL(w) \
(w <= PANGO_WEIGHT_THIN ? Qextra_light \
: w <= PANGO_WEIGHT_ULTRALIGHT ? Qlight \
@@ -2042,6 +2038,7 @@ extern Lisp_Object Qoblique, Qitalic;
static char *x_last_font_name;
+extern Lisp_Object Qxft;
/* Pop up a GTK font selector and return the name of the font the user
selects, as a C string. The returned font name follows GTK's own
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 462e879d3e7..926478dd728 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <gtk/gtk.h>
#include "frame.h"
+#include "xterm.h"
/* Minimum and maximum values used for GTK scroll bars */
@@ -149,9 +150,6 @@ extern GdkCursor * xg_create_default_cursor (Display *dpy);
extern int xg_create_frame_widgets (FRAME_PTR f);
extern void xg_free_frame_widgets (FRAME_PTR f);
-extern void x_wm_set_size_hint (FRAME_PTR f,
- long flags,
- int user_position);
extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
extern int xg_check_special_colors (struct frame *f,
const char *color_name,
diff --git a/src/image.c b/src/image.c
index f2778165ece..3e021677e09 100644
--- a/src/image.c
+++ b/src/image.c
@@ -50,11 +50,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "termhooks.h"
#include "font.h"
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#include <sys/types.h>
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif /* HAVE_SYS_STAT_H */
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
+#ifdef HAVE_X_WINDOWS
#define COLOR_TABLE_SUPPORT 1
typedef struct x_bitmap_record Bitmap_Record;
@@ -67,11 +75,8 @@ typedef struct x_bitmap_record Bitmap_Record;
#define PIX_MASK_DRAW 1
#endif /* HAVE_X_WINDOWS */
-
#ifdef HAVE_NTGUI
#include "w32.h"
-#include "w32term.h"
-
/* W32_TODO : Color tables on W32. */
#undef COLOR_TABLE_SUPPORT
@@ -84,15 +89,9 @@ typedef struct w32_bitmap_record Bitmap_Record;
#define PIX_MASK_RETAIN 0
#define PIX_MASK_DRAW 1
-#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
#define x_defined_color w32_defined_color
#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits)
-/* Functions from w32term.c that depend on XColor (so can't go in w32term.h
- without modifying lots of files). */
-extern void x_query_colors (struct frame *f, XColor *colors, int ncolors);
-extern void x_query_color (struct frame *f, XColor *color);
-
/* Version of libpng that we were compiled with, or -1 if no PNG
support was compiled in. This is tested by w32-win.el to correctly
set up the alist used to search for PNG libraries. */
@@ -100,10 +99,6 @@ Lisp_Object Qlibpng_version;
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
-#include "nsterm.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
#undef COLOR_TABLE_SUPPORT
typedef struct ns_bitmap_record Bitmap_Record;
@@ -117,10 +112,8 @@ typedef struct ns_bitmap_record Bitmap_Record;
#define PIX_MASK_RETAIN 0
#define PIX_MASK_DRAW 1
-#define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO (f)->visual
#define x_defined_color(f, name, color_def, alloc) \
ns_defined_color (f, name, color_def, alloc, 0)
-#define FRAME_X_SCREEN(f) 0
#define DefaultDepthOfScreen(screen) x_display_list->n_planes
#endif /* HAVE_NS */
@@ -5524,13 +5517,13 @@ init_png_functions (Lisp_Object libraries)
#if (PNG_LIBPNG_VER < 10500)
-#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1))
+#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1))
#define PNG_JMPBUF(ptr) ((ptr)->jmpbuf)
#else
/* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */
#define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1))
#define PNG_JMPBUF(ptr) \
- (*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf)))
+ (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf)))
#endif
/* Error and warning handlers installed when the PNG library
@@ -5703,7 +5696,7 @@ png_load (struct frame *f, struct image *img)
/* Set error jump-back. We come back here when the PNG library
detects an error. */
- if (setjmp (PNG_JMPBUF (png_ptr)))
+ if (_setjmp (PNG_JMPBUF (png_ptr)))
{
error:
if (png_ptr)
@@ -6121,7 +6114,7 @@ static _Noreturn void
my_error_exit (j_common_ptr cinfo)
{
struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
- longjmp (mgr->setjmp_buffer, 1);
+ _longjmp (mgr->setjmp_buffer, 1);
}
@@ -6372,7 +6365,7 @@ jpeg_load (struct frame *f, struct image *img)
cinfo.err = fn_jpeg_std_error (&mgr.pub);
mgr.pub.error_exit = my_error_exit;
- if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
+ if ((rc = _setjmp (mgr.setjmp_buffer)) != 0)
{
if (rc == 1)
{
@@ -6418,12 +6411,12 @@ jpeg_load (struct frame *f, struct image *img)
if (!check_image_size (f, width, height))
{
image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
- longjmp (mgr.setjmp_buffer, 2);
+ _longjmp (mgr.setjmp_buffer, 2);
}
/* Create X image and pixmap. */
if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
- longjmp (mgr.setjmp_buffer, 2);
+ _longjmp (mgr.setjmp_buffer, 2);
/* Allocate colors. When color quantization is used,
cinfo.actual_number_of_colors has been set with the number of
diff --git a/src/insdel.c b/src/insdel.c
index 1dceb67bffa..da258c19a1e 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -31,19 +31,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "blockinput.h"
#include "region-cache.h"
-static void insert_from_string_1 (Lisp_Object string,
- ptrdiff_t pos, ptrdiff_t pos_byte,
- ptrdiff_t nchars, ptrdiff_t nbytes,
- int inherit, int before_markers);
-static void insert_from_buffer_1 (struct buffer *buf,
- ptrdiff_t from, ptrdiff_t nchars,
- int inherit);
-static void gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap);
-static void gap_right (ptrdiff_t charpos, ptrdiff_t bytepos);
+static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t,
+ ptrdiff_t, bool, bool);
+static void insert_from_buffer_1 (struct buffer *, ptrdiff_t, ptrdiff_t, bool);
+static void gap_left (ptrdiff_t, ptrdiff_t, bool);
+static void gap_right (ptrdiff_t, ptrdiff_t);
/* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT)
describing changes which happened while combine_after_change_calls
- was nonzero. We use this to decide how to call them
+ was non-nil. We use this to decide how to call them
once the deferral ends.
In each element.
@@ -67,8 +63,8 @@ static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
static void
check_markers (void)
{
- register struct Lisp_Marker *tail;
- int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+ struct Lisp_Marker *tail;
+ bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
{
@@ -113,13 +109,13 @@ move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
/* Move the gap to a position less than the current GPT.
BYTEPOS describes the new position as a byte position,
and CHARPOS is the corresponding char position.
- If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */
+ If NEWGAP, then don't update beg_unchanged and end_unchanged. */
static void
-gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap)
+gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, bool newgap)
{
- register unsigned char *to, *from;
- register ptrdiff_t i;
+ unsigned char *to, *from;
+ ptrdiff_t i;
ptrdiff_t new_s1;
if (!newgap)
@@ -287,10 +283,10 @@ adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte,
static void
adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte,
- ptrdiff_t to, ptrdiff_t to_byte, int before_markers)
+ ptrdiff_t to, ptrdiff_t to_byte, bool before_markers)
{
struct Lisp_Marker *m;
- int adjusted = 0;
+ bool adjusted = 0;
ptrdiff_t nchars = to - from;
ptrdiff_t nbytes = to_byte - from_byte;
@@ -515,7 +511,7 @@ make_gap (ptrdiff_t nbytes_added)
ptrdiff_t
copy_text (const unsigned char *from_addr, unsigned char *to_addr,
- ptrdiff_t nbytes, int from_multibyte, int to_multibyte)
+ ptrdiff_t nbytes, bool from_multibyte, bool to_multibyte)
{
if (from_multibyte == to_multibyte)
{
@@ -664,7 +660,7 @@ insert_before_markers_and_inherit (const char *string,
void
insert_1 (const char *string, ptrdiff_t nbytes,
- int inherit, int prepare, int before_markers)
+ bool inherit, bool prepare, bool before_markers)
{
insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
nbytes, inherit, prepare, before_markers);
@@ -790,7 +786,7 @@ count_combining_after (const unsigned char *string,
void
insert_1_both (const char *string,
ptrdiff_t nchars, ptrdiff_t nbytes,
- int inherit, int prepare, int before_markers)
+ bool inherit, bool prepare, bool before_markers)
{
if (nchars == 0)
return;
@@ -867,7 +863,7 @@ insert_1_both (const char *string,
void
insert_from_string (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
- ptrdiff_t length, ptrdiff_t length_byte, int inherit)
+ ptrdiff_t length, ptrdiff_t length_byte, bool inherit)
{
ptrdiff_t opoint = PT;
@@ -887,7 +883,7 @@ void
insert_from_string_before_markers (Lisp_Object string,
ptrdiff_t pos, ptrdiff_t pos_byte,
ptrdiff_t length, ptrdiff_t length_byte,
- int inherit)
+ bool inherit)
{
ptrdiff_t opoint = PT;
@@ -905,7 +901,7 @@ insert_from_string_before_markers (Lisp_Object string,
static void
insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
ptrdiff_t nchars, ptrdiff_t nbytes,
- int inherit, int before_markers)
+ bool inherit, bool before_markers)
{
struct gcpro gcpro1;
ptrdiff_t outgoing_nbytes = nbytes;
@@ -1039,7 +1035,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
void
insert_from_buffer (struct buffer *buf,
- ptrdiff_t charpos, ptrdiff_t nchars, int inherit)
+ ptrdiff_t charpos, ptrdiff_t nchars, bool inherit)
{
ptrdiff_t opoint = PT;
@@ -1050,7 +1046,7 @@ insert_from_buffer (struct buffer *buf,
static void
insert_from_buffer_1 (struct buffer *buf,
- ptrdiff_t from, ptrdiff_t nchars, int inherit)
+ ptrdiff_t from, ptrdiff_t nchars, bool inherit)
{
ptrdiff_t chunk, chunk_expanded;
ptrdiff_t from_byte = buf_charpos_to_bytepos (buf, from);
@@ -1265,7 +1261,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
}
/* Replace the text from character positions FROM to TO with NEW,
- If PREPARE is nonzero, call prepare_to_modify_buffer.
+ If PREPARE, call prepare_to_modify_buffer.
If INHERIT, the newly inserted text should inherit text properties
from the surrounding non-deleted text. */
@@ -1278,7 +1274,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
void
replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
- int prepare, int inherit, int markers)
+ bool prepare, bool inherit, bool markers)
{
ptrdiff_t inschars = SCHARS (new);
ptrdiff_t insbytes = SBYTES (new);
@@ -1443,7 +1439,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
Note that this does not yet handle markers quite right.
- If MARKERS is nonzero, relocate markers.
+ If MARKERS, relocate markers.
Unlike most functions at this level, never call
prepare_to_modify_buffer and never call signal_after_change. */
@@ -1452,7 +1448,7 @@ void
replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
ptrdiff_t to, ptrdiff_t to_byte,
const char *ins, ptrdiff_t inschars, ptrdiff_t insbytes,
- int markers)
+ bool markers)
{
ptrdiff_t nbytes_del, nchars_del;
@@ -1563,7 +1559,7 @@ del_range (ptrdiff_t from, ptrdiff_t to)
RET_STRING says to return the deleted text. */
Lisp_Object
-del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string)
+del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, bool ret_string)
{
ptrdiff_t from_byte, to_byte;
Lisp_Object deletion;
@@ -1599,7 +1595,7 @@ del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string)
/* Like del_range_1 but args are byte positions, not char positions. */
void
-del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare)
+del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare)
{
ptrdiff_t from, to;
@@ -1643,7 +1639,7 @@ del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare)
void
del_range_both (ptrdiff_t from, ptrdiff_t from_byte,
- ptrdiff_t to, ptrdiff_t to_byte, int prepare)
+ ptrdiff_t to, ptrdiff_t to_byte, bool prepare)
{
/* Make args be valid */
if (from_byte < BEGV_BYTE)
@@ -1685,13 +1681,13 @@ del_range_both (ptrdiff_t from, ptrdiff_t from_byte,
/* Delete a range of text, specified both as character positions
and byte positions. FROM and TO are character positions,
while FROM_BYTE and TO_BYTE are byte positions.
- If RET_STRING is true, the deleted area is returned as a string. */
+ If RET_STRING, the deleted area is returned as a string. */
Lisp_Object
del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
- ptrdiff_t to, ptrdiff_t to_byte, int ret_string)
+ ptrdiff_t to, ptrdiff_t to_byte, bool ret_string)
{
- register ptrdiff_t nbytes_del, nchars_del;
+ ptrdiff_t nbytes_del, nchars_del;
Lisp_Object deletion;
check_markers ();
@@ -1770,17 +1766,16 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
and warns the next redisplay that it should pay attention to that
area.
- If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF.
+ If PRESERVE_CHARS_MODIFF, do not update CHARS_MODIFF.
Otherwise set CHARS_MODIFF to the new value of MODIFF. */
void
modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
- int preserve_chars_modiff)
+ bool preserve_chars_modiff)
{
struct buffer *old_buffer = current_buffer;
- if (buffer != old_buffer)
- set_buffer_internal (buffer);
+ set_buffer_internal (buffer);
prepare_to_modify_buffer (start, end, NULL);
@@ -1794,8 +1789,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
bset_point_before_scroll (buffer, Qnil);
- if (buffer != old_buffer)
- set_buffer_internal (old_buffer);
+ set_buffer_internal (old_buffer);
}
/* Check that it is okay to modify the buffer between START and END,
@@ -2119,7 +2113,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
return Qnil;
}
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (combine_after_change_buffer);
diff --git a/src/intervals.c b/src/intervals.c
index 0a85e20e5d9..49d61b2f9b0 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -178,14 +178,13 @@ merge_properties (register INTERVAL source, register INTERVAL target)
}
}
-/* Return 1 if the two intervals have the same properties,
- 0 otherwise. */
+/* Return true if the two intervals have the same properties. */
-int
+bool
intervals_equal (INTERVAL i0, INTERVAL i1)
{
- register Lisp_Object i0_cdr, i0_sym;
- register Lisp_Object i1_cdr, i1_val;
+ Lisp_Object i0_cdr, i0_sym;
+ Lisp_Object i1_cdr, i1_val;
if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1))
return 1;
@@ -469,10 +468,10 @@ balance_an_interval (INTERVAL i)
Lisp Object. */
static inline INTERVAL
-balance_possible_root_interval (register INTERVAL interval)
+balance_possible_root_interval (INTERVAL interval)
{
Lisp_Object parent;
- int have_parent = 0;
+ bool have_parent = 0;
if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval))
return interval;
@@ -845,9 +844,9 @@ static INTERVAL
adjust_intervals_for_insertion (INTERVAL tree,
ptrdiff_t position, ptrdiff_t length)
{
- register INTERVAL i;
- register INTERVAL temp;
- int eobp = 0;
+ INTERVAL i;
+ INTERVAL temp;
+ bool eobp = 0;
Lisp_Object parent;
ptrdiff_t offset;
@@ -1068,11 +1067,10 @@ FR 8 9 A B
static Lisp_Object
merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright)
{
- register Lisp_Object props, front, rear;
+ Lisp_Object props, front, rear;
Lisp_Object lfront, lrear, rfront, rrear;
- register Lisp_Object tail1, tail2, sym, lval, rval, cat;
- int use_left, use_right;
- int lpresent;
+ Lisp_Object tail1, tail2, sym, lval, rval, cat;
+ bool use_left, use_right, lpresent;
props = Qnil;
front = Qnil;
@@ -1610,7 +1608,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
void
graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
ptrdiff_t length, struct buffer *buffer,
- int inherit)
+ bool inherit)
{
INTERVAL tree = buffer_intervals (buffer);
INTERVAL under, over, this;
@@ -1753,9 +1751,9 @@ textget (Lisp_Object plist, register Lisp_Object prop)
}
Lisp_Object
-lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop)
+lookup_char_property (Lisp_Object plist, Lisp_Object prop, bool textprop)
{
- register Lisp_Object tail, fallback = Qnil;
+ Lisp_Object tail, fallback = Qnil;
for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail)))
{
@@ -1826,8 +1824,8 @@ set_point (ptrdiff_t charpos)
/* If there's an invisible character at position POS + TEST_OFFS in the
current buffer, and the invisible property has a `stickiness' such that
inserting a character at position POS would inherit the property it,
- return POS + ADJ, otherwise return POS. If TEST_INTANG is non-zero,
- then intangibility is required as well as invisibility.
+ return POS + ADJ, otherwise return POS. If TEST_INTANG, intangibility
+ is required as well as invisibility.
TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1.
@@ -1836,7 +1834,7 @@ set_point (ptrdiff_t charpos)
static ptrdiff_t
adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj,
- int test_intang)
+ bool test_intang)
{
Lisp_Object invis_propval, invis_overlay;
Lisp_Object test_pos;
@@ -1883,8 +1881,8 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
initial position is the same as the destination, in the rare
instances where this is important, e.g. in line-move-finish
(simple.el). */
- int backwards = (charpos < old_position ? 1 : 0);
- int have_overlays;
+ bool backwards = charpos < old_position;
+ bool have_overlays;
ptrdiff_t original_position;
bset_point_before_scroll (current_buffer, Qnil);
@@ -2154,12 +2152,12 @@ move_if_not_intangible (ptrdiff_t position)
/* If text at position POS has property PROP, set *VAL to the property
value, *START and *END to the beginning and end of a region that
- has the same property, and return 1. Otherwise return 0.
+ has the same property, and return true. Otherwise return false.
OBJECT is the string or buffer to look for the property in;
nil means the current buffer. */
-int
+bool
get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object)
{
@@ -2306,10 +2304,10 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
set_string_intervals (string, interval_copy);
}
-/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise.
+/* Return true if strings S1 and S2 have identical properties.
Assume they have identical characters. */
-int
+bool
compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
{
INTERVAL i1, i2;
@@ -2348,7 +2346,7 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
START_BYTE ... END_BYTE in bytes. */
static void
-set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
+set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
ptrdiff_t start, ptrdiff_t start_byte,
ptrdiff_t end, ptrdiff_t end_byte)
{
@@ -2456,11 +2454,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
}
/* Update the intervals of the current buffer
- to fit the contents as multibyte (if MULTI_FLAG is 1)
- or to fit them as non-multibyte (if MULTI_FLAG is 0). */
+ to fit the contents as multibyte (if MULTI_FLAG)
+ or to fit them as non-multibyte (if not MULTI_FLAG). */
void
-set_intervals_multibyte (int multi_flag)
+set_intervals_multibyte (bool multi_flag)
{
INTERVAL i = buffer_intervals (current_buffer);
diff --git a/src/intervals.h b/src/intervals.h
index 01e72d7c9db..2b30101d0fa 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -227,7 +227,7 @@ extern INTERVAL make_interval (void);
extern INTERVAL create_root_interval (Lisp_Object);
extern void copy_properties (INTERVAL, INTERVAL);
-extern int intervals_equal (INTERVAL, INTERVAL);
+extern bool intervals_equal (INTERVAL, INTERVAL);
extern void traverse_intervals (INTERVAL, ptrdiff_t,
void (*) (INTERVAL, Lisp_Object),
Lisp_Object);
@@ -242,22 +242,22 @@ extern INTERVAL previous_interval (INTERVAL);
extern INTERVAL merge_interval_left (INTERVAL);
extern void offset_intervals (struct buffer *, ptrdiff_t, ptrdiff_t);
extern void graft_intervals_into_buffer (INTERVAL, ptrdiff_t, ptrdiff_t,
- struct buffer *, int);
+ struct buffer *, bool);
extern void verify_interval_modification (struct buffer *,
ptrdiff_t, ptrdiff_t);
extern INTERVAL balance_intervals (INTERVAL);
extern void copy_intervals_to_string (Lisp_Object, struct buffer *,
ptrdiff_t, ptrdiff_t);
extern INTERVAL copy_intervals (INTERVAL, ptrdiff_t, ptrdiff_t);
-extern int compare_string_intervals (Lisp_Object, Lisp_Object);
+extern bool compare_string_intervals (Lisp_Object, Lisp_Object);
extern Lisp_Object textget (Lisp_Object, Lisp_Object);
-extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int);
+extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, bool);
extern void move_if_not_intangible (ptrdiff_t);
-extern int get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *,
- ptrdiff_t *, ptrdiff_t *, Lisp_Object);
+extern bool get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *,
+ ptrdiff_t *, ptrdiff_t *, Lisp_Object);
extern Lisp_Object get_local_map (ptrdiff_t, struct buffer *, Lisp_Object);
extern INTERVAL update_interval (INTERVAL, ptrdiff_t);
-extern void set_intervals_multibyte (int);
+extern void set_intervals_multibyte (bool);
extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *,
Lisp_Object *, int);
extern INTERVAL interval_of (ptrdiff_t, Lisp_Object);
diff --git a/src/keyboard.c b/src/keyboard.c
index 868d0c8d2c1..464c3ae0d66 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -63,20 +63,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <fcntl.h>
-/* This is to get the definitions of the XK_ symbols. */
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif
-
-#ifdef HAVE_NTGUI
-#include "w32term.h"
-#endif /* HAVE_NTGUI */
-
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
-/* Variables for blockinput.h: */
+/* Variables for blockinput.h: */
/* Non-zero if interrupt input is blocked right now. */
volatile int interrupt_input_blocked;
@@ -1434,8 +1425,7 @@ command_loop_1 (void)
Fkill_emacs (Qnil);
/* Make sure the current window's buffer is selected. */
- if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
- set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+ set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
/* Display any malloc warning that just came out. Use while because
displaying one warning can cause another. */
@@ -1513,8 +1503,7 @@ command_loop_1 (void)
/* A filter may have run while we were reading the input. */
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
- if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
- set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+ set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
++num_input_keys;
@@ -4350,9 +4339,8 @@ struct input_event last_timer_event EXTERNALLY_VISIBLE;
...). Each element has the form (FUN . ARGS). */
Lisp_Object pending_funcalls;
-/* If TIMER is a valid timer, return nonzero and place its value into
- *RESULT. Otherwise return zero. */
-static int
+/* Return true if TIMER is a valid timer, placing its value into *RESULT. */
+static bool
decode_timer (Lisp_Object timer, EMACS_TIME *result)
{
Lisp_Object *vector;
@@ -4419,7 +4407,6 @@ timer_check_2 (void)
while (CONSP (timers) || CONSP (idle_timers))
{
- Lisp_Object *vector;
Lisp_Object timer = Qnil, idle_timer = Qnil;
EMACS_TIME timer_time, idle_timer_time;
EMACS_TIME difference;
@@ -4495,15 +4482,14 @@ timer_check_2 (void)
/* If timer is ripe, run it if it hasn't been run. */
if (ripe)
{
- vector = XVECTOR (chosen_timer)->contents;
- if (NILP (vector[0]))
+ if (NILP (AREF (chosen_timer, 0)))
{
ptrdiff_t count = SPECPDL_INDEX ();
Lisp_Object old_deactivate_mark = Vdeactivate_mark;
/* Mark the timer as triggered to prevent problems if the lisp
code fails to reschedule it right. */
- vector[0] = Qt;
+ ASET (chosen_timer, 0, Qt);
specbind (Qinhibit_quit, Qt);
@@ -8447,7 +8433,6 @@ init_tool_bar_items (Lisp_Object reuse)
static void
append_tool_bar_item (void)
{
- Lisp_Object *to, *from;
ptrdiff_t incr =
(ntool_bar_items
- (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS));
@@ -8459,9 +8444,8 @@ append_tool_bar_item (void)
/* Append entries from tool_bar_item_properties to the end of
tool_bar_items_vector. */
- to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items;
- from = XVECTOR (tool_bar_item_properties)->contents;
- memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
+ vcopy (tool_bar_items_vector, ntool_bar_items,
+ XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
}
@@ -9578,7 +9562,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
because we may get input from a subprocess which
wants to change the selected window and stuff (say,
emacsclient). */
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
if (! FRAME_LIVE_P (XFRAME (selected_frame)))
Fkill_emacs (Qnil);
@@ -10490,10 +10474,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
else
{
val = Fvector (NUM_RECENT_KEYS, keys);
- memcpy (XVECTOR (val)->contents, keys + recent_keys_index,
- (NUM_RECENT_KEYS - recent_keys_index) * word_size);
- memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index,
- keys, recent_keys_index * word_size);
+ vcopy (val, 0, keys + recent_keys_index,
+ NUM_RECENT_KEYS - recent_keys_index);
+ vcopy (val, NUM_RECENT_KEYS - recent_keys_index,
+ keys, recent_keys_index);
return val;
}
}
@@ -11255,7 +11239,7 @@ The `posn-' functions access elements of such lists. */)
if (WINDOWP (frame_or_window))
{
- struct window *w = decode_valid_window (frame_or_window);
+ struct window *w = decode_live_window (frame_or_window);
XSETINT (x, (XINT (x)
+ WINDOW_LEFT_EDGE_X (w)
diff --git a/src/keymap.c b/src/keymap.c
index 21f7dcb5d37..85c384b8180 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1570,9 +1570,7 @@ like in the respective argument of `key-binding'. */)
would not be a problem here, but it is easier to keep
things the same.
*/
-
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
-
+ record_unwind_current_buffer ();
set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
}
}
@@ -2159,7 +2157,7 @@ The `kbd' macro is an approximate inverse of this. */)
char *
push_key_description (EMACS_INT ch, char *p, int force_multibyte)
{
- int c, c2;
+ int c, c2, tab_as_ci;
/* Clear all the meaningless bits above the meta bit. */
c = ch & (meta_modifier | ~ - meta_modifier);
@@ -2173,6 +2171,8 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte)
return p;
}
+ tab_as_ci = (c2 == '\t' && (c & meta_modifier));
+
if (c & alt_modifier)
{
*p++ = 'A';
@@ -2180,7 +2180,8 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte)
c -= alt_modifier;
}
if ((c & ctrl_modifier) != 0
- || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M')))
+ || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M'))
+ || tab_as_ci)
{
*p++ = 'C';
*p++ = '-';
@@ -2218,6 +2219,10 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte)
*p++ = 'S';
*p++ = 'C';
}
+ else if (tab_as_ci)
+ {
+ *p++ = 'i';
+ }
else if (c == '\t')
{
*p++ = 'T';
diff --git a/src/lisp.h b/src/lisp.h
index 5c7e8dc2f82..07a3ae17469 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -126,7 +126,7 @@ extern _Noreturn void die (const char *, const char *, int);
eassert macro altogether, e.g., if XSTRING (x) uses eassert to test
STRINGP (x), but a particular use of XSTRING is invoked only after
testing that STRINGP (x) is true, making the test redundant. */
-extern int suppress_checking EXTERNALLY_VISIBLE;
+extern bool suppress_checking EXTERNALLY_VISIBLE;
# define eassert(cond) \
((cond) || suppress_checking \
@@ -617,10 +617,8 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
#define AREF(ARRAY, IDX) XVECTOR ((ARRAY))->contents[IDX]
#define ASIZE(ARRAY) XVECTOR ((ARRAY))->header.size
-/* The IDX==IDX tries to detect when the macro argument is side-effecting. */
#define ASET(ARRAY, IDX, VAL) \
- (eassert ((IDX) == (IDX)), \
- eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
+ (eassert (0 <= (IDX) && (IDX) < ASIZE (ARRAY)), \
XVECTOR (ARRAY)->contents[IDX] = (VAL))
/* Convenience macros for dealing with Lisp strings. */
@@ -713,7 +711,7 @@ struct Lisp_Cons
#define CDR_SAFE(c) \
(CONSP ((c)) ? XCDR ((c)) : Qnil)
-/* Nonzero if STR is a multibyte string. */
+/* True if STR is a multibyte string. */
#define STRING_MULTIBYTE(STR) \
(XSTRING (STR)->size_byte >= 0)
@@ -1929,11 +1927,7 @@ typedef struct {
Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
/* Non-zero if OBJ is a Lisp function. */
-#define FUNCTIONP(OBJ) \
- ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda)) \
- || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ))) \
- || COMPILEDP (OBJ) \
- || SUBRP (OBJ))
+#define FUNCTIONP(OBJ) functionp(OBJ)
/* defsubr (Sname);
is how we define the symbol for function `name' at start-up time. */
@@ -2357,6 +2351,17 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
XVECTOR (array)->contents[idx] = val;
}
+/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */
+
+LISP_INLINE void
+vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
+{
+ eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
+ memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
+}
+
+/* Functions to modify hash tables. */
+
LISP_INLINE void
set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value)
{
@@ -2582,8 +2587,7 @@ extern Lisp_Object Qoverflow_error, Qunderflow_error;
extern Lisp_Object Qfloatp;
extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
-extern Lisp_Object Qinteger, Qinterval, Qsymbol, Qstring;
-extern Lisp_Object Qmisc, Qvector, Qfloat, Qcons, Qbuffer;
+extern Lisp_Object Qbuffer, Qinteger, Qsymbol;
extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
@@ -2630,7 +2634,7 @@ extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
Lisp_Object);
extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
-extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
+extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
extern void syms_of_data (void);
extern void init_data (void);
extern void swap_in_global_binding (struct Lisp_Symbol *);
@@ -2642,7 +2646,7 @@ extern void keys_of_cmds (void);
/* Defined in coding.c */
extern Lisp_Object Qcharset;
extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
- ptrdiff_t, int, int, Lisp_Object);
+ ptrdiff_t, bool, bool, Lisp_Object);
extern void init_coding (void);
extern void init_coding_once (void);
extern void syms_of_coding (void);
@@ -2730,43 +2734,43 @@ extern void move_gap_both (ptrdiff_t, ptrdiff_t);
extern _Noreturn void buffer_overflow (void);
extern void make_gap (ptrdiff_t);
extern ptrdiff_t copy_text (const unsigned char *, unsigned char *,
- ptrdiff_t, int, int);
+ ptrdiff_t, bool, bool);
extern int count_combining_before (const unsigned char *,
ptrdiff_t, ptrdiff_t, ptrdiff_t);
extern int count_combining_after (const unsigned char *,
ptrdiff_t, ptrdiff_t, ptrdiff_t);
extern void insert (const char *, ptrdiff_t);
extern void insert_and_inherit (const char *, ptrdiff_t);
-extern void insert_1 (const char *, ptrdiff_t, int, int, int);
+extern void insert_1 (const char *, ptrdiff_t, bool, bool, bool);
extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t,
- int, int, int);
+ bool, bool, bool);
extern void insert_from_gap (ptrdiff_t, ptrdiff_t);
extern void insert_from_string (Lisp_Object, ptrdiff_t, ptrdiff_t,
- ptrdiff_t, ptrdiff_t, int);
-extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, int);
+ ptrdiff_t, ptrdiff_t, bool);
+extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, bool);
extern void insert_char (int);
extern void insert_string (const char *);
extern void insert_before_markers (const char *, ptrdiff_t);
extern void insert_before_markers_and_inherit (const char *, ptrdiff_t);
extern void insert_from_string_before_markers (Lisp_Object, ptrdiff_t,
ptrdiff_t, ptrdiff_t,
- ptrdiff_t, int);
+ ptrdiff_t, bool);
extern void del_range (ptrdiff_t, ptrdiff_t);
-extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, int, int);
-extern void del_range_byte (ptrdiff_t, ptrdiff_t, int);
-extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, bool, bool);
+extern void del_range_byte (ptrdiff_t, ptrdiff_t, bool);
+extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool);
extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t,
- ptrdiff_t, ptrdiff_t, int);
-extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, int);
+ ptrdiff_t, ptrdiff_t, bool);
+extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, bool);
extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t);
extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t);
extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t);
-extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, int, int, int);
+extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, bool);
extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
- const char *, ptrdiff_t, ptrdiff_t, int);
+ const char *, ptrdiff_t, ptrdiff_t, bool);
extern void syms_of_insdel (void);
/* Defined in dispnew.c */
@@ -2776,7 +2780,7 @@ _Noreturn void __executable_start (void);
#endif
extern Lisp_Object selected_frame;
extern Lisp_Object Vwindow_system;
-extern Lisp_Object sit_for (Lisp_Object, int, int);
+extern Lisp_Object sit_for (Lisp_Object, bool, int);
extern void init_display (void);
extern void syms_of_display (void);
@@ -2802,7 +2806,7 @@ extern Lisp_Object echo_area_buffer[2];
extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
extern void check_message_stack (void);
extern void setup_echo_area_for_printing (int);
-extern int push_message (void);
+extern bool push_message (void);
extern Lisp_Object pop_message_unwind (Lisp_Object);
extern Lisp_Object restore_message_unwind (Lisp_Object);
extern void restore_message (void);
@@ -2845,7 +2849,7 @@ extern void uninterrupt_malloc (void);
extern void malloc_warning (const char *);
extern _Noreturn void memory_full (size_t);
extern _Noreturn void buffer_memory_full (ptrdiff_t);
-extern int survives_gc_p (Lisp_Object);
+extern bool survives_gc_p (Lisp_Object);
extern void mark_object (Lisp_Object);
#if defined REL_ALLOC && !defined SYSTEM_MALLOC
extern void refill_memory_reserve (void);
@@ -2887,8 +2891,8 @@ extern Lisp_Object make_uninit_string (EMACS_INT);
extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT);
extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t);
extern Lisp_Object make_specified_string (const char *,
- ptrdiff_t, ptrdiff_t, int);
-extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int);
+ ptrdiff_t, ptrdiff_t, bool);
+extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, bool);
extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t);
/* Make a string allocated in pure space, use STR as string data. */
@@ -2922,8 +2926,8 @@ extern struct window *allocate_window (void);
extern struct frame *allocate_frame (void);
extern struct Lisp_Process *allocate_process (void);
extern struct terminal *allocate_terminal (void);
-extern int gc_in_progress;
-extern int abort_on_gc;
+extern bool gc_in_progress;
+extern bool abort_on_gc;
extern Lisp_Object make_float (double);
extern void display_malloc_warning (void);
extern ptrdiff_t inhibit_garbage_collection (void);
@@ -3001,6 +3005,7 @@ extern ptrdiff_t evxprintf (char **, ptrdiff_t *, char const *, ptrdiff_t,
/* Defined in lread.c. */
extern Lisp_Object Qvariable_documentation, Qstandard_input;
extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
+extern Lisp_Object Qlexical_binding;
extern Lisp_Object check_obarray (Lisp_Object);
extern Lisp_Object intern_1 (const char *, ptrdiff_t);
extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
@@ -3034,7 +3039,7 @@ intern_c_string (const char *str)
/* Defined in eval.c. */
extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro;
-extern Lisp_Object Qinhibit_quit, Qclosure;
+extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure;
extern Lisp_Object Qand_rest;
extern Lisp_Object Vautoload_queue;
extern Lisp_Object Vsignaling_function;
@@ -3109,23 +3114,23 @@ extern Lisp_Object save_restriction_save (void);
extern Lisp_Object save_excursion_restore (Lisp_Object);
extern Lisp_Object save_restriction_restore (Lisp_Object);
extern _Noreturn void time_overflow (void);
-extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool);
extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
- ptrdiff_t, int);
+ ptrdiff_t, bool);
extern void init_editfns (void);
const char *get_system_name (void);
extern void syms_of_editfns (void);
extern void set_time_zone_rule (const char *);
/* Defined in buffer.c. */
-extern int mouse_face_overlay_overlaps (Lisp_Object);
+extern bool mouse_face_overlay_overlaps (Lisp_Object);
extern _Noreturn void nsberror (Lisp_Object);
extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t);
extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t);
extern void fix_start_end_in_overlays (ptrdiff_t, ptrdiff_t);
-extern void report_overlay_modification (Lisp_Object, Lisp_Object, int,
+extern void report_overlay_modification (Lisp_Object, Lisp_Object, bool,
Lisp_Object, Lisp_Object, Lisp_Object);
-extern int overlay_touches_p (ptrdiff_t);
+extern bool overlay_touches_p (ptrdiff_t);
extern Lisp_Object Vbuffer_alist;
extern Lisp_Object set_buffer_if_live (Lisp_Object);
extern Lisp_Object other_buffer_safely (Lisp_Object);
@@ -3272,7 +3277,7 @@ extern void syms_of_frame (void);
extern char **initial_argv;
extern int initial_argc;
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
-extern int display_arg;
+extern bool display_arg;
#endif
extern Lisp_Object decode_env_path (const char *, const char *);
extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
@@ -3291,22 +3296,26 @@ void synchronize_system_time_locale (void);
#define synchronize_system_messages_locale()
#define synchronize_system_time_locale()
#endif
-void shut_down_emacs (int, int, Lisp_Object);
-/* Nonzero means don't do interactive redisplay and don't change tty modes. */
-extern int noninteractive;
+extern void shut_down_emacs (int, Lisp_Object);
+
+/* True means don't do interactive redisplay and don't change tty modes. */
+extern bool noninteractive;
-/* Nonzero means remove site-lisp directories from load-path. */
-extern int no_site_lisp;
+/* True means remove site-lisp directories from load-path. */
+extern bool no_site_lisp;
/* Pipe used to send exit notification to the daemon parent at
startup. */
extern int daemon_pipe[2];
#define IS_DAEMON (daemon_pipe[1] != 0)
-/* Nonzero means don't do use window-system-specific display code. */
-extern int inhibit_window_system;
-/* Nonzero means that a filter or a sentinel is running. */
-extern int running_asynch_code;
+/* True if handling a fatal error already. */
+extern bool fatal_error_in_progress;
+
+/* True means don't do use window-system-specific display code. */
+extern bool inhibit_window_system;
+/* True means that a filter or a sentinel is running. */
+extern bool running_asynch_code;
/* Defined in process.c. */
extern Lisp_Object QCtype, Qlocal;
@@ -3338,7 +3347,7 @@ extern void setup_process_coding_systems (Lisp_Object);
#ifndef DOS_NT
_Noreturn
#endif
-extern int child_setup (int, int, int, char **, int, Lisp_Object);
+extern int child_setup (int, int, int, char **, bool, Lisp_Object);
extern void init_callproc_1 (void);
extern void init_callproc (void);
extern void set_initial_environment (void);
@@ -3347,9 +3356,9 @@ extern void syms_of_callproc (void);
/* Defined in doc.c */
extern Lisp_Object Qfunction_documentation;
extern Lisp_Object read_doc_string (Lisp_Object);
-extern Lisp_Object get_doc_string (Lisp_Object, int, int);
+extern Lisp_Object get_doc_string (Lisp_Object, bool, bool);
extern void syms_of_doc (void);
-extern int read_bytecode_char (int);
+extern int read_bytecode_char (bool);
/* Defined in bytecode.c */
extern Lisp_Object Qbytecode;
@@ -3419,7 +3428,8 @@ extern void child_setup_tty (int);
extern void setup_pty (int);
extern int set_window_size (int, int, int);
extern EMACS_INT get_random (void);
-extern void seed_random (long);
+extern void seed_random (void *, ptrdiff_t);
+extern void init_random (void);
extern int emacs_open (const char *, int, int);
extern int emacs_close (int);
extern ptrdiff_t emacs_read (int, char *, ptrdiff_t);
@@ -3448,11 +3458,10 @@ extern void syms_of_ccl (void);
extern void syms_of_dired (void);
extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
- int, Lisp_Object);
+ bool, Lisp_Object);
/* Defined in term.c */
extern int *char_ins_del_vector;
-extern void mark_ttys (void);
extern void syms_of_term (void);
extern _Noreturn void fatal (const char *msgid, ...)
ATTRIBUTE_FORMAT_PRINTF (1, 2);
@@ -3480,6 +3489,9 @@ extern Lisp_Object Qface;
extern Lisp_Object Qnormal;
extern Lisp_Object QCfamily, QCweight, QCslant;
extern Lisp_Object QCheight, QCname, QCwidth, QCforeground, QCbackground;
+extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold;
+extern Lisp_Object Qbold, Qextra_bold, Qultra_bold;
+extern Lisp_Object Qoblique, Qitalic;
extern Lisp_Object Vface_alternative_font_family_alist;
extern Lisp_Object Vface_alternative_font_registry_alist;
extern void syms_of_xfaces (void);
@@ -3524,9 +3536,9 @@ void syms_of_dbusbind (void);
extern char *emacs_root_dir (void);
#endif /* DOS_NT */
-/* Nonzero means Emacs has already been initialized.
+/* True means Emacs has already been initialized.
Used during startup to detect startup of dumped Emacs. */
-extern int initialized;
+extern bool initialized;
extern int immediate_quit; /* Nonzero means ^G can quit instantly */
@@ -3593,7 +3605,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
extern void *record_xmalloc (size_t);
#define USE_SAFE_ALLOCA \
- ptrdiff_t sa_count = SPECPDL_INDEX (); int sa_must_free = 0
+ ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = 0
/* SAFE_ALLOCA allocates a simple buffer. */
@@ -3664,6 +3676,38 @@ maybe_gc (void)
Fgarbage_collect ();
}
+LISP_INLINE int
+functionp (Lisp_Object object)
+{
+ if (SYMBOLP (object) && !NILP (Ffboundp (object)))
+ {
+ object = Findirect_function (object, Qt);
+
+ if (CONSP (object) && EQ (XCAR (object), Qautoload))
+ {
+ /* Autoloaded symbols are functions, except if they load
+ macros or keymaps. */
+ int i;
+ for (i = 0; i < 4 && CONSP (object); i++)
+ object = XCDR (object);
+
+ return ! (CONSP (object) && !NILP (XCAR (object)));
+ }
+ }
+
+ if (SUBRP (object))
+ return XSUBR (object)->max_args != UNEVALLED;
+ else if (COMPILEDP (object))
+ return 1;
+ else if (CONSP (object))
+ {
+ Lisp_Object car = XCAR (object);
+ return EQ (car, Qlambda) || EQ (car, Qclosure);
+ }
+ else
+ return 0;
+}
+
INLINE_HEADER_END
#endif /* EMACS_LISP_H */
diff --git a/src/lread.c b/src/lread.c
index e2ad03b349f..1dd6275684b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -89,8 +89,6 @@ static Lisp_Object Qget_emacs_mule_file_char;
static Lisp_Object Qload_force_doc_strings;
-extern Lisp_Object Qinternal_interpreter_environment;
-
static Lisp_Object Qload_in_progress;
/* The association list of objects read with the #n=object form.
@@ -189,7 +187,7 @@ static int readbyte_from_string (int, Lisp_Object);
static int unread_char;
static int
-readchar (Lisp_Object readcharfun, int *multibyte)
+readchar (Lisp_Object readcharfun, bool *multibyte)
{
Lisp_Object tem;
register int c;
@@ -2354,9 +2352,9 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
static Lisp_Object
read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
{
- register int c;
- unsigned uninterned_symbol = 0;
- int multibyte;
+ int c;
+ bool uninterned_symbol = 0;
+ bool multibyte;
*pch = 0;
load_each_byte = 0;
@@ -3406,7 +3404,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
/* Delay handling the bytecode slot until we know whether
it is lazily-loaded (we can tell by whether the
constants slot is nil). */
- ptr[COMPILED_CONSTANTS] = item;
+ ASET (vector, COMPILED_CONSTANTS, item);
item = Qnil;
}
else if (i == COMPILED_CONSTANTS)
@@ -3432,7 +3430,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
}
/* Now handle the bytecode slot. */
- ptr[COMPILED_BYTECODE] = bytestr;
+ ASET (vector, COMPILED_BYTECODE, bytestr);
}
else if (i == COMPILED_DOC_STRING
&& STRINGP (item)
@@ -3444,7 +3442,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
item = Fstring_as_multibyte (item);
}
}
- ptr[i] = item;
+ ASET (vector, i, item);
otem = XCONS (tem);
tem = Fcdr (tem);
free_cons (otem);
@@ -4253,9 +4251,12 @@ init_lread (void)
{
tem = Fexpand_file_name (build_string ("site-lisp"),
Vsource_directory);
-
- if (NILP (Fmember (tem, Vload_path)))
- Vload_path = Fcons (tem, Vload_path);
+ tem1 = Ffile_exists_p (tem);
+ if (!NILP (tem1))
+ {
+ if (NILP (Fmember (tem, Vload_path)))
+ Vload_path = Fcons (tem, Vload_path);
+ }
}
}
} /* Vinstallation_directory != Vsource_directory */
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index bdb292099bc..a8dcf5f2ae8 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -390,6 +390,7 @@ SYSTIME_H = $(SRC)/systime.h \
$(NT_INC)/sys/time.h \
$(GNU_LIB)/timespec.h
ATIMER_H = $(SRC)/atimer.h \
+ $(NT_INC)/stdbool.h \
$(SYSTIME_H)
BLOCKINPUT_H = $(SRC)/blockinput.h \
$(ATIMER_H)
@@ -401,6 +402,8 @@ CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
$(NT_INC)/unistd.h
CHARACTER_H = $(SRC)/character.h \
$(GNU_LIB)/verify.h
+CCL_H = $(SRC)/ccl.h \
+ $(CHARACTER_H)
CHARSET_H = $(SRC)/charset.h \
$(GNU_LIB)/verify.h
CODING_H = $(SRC)/coding.h \
@@ -422,7 +425,7 @@ DISPEXTERN_H = $(SRC)/dispextern.h \
FILEMODE_H = $(GNU_LIB)/filemode.h \
$(NT_INC)/sys/stat.h
FONT_H = $(SRC)/font.h \
- $(SRC)/ccl.h
+ $(CCL_H)
FRAME_H = $(SRC)/frame.h \
$(DISPEXTERN_H)
FTOASTR_H = $(GNU_LIB)/ftoastr.h \
@@ -469,6 +472,8 @@ SYSTTY_H = $(SRC)/systty.h \
$(NT_INC)/unistd.h
TERMHOOKS_H = $(SRC)/termhooks.h \
$(SYSTIME_H)
+W32FONT_H = $(SRC)/w32font.h \
+ $(FONT_H)
W32TERM_H = $(SRC)/w32term.h \
$(W32GUI_H)
WINDOW_H = $(SRC)/window.h \
@@ -553,7 +558,6 @@ $(BLD)/callint.$(O) : \
$(BLD)/callproc.$(O) : \
$(SRC)/callproc.c \
- $(SRC)/ccl.h \
$(SRC)/commands.h \
$(SRC)/composite.h \
$(SRC)/epaths.h \
@@ -563,6 +567,7 @@ $(BLD)/callproc.$(O) : \
$(NT_INC)/unistd.h \
$(BLOCKINPUT_H) \
$(BUFFER_H) \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CODING_H) \
$(CONFIG_H) \
@@ -602,7 +607,7 @@ $(BLD)/category.$(O) : \
$(BLD)/ccl.$(O) : \
$(SRC)/ccl.c \
- $(SRC)/ccl.h \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CODING_H) \
@@ -634,7 +639,7 @@ $(BLD)/charset.$(O) : \
$(BLD)/chartab.$(O) : \
$(SRC)/chartab.c \
- $(SRC)/ccl.h \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CONFIG_H) \
@@ -656,9 +661,9 @@ $(BLD)/cmds.$(O) : \
$(BLD)/coding.$(O) : \
$(SRC)/coding.c \
- $(SRC)/ccl.h \
$(SRC)/composite.h \
$(BUFFER_H) \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CODING_H) \
@@ -802,6 +807,7 @@ $(BLD)/emacs.$(O) : \
$(PROCESS_H) \
$(SYSTTY_H) \
$(TERMHOOKS_H) \
+ $(W32TERM_H) \
$(WINDOW_H)
$(BLD)/eval.$(O) : \
@@ -897,10 +903,10 @@ $(BLD)/font.$(O) : \
$(BLD)/fontset.$(O) : \
$(SRC)/fontset.c \
- $(SRC)/ccl.h \
$(SRC)/fontset.h \
$(BLOCKINPUT_H) \
$(BUFFER_H) \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CONFIG_H) \
@@ -1268,6 +1274,7 @@ $(BLD)/process.$(O) : \
$(SYSTIME_H) \
$(SYSTTY_H) \
$(TERMHOOKS_H) \
+ $(W32TERM_H) \
$(WINDOW_H)
$(BLD)/ralloc.$(O) : \
@@ -1523,14 +1530,13 @@ $(BLD)/xfaces.$(O) : \
$(BLD)/w32fns.$(O) : \
$(SRC)/w32fns.c \
- $(SRC)/ccl.h \
$(SRC)/epaths.h \
$(SRC)/fontset.h \
$(SRC)/w32.h \
- $(SRC)/w32font.h \
$(SRC)/w32heap.h \
$(BLOCKINPUT_H) \
$(BUFFER_H) \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CODING_H) \
@@ -1543,6 +1549,7 @@ $(BLD)/w32fns.$(O) : \
$(LISP_H) \
$(SYSTIME_H) \
$(TERMHOOKS_H) \
+ $(W32FONT_H) \
$(W32TERM_H) \
$(WINDOW_H)
@@ -1567,18 +1574,17 @@ $(BLD)/w32menu.$(O) : \
$(BLD)/w32term.$(O) : \
$(SRC)/w32term.c \
- $(SRC)/ccl.h \
$(SRC)/disptab.h \
$(SRC)/fontset.h \
$(SRC)/keymap.h \
$(SRC)/termchar.h \
$(SRC)/termopts.h \
- $(SRC)/w32font.h \
$(SRC)/w32heap.h \
$(NT_INC)/sys/stat.h \
$(ATIMER_H) \
$(BLOCKINPUT_H) \
$(BUFFER_H) \
+ $(CCL_H) \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CODING_H) \
@@ -1593,6 +1599,7 @@ $(BLD)/w32term.$(O) : \
$(SYSTIME_H) \
$(SYSTTY_H) \
$(TERMHOOKS_H) \
+ $(W32FONT_H) \
$(W32TERM_H) \
$(WINDOW_H)
@@ -1628,7 +1635,6 @@ $(BLD)/w32xfns.$(O) : \
$(BLD)/w32font.$(O) : \
$(SRC)/w32font.c \
$(SRC)/fontset.h \
- $(SRC)/w32font.h \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CODING_H) \
@@ -1637,13 +1643,13 @@ $(BLD)/w32font.$(O) : \
$(FONT_H) \
$(FRAME_H) \
$(LISP_H) \
+ $(W32FONT_H) \
$(W32TERM_H)
$(BLD)/w32uniscribe.$(O) : \
$(SRC)/w32uniscribe.c \
$(SRC)/composite.h \
$(SRC)/fontset.h \
- $(SRC)/w32font.h \
$(CHARACTER_H) \
$(CHARSET_H) \
$(CONFIG_H) \
@@ -1651,6 +1657,7 @@ $(BLD)/w32uniscribe.$(O) : \
$(FONT_H) \
$(FRAME_H) \
$(LISP_H) \
+ $(W32FONT_H) \
$(W32TERM_H)
# Each object file depends on stamp_BLD, because in parallel builds we must
diff --git a/src/menu.c b/src/menu.c
index 3e466b46aa3..20770537326 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -36,24 +36,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "../lwlib/lwlib.h"
#endif
-#ifdef HAVE_X_WINDOWS
-#include "xterm.h"
-#endif
-
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
-
-#ifdef USE_GTK
-#include "gtkutil.h"
-#endif
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_NTGUI
-#include "w32term.h"
-
extern AppendMenuW_Proc unicode_append_menu;
extern HMENU current_popup_menu;
-
#endif /* HAVE_NTGUI */
#include "menu.h"
diff --git a/src/minibuf.c b/src/minibuf.c
index 2154d1654df..2035a3e3985 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -817,7 +817,7 @@ get_minibuffer (EMACS_INT depth)
while the buffer doesn't know about them any more. */
delete_all_overlays (XBUFFER (buf));
reset_buffer (XBUFFER (buf));
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (buf);
if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
call0 (intern ("minibuffer-inactive-mode"));
@@ -1860,7 +1860,6 @@ the values STRING, PREDICATE and `lambda'. */)
}
static Lisp_Object Qmetadata;
-extern Lisp_Object Qbuffer;
DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0,
doc: /* Perform completion on buffer names.
diff --git a/src/msdos.c b/src/msdos.c
index 30435820d9e..ac348e94375 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1029,7 +1029,6 @@ IT_clear_end_of_line (struct frame *f, int first_unused)
{
char *spaces, *sp;
int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
- extern int fatal_error_in_progress;
struct tty_display_info *tty = FRAME_TTY (f);
if (new_pos_X >= first_unused || fatal_error_in_progress)
@@ -2434,10 +2433,10 @@ and then the scan code. */)
else
{
val = Fvector (NUM_RECENT_DOSKEYS, keys);
- memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index,
- (NUM_RECENT_DOSKEYS - recent_doskeys_index) * word_size);
- memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index,
- keys, recent_doskeys_index * word_size);
+ vcopy (val, 0, keys + recent_doskeys_index,
+ NUM_RECENT_DOSKEYS - recent_doskeys_index);
+ vcopy (val, NUM_RECENT_DOSKEYS - recent_doskeys_index,
+ keys, recent_doskeys_index);
return val;
}
}
diff --git a/src/nsmenu.m b/src/nsmenu.m
index e8a0b43a01b..9e290486213 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1497,6 +1497,8 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
FlippedView *contentView;
NSImage *img;
+ dialog_return = Qundefined;
+ button_values = NULL;
area.origin.x = 3*SPACER;
area.origin.y = 2*SPACER;
area.size.width = ICONSIZE;
@@ -1578,44 +1580,65 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
[self setOneShot: YES];
[self setReleasedWhenClosed: YES];
[self setHidesOnDeactivate: YES];
+ [self setStyleMask:
+ NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask];
+
return self;
}
- (BOOL)windowShouldClose: (id)sender
{
- [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!!
+ window_closed = YES;
+ [NSApp stop:self];
return NO;
}
+- (void)dealloc
+{
+ xfree (button_values);
+ [super dealloc];
+}
-void process_dialog (id window, Lisp_Object list)
+- (void)process_dialog: (Lisp_Object) list
{
- Lisp_Object item;
+ Lisp_Object item, lst = list;
int row = 0;
+ int buttons = 0, btnnr = 0;
+
+ for (; XTYPE (lst) == Lisp_Cons; lst = XCDR (lst))
+ {
+ item = XCAR (list);
+ if (XTYPE (item) == Lisp_Cons)
+ ++buttons;
+ }
+
+ if (buttons > 0)
+ button_values = (Lisp_Object *) xmalloc (buttons * sizeof (*button_values));
for (; XTYPE (list) == Lisp_Cons; list = XCDR (list))
{
item = XCAR (list);
if (XTYPE (item) == Lisp_String)
{
- [window addString: SSDATA (item) row: row++];
+ [self addString: SSDATA (item) row: row++];
}
else if (XTYPE (item) == Lisp_Cons)
{
- [window addButton: SSDATA (XCAR (item))
- value: XCDR (item) row: row++];
+ button_values[btnnr] = XCDR (item);
+ [self addButton: SSDATA (XCAR (item)) value: btnnr row: row++];
+ ++btnnr;
}
else if (NILP (item))
{
- [window addSplit];
+ [self addSplit];
row = 0;
}
}
}
-- addButton: (char *)str value: (Lisp_Object)val row: (int)row
+- (void)addButton: (char *)str value: (int)tag row: (int)row
{
id cell;
@@ -1628,15 +1651,13 @@ void process_dialog (id window, Lisp_Object list)
[cell setTarget: self];
[cell setAction: @selector (clicked: )];
[cell setTitle: [NSString stringWithUTF8String: str]];
- [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!!
+ [cell setTag: tag];
[cell setBordered: YES];
[cell setEnabled: YES];
-
- return self;
}
-- addString: (char *)str row: (int)row
+- (void)addString: (char *)str row: (int)row
{
id cell;
@@ -1649,32 +1670,28 @@ void process_dialog (id window, Lisp_Object list)
[cell setTitle: [NSString stringWithUTF8String: str]];
[cell setBordered: YES];
[cell setEnabled: NO];
-
- return self;
}
-- addSplit
+- (void)addSplit
{
[matrix addColumn];
cols++;
- return self;
}
-- clicked: sender
+- (void)clicked: sender
{
NSArray *sellist = nil;
EMACS_INT seltag;
sellist = [sender selectedCells];
- if ([sellist count]<1)
- return self;
+ if ([sellist count] < 1)
+ return;
seltag = [[sellist objectAtIndex: 0] tag];
- if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!!
- [NSApp stopModalWithCode: seltag];
- return self;
+ dialog_return = button_values[seltag];
+ [NSApp stop:self];
}
@@ -1686,7 +1703,7 @@ void process_dialog (id window, Lisp_Object list)
if (XTYPE (contents) == Lisp_Cons)
{
head = Fcar (contents);
- process_dialog (self, Fcdr (contents));
+ [self process_dialog: Fcdr (contents)];
}
else
head = contents;
@@ -1706,7 +1723,7 @@ void process_dialog (id window, Lisp_Object list)
if (cols == 1 && rows > 1) /* Never told where to split */
{
[matrix addColumn];
- for (i = 0; i<rows/2; i++)
+ for (i = 0; i < rows/2; i++)
{
[matrix putCell: [matrix cellAtRow: (rows+1)/2 column: 0]
atRow: i column: 1];
@@ -1756,13 +1773,27 @@ void process_dialog (id window, Lisp_Object list)
- (void)timeout_handler: (NSTimer *)timedEntry
{
- timer_fired = 1;
- [NSApp abortModal];
+ NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
+ location: NSMakePoint (0, 0)
+ modifierFlags: 0
+ timestamp: 0
+ windowNumber: [[NSApp mainWindow] windowNumber]
+ context: [NSApp context]
+ subtype: 0
+ data1: 0
+ data2: 0];
+
+ timer_fired = YES;
+ /* We use sto because stopModal/abortModal out of the main loop does not
+ seem to work in 10.6. But as we use stop we must send a real event so
+ the stop is seen and acted upon. */
+ [NSApp stop:self];
+ [NSApp postEvent: nxev atStart: NO];
}
- (Lisp_Object)runDialogAt: (NSPoint)p
{
- NSInteger ret = 0;
+ Lisp_Object ret = Qundefined;
while (popup_activated_flag)
{
@@ -1780,8 +1811,10 @@ void process_dialog (id window, Lisp_Object list)
[[NSRunLoop currentRunLoop] addTimer: tmo
forMode: NSModalPanelRunLoopMode];
}
- timer_fired = 0;
- ret = [NSApp runModalForWindow: self];
+ timer_fired = NO;
+ dialog_return = Qundefined;
+ [NSApp runModalForWindow: self];
+ ret = dialog_return;
if (! timer_fired)
{
if (tmo != nil) [tmo invalidate]; /* Cancels timer */
@@ -1789,11 +1822,11 @@ void process_dialog (id window, Lisp_Object list)
}
}
- { /* FIXME: BIG UGLY HACK!!! */
- Lisp_Object tmp;
- *(EMACS_INT*)(&tmp) = ret;
- return tmp;
- }
+ if (EQ (ret, Qundefined) && window_closed)
+ /* Make close button pressed equivalent to C-g. */
+ Fsignal (Qquit, Qnil);
+
+ return ret;
}
@end
diff --git a/src/nsterm.h b/src/nsterm.h
index 54f4a4ec89e..f0cae193005 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -195,12 +195,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
NSTextField *title;
NSMatrix *matrix;
int rows, cols;
- int timer_fired;
+ BOOL timer_fired, window_closed;
+ Lisp_Object dialog_return;
+ Lisp_Object *button_values;
}
- initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
-- addButton: (char *)str value: (Lisp_Object)val row: (int)row;
-- addString: (char *)str row: (int)row;
-- addSplit;
+- (void)process_dialog: (Lisp_Object)list;
+- (void)addButton: (char *)str value: (int)tag row: (int)row;
+- (void)addString: (char *)str row: (int)row;
+- (void)addSplit;
- (Lisp_Object)runDialogAt: (NSPoint)p;
- (void)timeout_handler: (NSTimer *)timedEntry;
@end
@@ -628,6 +631,8 @@ struct x_output
/* This is the `Display *' which frame F is on. */
#define FRAME_NS_DISPLAY(f) (0)
#define FRAME_X_DISPLAY(f) (0)
+#define FRAME_X_SCREEN(f) (0)
+#define FRAME_X_VISUAL(f) FRAME_NS_DISPLAY_INFO(f)->visual
#define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color)
#define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color)
@@ -777,31 +782,6 @@ extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f,
extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
Lisp_Object header);
-/* More prototypes that should be moved to a more general include file */
-extern void set_frame_menubar (struct frame *f, int first_time, int deep_p);
-extern void x_set_window_size (struct frame *f, int change_grav,
- int cols, int rows);
-extern void x_sync (struct frame *);
-extern Lisp_Object x_get_focus_frame (struct frame *);
-extern void x_set_mouse_position (struct frame *f, int h, int v);
-extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
-extern void x_make_frame_visible (struct frame *f);
-extern void x_make_frame_invisible (struct frame *f);
-extern void x_iconify_frame (struct frame *f);
-extern int x_char_width (struct frame *f);
-extern int x_char_height (struct frame *f);
-extern int x_pixel_width (struct frame *f);
-extern int x_pixel_height (struct frame *f);
-extern void x_set_frame_alpha (struct frame *f);
-extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
-extern void x_set_tool_bar_lines (struct frame *f,
- Lisp_Object value,
- Lisp_Object oldval);
-extern void x_activate_menubar (struct frame *);
-extern void free_frame_menubar (struct frame *);
-extern void x_free_frame_resources (struct frame *);
-extern void x_destroy_window (struct frame *);
-
#define NSAPP_DATA2_RUNASSCRIPT 10
extern void ns_run_ascript (void);
diff --git a/src/nsterm.m b/src/nsterm.m
index 3ab9358467a..c892a5486a7 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -4600,11 +4600,15 @@ not_in_argv (NSString *arg)
SELECT_TYPE readfds, writefds, *wfds;
EMACS_TIME timeout, *tmo;
+ NSAutoreleasePool *pool = nil;
/* NSTRACE (fd_handler); */
for (;;)
{
+ [pool release];
+ pool = [[NSAutoreleasePool alloc] init];
+
if (waiting)
{
SELECT_TYPE fds;
@@ -5087,7 +5091,8 @@ not_in_argv (NSString *arg)
/* TODO: still need this? */
if (code == 0x2DC)
code = '~'; /* 0x7E */
- emacs_event->modifiers = 0;
+ if (code != 32) /* Space */
+ emacs_event->modifiers = 0;
emacs_event->kind
= code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
emacs_event->code = code;
diff --git a/src/print.c b/src/print.c
index e8309109f1d..3cf5fc7348d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -197,8 +197,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
? PT - start_point : 0), \
old_point_byte + (old_point_byte >= start_point_byte \
? PT_BYTE - start_point_byte : 0)); \
- if (old != current_buffer) \
- set_buffer_internal (old);
+ set_buffer_internal (old);
#define PRINTCHAR(ch) printchar (ch, printcharfun)
@@ -488,7 +487,7 @@ temp_output_buffer_setup (const char *bufname)
register struct buffer *old = current_buffer;
register Lisp_Object buf;
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (Fget_buffer_create (build_string (bufname)));
@@ -586,6 +585,7 @@ A printed representation of an object is text which describes that object. */)
(Lisp_Object object, Lisp_Object noescape)
{
Lisp_Object printcharfun;
+ bool prev_abort_on_gc;
/* struct gcpro gcpro1, gcpro2; */
Lisp_Object save_deactivate_mark;
ptrdiff_t count = SPECPDL_INDEX ();
@@ -601,7 +601,8 @@ A printed representation of an object is text which describes that object. */)
No need for specbind, since errors deactivate the mark. */
save_deactivate_mark = Vdeactivate_mark;
/* GCPRO2 (object, save_deactivate_mark); */
- abort_on_gc++;
+ prev_abort_on_gc = abort_on_gc;
+ abort_on_gc = 1;
printcharfun = Vprin1_to_string_buffer;
PRINTPREPARE;
@@ -625,7 +626,7 @@ A printed representation of an object is text which describes that object. */)
Vdeactivate_mark = save_deactivate_mark;
/* UNGCPRO; */
- abort_on_gc--;
+ abort_on_gc = prev_abort_on_gc;
return unbind_to (count, object);
}
diff --git a/src/process.c b/src/process.c
index fa138027ec1..dbbb23b8627 100644
--- a/src/process.c
+++ b/src/process.c
@@ -116,12 +116,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "gnutls.h"
#endif
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
+#endif /* HAVE_WINDOW_SYSTEM */
+
#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
#include "xgselect.h"
#endif
-#ifdef HAVE_NS
-#include "nsterm.h"
-#endif
/* Work around GCC 4.7.0 bug with strict overflow checking; see
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
@@ -164,16 +165,6 @@ static Lisp_Object QClocal, QCremote, QCcoding;
static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
static Lisp_Object QCsentinel, QClog, QCoptions, QCplist;
static Lisp_Object Qlast_nonmenu_event;
-/* QCfamily is declared and initialized in xfaces.c,
- QCfilter in keyboard.c. */
-extern Lisp_Object QCfamily, QCfilter;
-
-/* Qexit is declared and initialized in eval.c. */
-
-/* QCfamily is defined in xfaces.c. */
-extern Lisp_Object QCfamily;
-/* QCfilter is defined in keyboard.c. */
-extern Lisp_Object QCfilter;
#define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork))
#define NETCONN1_P(p) (EQ (p->type, Qnetwork))
@@ -5039,15 +5030,13 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
for (channel = 0; channel <= max_input_desc; ++channel)
{
struct fd_callback_data *d = &fd_callback_info[channel];
- if (FD_ISSET (channel, &Available)
- && d->func != 0
- && (d->flags & FOR_READ) != 0)
- d->func (channel, d->data, 1);
- if (FD_ISSET (channel, &Writeok)
- && d->func != 0
- && (d->flags & FOR_WRITE) != 0)
- d->func (channel, d->data, 0);
- }
+ if (d->func
+ && ((d->flags & FOR_READ
+ && FD_ISSET (channel, &Available))
+ || (d->flags & FOR_WRITE
+ && FD_ISSET (channel, &Writeok))))
+ d->func (channel, d->data);
+ }
for (channel = 0; channel <= max_process_desc; channel++)
{
@@ -5361,14 +5350,14 @@ read_process_output (Lisp_Object proc, register int channel)
/* There's no good reason to let process filters change the current
buffer, and many callers of accept-process-output, sit-for, and
friends don't expect current-buffer to be changed from under them. */
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
/* Read and dispose of the process output. */
outstream = p->filter;
if (!NILP (outstream))
{
Lisp_Object text;
- int outer_running_asynch_code = running_asynch_code;
+ bool outer_running_asynch_code = running_asynch_code;
int waiting = waiting_for_user_input_p;
/* No need to gcpro these, because all we do with them later
@@ -5605,7 +5594,7 @@ send_process_trap (int ignore)
{
SIGNAL_THREAD_CHECK (SIGPIPE);
sigunblock (sigmask (SIGPIPE));
- longjmp (send_process_frame, 1);
+ _longjmp (send_process_frame, 1);
}
/* In send_process, when a write fails temporarily,
@@ -5808,7 +5797,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
/* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
CFLAGS="-g -O": The value of the parameter `proc' is clobbered
when returning with longjmp despite being declared volatile. */
- if (!setjmp (send_process_frame))
+ if (!_setjmp (send_process_frame))
{
p = XPROCESS (proc); /* Repair any setjmp clobbering. */
process_sent_to = proc;
@@ -6725,9 +6714,9 @@ static void
exec_sentinel (Lisp_Object proc, Lisp_Object reason)
{
Lisp_Object sentinel, odeactivate;
- register struct Lisp_Process *p = XPROCESS (proc);
+ struct Lisp_Process *p = XPROCESS (proc);
ptrdiff_t count = SPECPDL_INDEX ();
- int outer_running_asynch_code = running_asynch_code;
+ bool outer_running_asynch_code = running_asynch_code;
int waiting = waiting_for_user_input_p;
if (inhibit_sentinels)
@@ -6745,7 +6734,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
/* There's no good reason to let sentinels change the current
buffer, and many callers of accept-process-output, sit-for, and
friends don't expect current-buffer to be changed from under them. */
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
sentinel = p->sentinel;
if (NILP (sentinel))
diff --git a/src/process.h b/src/process.h
index db000464cb5..e89ba478187 100644
--- a/src/process.h
+++ b/src/process.h
@@ -187,7 +187,7 @@ pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
/* True if we are about to fork off a synchronous process or if we
are waiting for it. */
-extern int synch_process_alive;
+extern bool synch_process_alive;
/* Communicate exit status of sync process to from sigchld_handler
to Fcall_process. */
@@ -222,7 +222,7 @@ extern void hold_keyboard_input (void);
extern void unhold_keyboard_input (void);
extern int kbd_on_hold_p (void);
-typedef void (*fd_callback)(int fd, void *data, int for_read);
+typedef void (*fd_callback) (int fd, void *data);
extern void add_read_fd (int fd, fd_callback func, void *data);
extern void delete_read_fd (int fd);
diff --git a/src/ralloc.c b/src/ralloc.c
index c40258693f5..3877e21d4f6 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -670,6 +670,7 @@ static void
free_bloc (bloc_ptr bloc)
{
heap_ptr heap = bloc->heap;
+ heap_ptr h;
if (r_alloc_freeze_level)
{
@@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc)
bloc->prev->next = bloc->next;
}
- /* Update the records of which blocs are in HEAP. */
- if (heap->first_bloc == bloc)
+ /* Sometimes, 'heap' obtained from bloc->heap above is not really a
+ 'heap' structure. It can even be beyond the current break point,
+ which will cause crashes when we dereference it below (see
+ bug#12242). Evidently, the reason is bloc allocations done while
+ use_relocatable_buffers was non-positive, because additional
+ memory we get then is not recorded in the heaps we manage. If
+ bloc->heap records such a "heap", we cannot (and don't need to)
+ update its records. So we validate the 'heap' value by making
+ sure it is one of the heaps we manage via the heaps linked list,
+ and don't touch a 'heap' that isn't found there. This avoids
+ accessing memory we know nothing about. */
+ for (h = first_heap; h != NIL_HEAP; h = h->next)
+ if (heap == h)
+ break;
+
+ if (h)
{
- if (bloc->next != 0 && bloc->next->heap == heap)
- heap->first_bloc = bloc->next;
- else
- heap->first_bloc = heap->last_bloc = NIL_BLOC;
- }
- if (heap->last_bloc == bloc)
- {
- if (bloc->prev != 0 && bloc->prev->heap == heap)
- heap->last_bloc = bloc->prev;
- else
- heap->first_bloc = heap->last_bloc = NIL_BLOC;
+ /* Update the records of which blocs are in HEAP. */
+ if (heap->first_bloc == bloc)
+ {
+ if (bloc->next != 0 && bloc->next->heap == heap)
+ heap->first_bloc = bloc->next;
+ else
+ heap->first_bloc = heap->last_bloc = NIL_BLOC;
+ }
+ if (heap->last_bloc == bloc)
+ {
+ if (bloc->prev != 0 && bloc->prev->heap == heap)
+ heap->last_bloc = bloc->prev;
+ else
+ heap->first_bloc = heap->last_bloc = NIL_BLOC;
+ }
}
relinquish ();
diff --git a/src/sysdep.c b/src/sysdep.c
index 183ee005227..b84e6a4ea3a 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1765,19 +1765,37 @@ init_signals (void)
#endif /* !RAND_BITS */
void
-seed_random (long int arg)
+seed_random (void *seed, ptrdiff_t seed_size)
{
+#if defined HAVE_RANDOM || ! defined HAVE_LRAND48
+ unsigned int arg = 0;
+#else
+ long int arg = 0;
+#endif
+ unsigned char *argp = (unsigned char *) &arg;
+ unsigned char *seedp = seed;
+ ptrdiff_t i;
+ for (i = 0; i < seed_size; i++)
+ argp[i % sizeof arg] ^= seedp[i];
#ifdef HAVE_RANDOM
- srandom ((unsigned int)arg);
+ srandom (arg);
#else
# ifdef HAVE_LRAND48
srand48 (arg);
# else
- srand ((unsigned int)arg);
+ srand (arg);
# endif
#endif
}
+void
+init_random (void)
+{
+ EMACS_TIME t = current_emacs_time ();
+ uintmax_t v = getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t);
+ seed_random (&v, sizeof v);
+}
+
/*
* Return a nonnegative random integer out of whatever we've got.
* It contains enough bits to make a random (signed) Emacs fixnum.
diff --git a/src/systime.h b/src/systime.h
index d3bdeb83019..9ce7ce646fb 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -154,8 +154,8 @@ extern void set_waiting_for_input (EMACS_TIME *);
#ifdef GCPRO1
/* defined in editfns.c */
extern Lisp_Object make_lisp_time (EMACS_TIME);
-extern int decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object,
- Lisp_Object, EMACS_TIME *, double *);
+extern bool decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object,
+ Lisp_Object, EMACS_TIME *, double *);
extern EMACS_TIME lisp_time_argument (Lisp_Object);
#endif
diff --git a/src/term.c b/src/term.c
index 23e074287c1..f1a09b39cf9 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3001,6 +3001,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
#else
tty = xzalloc (sizeof *tty);
#endif
+ tty->top_frame = Qnil;
tty->next = tty_list;
tty_list = tty;
@@ -3541,22 +3542,6 @@ delete_tty (struct terminal *terminal)
xfree (tty);
}
-
-
-/* Mark the pointers in the tty_display_info objects.
- Called by Fgarbage_collect. */
-
-void
-mark_ttys (void)
-{
- struct tty_display_info *tty;
-
- for (tty = tty_list; tty; tty = tty->next)
- mark_object (tty->top_frame);
-}
-
-
-
void
syms_of_term (void)
{
diff --git a/src/textprop.c b/src/textprop.c
index 20d98b0e6f3..b6895fc426a 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -760,7 +760,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */)
if (BUFFERP (object) && current_buffer != XBUFFER (object))
{
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (object);
}
@@ -843,7 +843,7 @@ position LIMIT; return LIMIT if nothing is found before reaching LIMIT. */)
if (BUFFERP (object) && current_buffer != XBUFFER (object))
{
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (object);
}
diff --git a/src/undo.c b/src/undo.c
index 777e3291806..9cd1d5f9f67 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -324,7 +324,7 @@ truncate_undo_list (struct buffer *b)
/* Make the buffer current to get its local values of variables such
as undo_limit. Also so that Vundo_outer_limit_function can
tell which buffer to operate on. */
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
set_buffer_internal (b);
list = BVAR (b, undo_list);
diff --git a/src/w32.c b/src/w32.c
index b460660cb8c..fe612687f48 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -4098,7 +4098,7 @@ symlink (char const *filename, char const *linkname)
dir_access = sys_access (filename, D_OK);
/* Since Windows distinguishes between symlinks to directories and
- to files, we provide a kludgey feature: if FILENAME doesn't
+ to files, we provide a kludgy feature: if FILENAME doesn't
exist, but ends in a slash, we create a symlink to directory. If
FILENAME exists and is a directory, we always create a symlink to
directory. */
@@ -4165,7 +4165,7 @@ symlink (char const *filename, char const *linkname)
whether the underlying volume actually supports symlinks, by
testing the FILE_SUPPORTS_REPARSE_POINTS bit in volume's flags, and
avoid the call to this function if it doesn't. That's because the
- call to GetFileAttributes takes a non-negligible time, expecially
+ call to GetFileAttributes takes a non-negligible time, especially
on non-local or removable filesystems. See stat_worker for an
example of how to do that. */
static int
@@ -6773,7 +6773,7 @@ shutdown_handler (DWORD type)
|| type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */
{
/* Shut down cleanly, making sure autosave files are up to date. */
- shut_down_emacs (0, 0, Qnil);
+ shut_down_emacs (0, Qnil);
}
/* Allow other handlers to handle this signal. */
diff --git a/src/w32fns.c b/src/w32fns.c
index 9c5231f9d93..5a1b6dfabab 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4735,7 +4735,7 @@ x_display_info_for_name (Lisp_Object name)
CHECK_STRING (name);
for (dpyinfo = &one_w32_display_info, names = w32_display_name_list;
- dpyinfo;
+ dpyinfo && !NILP (w32_display_name_list);
dpyinfo = dpyinfo->next, names = XCDR (names))
{
Lisp_Object tem;
diff --git a/src/w32font.h b/src/w32font.h
index b08d48a3d36..a29ddbe778c 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef EMACS_W32FONT_H
#define EMACS_W32FONT_H
+#include "font.h"
/* Bit 17 of ntmFlags in NEWTEXTMETRIC is set for PostScript OpenType fonts,
bit 18 for TrueType OpenType fonts, bit 20 for Type1 fonts. */
@@ -83,4 +84,7 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec);
Lisp_Object intern_font_name (char *);
+extern void syms_of_w32font (void);
+extern void globals_of_w32font (void);
+
#endif
diff --git a/src/w32term.h b/src/w32term.h
index ccbf3c42c0e..5d756f435e4 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -302,9 +302,6 @@ struct w32_output
/* Non-hourglass cursor that is currently active. */
Cursor current_cursor;
- /* Flag to set when the window needs to be completely repainted. */
- int needs_exposure;
-
DWORD dwStyle;
/* This is the Emacs structure for the display this frame is on. */
@@ -345,7 +342,7 @@ extern struct w32_output w32term_display;
/* Return the window associated with the frame F. */
#define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc)
-#define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc)
+#define FRAME_X_WINDOW(f) FRAME_W32_WINDOW (f)
#define FRAME_FONT(f) ((f)->output_data.w32->font)
#define FRAME_FONTSET(f) ((f)->output_data.w32->fontset)
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 06f7b1bd192..bc45e2c648c 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -320,7 +320,7 @@ uniscribe_shape (Lisp_Object lgstring)
}
if (SUCCEEDED (result))
{
- int j, from, to;
+ int j, from, to, adj_offset = 0;
from = 0;
to = from;
@@ -364,6 +364,32 @@ uniscribe_shape (Lisp_Object lgstring)
}
}
}
+
+ /* For RTL text, the Uniscribe shaper prepares
+ the values in ADVANCES array for layout in
+ reverse order, whereby "advance width" is
+ applied to move the pen in reverse direction
+ and _before_ drawing the glyph. Since we
+ draw glyphs in their normal left-to-right
+ order, we need to adjust the coordinates of
+ each non-base glyph in a grapheme cluster via
+ X-OFF component of the gstring's ADJUSTMENT
+ sub-vector. This loop computes, for each
+ grapheme cluster, the initial value of the
+ adjustment for the base character, which is
+ then updated for each successive glyph in the
+ grapheme cluster. */
+ if (items[i].a.fRTL)
+ {
+ int j1 = j;
+
+ adj_offset = 0;
+ while (j1 < nglyphs && !attributes[j1].fClusterStart)
+ {
+ adj_offset += advances[j1];
+ j1++;
+ }
+ }
}
LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos
@@ -392,9 +418,11 @@ uniscribe_shape (Lisp_Object lgstring)
if (SUCCEEDED (result))
{
- LGLYPH_SET_LBEARING (lglyph, char_metric.abcA);
- LGLYPH_SET_RBEARING (lglyph, (char_metric.abcA
- + char_metric.abcB));
+ int lbearing = char_metric.abcA;
+ int rbearing = char_metric.abcA + char_metric.abcB;
+
+ LGLYPH_SET_LBEARING (lglyph, lbearing);
+ LGLYPH_SET_RBEARING (lglyph, rbearing);
}
else
{
@@ -402,18 +430,43 @@ uniscribe_shape (Lisp_Object lgstring)
LGLYPH_SET_RBEARING (lglyph, advances[j]);
}
- if (offsets[j].du || offsets[j].dv)
+ if (offsets[j].du || offsets[j].dv
+ /* For non-base glyphs of RTL grapheme clusters,
+ adjust the X offset even if both DU and DV
+ are zero. */
+ || (!attributes[j].fClusterStart && items[i].a.fRTL))
{
Lisp_Object vec;
vec = Fmake_vector (make_number (3), Qnil);
- ASET (vec, 0, make_number (offsets[j].du));
+ if (items[i].a.fRTL)
+ {
+ /* Empirically, it looks like Uniscribe
+ interprets DU in reverse direction for
+ RTL clusters. E.g., if we don't reverse
+ the direction, the Hebrew point HOLAM is
+ drawn above the right edge of the base
+ consonant, instead of above the left edge. */
+ ASET (vec, 0, make_number (-offsets[j].du
+ + adj_offset));
+ /* Update the adjustment value for the width
+ advance of the glyph we just emitted. */
+ adj_offset -= 2 * advances[j];
+ }
+ else
+ ASET (vec, 0, make_number (offsets[j].du + adj_offset));
ASET (vec, 1, make_number (offsets[j].dv));
/* Based on what ftfont.c does... */
ASET (vec, 2, make_number (advances[j]));
LGLYPH_SET_ADJUSTMENT (lglyph, vec);
}
else
- LGLYPH_SET_ADJUSTMENT (lglyph, Qnil);
+ {
+ LGLYPH_SET_ADJUSTMENT (lglyph, Qnil);
+ /* Update the adjustment value to compensate for
+ the width of the base character. */
+ if (items[i].a.fRTL)
+ adj_offset -= advances[j];
+ }
}
}
}
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 745a5cfe3e7..62e45dd987b 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -438,6 +438,6 @@ XParseGeometry (char *string,
/* x_sync is a no-op on W32. */
void
-x_sync (void *f)
+x_sync (struct frame *f)
{
}
diff --git a/src/widget.c b/src/widget.c
index b94c30f4e9c..ea9bdb61b13 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -671,8 +671,6 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs
update_wm_hints (ew);
}
-extern void free_frame_faces (struct frame *);
-
static void
EmacsFrameDestroy (Widget widget)
{
diff --git a/src/window.c b/src/window.c
index 20325711e73..732d5060d29 100644
--- a/src/window.c
+++ b/src/window.c
@@ -54,14 +54,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "nsterm.h"
#endif
-Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p;
+Lisp_Object Qwindowp, Qwindow_live_p;
+static Lisp_Object Qwindow_valid_p;
static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
static Lisp_Object Qsafe, Qabove, Qbelow;
-static Lisp_Object Qauto_buffer_name, Qclone_of;
+static Lisp_Object Qclone_of;
static int displayed_window_lines (struct window *);
static int count_windows (struct window *);
@@ -268,7 +269,7 @@ decode_any_window (register Lisp_Object window)
return w;
}
-struct window *
+static struct window *
decode_valid_window (register Lisp_Object window)
{
struct window *w;
@@ -1407,22 +1408,21 @@ DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
doc: /* Return current value of point in WINDOW.
WINDOW must be a live window and defaults to the selected one.
-For a nonselected window, this is the value point would have
-if that window were selected.
+For a nonselected window, this is the value point would have if that
+window were selected.
-Note that, when WINDOW is the selected window and its buffer
-is also currently selected, the value returned is the same as (point).
-It would be more strictly correct to return the `top-level' value
-of point, outside of any save-excursion forms.
-But that is hard to define. */)
+Note that, when WINDOW is selected, the value returned is the same as
+that returned by `point' for WINDOW's buffer. It would be more strictly
+correct to return the `top-level' value of `point', outside of any
+`save-excursion' forms. But that is hard to define. */)
(Lisp_Object window)
{
register struct window *w = decode_live_window (window);
- if (w == XWINDOW (selected_window)
- && current_buffer == XBUFFER (w->buffer))
- return Fpoint ();
- return Fmarker_position (w->pointm);
+ if (w == XWINDOW (selected_window))
+ return make_number (BUF_PT (XBUFFER (w->buffer)));
+ else
+ return Fmarker_position (w->pointm);
}
DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1532,16 +1532,27 @@ Return POS. */)
register struct window *w = decode_live_window (window);
CHECK_NUMBER_COERCE_MARKER (pos);
- if (w == XWINDOW (selected_window)
- && XBUFFER (w->buffer) == current_buffer)
- Fgoto_char (pos);
- else
- set_marker_restricted (w->pointm, pos, w->buffer);
- /* We have to make sure that redisplay updates the window to show
- the new value of point. */
- if (!EQ (window, selected_window))
- ++windows_or_buffers_changed;
+ if (w == XWINDOW (selected_window))
+ {
+ if (XBUFFER (w->buffer) == current_buffer)
+ Fgoto_char (pos);
+ else
+ {
+ struct buffer *old_buffer = current_buffer;
+
+ set_buffer_internal (XBUFFER (w->buffer));
+ Fgoto_char (pos);
+ set_buffer_internal (old_buffer);
+ }
+ }
+ else
+ {
+ set_marker_restricted (w->pointm, pos, w->buffer);
+ /* We have to make sure that redisplay updates the window to show
+ the new value of point. */
+ ++windows_or_buffers_changed;
+ }
return pos;
}
@@ -1958,6 +1969,9 @@ unshow_buffer (register struct window *w)
is actually stored in that buffer, and the window's pointm isn't used.
So don't clobber point in that buffer. */
if (! EQ (buf, XWINDOW (selected_window)->buffer)
+ /* Don't clobber point in current buffer either (this could be
+ useful in connection with bug#12208).
+ && XBUFFER (buf) != current_buffer */
/* This line helps to fix Horsley's testbug.el bug. */
&& !(WINDOWP (BVAR (b, last_selected_window))
&& w != XWINDOW (BVAR (b, last_selected_window))
@@ -3087,7 +3101,7 @@ run_window_configuration_change_hook (struct frame *f)
/* Use the right buffer. Matters when running the local hooks. */
if (current_buffer != XBUFFER (Fwindow_buffer (Qnil)))
{
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (Fwindow_buffer (Qnil));
}
@@ -3124,7 +3138,7 @@ run_window_configuration_change_hook (struct frame *f)
DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook,
Srun_window_configuration_change_hook, 1, 1, 0,
doc: /* Run `window-configuration-change-hook' for FRAME. */)
- (Lisp_Object frame)
+ (Lisp_Object frame)
{
CHECK_LIVE_FRAME (frame);
run_window_configuration_change_hook (XFRAME (frame));
@@ -3191,7 +3205,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
because that might itself be a local variable. */
if (window_initialized)
{
- record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
Fset_buffer (buffer);
}
@@ -5526,7 +5540,6 @@ the return value is nil. Otherwise the value is t. */)
struct Lisp_Vector *saved_windows;
Lisp_Object new_current_buffer;
Lisp_Object frame;
- Lisp_Object auto_buffer_name;
FRAME_PTR f;
ptrdiff_t old_point = -1;
@@ -5602,6 +5615,21 @@ the return value is nil. Otherwise the value is t. */)
int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
+ /* Don't do this within the main loop below: This may call Lisp
+ code and is thus potentially unsafe while input is blocked. */
+ for (k = 0; k < saved_windows->header.size; k++)
+ {
+ p = SAVED_WINDOW_N (saved_windows, k);
+ window = p->window;
+ w = XWINDOW (window);
+ if (!NILP (w->buffer)
+ && !EQ (w->buffer, p->buffer)
+ && !NILP (BVAR (XBUFFER (p->buffer), name)))
+ /* If a window we restore gets another buffer, record the
+ window's old buffer. */
+ call1 (Qrecord_window_buffer, window);
+ }
+
/* The mouse highlighting code could get screwed up
if it runs during this. */
BLOCK_INPUT;
@@ -5780,18 +5808,6 @@ the return value is nil. Otherwise the value is t. */)
BUF_PT_BYTE (XBUFFER (w->buffer)));
w->start_at_line_beg = 1;
}
- else if (STRINGP (auto_buffer_name =
- Fwindow_parameter (window, Qauto_buffer_name))
- && SCHARS (auto_buffer_name) != 0
- && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)),
- !NILP (w->buffer)))
- {
- set_marker_restricted (w->start,
- make_number (0), w->buffer);
- set_marker_restricted (w->pointm,
- make_number (0), w->buffer);
- w->start_at_line_beg = 1;
- }
else
/* Window has no live buffer, get one. */
{
@@ -5889,7 +5905,13 @@ the return value is nil. Otherwise the value is t. */)
}
if (!NILP (new_current_buffer))
- Fset_buffer (new_current_buffer);
+ {
+ Fset_buffer (new_current_buffer);
+ /* If the new current buffer doesn't appear in the selected
+ window, go to its old point (see bug#12208). */
+ if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
+ Fgoto_char (make_number (old_point));
+ }
Vminibuf_scroll_window = data->minibuf_scroll_window;
minibuf_selected_window = data->minibuf_selected_window;
@@ -6691,7 +6713,6 @@ syms_of_window (void)
DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook");
DEFSYM (Qabove, "above");
DEFSYM (Qbelow, "below");
- DEFSYM (Qauto_buffer_name, "auto-buffer-name");
DEFSYM (Qclone_of, "clone-of");
staticpro (&Vwindow_list);
diff --git a/src/window.h b/src/window.h
index 28b9678b667..dfb88b2cf3c 100644
--- a/src/window.h
+++ b/src/window.h
@@ -972,7 +972,6 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Vwindow_list;
-extern struct window *decode_valid_window (Lisp_Object);
extern struct window *decode_live_window (Lisp_Object);
extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
extern void mark_window_cursors_off (struct window *);
diff --git a/src/xdisp.c b/src/xdisp.c
index e41783d03c1..86f041dea4d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -768,9 +768,9 @@ static int clear_image_cache_count;
static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
#endif
-/* Non-zero while redisplay_internal is in progress. */
+/* True while redisplay_internal is in progress. */
-int redisplaying_p;
+bool redisplaying_p;
static Lisp_Object Qinhibit_free_realized_faces;
static Lisp_Object Qmode_line_default_help_echo;
@@ -2420,7 +2420,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
static Lisp_Object
safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args)
{
- add_to_log ("Error during redisplay: %S signalled %S",
+ add_to_log ("Error during redisplay: %S signaled %S",
Flist (nargs, args), arg);
return Qnil;
}
@@ -10480,11 +10480,10 @@ current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
empty. This is a relatively infrequent operation, so it's not
worth optimizing. */
-int
+bool
push_message (void)
{
- Lisp_Object msg;
- msg = current_message ();
+ Lisp_Object msg = current_message ();
Vmessage_stack = Fcons (msg, Vmessage_stack);
return STRINGP (msg);
}
@@ -12967,12 +12966,11 @@ redisplay_internal (void)
if (redisplaying_p)
return;
- /* Record a function that resets redisplaying_p to its old value
+ /* Record a function that clears redisplaying_p
when we leave this function. */
count = SPECPDL_INDEX ();
- record_unwind_protect (unwind_redisplay,
- Fcons (make_number (redisplaying_p), selected_frame));
- ++redisplaying_p;
+ record_unwind_protect (unwind_redisplay, selected_frame);
+ redisplaying_p = 1;
specbind (Qinhibit_free_realized_faces, Qnil);
{
@@ -13710,21 +13708,15 @@ redisplay_preserve_echo_area (int from_where)
}
-/* Function registered with record_unwind_protect in
- redisplay_internal. Reset redisplaying_p to the value it had
- before redisplay_internal was called, and clear
- prevent_freeing_realized_faces_p. It also selects the previously
+/* Function registered with record_unwind_protect in redisplay_internal.
+ Clear redisplaying_p. Also, select the previously
selected frame, unless it has been deleted (by an X connection
failure during redisplay, for example). */
static Lisp_Object
-unwind_redisplay (Lisp_Object val)
+unwind_redisplay (Lisp_Object old_frame)
{
- Lisp_Object old_redisplaying_p, old_frame;
-
- old_redisplaying_p = XCAR (val);
- redisplaying_p = XFASTINT (old_redisplaying_p);
- old_frame = XCDR (val);
+ redisplaying_p = 0;
if (! EQ (old_frame, selected_frame)
&& FRAME_LIVE_P (XFRAME (old_frame)))
select_frame_for_redisplay (old_frame);
@@ -14552,8 +14544,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
make_number (CHARPOS (startp)));
SET_TEXT_POS_FROM_MARKER (startp, w->start);
/* In case the hook functions switch buffers. */
- if (current_buffer != XBUFFER (w->buffer))
- set_buffer_internal_1 (XBUFFER (w->buffer));
+ set_buffer_internal (XBUFFER (w->buffer));
}
return startp;
@@ -15381,7 +15372,7 @@ set_vertical_scroll_bar (struct window *w)
selected_window is redisplayed.
We can return without actually redisplaying the window if
- fonts_changed_p is nonzero. In that case, redisplay_internal will
+ fonts_changed_p. In that case, redisplay_internal will
retry. */
static void
@@ -16225,7 +16216,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
}
#endif /* HAVE_WINDOW_SYSTEM */
- /* We go to this label, with fonts_changed_p nonzero,
+ /* We go to this label, with fonts_changed_p set,
if it is necessary to try again using larger glyph matrices.
We have to redeem the scroll bar even in this case,
because the loop in redisplay_internal expects that. */
@@ -17706,15 +17697,15 @@ try_window_id (struct window *w)
{
rotate_matrix (current_matrix, first_unchanged_at_end_vpos + dvpos,
bottom_vpos, dvpos);
- enable_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos,
- bottom_vpos, 0);
+ clear_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos,
+ bottom_vpos);
}
else if (dvpos > 0)
{
rotate_matrix (current_matrix, first_unchanged_at_end_vpos,
bottom_vpos, dvpos);
- enable_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos,
- first_unchanged_at_end_vpos + dvpos, 0);
+ clear_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos,
+ first_unchanged_at_end_vpos + dvpos);
}
/* For frame-based redisplay, make sure that current frame and window
diff --git a/src/xfaces.c b/src/xfaces.c
index 46121d66606..4df5caf6f2a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -225,11 +225,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "dosfns.h"
#endif
-#ifdef WINDOWSNT
-#include "w32term.h"
+#ifdef HAVE_WINDOW_SYSTEM
+#include TERM_HEADER
#include "fontset.h"
-/* Redefine X specifics to W32 equivalents to avoid cluttering the
- code with #ifdef blocks. */
+#ifdef WINDOWSNT
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO
#define x_display_info w32_display_info
@@ -238,13 +237,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#endif /* WINDOWSNT */
#ifdef HAVE_NS
-#include "nsterm.h"
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO
#define x_display_info ns_display_info
#define check_x check_ns
#define GCGraphicsExposures 0
#endif /* HAVE_NS */
+#endif /* HAVE_WINDOW_SYSTEM */
#include "buffer.h"
#include "dispextern.h"
@@ -254,9 +253,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "termchar.h"
#include "font.h"
-#ifdef HAVE_WINDOW_SYSTEM
-#include "fontset.h"
-#endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_X_WINDOWS
@@ -319,9 +315,10 @@ static Lisp_Object QCfontset;
Lisp_Object Qnormal;
Lisp_Object Qbold;
static Lisp_Object Qline, Qwave;
-Lisp_Object Qultra_light, Qextra_light, Qlight;
+static Lisp_Object Qultra_light, Qreverse_oblique, Qreverse_italic;
+Lisp_Object Qextra_light, Qlight;
Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold;
-Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic;
+Lisp_Object Qoblique;
Lisp_Object Qitalic;
static Lisp_Object Qultra_condensed, Qextra_condensed;
Lisp_Object Qcondensed;
@@ -456,18 +453,7 @@ static int menu_face_changed_default;
struct table_entry;
struct named_merge_point;
-static void map_tty_color (struct frame *, struct face *,
- enum lface_attribute_index, int *);
-static Lisp_Object resolve_face_name (Lisp_Object, int);
static void set_font_frame_param (Lisp_Object, Lisp_Object);
-static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
- int, struct named_merge_point *);
-static ptrdiff_t load_pixmap (struct frame *, Lisp_Object,
- unsigned *, unsigned *);
-static struct frame *frame_or_selected_frame (Lisp_Object, int);
-static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
-static void free_face_colors (struct frame *, struct face *);
-static int face_color_gray_p (struct frame *, const char *);
static struct face *realize_face (struct face_cache *, Lisp_Object *,
int);
static struct face *realize_non_ascii_face (struct frame *, Lisp_Object,
@@ -477,38 +463,11 @@ static struct face *realize_tty_face (struct face_cache *, Lisp_Object *);
static int realize_basic_faces (struct frame *);
static int realize_default_face (struct frame *);
static void realize_named_face (struct frame *, Lisp_Object, int);
-static int lface_fully_specified_p (Lisp_Object *);
-static int lface_equal_p (Lisp_Object *, Lisp_Object *);
-static unsigned hash_string_case_insensitive (Lisp_Object);
-static unsigned lface_hash (Lisp_Object *);
-static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *);
static struct face_cache *make_face_cache (struct frame *);
static void clear_face_gcs (struct face_cache *);
static void free_face_cache (struct face_cache *);
-static int face_fontset (Lisp_Object *);
-static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*,
- struct named_merge_point *);
static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *,
int, struct named_merge_point *);
-static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object,
- int);
-static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int);
-static struct face *make_realized_face (Lisp_Object *);
-static void cache_face (struct face_cache *, struct face *, unsigned);
-static void uncache_face (struct face_cache *, struct face *);
-
-#ifdef HAVE_WINDOW_SYSTEM
-
-static GC x_create_gc (struct frame *, unsigned long, XGCValues *);
-static void x_free_gc (struct frame *, GC);
-
-#ifdef USE_X_TOOLKIT
-static void x_update_menu_appearance (struct frame *);
-
-extern void free_frame_menubar (struct frame *);
-#endif /* USE_X_TOOLKIT */
-
-#endif /* HAVE_WINDOW_SYSTEM */
/***********************************************************************
@@ -2565,13 +2524,13 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
}
else if (EQ (keyword, QCstipple))
{
-#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM)
Lisp_Object pixmap_p = Fbitmap_spec_p (value);
if (!NILP (pixmap_p))
to[LFACE_STIPPLE_INDEX] = value;
else
err = 1;
-#endif
+#endif /* HAVE_WINDOW_SYSTEM */
}
else if (EQ (keyword, QCwidth))
{
@@ -2781,8 +2740,7 @@ The value is TO. */)
copy = Finternal_make_lisp_face (to, new_frame);
}
- memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents,
- LFACE_VECTOR_SIZE * word_size);
+ vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
/* Changing a named face means that all realized faces depending on
that face are invalid. Since we cannot tell which realized faces
@@ -3126,14 +3084,14 @@ FRAME 0 means change the face on all frames, and change the default
}
else if (EQ (attr, QCstipple))
{
-#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM)
if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)
&& !NILP (value)
&& NILP (Fbitmap_spec_p (value)))
signal_error ("Invalid stipple attribute", value);
old_value = LFACE_STIPPLE (lface);
ASET (lface, LFACE_STIPPLE_INDEX, value);
-#endif /* HAVE_X_WINDOWS || HAVE_NS */
+#endif /* HAVE_WINDOW_SYSTEM */
}
else if (EQ (attr, QCwidth))
{
@@ -3831,9 +3789,9 @@ Default face attributes override any local face attributes. */)
gvec = XVECTOR (global_lface)->contents;
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
if (IGNORE_DEFFACE_P (gvec[i]))
- lvec[i] = Qunspecified;
+ ASET (local_lface, i, Qunspecified);
else if (! UNSPECIFIEDP (gvec[i]))
- lvec[i] = gvec[i];
+ ASET (local_lface, i, AREF (global_lface, i));
/* If the default face was changed, update the face cache and the
`font' frame parameter. */
@@ -3850,7 +3808,7 @@ Default face attributes override any local face attributes. */)
the previously-cached vector. */
memcpy (attrs, oldface->lface, sizeof attrs);
merge_face_vectors (f, lvec, attrs, 0);
- memcpy (lvec, attrs, sizeof attrs);
+ vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE);
newface = realize_face (c, lvec, DEFAULT_FACE_ID);
if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
diff --git a/src/xfont.c b/src/xfont.c
index 072bce7bb0a..be9556d585a 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -46,7 +46,6 @@ struct xfont_info
};
/* Prototypes of support functions. */
-extern void x_clear_errors (Display *);
static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *);
@@ -390,7 +389,7 @@ xfont_list_pattern (Display *display, const char *pattern,
Lisp_Object scripts = Qnil;
for (i = 0; i < ASIZE (xfont_scratch_props); i++)
- props[i] = Qnil;
+ ASET (xfont_scratch_props, i, Qnil);
for (i = 0; i < num_fonts; i++)
indices[i] = names[i];
qsort (indices, num_fonts, sizeof (char *), compare_font_names);
@@ -467,9 +466,9 @@ xfont_list_pattern (Display *display, const char *pattern,
word_size * 7)
|| ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7]))
{
- memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX),
- word_size * 7);
- props[7] = AREF (entity, FONT_SPACING_INDEX);
+ vcopy (xfont_scratch_props, 0,
+ aref_addr (entity, FONT_FOUNDRY_INDEX), 7);
+ ASET (xfont_scratch_props, 7, AREF (entity, FONT_SPACING_INDEX));
scripts = xfont_supported_scripts (display, indices[i],
xfont_scratch_props, encoding);
}
diff --git a/src/xgselect.c b/src/xgselect.c
index 04ca00274e8..0c00d815820 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -29,9 +29,6 @@ along with GNU Emacs. If not, see <http§://www.gnu.org/licenses/>. */
#include <setjmp.h>
#include "xterm.h"
-static GPollFD *gfds;
-static ptrdiff_t gfds_size;
-
int
xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
EMACS_TIME *timeout, sigset_t *sigmask)
@@ -41,35 +38,31 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
GMainContext *context;
int have_wfds = wfds != NULL;
- int n_gfds = 0, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
+ GPollFD gfds_buf[128];
+ GPollFD *gfds = gfds_buf;
+ int gfds_size = sizeof gfds_buf / sizeof *gfds_buf;
+ int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
int i, nfds, tmo_in_millisec;
+ USE_SAFE_ALLOCA;
- if (!x_in_use)
- return pselect (fds_lim, rfds, wfds, efds, tmop, sigmask);
+ if (! (x_in_use
+ && g_main_context_pending (context = g_main_context_default ())))
+ return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask);
if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
else FD_ZERO (&all_rfds);
if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));
else FD_ZERO (&all_wfds);
- /* Update event sources in GLib. */
- context = g_main_context_default ();
- g_main_context_pending (context);
-
- do {
- if (n_gfds > gfds_size)
- {
- xfree (gfds);
- gfds = xpalloc (0, &gfds_size, n_gfds - gfds_size, INT_MAX,
- sizeof *gfds);
- }
-
- n_gfds = g_main_context_query (context,
- G_PRIORITY_LOW,
- &tmo_in_millisec,
- gfds,
- gfds_size);
- } while (n_gfds > gfds_size);
+ n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
+ gfds, gfds_size);
+ if (gfds_size < n_gfds)
+ {
+ SAFE_NALLOCA (gfds, sizeof *gfds, n_gfds);
+ gfds_size = n_gfds;
+ n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
+ gfds, gfds_size);
+ }
for (i = 0; i < n_gfds; ++i)
{
@@ -86,6 +79,8 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
}
}
+ SAFE_FREE ();
+
if (tmo_in_millisec >= 0)
{
tmo = make_emacs_time (tmo_in_millisec / 1000,
@@ -147,12 +142,3 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
return retval;
}
#endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */
-
-void
-xgselect_initialize (void)
-{
-#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
- gfds_size = 128;
- gfds = xmalloc (gfds_size * sizeof *gfds);
-#endif
-}
diff --git a/src/xgselect.h b/src/xgselect.h
index 8e5614ea972..5509e23c5c0 100644
--- a/src/xgselect.h
+++ b/src/xgselect.h
@@ -31,6 +31,4 @@ extern int xg_select (int max_fds,
EMACS_TIME *timeout,
sigset_t *sigmask);
-extern void xgselect_initialize (void);
-
#endif /* XGSELECT_H */
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 1f6eb84260e..cddbb2aae86 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -97,7 +97,7 @@ ice_connection_closed (void)
open to a session manager, just return. */
static void
-x_session_check_input (int fd, void *data, int for_read)
+x_session_check_input (int fd, void *data)
{
int ret;
diff --git a/src/xterm.c b/src/xterm.c
index 118c8767c23..f497b5322bf 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -165,13 +165,6 @@ struct x_display_info *x_display_list;
Lisp_Object x_display_name_list;
-/* Frame being updated by update_frame. This is declared in term.c.
- This is set by update_begin and looked at by all the XT functions.
- It is zero while not inside an update. In that case, the XT
- functions assume that `selected_frame' is the frame to apply to. */
-
-extern struct frame *updating_frame;
-
/* This is a frame waiting to be auto-raised, within XTread_socket. */
static struct frame *pending_autoraise_frame;
@@ -7850,7 +7843,7 @@ x_connection_closed (Display *dpy, const char *error_message)
(https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once,
the resulting Glib error message loop filled a user's disk.
To avoid this, kill Emacs unconditionally on disconnect. */
- shut_down_emacs (0, 0, Qnil);
+ shut_down_emacs (0, Qnil);
fprintf (stderr, "%s\n\
When compiled with GTK, Emacs cannot recover from X disconnects.\n\
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\
@@ -10609,8 +10602,6 @@ x_activate_timeout_atimer (void)
/* Set up use of X before we make the first connection. */
-extern frame_parm_handler x_frame_parm_handlers[];
-
static struct redisplay_interface x_redisplay_interface =
{
x_frame_parm_handlers,
@@ -10815,8 +10806,6 @@ x_initialize (void)
XSetIOErrorHandler (x_io_error_quitter);
signal (SIGPIPE, x_connection_signal);
-
- xgselect_initialize ();
}
diff --git a/src/xterm.h b/src/xterm.h
index 86a76fd81a9..2d718f49118 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -16,6 +16,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
+#ifndef XTERM_H
+#define XTERM_H
+
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
@@ -367,13 +370,14 @@ extern int use_xim;
extern void check_x (void);
extern struct frame *x_window_to_frame (struct x_display_info *, int);
-
extern struct frame *x_any_window_to_frame (struct x_display_info *, int);
extern struct frame *x_menubar_window_to_frame (struct x_display_info *,
XEvent *);
-
extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
+extern struct frame *x_menubar_window_to_frame (struct x_display_info *,
+ XEvent *);
+
#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
#define x_any_window_to_frame x_window_to_frame
#define x_top_window_to_frame x_window_to_frame
@@ -389,7 +393,6 @@ extern struct x_display_info *x_display_list;
extern Lisp_Object x_display_name_list;
extern struct x_display_info *x_display_info_for_display (Display *);
-extern void x_set_frame_alpha (struct frame *);
extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
extern int x_display_ok (const char *);
@@ -544,9 +547,6 @@ struct x_output
/* Non-zero means hourglass cursor is currently displayed. */
unsigned hourglass_p : 1;
- /* Flag to set when the X window needs to be completely repainted. */
- int needs_exposure;
-
/* These are the current window manager hints. It seems that
XSetWMHints, when presented with an unset bit in the `flags'
member of the hints structure, does not leave the corresponding
@@ -944,7 +944,6 @@ XrmDatabase x_load_resources (Display *, const char *, const char *,
/* Defined in xterm.c */
extern int x_text_icon (struct frame *, const char *);
-extern int x_bitmap_icon (struct frame *, Lisp_Object);
extern void x_catch_errors (Display *);
extern void x_check_errors (Display *, const char *)
ATTRIBUTE_FORMAT_PRINTF (2, 0);
@@ -956,11 +955,6 @@ extern void x_set_mouse_position (struct frame *, int, int);
extern void x_set_mouse_pixel_position (struct frame *, int, int);
extern void xembed_request_focus (struct frame *);
extern void x_ewmh_activate_frame (struct frame *);
-extern void x_make_frame_visible (struct frame *);
-extern void x_make_frame_invisible (struct frame *);
-extern void x_iconify_frame (struct frame *);
-extern void x_free_frame_resources (struct frame *);
-extern void x_wm_set_size_hint (struct frame *, long, int);
extern void x_delete_terminal (struct terminal *terminal);
extern unsigned long x_copy_color (struct frame *, unsigned long);
#ifdef USE_X_TOOLKIT
@@ -973,7 +967,6 @@ extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
double, int);
#endif
extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
-extern void x_query_colors (struct frame *f, XColor *, int);
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
@@ -1032,8 +1025,6 @@ extern int xg_set_icon (struct frame *, Lisp_Object);
extern int xg_set_icon_from_xpm_data (struct frame *, const char**);
#endif /* USE_GTK */
-extern void x_real_positions (struct frame *, int *, int *);
-extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
extern void xic_free_xfontset (struct frame *);
extern void create_frame_xic (struct frame *);
@@ -1043,9 +1034,6 @@ 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_char_width (struct frame *);
-extern int x_char_height (struct frame *);
-extern void x_sync (struct frame *);
extern int x_defined_color (struct frame *, const char *, XColor *, int);
#ifdef HAVE_X_I18N
extern void free_frame_xic (struct frame *);
@@ -1053,7 +1041,6 @@ extern void free_frame_xic (struct frame *);
extern char * xic_create_fontsetname (const char *base_fontname, int motif);
# endif
#endif
-extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
/* Defined in xfaces.c */
@@ -1070,10 +1057,8 @@ extern void x_menu_set_in_use (int);
#ifdef USE_MOTIF
extern void x_menu_wait_for_event (void *data);
#endif
-extern void x_activate_menubar (struct frame *);
extern int popup_activated (void);
extern void initialize_frame_menubar (struct frame *);
-extern void free_frame_menubar (struct frame *);
/* Defined in widget.c */
@@ -1115,3 +1100,5 @@ extern Lisp_Object Qx_gtk_map_stock;
(nr).y = (ry), \
(nr).width = (rwidth), \
(nr).height = (rheight))
+
+#endif /* XTERM_H */