aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-08-22 18:05:50 +0900
committerKenichi Handa2012-08-22 18:05:50 +0900
commitfabc1281e9cde34ff9a19d843316d2ceca8647ad (patch)
treef38f13cab3ec6c32ab8ab49ea2e60f64969a0d22 /src
parent4ff819d728960bf5e52b72501c606f4bb3fde028 (diff)
parent842e3a93aa3a0826cb4148376e54cd1527d10901 (diff)
downloademacs-fabc1281e9cde34ff9a19d843316d2ceca8647ad.tar.gz
emacs-fabc1281e9cde34ff9a19d843316d2ceca8647ad.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit10
-rw-r--r--src/ChangeLog365
-rw-r--r--src/Makefile.in9
-rw-r--r--src/alloc.c86
-rw-r--r--src/buffer.c593
-rw-r--r--src/buffer.h153
-rw-r--r--src/callint.c4
-rw-r--r--src/callproc.c4
-rw-r--r--src/casetab.c24
-rw-r--r--src/category.c25
-rw-r--r--src/category.h8
-rw-r--r--src/charset.c2
-rw-r--r--src/chartab.c92
-rw-r--r--src/cmds.c2
-rw-r--r--src/coding.c16
-rw-r--r--src/conf_post.h3
-rw-r--r--src/data.c85
-rw-r--r--src/dbusbind.c6
-rw-r--r--src/dispnew.c113
-rw-r--r--src/dosfns.c2
-rw-r--r--src/editfns.c34
-rw-r--r--src/emacs.c4
-rw-r--r--src/eval.c34
-rw-r--r--src/fileio.c42
-rw-r--r--src/fns.c86
-rw-r--r--src/fontset.c138
-rw-r--r--src/frame.c111
-rw-r--r--src/frame.h114
-rw-r--r--src/gnutls.c2
-rw-r--r--src/indent.c10
-rw-r--r--src/insdel.c20
-rw-r--r--src/intervals.c194
-rw-r--r--src/intervals.h39
-rw-r--r--src/keyboard.c197
-rw-r--r--src/keyboard.h49
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h164
-rw-r--r--src/lread.c20
-rw-r--r--src/macros.c15
-rw-r--r--src/makefile.w32-in1
-rw-r--r--src/minibuf.c14
-rw-r--r--src/msdos.c14
-rw-r--r--src/nsfns.m24
-rw-r--r--src/nsfont.m3
-rw-r--r--src/nsmenu.m4
-rw-r--r--src/nsterm.m14
-rw-r--r--src/print.c28
-rw-r--r--src/process.c295
-rw-r--r--src/process.h27
-rw-r--r--src/search.c6
-rw-r--r--src/syntax.c11
-rw-r--r--src/sysdep.c3
-rw-r--r--src/term.c4
-rw-r--r--src/termhooks.h23
-rw-r--r--src/terminal.c12
-rw-r--r--src/textprop.c26
-rw-r--r--src/undo.c45
-rw-r--r--src/unexaix.c3
-rw-r--r--src/unexcoff.c2
-rw-r--r--src/vm-limit.c2
-rw-r--r--src/w32.c2
-rw-r--r--src/w32fns.c46
-rw-r--r--src/w32menu.c6
-rw-r--r--src/w32term.c20
-rw-r--r--src/w32uniscribe.c57
-rw-r--r--src/window.c692
-rw-r--r--src/window.h80
-rw-r--r--src/xdisp.c263
-rw-r--r--src/xfaces.c11
-rw-r--r--src/xfns.c52
-rw-r--r--src/xfont.c8
-rw-r--r--src/xmenu.c6
-rw-r--r--src/xselect.c9
-rw-r--r--src/xterm.c29
74 files changed, 3115 insertions, 1604 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index c0a1bbfffd8..de980c6345f 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -18,9 +18,9 @@
18# Boston, MA 02110-1301, USA. 18# Boston, MA 02110-1301, USA.
19 19
20# Force loading of symbols, enough to give us VALBITS etc. 20# Force loading of symbols, enough to give us VALBITS etc.
21set main 21set $dummy = main + 8
22# With some compilers, we need this to give us struct Lisp_Symbol etc.: 22# With some compilers, we need this to give us struct Lisp_Symbol etc.:
23set Fmake_symbol 23set $dummy = Fmake_symbol + 8
24 24
25# Find lwlib source files too. 25# Find lwlib source files too.
26dir ../lwlib 26dir ../lwlib
@@ -89,7 +89,7 @@ define pp
89 set $tmp = $arg0 89 set $tmp = $arg0
90 set $output_debug = print_output_debug_flag 90 set $output_debug = print_output_debug_flag
91 set print_output_debug_flag = 0 91 set print_output_debug_flag = 0
92 set safe_debug_print ($tmp) 92 call safe_debug_print ($tmp)
93 set print_output_debug_flag = $output_debug 93 set print_output_debug_flag = $output_debug
94end 94end
95document pp 95document pp
@@ -102,7 +102,7 @@ define pv
102 set $tmp = "$arg0" 102 set $tmp = "$arg0"
103 set $output_debug = print_output_debug_flag 103 set $output_debug = print_output_debug_flag
104 set print_output_debug_flag = 0 104 set print_output_debug_flag = 0
105 set safe_debug_print (find_symbol_value (intern ($tmp))) 105 call safe_debug_print (find_symbol_value (intern ($tmp)))
106 set print_output_debug_flag = $output_debug 106 set print_output_debug_flag = $output_debug
107end 107end
108document pv 108document pv
@@ -1162,7 +1162,7 @@ end
1162define xwhichsymbols 1162define xwhichsymbols
1163 set $output_debug = print_output_debug_flag 1163 set $output_debug = print_output_debug_flag
1164 set print_output_debug_flag = 0 1164 set print_output_debug_flag = 0
1165 set safe_debug_print (which_symbols ($arg0, $arg1)) 1165 call safe_debug_print (which_symbols ($arg0, $arg1))
1166 set print_output_debug_flag = $output_debug 1166 set print_output_debug_flag = $output_debug
1167end 1167end
1168document xwhichsymbols 1168document xwhichsymbols
diff --git a/src/ChangeLog b/src/ChangeLog
index 72a11c177c4..c43404fa438 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,368 @@
12012-08-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
4 Otherwise, the compiler complains about (A?B:C) where B is void
5 and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12.
6 (fontset_add): Return void, for FONTSET_ADD.
7
82012-08-21 Paul Eggert <eggert@cs.ucla.edu>
9
10 * alloc.c: Use bool for booleans.
11 (gc_in_progress, abort_on_gc)
12 (setjmp_tested_p) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]:
13 (dont_register_blocks) [GC_MALLOC_CHECK]:
14 (suppress_checking) [ENABLE_CHECKING]: Now bool, not int.
15 (check_string_bytes, make_specified_string, memory_full)
16 (live_string_p, live_cons_p, live_symbol_p, live_float_p)
17 (live_misc_p, live_vector_p, live_buffer_p, mark_maybe_object)
18 (mark_stack, valid_pointer_p, make_pure_string)
19 (Fgarbage_collect, survives_gc_p, gc_sweep):
20 Use bool for booleans, instead of int.
21 (test_setjmp) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]:
22 Remove unused local.
23 * alloc.c (PURE_POINTER_P):
24 * lisp.h (STRING_MULTIBYTE): Document that it returns a boolean.
25 * editfns.c (Fformat):
26 * fileio.c (Fexpand_file_name, Fsubstitute_in_file_name)
27 (Fdo_auto_save):
28 * fns.c (sweep_weak_table):
29 * lisp.h (suppress_checking, push_message, survives_gc_p)
30 (make_pure_string, gc_in_progress, abort_on_gc):
31 * lread.c (readchar, read1):
32 * print.c (Fprin1_to_string):
33 * xdisp.c (push_message):
34 Use bool for booleans affected directly or indirectly by
35 alloc.c's changes.
36
37 Make recently-introduced setters macros.
38 * fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii)
39 (set_fontset_base, set_fontset_frame, set_fontset_nofont_face)
40 (set_fontset_default, set_fontset_fallback): Rename from their
41 upper-case counterparts, and make them functions rather than macros.
42 This is more consistent with the other recently-introduced setters.
43 These don't need to be inline, since they're local.
44
452012-08-21 Jan Djärv <jan.h.d@swipnet.se>
46
47 * nsterm.m (fd_handler:): Alloc and release a NSAutoreleasePool in
48 the loop (Bug#12247).
49
502012-08-21 Paul Eggert <eggert@cs.ucla.edu>
51
52 * lisp.h (vcopy): Use memcpy rather than our own loop.
53 This fixes a performance regression introduced by the recent
54 addition of vcopy. This means 'vcopy' will need to be modified
55 for a copying collector, but that's OK. Also, tighten the
56 checking in the assertion.
57
582012-08-21 Eli Zaretskii <eliz@gnu.org>
59
60 * w32uniscribe.c (uniscribe_shape): Fix producing gstring
61 components for RTL text (Bug#11860). Adjust X-OFFSET of each
62 non-base glyph for the width of the base character, according to
63 what x_draw_composite_glyph_string_foreground expects. Generate
64 WADJUST value according to composition_gstring_width's
65 expectations, to produce correct width of the composed character.
66 Reverse the sign of the DU offset produced by ScriptPlace.
67
682012-08-21 Paul Eggert <eggert@cs.ucla.edu>
69
70 * dbusbind.c (xd_remove_watch): Do not assume C99 comments.
71
722012-08-21 Dmitry Antipov <dmantipov@yandex.ru>
73
74 Avoid direct writes to contents member of struct Lisp_Vector.
75 * lisp.h (vcopy): New function to copy data into vector.
76 * dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET.
77 * fns.c (Ffillarray): Use ASET.
78 * keyboard.c (timer_check_2): Use AREF and ASET.
79 (append_tool_bar_item, Frecent_keys): Use vcopy.
80 * lread.c (read_vector): Use ASET.
81 * msdos.c (Frecent_doskeys): Use vcopy.
82 * xface.c (Finternal_copy_lisp_face): Use vcopy.
83 (Finternal_merge_in_global_face): Use ASET and vcopy.
84 * xfont.c (xfont_list_pattern): Likewise.
85
862012-08-21 Martin Rudalics <rudalics@gmx.at>
87
88 * window.c (Fwindow_point): For the selected window always return
89 the position of its buffer's point.
90 (Fset_window_point): For the selected window always go in its
91 buffer to the specified position.
92
932012-08-21 Dmitry Antipov <dmantipov@yandex.ru>
94
95 Setter macros for fontsets.
96 * fontset.c (SET_FONTSET_ID, SET_FONTSET_NAME, SET_FONTSET_ASCII)
97 (SET_FONTSET_BASE, SET_FONTSET_FRAME, SET_FONTSET_NOFONT_FACE)
98 (SET_FONTSET_DEFAULT, SET_FONTSET_FALLBACK): New macros.
99 Adjust users.
100
1012012-08-20 Glenn Morris <rgm@gnu.org>
102
103 * Makefile.in (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)):
104 Don't assume that `ln -f' works.
105
1062012-08-20 Eli Zaretskii <eliz@gnu.org>
107
108 * .gdbinit: Use "set $dummy = ..." to avoid warnings from GDB 7.5
109 and later about non-assignments with no effect. See discussion at
110 http://sourceware.org/ml/gdb-patches/2012-08/msg00518.html for
111 details.
112
1132012-08-20 Dmitry Antipov <dmantipov@yandex.ru>
114
115 Inline setter functions for Lisp_Objects slots of struct specbinding.
116 * eval.c (set_specpdl_symbol, set_specpdl_old_value): New functions.
117 Adjust users.
118
1192012-08-20 Martin Rudalics <rudalics@gmx.at>
120
121 * window.c (select_window): Always make selected window's buffer
122 current.
123
1242012-08-20 Dmitry Antipov <dmantipov@yandex.ru>
125
126 Use AREF and ASET for docstrings of category tables.
127 * category.h (CATEGORY_DOCSTRING): Use AREF.
128 (SET_CATEGORY_DOCSTRING): Use ASET.
129 * category.c (Fdefine_category): Use SET_CATEGORY_DOCSTRING.
130
1312012-08-20 Dmitry Antipov <dmantipov@yandex.ru>
132
133 Inline setter functions for hash table members.
134 * lisp.h (set_hash_key, set_hash_value, set_hash_next)
135 (set_hash_hash, set_hash_index): Rename with _slot suffix.
136 (set_hash_key_and_value, set_hash_index, set_hash_next)
137 (set_hash_hash): New functions.
138 * charset.c, fns.c: Adjust users.
139
1402012-08-20 Dmitry Antipov <dmantipov@yandex.ru>
141
142 Inline getter and setter functions for per-buffer values.
143 * buffer.h (per_buffer_default, set_per_buffer_default)
144 (per_buffer_value, set_per_buffer_value): New functions.
145 (PER_BUFFER_VALUE, PER_BUFFER_DEFAULT): Remove.
146 * buffer.c, data.c: Adjust users.
147
1482012-08-20 Juanma Barranquero <lekktu@gmail.com>
149
150 * makefile.w32-in ($(BLD)/vm-limit.$(O)): Update dependencies.
151
1522012-08-19 Paul Eggert <eggert@cs.ucla.edu>
153
154 Rely on <config.h> + <unistd.h> to declare 'environ',
155 as gnulib does this if the system doesn't.
156 * callproc.c, editfns.c, process.c (environ) [!USE_CRT_DLL]:
157 Remove declaration. MS-Windows declares it on stdlib.h which is
158 included by conf_post.h.
159 * emacs.c (environ) [DOUG_LEA_MALLOC]:
160 * vm-limit.c (environ) [ORDINARY_LINK]: Remove decl.
161 * vm-limit.c: Include <unistd.h>, for 'environ'.
162
163 * unexaix.c, unexcoff.c: Include "mem-limits.h".
164 (start_of_data): Remove decl; mem-limits.h provides it.
165
166 * xdisp.c (handle_invisible_prop): Make it a bit faster
167 and avoid a gcc -Wmaybe-uninitialized diagnostic.
168
1692012-08-19 Chong Yidong <cyd@gnu.org>
170
171 * xdisp.c (handle_invisible_prop): Fix ellipses at overlay string
172 ends (Bug#3874).
173
1742012-08-19 Andreas Schwab <schwab@linux-m68k.org>
175
176 * .gdbinit: Use call instead of set when calling a function in the
177 inferior.
178
179 * data.c (set_internal): Don't use set_blv_found.
180 (Fkill_local_variable): Likewise.
181
1822012-08-18 Alp Aker <alp.tekin.aker@gmail.com>
183
184 * nsfont.m (ns_ascii_average_width): Ensure the string
185 ascii_printable is initialized with a null-terminated character
186 array. Otherwise, it can contain undesired extra characters.
187
1882012-08-18 Paul Eggert <eggert@cs.ucla.edu>
189
190 port new setting code to Sun C 5.8 2005/10/13
191 * chartab.c, lisp.h (char_table_set, char_table_set_range):
192 Return void, not Lisp_Object. Otherwise, the compiler
193 complains about (A?B:C) where B is void and C is Lisp_Object
194 when compiling CHAR_TABLE_SET, due to the recent change to
195 the API of sub_char_table_set_contents.
196
1972012-08-18 Chong Yidong <cyd@gnu.org>
198
199 * xdisp.c (handle_invisible_prop): Obey TEXT_PROP_MEANS_INVISIBLE
200 for the string case (Bug#3874).
201
2022012-08-18 Paul Eggert <eggert@cs.ucla.edu>
203
204 * buffer.h (BSET): Remove (Bug#12215).
205 Replace all uses with calls to new setter functions.
206 (bset_bidi_paragraph_direction, bset_case_canon_table)
207 (bset_case_eqv_table, bset_directory, bset_display_count)
208 (bset_display_time, bset_downcase_table)
209 (bset_enable_multibyte_characters, bset_filename, bset_keymap)
210 (bset_last_selected_window, bset_local_var_alist)
211 (bset_mark_active, bset_point_before_scroll, bset_read_only)
212 (bset_truncate_lines, bset_undo_list, bset_upcase_table)
213 (bset_width_table):
214 * buffer.c (bset_abbrev_mode, bset_abbrev_table)
215 (bset_auto_fill_function, bset_auto_save_file_format)
216 (bset_auto_save_file_name, bset_backed_up, bset_begv_marker)
217 (bset_bidi_display_reordering, bset_buffer_file_coding_system)
218 (bset_cache_long_line_scans, bset_case_fold_search)
219 (bset_ctl_arrow, bset_cursor_in_non_selected_windows)
220 (bset_cursor_type, bset_display_table, bset_extra_line_spacing)
221 (bset_file_format, bset_file_truename, bset_fringe_cursor_alist)
222 (bset_fringe_indicator_alist, bset_fringes_outside_margins)
223 (bset_header_line_format, bset_indicate_buffer_boundaries)
224 (bset_indicate_empty_lines, bset_invisibility_spec)
225 (bset_left_fringe_width, bset_major_mode, bset_mark)
226 (bset_minor_modes, bset_mode_line_format, bset_mode_name)
227 (bset_name, bset_overwrite_mode, bset_pt_marker)
228 (bset_right_fringe_width, bset_save_length)
229 (bset_scroll_bar_width, bset_scroll_down_aggressively)
230 (bset_scroll_up_aggressively, bset_selective_display)
231 (bset_selective_display_ellipses, bset_vertical_scroll_bar_type)
232 (bset_word_wrap, bset_zv_marker):
233 * category.c (bset_category_table):
234 * syntax.c (bset_syntax_table):
235 New setter functions.
236
237 * process.h (PSET): Remove (Bug#12215).
238 Replace all uses with calls to new setter functions.
239 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
240 (PROCESS_INLINE): New macro.
241 (pset_childp): New setter function.
242 (pset_gnutls_cred_type) [HAVE_GNUTLS]: New setter function.
243 * process.c (PROCESS_INLINE):
244 Define to EXTERN_INLINE, so that the corresponding functions
245 are compiled into code.
246 (pset_buffer, pset_command, pset_decode_coding_system)
247 (pset_decoding_buf, pset_encode_coding_system)
248 (pset_encoding_buf, pset_filter, pset_log, pset_mark, pset_name)
249 (pset_plist, pset_sentinel, pset_status, pset_tty_name)
250 (pset_type, pset_write_queue): New setter functions.
251
252 * window.h (WSET): Remove (Bug#12215).
253 Replace all uses with calls to new setter functions.
254 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
255 (WINDOW_INLINE): New macro.
256 (wset_buffer, wset_frame, wset_left_col, wset_next, wset_prev)
257 (wset_redisplay_end_trigger, wset_top_line, wset_total_cols)
258 (wset_total_lines, wset_vertical_scroll_bar)
259 (wset_window_end_pos, wset_window_end_valid)
260 (wset_window_end_vpos): New setter functions.
261 * window.c (WINDOW_INLINE):
262 Define to EXTERN_INLINE, so that the corresponding functions
263 are compiled into code.
264 (wset_combination_limit, wset_dedicated, wset_display_table)
265 (wset_hchild, wset_left_fringe_width, wset_left_margin_cols)
266 (wset_new_normal, wset_new_total, wset_next_buffers)
267 (wset_normal_cols, wset_normal_lines, wset_parent, wset_pointm)
268 (wset_prev_buffers, wset_right_fringe_width)
269 (wset_right_margin_cols, wset_scroll_bar_width, wset_start)
270 (wset_temslot, wset_vchild, wset_vertical_scroll_bar_type)
271 (wset_window_parameters):
272 * xdisp.c (wset_base_line_number, wset_base_line_pos)
273 (wset_column_number_displayed, wset_region_showing):
274 New setter functions.
275
276 * termhooks.h (TSET): Remove (Bug#12215).
277 Replace all uses with calls to new setter functions.
278 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
279 (TERMHOOKS_INLINE): New macro.
280 (tset_charset_list, tset_selection_alist): New setter functions.
281 * terminal.c (TERMHOOKS_INLINE):
282 Define to EXTERN_INLINE, so that the corresponding functions
283 are compiled into code.
284 (tset_param_alist): New setter function.
285
2862012-08-17 Paul Eggert <eggert@cs.ucla.edu>
287
288 * keyboard.h (KSET): Remove (Bug#12215).
289 Replace all uses with calls to new setter functions.
290 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
291 (KEYBOARD_INLINE): New macro.
292 (kset_default_minibuffer_frame, kset_defining_kbd_macro)
293 (kset_input_decode_map, kset_last_command, kset_last_kbd_macro)
294 (kset_prefix_arg, kset_system_key_alist, kset_window_system):
295 New setter functions.
296 * keyboard.c (KEYBOARD_INLINE):
297 Define to EXTERN_INLINE, so that the corresponding functions
298 are compiled into code.
299 (kset_echo_string, kset_kbd_queue)
300 (kset_keyboard_translate_table, kset_last_prefix_arg)
301 (kset_last_repeatable_command, kset_local_function_key_map)
302 (kset_overriding_terminal_local_map, kset_real_last_command)
303 (kset_system_key_syms): New setter functions.
304
305 * frame.h (FSET): Remove (Bug#12215).
306 Replace all uses with calls to new setter functions.
307 Use INLINE_HEADER_BEGIN, INLINE_HEADER_END.
308 (FRAME_INLINE): New macro.
309 (fset_buffer_list, fset_buried_buffer_list, fset_condemned_scroll_bars)
310 (fset_current_tool_bar_string, fset_desired_tool_bar_string)
311 (fset_face_alist, fset_focus_frame, fset_icon_name, fset_menu_bar_items)
312 (fset_menu_bar_vector, fset_menu_bar_window, fset_name)
313 (fset_param_alist, fset_root_window, fset_scroll_bars)
314 (fset_selected_window, fset_title, fset_tool_bar_items)
315 (fset_tool_bar_position, fset_tool_bar_window): New functions.
316 * frame.c (FRAME_INLINE):
317 Define to EXTERN_INLINE, so that the corresponding functions
318 are compiled into code.
319 (fset_buffer_predicate, fset_minibuffer_window): New setter functions.
320
321 A few more naming-convention fixes for getters and setters.
322 * buffer.c (set_buffer_overlays_before): Move here from buffer.h,
323 and rename from buffer_overlays_set_before.
324 (set_buffer_overlays_after): Move here from buffer.h, and rename
325 from buffer_overlays_set_after.
326 * buffer.h (buffer_intervals): Rename from buffer_get_intervals.
327 All uses changed.
328 (set_buffer_intervals): Rename from buffer_set_intervals.
329 * intervals.c (set_interval_object): Move here from intervals.h,
330 and rename from interval_set_object.
331 (set_interval_left): Move here from intervals.h, and rename from
332 interval_set_left.
333 (set_interval_right): Move here from intervals.h, and rename from
334 interval_set_right.
335 (copy_interval_parent): Move here from intervals.h, and rename from
336 interval_copy_parent.
337 * intervals.h (set_interval_parent): Rename from interval_set_parent.
338 (set_interval_plist): Rename from interval_set_plist.
339 Return void, not Lisp_Object, since no caller uses the result.
340 * lisp.h (string_intervals): Rename from string_get_intervals.
341 (set_string_intervals): Rename from string_set_intervals.
342
343 * lisp.h (set_char_table_extras): Rename from char_table_set_extras.
344 (set_char_table_contents): Rename from char_table_set_contents.
345 (set_sub_char_table_contents): Rename from sub_char_table_set_contents.
346 All uses changed. See the end of
347 <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00549.html>.
348
349 * lisp.h (CSET): Remove (Bug#12215).
350 (set_char_table_ascii, set_char_table_defalt, set_char_table_parent)
351 (set_char_table_purpose): New functions,
352 replacing CSET. All uses changed. For example, replace
353 "CSET (XCHAR_TABLE (char_table), parent, parent);" with
354 "set_char_table_parent (char_table, parent);".
355 The old version was confusing because it used the same name
356 'parent' for two different things.
357
3582012-08-17 Dmitry Antipov <dmantipov@yandex.ru>
359
360 Functions to get and set Lisp_Object fields of buffer-local variables.
361 * lisp.h (blv_found, set_blv_found, blv_value, set_blv_value)
362 (set_blv_where, set_blv_defcell, set_blv_valcell): New functions.
363 (BLV_FOUND, SET_BLV_FOUND, BLV_VALUE, SET_BLV_VALUE): Remove.
364 * data.c, eval.c, frame.c: Adjust users.
365
12012-08-17 Chong Yidong <cyd@gnu.org> 3662012-08-17 Chong Yidong <cyd@gnu.org>
2 367
3 * xfaces.c (merge_face_vectors): If the target font specfies a 368 * xfaces.c (merge_face_vectors): If the target font specfies a
diff --git a/src/Makefile.in b/src/Makefile.in
index 4b1520ada62..1d89af31401 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -402,11 +402,13 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
402## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here. 402## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
403emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el 403emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
404 if test "$(CANNOT_DUMP)" = "yes"; then \ 404 if test "$(CANNOT_DUMP)" = "yes"; then \
405 ln -f temacs$(EXEEXT) emacs$(EXEEXT); \ 405 rm -f emacs$(EXEEXT); \
406 ln temacs$(EXEEXT) emacs$(EXEEXT); \
406 else \ 407 else \
407 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ 408 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
408 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ 409 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
409 ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 410 rm -f bootstrap-emacs$(EXEEXT); \
411 ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
410 fi 412 fi
411 413
412## We run make-docfile twice because the command line may get too long 414## We run make-docfile twice because the command line may get too long
@@ -600,7 +602,8 @@ $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
600bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) 602bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
601 cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs 603 cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
602 if test "$(CANNOT_DUMP)" = "yes"; then \ 604 if test "$(CANNOT_DUMP)" = "yes"; then \
603 ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ 605 rm -f bootstrap-emacs$(EXEEXT); \
606 ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
604 else \ 607 else \
605 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ 608 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
606 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ 609 test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
diff --git a/src/alloc.c b/src/alloc.c
index 1d484d4a322..f0da9416ece 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -173,15 +173,15 @@ EMACS_INT gc_relative_threshold;
173 173
174EMACS_INT memory_full_cons_threshold; 174EMACS_INT memory_full_cons_threshold;
175 175
176/* Nonzero during GC. */ 176/* True during GC. */
177 177
178int gc_in_progress; 178bool gc_in_progress;
179 179
180/* Nonzero means abort if try to GC. 180/* True means abort if try to GC.
181 This is for code which is written on the assumption that 181 This is for code which is written on the assumption that
182 no GC will happen, so as to verify that assumption. */ 182 no GC will happen, so as to verify that assumption. */
183 183
184int abort_on_gc; 184bool abort_on_gc;
185 185
186/* Number of live and free conses etc. */ 186/* Number of live and free conses etc. */
187 187
@@ -223,7 +223,7 @@ static ptrdiff_t pure_size;
223 223
224static ptrdiff_t pure_bytes_used_before_overflow; 224static ptrdiff_t pure_bytes_used_before_overflow;
225 225
226/* Value is non-zero if P points into pure space. */ 226/* True if P points into pure space. */
227 227
228#define PURE_POINTER_P(P) \ 228#define PURE_POINTER_P(P) \
229 ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size) 229 ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size)
@@ -392,13 +392,13 @@ static struct mem_node mem_z;
392static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); 392static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t);
393static void lisp_free (void *); 393static void lisp_free (void *);
394static void mark_stack (void); 394static void mark_stack (void);
395static int live_vector_p (struct mem_node *, void *); 395static bool live_vector_p (struct mem_node *, void *);
396static int live_buffer_p (struct mem_node *, void *); 396static bool live_buffer_p (struct mem_node *, void *);
397static int live_string_p (struct mem_node *, void *); 397static bool live_string_p (struct mem_node *, void *);
398static int live_cons_p (struct mem_node *, void *); 398static bool live_cons_p (struct mem_node *, void *);
399static int live_symbol_p (struct mem_node *, void *); 399static bool live_symbol_p (struct mem_node *, void *);
400static int live_float_p (struct mem_node *, void *); 400static bool live_float_p (struct mem_node *, void *);
401static int live_misc_p (struct mem_node *, void *); 401static bool live_misc_p (struct mem_node *, void *);
402static void mark_maybe_object (Lisp_Object); 402static void mark_maybe_object (Lisp_Object);
403static void mark_memory (void *, void *); 403static void mark_memory (void *, void *);
404#if GC_MARK_STACK || defined GC_MALLOC_CHECK 404#if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -1241,7 +1241,7 @@ static void (*old_free_hook) (void*, const void*);
1241#endif 1241#endif
1242 1242
1243#ifdef GC_MALLOC_CHECK 1243#ifdef GC_MALLOC_CHECK
1244static int dont_register_blocks; 1244static bool dont_register_blocks;
1245#endif 1245#endif
1246 1246
1247static size_t bytes_used_when_reconsidered; 1247static size_t bytes_used_when_reconsidered;
@@ -1828,11 +1828,11 @@ check_sblock (struct sblock *b)
1828 1828
1829 1829
1830/* Check validity of Lisp strings' string_bytes member. ALL_P 1830/* Check validity of Lisp strings' string_bytes member. ALL_P
1831 non-zero means check all strings, otherwise check only most 1831 means check all strings, otherwise check only most
1832 recently allocated strings. Used for hunting a bug. */ 1832 recently allocated strings. Used for hunting a bug. */
1833 1833
1834static void 1834static void
1835check_string_bytes (int all_p) 1835check_string_bytes (bool all_p)
1836{ 1836{
1837 if (all_p) 1837 if (all_p)
1838 { 1838 {
@@ -2437,9 +2437,9 @@ make_string_from_bytes (const char *contents,
2437 2437
2438Lisp_Object 2438Lisp_Object
2439make_specified_string (const char *contents, 2439make_specified_string (const char *contents,
2440 ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) 2440 ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
2441{ 2441{
2442 register Lisp_Object val; 2442 Lisp_Object val;
2443 2443
2444 if (nchars < 0) 2444 if (nchars < 0)
2445 { 2445 {
@@ -3094,7 +3094,7 @@ sweep_vectors (void)
3094 3094
3095 for (block = vector_blocks; block; block = *bprev) 3095 for (block = vector_blocks; block; block = *bprev)
3096 { 3096 {
3097 int free_this_block = 0; 3097 bool free_this_block = 0;
3098 3098
3099 for (vector = (struct Lisp_Vector *) block->data; 3099 for (vector = (struct Lisp_Vector *) block->data;
3100 VECTOR_IN_BLOCK (vector, block); vector = next) 3100 VECTOR_IN_BLOCK (vector, block); vector = next)
@@ -3753,7 +3753,7 @@ void
3753memory_full (size_t nbytes) 3753memory_full (size_t nbytes)
3754{ 3754{
3755 /* Do not go into hysterics merely because a large request failed. */ 3755 /* Do not go into hysterics merely because a large request failed. */
3756 int enough_free_memory = 0; 3756 bool enough_free_memory = 0;
3757 if (SPARE_MEMORY < nbytes) 3757 if (SPARE_MEMORY < nbytes)
3758 { 3758 {
3759 void *p; 3759 void *p;
@@ -4246,7 +4246,7 @@ mem_delete_fixup (struct mem_node *x)
4246/* Value is non-zero if P is a pointer to a live Lisp string on 4246/* Value is non-zero if P is a pointer to a live Lisp string on
4247 the heap. M is a pointer to the mem_block for P. */ 4247 the heap. M is a pointer to the mem_block for P. */
4248 4248
4249static inline int 4249static inline bool
4250live_string_p (struct mem_node *m, void *p) 4250live_string_p (struct mem_node *m, void *p)
4251{ 4251{
4252 if (m->type == MEM_TYPE_STRING) 4252 if (m->type == MEM_TYPE_STRING)
@@ -4269,7 +4269,7 @@ live_string_p (struct mem_node *m, void *p)
4269/* Value is non-zero if P is a pointer to a live Lisp cons on 4269/* Value is non-zero if P is a pointer to a live Lisp cons on
4270 the heap. M is a pointer to the mem_block for P. */ 4270 the heap. M is a pointer to the mem_block for P. */
4271 4271
4272static inline int 4272static inline bool
4273live_cons_p (struct mem_node *m, void *p) 4273live_cons_p (struct mem_node *m, void *p)
4274{ 4274{
4275 if (m->type == MEM_TYPE_CONS) 4275 if (m->type == MEM_TYPE_CONS)
@@ -4295,7 +4295,7 @@ live_cons_p (struct mem_node *m, void *p)
4295/* Value is non-zero if P is a pointer to a live Lisp symbol on 4295/* Value is non-zero if P is a pointer to a live Lisp symbol on
4296 the heap. M is a pointer to the mem_block for P. */ 4296 the heap. M is a pointer to the mem_block for P. */
4297 4297
4298static inline int 4298static inline bool
4299live_symbol_p (struct mem_node *m, void *p) 4299live_symbol_p (struct mem_node *m, void *p)
4300{ 4300{
4301 if (m->type == MEM_TYPE_SYMBOL) 4301 if (m->type == MEM_TYPE_SYMBOL)
@@ -4321,7 +4321,7 @@ live_symbol_p (struct mem_node *m, void *p)
4321/* Value is non-zero if P is a pointer to a live Lisp float on 4321/* Value is non-zero if P is a pointer to a live Lisp float on
4322 the heap. M is a pointer to the mem_block for P. */ 4322 the heap. M is a pointer to the mem_block for P. */
4323 4323
4324static inline int 4324static inline bool
4325live_float_p (struct mem_node *m, void *p) 4325live_float_p (struct mem_node *m, void *p)
4326{ 4326{
4327 if (m->type == MEM_TYPE_FLOAT) 4327 if (m->type == MEM_TYPE_FLOAT)
@@ -4345,7 +4345,7 @@ live_float_p (struct mem_node *m, void *p)
4345/* Value is non-zero if P is a pointer to a live Lisp Misc on 4345/* Value is non-zero if P is a pointer to a live Lisp Misc on
4346 the heap. M is a pointer to the mem_block for P. */ 4346 the heap. M is a pointer to the mem_block for P. */
4347 4347
4348static inline int 4348static inline bool
4349live_misc_p (struct mem_node *m, void *p) 4349live_misc_p (struct mem_node *m, void *p)
4350{ 4350{
4351 if (m->type == MEM_TYPE_MISC) 4351 if (m->type == MEM_TYPE_MISC)
@@ -4371,7 +4371,7 @@ live_misc_p (struct mem_node *m, void *p)
4371/* Value is non-zero if P is a pointer to a live vector-like object. 4371/* Value is non-zero if P is a pointer to a live vector-like object.
4372 M is a pointer to the mem_block for P. */ 4372 M is a pointer to the mem_block for P. */
4373 4373
4374static inline int 4374static inline bool
4375live_vector_p (struct mem_node *m, void *p) 4375live_vector_p (struct mem_node *m, void *p)
4376{ 4376{
4377 if (m->type == MEM_TYPE_VECTOR_BLOCK) 4377 if (m->type == MEM_TYPE_VECTOR_BLOCK)
@@ -4407,7 +4407,7 @@ live_vector_p (struct mem_node *m, void *p)
4407/* Value is non-zero if P is a pointer to a live buffer. M is a 4407/* Value is non-zero if P is a pointer to a live buffer. M is a
4408 pointer to the mem_block for P. */ 4408 pointer to the mem_block for P. */
4409 4409
4410static inline int 4410static inline bool
4411live_buffer_p (struct mem_node *m, void *p) 4411live_buffer_p (struct mem_node *m, void *p)
4412{ 4412{
4413 /* P must point to the start of the block, and the buffer 4413 /* P must point to the start of the block, and the buffer
@@ -4487,7 +4487,7 @@ mark_maybe_object (Lisp_Object obj)
4487 4487
4488 if (m != MEM_NIL) 4488 if (m != MEM_NIL)
4489 { 4489 {
4490 int mark_p = 0; 4490 bool mark_p = 0;
4491 4491
4492 switch (XTYPE (obj)) 4492 switch (XTYPE (obj))
4493 { 4493 {
@@ -4707,7 +4707,8 @@ mark_memory (void *start, void *end)
4707 4707
4708#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS 4708#if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS
4709 4709
4710static int setjmp_tested_p, longjmps_done; 4710static bool setjmp_tested_p;
4711static int longjmps_done;
4711 4712
4712#define SETJMP_WILL_LIKELY_WORK "\ 4713#define SETJMP_WILL_LIKELY_WORK "\
4713\n\ 4714\n\
@@ -4751,7 +4752,6 @@ test_setjmp (void)
4751 char buf[10]; 4752 char buf[10];
4752 register int x; 4753 register int x;
4753 jmp_buf jbuf; 4754 jmp_buf jbuf;
4754 int result = 0;
4755 4755
4756 /* Arrange for X to be put in a register. */ 4756 /* Arrange for X to be put in a register. */
4757 sprintf (buf, "1"); 4757 sprintf (buf, "1");
@@ -4891,7 +4891,7 @@ mark_stack (void)
4891 Lisp_Object o; 4891 Lisp_Object o;
4892 jmp_buf j; 4892 jmp_buf j;
4893 } j; 4893 } j;
4894 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; 4894 volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base;
4895#endif 4895#endif
4896 /* This trick flushes the register windows so that all the state of 4896 /* This trick flushes the register windows so that all the state of
4897 the process is contained in the stack. */ 4897 the process is contained in the stack. */
@@ -4965,7 +4965,7 @@ valid_pointer_p (void *p)
4965 4965
4966 if (pipe (fd) == 0) 4966 if (pipe (fd) == 0)
4967 { 4967 {
4968 int valid = (emacs_write (fd[1], (char *) p, 16) == 16); 4968 bool valid = emacs_write (fd[1], (char *) p, 16) == 16;
4969 emacs_close (fd[1]); 4969 emacs_close (fd[1]);
4970 emacs_close (fd[0]); 4970 emacs_close (fd[0]);
4971 return valid; 4971 return valid;
@@ -5186,7 +5186,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
5186 5186
5187/* Return a string allocated in pure space. DATA is a buffer holding 5187/* Return a string allocated in pure space. DATA is a buffer holding
5188 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE 5188 NCHARS characters, and NBYTES bytes of string data. MULTIBYTE
5189 non-zero means make the result string multibyte. 5189 means make the result string multibyte.
5190 5190
5191 Must get an error if pure storage is full, since if it cannot hold 5191 Must get an error if pure storage is full, since if it cannot hold
5192 a large string it may be able to hold conses that point to that 5192 a large string it may be able to hold conses that point to that
@@ -5194,7 +5194,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
5194 5194
5195Lisp_Object 5195Lisp_Object
5196make_pure_string (const char *data, 5196make_pure_string (const char *data,
5197 ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) 5197 ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte)
5198{ 5198{
5199 Lisp_Object string; 5199 Lisp_Object string;
5200 struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String); 5200 struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
@@ -5389,11 +5389,11 @@ returns nil, because real GC can't be done.
5389See Info node `(elisp)Garbage Collection'. */) 5389See Info node `(elisp)Garbage Collection'. */)
5390 (void) 5390 (void)
5391{ 5391{
5392 register struct specbinding *bind; 5392 struct specbinding *bind;
5393 register struct buffer *nextb; 5393 struct buffer *nextb;
5394 char stack_top_variable; 5394 char stack_top_variable;
5395 ptrdiff_t i; 5395 ptrdiff_t i;
5396 int message_p; 5396 bool message_p;
5397 ptrdiff_t count = SPECPDL_INDEX (); 5397 ptrdiff_t count = SPECPDL_INDEX ();
5398 EMACS_TIME start; 5398 EMACS_TIME start;
5399 Lisp_Object retval = Qnil; 5399 Lisp_Object retval = Qnil;
@@ -5836,7 +5836,7 @@ mark_buffer (struct buffer *buffer)
5836 5836
5837 /* ...but there are some buffer-specific things. */ 5837 /* ...but there are some buffer-specific things. */
5838 5838
5839 MARK_INTERVAL_TREE (buffer_get_intervals (buffer)); 5839 MARK_INTERVAL_TREE (buffer_intervals (buffer));
5840 5840
5841 /* For now, we just don't mark the undo_list. It's done later in 5841 /* For now, we just don't mark the undo_list. It's done later in
5842 a special way just before the sweep phase, and after stripping 5842 a special way just before the sweep phase, and after stripping
@@ -6090,7 +6090,7 @@ mark_object (Lisp_Object arg)
6090 } 6090 }
6091 if (!PURE_POINTER_P (XSTRING (ptr->name))) 6091 if (!PURE_POINTER_P (XSTRING (ptr->name)))
6092 MARK_STRING (XSTRING (ptr->name)); 6092 MARK_STRING (XSTRING (ptr->name));
6093 MARK_INTERVAL_TREE (string_get_intervals (ptr->name)); 6093 MARK_INTERVAL_TREE (string_intervals (ptr->name));
6094 6094
6095 ptr = ptr->next; 6095 ptr = ptr->next;
6096 if (ptr) 6096 if (ptr)
@@ -6208,10 +6208,10 @@ mark_terminals (void)
6208/* Value is non-zero if OBJ will survive the current GC because it's 6208/* Value is non-zero if OBJ will survive the current GC because it's
6209 either marked or does not need to be marked to survive. */ 6209 either marked or does not need to be marked to survive. */
6210 6210
6211int 6211bool
6212survives_gc_p (Lisp_Object obj) 6212survives_gc_p (Lisp_Object obj)
6213{ 6213{
6214 int survives_p; 6214 bool survives_p;
6215 6215
6216 switch (XTYPE (obj)) 6216 switch (XTYPE (obj))
6217 { 6217 {
@@ -6405,7 +6405,7 @@ gc_sweep (void)
6405 { 6405 {
6406 if (!iblk->intervals[i].gcmarkbit) 6406 if (!iblk->intervals[i].gcmarkbit)
6407 { 6407 {
6408 interval_set_parent (&iblk->intervals[i], interval_free_list); 6408 set_interval_parent (&iblk->intervals[i], interval_free_list);
6409 interval_free_list = &iblk->intervals[i]; 6409 interval_free_list = &iblk->intervals[i];
6410 this_free++; 6410 this_free++;
6411 } 6411 }
@@ -6456,7 +6456,7 @@ gc_sweep (void)
6456 /* Check if the symbol was created during loadup. In such a case 6456 /* Check if the symbol was created during loadup. In such a case
6457 it might be pointed to by pure bytecode which we don't trace, 6457 it might be pointed to by pure bytecode which we don't trace,
6458 so we conservatively assume that it is live. */ 6458 so we conservatively assume that it is live. */
6459 int pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); 6459 bool pure_p = PURE_POINTER_P (XSTRING (sym->s.name));
6460 6460
6461 if (!sym->s.gcmarkbit && !pure_p) 6461 if (!sym->s.gcmarkbit && !pure_p)
6462 { 6462 {
@@ -6681,7 +6681,7 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
6681} 6681}
6682 6682
6683#ifdef ENABLE_CHECKING 6683#ifdef ENABLE_CHECKING
6684int suppress_checking; 6684bool suppress_checking;
6685 6685
6686void 6686void
6687die (const char *msg, const char *file, int line) 6687die (const char *msg, const char *file, int line)
diff --git a/src/buffer.c b/src/buffer.c
index 56d6231f5f8..c900ef8c5a8 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -157,6 +157,228 @@ static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay
157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); 157static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int); 158static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
159 159
160/* These setters are used only in this file, so they can be private. */
161static inline void
162bset_abbrev_mode (struct buffer *b, Lisp_Object val)
163{
164 b->INTERNAL_FIELD (abbrev_mode) = val;
165}
166static inline void
167bset_abbrev_table (struct buffer *b, Lisp_Object val)
168{
169 b->INTERNAL_FIELD (abbrev_table) = val;
170}
171static inline void
172bset_auto_fill_function (struct buffer *b, Lisp_Object val)
173{
174 b->INTERNAL_FIELD (auto_fill_function) = val;
175}
176static inline void
177bset_auto_save_file_format (struct buffer *b, Lisp_Object val)
178{
179 b->INTERNAL_FIELD (auto_save_file_format) = val;
180}
181static inline void
182bset_auto_save_file_name (struct buffer *b, Lisp_Object val)
183{
184 b->INTERNAL_FIELD (auto_save_file_name) = val;
185}
186static inline void
187bset_backed_up (struct buffer *b, Lisp_Object val)
188{
189 b->INTERNAL_FIELD (backed_up) = val;
190}
191static inline void
192bset_begv_marker (struct buffer *b, Lisp_Object val)
193{
194 b->INTERNAL_FIELD (begv_marker) = val;
195}
196static inline void
197bset_bidi_display_reordering (struct buffer *b, Lisp_Object val)
198{
199 b->INTERNAL_FIELD (bidi_display_reordering) = val;
200}
201static inline void
202bset_buffer_file_coding_system (struct buffer *b, Lisp_Object val)
203{
204 b->INTERNAL_FIELD (buffer_file_coding_system) = val;
205}
206static inline void
207bset_cache_long_line_scans (struct buffer *b, Lisp_Object val)
208{
209 b->INTERNAL_FIELD (cache_long_line_scans) = val;
210}
211static inline void
212bset_case_fold_search (struct buffer *b, Lisp_Object val)
213{
214 b->INTERNAL_FIELD (case_fold_search) = val;
215}
216static inline void
217bset_ctl_arrow (struct buffer *b, Lisp_Object val)
218{
219 b->INTERNAL_FIELD (ctl_arrow) = val;
220}
221static inline void
222bset_cursor_in_non_selected_windows (struct buffer *b, Lisp_Object val)
223{
224 b->INTERNAL_FIELD (cursor_in_non_selected_windows) = val;
225}
226static inline void
227bset_cursor_type (struct buffer *b, Lisp_Object val)
228{
229 b->INTERNAL_FIELD (cursor_type) = val;
230}
231static inline void
232bset_display_table (struct buffer *b, Lisp_Object val)
233{
234 b->INTERNAL_FIELD (display_table) = val;
235}
236static inline void
237bset_extra_line_spacing (struct buffer *b, Lisp_Object val)
238{
239 b->INTERNAL_FIELD (extra_line_spacing) = val;
240}
241static inline void
242bset_file_format (struct buffer *b, Lisp_Object val)
243{
244 b->INTERNAL_FIELD (file_format) = val;
245}
246static inline void
247bset_file_truename (struct buffer *b, Lisp_Object val)
248{
249 b->INTERNAL_FIELD (file_truename) = val;
250}
251static inline void
252bset_fringe_cursor_alist (struct buffer *b, Lisp_Object val)
253{
254 b->INTERNAL_FIELD (fringe_cursor_alist) = val;
255}
256static inline void
257bset_fringe_indicator_alist (struct buffer *b, Lisp_Object val)
258{
259 b->INTERNAL_FIELD (fringe_indicator_alist) = val;
260}
261static inline void
262bset_fringes_outside_margins (struct buffer *b, Lisp_Object val)
263{
264 b->INTERNAL_FIELD (fringes_outside_margins) = val;
265}
266static inline void
267bset_header_line_format (struct buffer *b, Lisp_Object val)
268{
269 b->INTERNAL_FIELD (header_line_format) = val;
270}
271static inline void
272bset_indicate_buffer_boundaries (struct buffer *b, Lisp_Object val)
273{
274 b->INTERNAL_FIELD (indicate_buffer_boundaries) = val;
275}
276static inline void
277bset_indicate_empty_lines (struct buffer *b, Lisp_Object val)
278{
279 b->INTERNAL_FIELD (indicate_empty_lines) = val;
280}
281static inline void
282bset_invisibility_spec (struct buffer *b, Lisp_Object val)
283{
284 b->INTERNAL_FIELD (invisibility_spec) = val;
285}
286static inline void
287bset_left_fringe_width (struct buffer *b, Lisp_Object val)
288{
289 b->INTERNAL_FIELD (left_fringe_width) = val;
290}
291static inline void
292bset_major_mode (struct buffer *b, Lisp_Object val)
293{
294 b->INTERNAL_FIELD (major_mode) = val;
295}
296static inline void
297bset_mark (struct buffer *b, Lisp_Object val)
298{
299 b->INTERNAL_FIELD (mark) = val;
300}
301static inline void
302bset_minor_modes (struct buffer *b, Lisp_Object val)
303{
304 b->INTERNAL_FIELD (minor_modes) = val;
305}
306static inline void
307bset_mode_line_format (struct buffer *b, Lisp_Object val)
308{
309 b->INTERNAL_FIELD (mode_line_format) = val;
310}
311static inline void
312bset_mode_name (struct buffer *b, Lisp_Object val)
313{
314 b->INTERNAL_FIELD (mode_name) = val;
315}
316static inline void
317bset_name (struct buffer *b, Lisp_Object val)
318{
319 b->INTERNAL_FIELD (name) = val;
320}
321static inline void
322bset_overwrite_mode (struct buffer *b, Lisp_Object val)
323{
324 b->INTERNAL_FIELD (overwrite_mode) = val;
325}
326static inline void
327bset_pt_marker (struct buffer *b, Lisp_Object val)
328{
329 b->INTERNAL_FIELD (pt_marker) = val;
330}
331static inline void
332bset_right_fringe_width (struct buffer *b, Lisp_Object val)
333{
334 b->INTERNAL_FIELD (right_fringe_width) = val;
335}
336static inline void
337bset_save_length (struct buffer *b, Lisp_Object val)
338{
339 b->INTERNAL_FIELD (save_length) = val;
340}
341static inline void
342bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
343{
344 b->INTERNAL_FIELD (scroll_bar_width) = val;
345}
346static inline void
347bset_scroll_down_aggressively (struct buffer *b, Lisp_Object val)
348{
349 b->INTERNAL_FIELD (scroll_down_aggressively) = val;
350}
351static inline void
352bset_scroll_up_aggressively (struct buffer *b, Lisp_Object val)
353{
354 b->INTERNAL_FIELD (scroll_up_aggressively) = val;
355}
356static inline void
357bset_selective_display (struct buffer *b, Lisp_Object val)
358{
359 b->INTERNAL_FIELD (selective_display) = val;
360}
361static inline void
362bset_selective_display_ellipses (struct buffer *b, Lisp_Object val)
363{
364 b->INTERNAL_FIELD (selective_display_ellipses) = val;
365}
366static inline void
367bset_vertical_scroll_bar_type (struct buffer *b, Lisp_Object val)
368{
369 b->INTERNAL_FIELD (vertical_scroll_bar_type) = val;
370}
371static inline void
372bset_word_wrap (struct buffer *b, Lisp_Object val)
373{
374 b->INTERNAL_FIELD (word_wrap) = val;
375}
376static inline void
377bset_zv_marker (struct buffer *b, Lisp_Object val)
378{
379 b->INTERNAL_FIELD (zv_marker) = val;
380}
381
160/* For debugging; temporary. See set_buffer_internal. */ 382/* For debugging; temporary. See set_buffer_internal. */
161/* Lisp_Object Qlisp_mode, Vcheck_symbol; */ 383/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
162 384
@@ -360,7 +582,7 @@ even if it is dead. The return value is never nil. */)
360 BUF_CHARS_MODIFF (b) = 1; 582 BUF_CHARS_MODIFF (b) = 1;
361 BUF_OVERLAY_MODIFF (b) = 1; 583 BUF_OVERLAY_MODIFF (b) = 1;
362 BUF_SAVE_MODIFF (b) = 1; 584 BUF_SAVE_MODIFF (b) = 1;
363 buffer_set_intervals (b, NULL); 585 set_buffer_intervals (b, NULL);
364 BUF_UNCHANGED_MODIFIED (b) = 1; 586 BUF_UNCHANGED_MODIFIED (b) = 1;
365 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; 587 BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1;
366 BUF_END_UNCHANGED (b) = 0; 588 BUF_END_UNCHANGED (b) = 0;
@@ -370,7 +592,7 @@ even if it is dead. The return value is never nil. */)
370 592
371 b->newline_cache = 0; 593 b->newline_cache = 0;
372 b->width_run_cache = 0; 594 b->width_run_cache = 0;
373 BSET (b, width_table, Qnil); 595 bset_width_table (b, Qnil);
374 b->prevent_redisplay_optimizations_p = 1; 596 b->prevent_redisplay_optimizations_p = 1;
375 597
376 /* Put this on the chain of all buffers including killed ones. */ 598 /* Put this on the chain of all buffers including killed ones. */
@@ -379,20 +601,20 @@ even if it is dead. The return value is never nil. */)
379 601
380 /* An ordinary buffer normally doesn't need markers 602 /* An ordinary buffer normally doesn't need markers
381 to handle BEGV and ZV. */ 603 to handle BEGV and ZV. */
382 BSET (b, pt_marker, Qnil); 604 bset_pt_marker (b, Qnil);
383 BSET (b, begv_marker, Qnil); 605 bset_begv_marker (b, Qnil);
384 BSET (b, zv_marker, Qnil); 606 bset_zv_marker (b, Qnil);
385 607
386 name = Fcopy_sequence (buffer_or_name); 608 name = Fcopy_sequence (buffer_or_name);
387 string_set_intervals (name, NULL); 609 set_string_intervals (name, NULL);
388 BSET (b, name, name); 610 bset_name (b, name);
389 611
390 BSET (b, undo_list, (SREF (name, 0) != ' ') ? Qnil : Qt); 612 bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);
391 613
392 reset_buffer (b); 614 reset_buffer (b);
393 reset_buffer_local_variables (b, 1); 615 reset_buffer_local_variables (b, 1);
394 616
395 BSET (b, mark, Fmake_marker ()); 617 bset_mark (b, Fmake_marker ());
396 BUF_MARKERS (b) = NULL; 618 BUF_MARKERS (b) = NULL;
397 619
398 /* Put this in the alist of all live buffers. */ 620 /* Put this in the alist of all live buffers. */
@@ -439,6 +661,19 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
439 return result; 661 return result;
440} 662}
441 663
664/* Set an appropriate overlay of B. */
665
666static inline void
667set_buffer_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
668{
669 b->overlays_before = o;
670}
671
672static inline void
673set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
674{
675 b->overlays_after = o;
676}
442 677
443/* Clone per-buffer values of buffer FROM. 678/* Clone per-buffer values of buffer FROM.
444 679
@@ -460,7 +695,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
460 if (offset == PER_BUFFER_VAR_OFFSET (name)) 695 if (offset == PER_BUFFER_VAR_OFFSET (name))
461 continue; 696 continue;
462 697
463 obj = PER_BUFFER_VALUE (from, offset); 698 obj = per_buffer_value (from, offset);
464 if (MARKERP (obj) && XMARKER (obj)->buffer == from) 699 if (MARKERP (obj) && XMARKER (obj)->buffer == from)
465 { 700 {
466 struct Lisp_Marker *m = XMARKER (obj); 701 struct Lisp_Marker *m = XMARKER (obj);
@@ -469,17 +704,17 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
469 XMARKER (obj)->insertion_type = m->insertion_type; 704 XMARKER (obj)->insertion_type = m->insertion_type;
470 } 705 }
471 706
472 PER_BUFFER_VALUE (to, offset) = obj; 707 set_per_buffer_value (to, offset, obj);
473 } 708 }
474 709
475 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags); 710 memcpy (to->local_flags, from->local_flags, sizeof to->local_flags);
476 711
477 buffer_set_overlays_before (to, copy_overlays (to, from->overlays_before)); 712 set_buffer_overlays_before (to, copy_overlays (to, from->overlays_before));
478 buffer_set_overlays_after (to, copy_overlays (to, from->overlays_after)); 713 set_buffer_overlays_after (to, copy_overlays (to, from->overlays_after));
479 714
480 /* Get (a copy of) the alist of Lisp-level local variables of FROM 715 /* Get (a copy of) the alist of Lisp-level local variables of FROM
481 and install that in TO. */ 716 and install that in TO. */
482 BSET (to, local_var_alist, buffer_lisp_local_variables (from, 1)); 717 bset_local_var_alist (to, buffer_lisp_local_variables (from, 1));
483} 718}
484 719
485 720
@@ -582,15 +817,15 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
582 817
583 b->newline_cache = 0; 818 b->newline_cache = 0;
584 b->width_run_cache = 0; 819 b->width_run_cache = 0;
585 BSET (b, width_table, Qnil); 820 bset_width_table (b, Qnil);
586 821
587 /* Put this on the chain of all buffers including killed ones. */ 822 /* Put this on the chain of all buffers including killed ones. */
588 b->header.next.buffer = all_buffers; 823 b->header.next.buffer = all_buffers;
589 all_buffers = b; 824 all_buffers = b;
590 825
591 name = Fcopy_sequence (name); 826 name = Fcopy_sequence (name);
592 string_set_intervals (name, NULL); 827 set_string_intervals (name, NULL);
593 BSET (b, name, name); 828 bset_name (b, name);
594 829
595 reset_buffer (b); 830 reset_buffer (b);
596 reset_buffer_local_variables (b, 1); 831 reset_buffer_local_variables (b, 1);
@@ -599,10 +834,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
599 XSETBUFFER (buf, b); 834 XSETBUFFER (buf, b);
600 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 835 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
601 836
602 BSET (b, mark, Fmake_marker ()); 837 bset_mark (b, Fmake_marker ());
603 838
604 /* The multibyte status belongs to the base buffer. */ 839 /* The multibyte status belongs to the base buffer. */
605 BSET (b, enable_multibyte_characters, BVAR (b->base_buffer, enable_multibyte_characters)); 840 bset_enable_multibyte_characters
841 (b, BVAR (b->base_buffer, enable_multibyte_characters));
606 842
607 /* Make sure the base buffer has markers for its narrowing. */ 843 /* Make sure the base buffer has markers for its narrowing. */
608 if (NILP (BVAR (b->base_buffer, pt_marker))) 844 if (NILP (BVAR (b->base_buffer, pt_marker)))
@@ -610,14 +846,17 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
610 eassert (NILP (BVAR (b->base_buffer, begv_marker))); 846 eassert (NILP (BVAR (b->base_buffer, begv_marker)));
611 eassert (NILP (BVAR (b->base_buffer, zv_marker))); 847 eassert (NILP (BVAR (b->base_buffer, zv_marker)));
612 848
613 BSET (b->base_buffer, pt_marker, 849 bset_pt_marker (b->base_buffer,
614 build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte)); 850 build_marker (b->base_buffer, b->base_buffer->pt,
851 b->base_buffer->pt_byte));
615 852
616 BSET (b->base_buffer, begv_marker, 853 bset_begv_marker (b->base_buffer,
617 build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte)); 854 build_marker (b->base_buffer, b->base_buffer->begv,
855 b->base_buffer->begv_byte));
618 856
619 BSET (b->base_buffer, zv_marker, 857 bset_zv_marker (b->base_buffer,
620 build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte)); 858 build_marker (b->base_buffer, b->base_buffer->zv,
859 b->base_buffer->zv_byte));
621 860
622 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; 861 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
623 } 862 }
@@ -625,9 +864,9 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
625 if (NILP (clone)) 864 if (NILP (clone))
626 { 865 {
627 /* Give the indirect buffer markers for its narrowing. */ 866 /* Give the indirect buffer markers for its narrowing. */
628 BSET (b, pt_marker, build_marker (b, b->pt, b->pt_byte)); 867 bset_pt_marker (b, build_marker (b, b->pt, b->pt_byte));
629 BSET (b, begv_marker, build_marker (b, b->begv, b->begv_byte)); 868 bset_begv_marker (b, build_marker (b, b->begv, b->begv_byte));
630 BSET (b, zv_marker, build_marker (b, b->zv, b->zv_byte)); 869 bset_zv_marker (b, build_marker (b, b->zv, b->zv_byte));
631 XMARKER (BVAR (b, zv_marker))->insertion_type = 1; 870 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
632 } 871 }
633 else 872 else
@@ -635,11 +874,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
635 struct buffer *old_b = current_buffer; 874 struct buffer *old_b = current_buffer;
636 875
637 clone_per_buffer_values (b->base_buffer, b); 876 clone_per_buffer_values (b->base_buffer, b);
638 BSET (b, filename, Qnil); 877 bset_filename (b, Qnil);
639 BSET (b, file_truename, Qnil); 878 bset_file_truename (b, Qnil);
640 BSET (b, display_count, make_number (0)); 879 bset_display_count (b, make_number (0));
641 BSET (b, backed_up, Qnil); 880 bset_backed_up (b, Qnil);
642 BSET (b, auto_save_file_name, Qnil); 881 bset_auto_save_file_name (b, Qnil);
643 set_buffer_internal_1 (b); 882 set_buffer_internal_1 (b);
644 Fset (intern ("buffer-save-without-query"), Qnil); 883 Fset (intern ("buffer-save-without-query"), Qnil);
645 Fset (intern ("buffer-file-number"), Qnil); 884 Fset (intern ("buffer-file-number"), Qnil);
@@ -688,8 +927,8 @@ delete_all_overlays (struct buffer *b)
688 ov->next = NULL; 927 ov->next = NULL;
689 } 928 }
690 929
691 buffer_set_overlays_before (b, NULL); 930 set_buffer_overlays_before (b, NULL);
692 buffer_set_overlays_after (b, NULL); 931 set_buffer_overlays_after (b, NULL);
693} 932}
694 933
695/* Reinitialize everything about a buffer except its name and contents 934/* Reinitialize everything about a buffer except its name and contents
@@ -702,10 +941,9 @@ delete_all_overlays (struct buffer *b)
702void 941void
703reset_buffer (register struct buffer *b) 942reset_buffer (register struct buffer *b)
704{ 943{
705 BSET (b, filename, Qnil); 944 bset_filename (b, Qnil);
706 BSET (b, file_truename, Qnil); 945 bset_file_truename (b, Qnil);
707 BSET (b, directory, 946 bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil);
708 (current_buffer) ? BVAR (current_buffer, directory) : Qnil);
709 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS); 947 b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
710 b->modtime_size = -1; 948 b->modtime_size = -1;
711 XSETFASTINT (BVAR (b, save_length), 0); 949 XSETFASTINT (BVAR (b, save_length), 0);
@@ -713,25 +951,25 @@ reset_buffer (register struct buffer *b)
713 /* It is more conservative to start out "changed" than "unchanged". */ 951 /* It is more conservative to start out "changed" than "unchanged". */
714 b->clip_changed = 0; 952 b->clip_changed = 0;
715 b->prevent_redisplay_optimizations_p = 1; 953 b->prevent_redisplay_optimizations_p = 1;
716 BSET (b, backed_up, Qnil); 954 bset_backed_up (b, Qnil);
717 BUF_AUTOSAVE_MODIFF (b) = 0; 955 BUF_AUTOSAVE_MODIFF (b) = 0;
718 b->auto_save_failure_time = 0; 956 b->auto_save_failure_time = 0;
719 BSET (b, auto_save_file_name, Qnil); 957 bset_auto_save_file_name (b, Qnil);
720 BSET (b, read_only, Qnil); 958 bset_read_only (b, Qnil);
721 buffer_set_overlays_before (b, NULL); 959 set_buffer_overlays_before (b, NULL);
722 buffer_set_overlays_after (b, NULL); 960 set_buffer_overlays_after (b, NULL);
723 b->overlay_center = BEG; 961 b->overlay_center = BEG;
724 BSET (b, mark_active, Qnil); 962 bset_mark_active (b, Qnil);
725 BSET (b, point_before_scroll, Qnil); 963 bset_point_before_scroll (b, Qnil);
726 BSET (b, file_format, Qnil); 964 bset_file_format (b, Qnil);
727 BSET (b, auto_save_file_format, Qt); 965 bset_auto_save_file_format (b, Qt);
728 BSET (b, last_selected_window, Qnil); 966 bset_last_selected_window (b, Qnil);
729 BSET (b, display_count, make_number (0)); 967 bset_display_count (b, make_number (0));
730 BSET (b, display_time, Qnil); 968 bset_display_time (b, Qnil);
731 BSET (b, enable_multibyte_characters, 969 bset_enable_multibyte_characters
732 BVAR (&buffer_defaults, enable_multibyte_characters)); 970 (b, BVAR (&buffer_defaults, enable_multibyte_characters));
733 BSET (b, cursor_type, BVAR (&buffer_defaults, cursor_type)); 971 bset_cursor_type (b, BVAR (&buffer_defaults, cursor_type));
734 BSET (b, extra_line_spacing, BVAR (&buffer_defaults, extra_line_spacing)); 972 bset_extra_line_spacing (b, BVAR (&buffer_defaults, extra_line_spacing));
735 973
736 b->display_error_modiff = 0; 974 b->display_error_modiff = 0;
737} 975}
@@ -755,10 +993,10 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
755 things that depend on the major mode. 993 things that depend on the major mode.
756 default-major-mode is handled at a higher level. 994 default-major-mode is handled at a higher level.
757 We ignore it here. */ 995 We ignore it here. */
758 BSET (b, major_mode, Qfundamental_mode); 996 bset_major_mode (b, Qfundamental_mode);
759 BSET (b, keymap, Qnil); 997 bset_keymap (b, Qnil);
760 BSET (b, mode_name, QSFundamental); 998 bset_mode_name (b, QSFundamental);
761 BSET (b, minor_modes, Qnil); 999 bset_minor_modes (b, Qnil);
762 1000
763 /* If the standard case table has been altered and invalidated, 1001 /* If the standard case table has been altered and invalidated,
764 fix up its insides first. */ 1002 fix up its insides first. */
@@ -767,15 +1005,15 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
767 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2]))) 1005 && CHAR_TABLE_P (XCHAR_TABLE (Vascii_downcase_table)->extras[2])))
768 Fset_standard_case_table (Vascii_downcase_table); 1006 Fset_standard_case_table (Vascii_downcase_table);
769 1007
770 BSET (b, downcase_table, Vascii_downcase_table); 1008 bset_downcase_table (b, Vascii_downcase_table);
771 BSET (b, upcase_table, XCHAR_TABLE (Vascii_downcase_table)->extras[0]); 1009 bset_upcase_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[0]);
772 BSET (b, case_canon_table, XCHAR_TABLE (Vascii_downcase_table)->extras[1]); 1010 bset_case_canon_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[1]);
773 BSET (b, case_eqv_table, XCHAR_TABLE (Vascii_downcase_table)->extras[2]); 1011 bset_case_eqv_table (b, XCHAR_TABLE (Vascii_downcase_table)->extras[2]);
774 BSET (b, invisibility_spec, Qt); 1012 bset_invisibility_spec (b, Qt);
775 1013
776 /* Reset all (or most) per-buffer variables to their defaults. */ 1014 /* Reset all (or most) per-buffer variables to their defaults. */
777 if (permanent_too) 1015 if (permanent_too)
778 BSET (b, local_var_alist, Qnil); 1016 bset_local_var_alist (b, Qnil);
779 else 1017 else
780 { 1018 {
781 Lisp_Object tmp, prop, last = Qnil; 1019 Lisp_Object tmp, prop, last = Qnil;
@@ -809,7 +1047,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
809 } 1047 }
810 /* Delete this local variable. */ 1048 /* Delete this local variable. */
811 else if (NILP (last)) 1049 else if (NILP (last))
812 BSET (b, local_var_alist, XCDR (tmp)); 1050 bset_local_var_alist (b, XCDR (tmp));
813 else 1051 else
814 XSETCDR (last, XCDR (tmp)); 1052 XSETCDR (last, XCDR (tmp));
815 } 1053 }
@@ -825,7 +1063,7 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
825 if ((idx > 0 1063 if ((idx > 0
826 && (permanent_too 1064 && (permanent_too
827 || buffer_permanent_local_flags[idx] == 0))) 1065 || buffer_permanent_local_flags[idx] == 0)))
828 PER_BUFFER_VALUE (b, offset) = PER_BUFFER_DEFAULT (offset); 1066 set_per_buffer_value (b, offset, per_buffer_default (offset));
829 } 1067 }
830} 1068}
831 1069
@@ -1001,7 +1239,7 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
1001 { 1239 {
1002 union Lisp_Fwd *fwd = SYMBOL_FWD (sym); 1240 union Lisp_Fwd *fwd = SYMBOL_FWD (sym);
1003 if (BUFFER_OBJFWDP (fwd)) 1241 if (BUFFER_OBJFWDP (fwd))
1004 result = PER_BUFFER_VALUE (buf, XBUFFER_OBJFWD (fwd)->offset); 1242 result = per_buffer_value (buf, XBUFFER_OBJFWD (fwd)->offset);
1005 else 1243 else
1006 result = Fdefault_value (variable); 1244 result = Fdefault_value (variable);
1007 break; 1245 break;
@@ -1081,7 +1319,7 @@ No argument or nil as argument means use current buffer as BUFFER. */)
1081 && SYMBOLP (PER_BUFFER_SYMBOL (offset))) 1319 && SYMBOLP (PER_BUFFER_SYMBOL (offset)))
1082 { 1320 {
1083 Lisp_Object sym = PER_BUFFER_SYMBOL (offset); 1321 Lisp_Object sym = PER_BUFFER_SYMBOL (offset);
1084 Lisp_Object val = PER_BUFFER_VALUE (buf, offset); 1322 Lisp_Object val = per_buffer_value (buf, offset);
1085 result = Fcons (EQ (val, Qunbound) ? sym : Fcons (sym, val), 1323 result = Fcons (EQ (val, Qunbound) ? sym : Fcons (sym, val),
1086 result); 1324 result);
1087 } 1325 }
@@ -1286,7 +1524,7 @@ This does not change the name of the visited file (if any). */)
1286 error ("Buffer name `%s' is in use", SDATA (newname)); 1524 error ("Buffer name `%s' is in use", SDATA (newname));
1287 } 1525 }
1288 1526
1289 BSET (current_buffer, name, newname); 1527 bset_name (current_buffer, newname);
1290 1528
1291 /* Catch redisplay's attention. Unless we do this, the mode lines for 1529 /* Catch redisplay's attention. Unless we do this, the mode lines for
1292 any windows displaying current_buffer will stay unchanged. */ 1530 any windows displaying current_buffer will stay unchanged. */
@@ -1431,7 +1669,7 @@ No argument or nil as argument means do this for the current buffer. */)
1431 } 1669 }
1432 1670
1433 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt)) 1671 if (EQ (BVAR (XBUFFER (real_buffer), undo_list), Qt))
1434 BSET (XBUFFER (real_buffer), undo_list, Qnil); 1672 bset_undo_list (XBUFFER (real_buffer), Qnil);
1435 1673
1436 return Qnil; 1674 return Qnil;
1437} 1675}
@@ -1691,7 +1929,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1691 m = next; 1929 m = next;
1692 } 1930 }
1693 BUF_MARKERS (b) = NULL; 1931 BUF_MARKERS (b) = NULL;
1694 buffer_set_intervals (b, NULL); 1932 set_buffer_intervals (b, NULL);
1695 1933
1696 /* Perhaps we should explicitly free the interval tree here... */ 1934 /* Perhaps we should explicitly free the interval tree here... */
1697 } 1935 }
@@ -1703,7 +1941,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1703 swap_out_buffer_local_variables (b); 1941 swap_out_buffer_local_variables (b);
1704 reset_buffer_local_variables (b, 1); 1942 reset_buffer_local_variables (b, 1);
1705 1943
1706 BSET (b, name, Qnil); 1944 bset_name (b, Qnil);
1707 1945
1708 BLOCK_INPUT; 1946 BLOCK_INPUT;
1709 if (b->base_buffer) 1947 if (b->base_buffer)
@@ -1727,9 +1965,9 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1727 free_region_cache (b->width_run_cache); 1965 free_region_cache (b->width_run_cache);
1728 b->width_run_cache = 0; 1966 b->width_run_cache = 0;
1729 } 1967 }
1730 BSET (b, width_table, Qnil); 1968 bset_width_table (b, Qnil);
1731 UNBLOCK_INPUT; 1969 UNBLOCK_INPUT;
1732 BSET (b, undo_list, Qnil); 1970 bset_undo_list (b, Qnil);
1733 1971
1734 /* Run buffer-list-update-hook. */ 1972 /* Run buffer-list-update-hook. */
1735 if (!NILP (Vrun_hooks)) 1973 if (!NILP (Vrun_hooks))
@@ -1770,8 +2008,8 @@ record_buffer (Lisp_Object buffer)
1770 Vinhibit_quit = tem; 2008 Vinhibit_quit = tem;
1771 2009
1772 /* Update buffer list of selected frame. */ 2010 /* Update buffer list of selected frame. */
1773 FSET (f, buffer_list, Fcons (buffer, Fdelq (buffer, f->buffer_list))); 2011 fset_buffer_list (f, Fcons (buffer, Fdelq (buffer, f->buffer_list)));
1774 FSET (f, buried_buffer_list, Fdelq (buffer, f->buried_buffer_list)); 2012 fset_buried_buffer_list (f, Fdelq (buffer, f->buried_buffer_list));
1775 2013
1776 /* Run buffer-list-update-hook. */ 2014 /* Run buffer-list-update-hook. */
1777 if (!NILP (Vrun_hooks)) 2015 if (!NILP (Vrun_hooks))
@@ -1808,9 +2046,9 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal,
1808 Vinhibit_quit = tem; 2046 Vinhibit_quit = tem;
1809 2047
1810 /* Update buffer lists of selected frame. */ 2048 /* Update buffer lists of selected frame. */
1811 FSET (f, buffer_list, Fdelq (buffer, f->buffer_list)); 2049 fset_buffer_list (f, Fdelq (buffer, f->buffer_list));
1812 FSET (f, buried_buffer_list, 2050 fset_buried_buffer_list
1813 Fcons (buffer, Fdelq (buffer, f->buried_buffer_list))); 2051 (f, Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)));
1814 2052
1815 /* Run buffer-list-update-hook. */ 2053 /* Run buffer-list-update-hook. */
1816 if (!NILP (Vrun_hooks)) 2054 if (!NILP (Vrun_hooks))
@@ -1910,7 +2148,7 @@ set_buffer_internal_1 (register struct buffer *b)
1910 /* Put the undo list back in the base buffer, so that it appears 2148 /* Put the undo list back in the base buffer, so that it appears
1911 that an indirect buffer shares the undo list of its base. */ 2149 that an indirect buffer shares the undo list of its base. */
1912 if (old_buf->base_buffer) 2150 if (old_buf->base_buffer)
1913 BSET (old_buf->base_buffer, undo_list, BVAR (old_buf, undo_list)); 2151 bset_undo_list (old_buf->base_buffer, BVAR (old_buf, undo_list));
1914 2152
1915 /* If the old current buffer has markers to record PT, BEGV and ZV 2153 /* If the old current buffer has markers to record PT, BEGV and ZV
1916 when it is not current, update them now. */ 2154 when it is not current, update them now. */
@@ -1920,7 +2158,7 @@ set_buffer_internal_1 (register struct buffer *b)
1920 /* Get the undo list from the base buffer, so that it appears 2158 /* Get the undo list from the base buffer, so that it appears
1921 that an indirect buffer shares the undo list of its base. */ 2159 that an indirect buffer shares the undo list of its base. */
1922 if (b->base_buffer) 2160 if (b->base_buffer)
1923 BSET (b, undo_list, BVAR (b->base_buffer, undo_list)); 2161 bset_undo_list (b, BVAR (b->base_buffer, undo_list));
1924 2162
1925 /* If the new current buffer has markers to record PT, BEGV and ZV 2163 /* If the new current buffer has markers to record PT, BEGV and ZV
1926 when it is not current, fetch them now. */ 2164 when it is not current, fetch them now. */
@@ -2118,8 +2356,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2118#define swapfield_(field, type) \ 2356#define swapfield_(field, type) \
2119 do { \ 2357 do { \
2120 type tmp##field = BVAR (other_buffer, field); \ 2358 type tmp##field = BVAR (other_buffer, field); \
2121 BSET (other_buffer, field, BVAR (current_buffer, field)); \ 2359 bset_##field (other_buffer, BVAR (current_buffer, field)); \
2122 BSET (current_buffer, field, tmp##field); \ 2360 bset_##field (current_buffer, tmp##field); \
2123 } while (0) 2361 } while (0)
2124 2362
2125 swapfield (own_text, struct buffer_text); 2363 swapfield (own_text, struct buffer_text);
@@ -2159,8 +2397,8 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
2159 swapfield_ (pt_marker, Lisp_Object); 2397 swapfield_ (pt_marker, Lisp_Object);
2160 swapfield_ (begv_marker, Lisp_Object); 2398 swapfield_ (begv_marker, Lisp_Object);
2161 swapfield_ (zv_marker, Lisp_Object); 2399 swapfield_ (zv_marker, Lisp_Object);
2162 BSET (current_buffer, point_before_scroll, Qnil); 2400 bset_point_before_scroll (current_buffer, Qnil);
2163 BSET (other_buffer, point_before_scroll, Qnil); 2401 bset_point_before_scroll (other_buffer, Qnil);
2164 2402
2165 current_buffer->text->modiff++; other_buffer->text->modiff++; 2403 current_buffer->text->modiff++; other_buffer->text->modiff++;
2166 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++; 2404 current_buffer->text->chars_modiff++; other_buffer->text->chars_modiff++;
@@ -2249,7 +2487,7 @@ current buffer is cleared. */)
2249 2487
2250 /* Don't record these buffer changes. We will put a special undo entry 2488 /* Don't record these buffer changes. We will put a special undo entry
2251 instead. */ 2489 instead. */
2252 BSET (current_buffer, undo_list, Qt); 2490 bset_undo_list (current_buffer, Qt);
2253 2491
2254 /* If the cached position is for this buffer, clear it out. */ 2492 /* If the cached position is for this buffer, clear it out. */
2255 clear_charpos_cache (current_buffer); 2493 clear_charpos_cache (current_buffer);
@@ -2271,7 +2509,7 @@ current buffer is cleared. */)
2271 to calculate the old correspondences. */ 2509 to calculate the old correspondences. */
2272 set_intervals_multibyte (0); 2510 set_intervals_multibyte (0);
2273 2511
2274 BSET (current_buffer, enable_multibyte_characters, Qnil); 2512 bset_enable_multibyte_characters (current_buffer, Qnil);
2275 2513
2276 Z = Z_BYTE; 2514 Z = Z_BYTE;
2277 BEGV = BEGV_BYTE; 2515 BEGV = BEGV_BYTE;
@@ -2409,7 +2647,7 @@ current buffer is cleared. */)
2409 2647
2410 /* Do this first, so that chars_in_text asks the right question. 2648 /* Do this first, so that chars_in_text asks the right question.
2411 set_intervals_multibyte needs it too. */ 2649 set_intervals_multibyte needs it too. */
2412 BSET (current_buffer, enable_multibyte_characters, Qt); 2650 bset_enable_multibyte_characters (current_buffer, Qt);
2413 2651
2414 GPT_BYTE = advance_to_char_boundary (GPT_BYTE); 2652 GPT_BYTE = advance_to_char_boundary (GPT_BYTE);
2415 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG; 2653 GPT = chars_in_text (BEG_ADDR, GPT_BYTE - BEG_BYTE) + BEG;
@@ -2467,11 +2705,11 @@ current buffer is cleared. */)
2467 if (!EQ (old_undo, Qt)) 2705 if (!EQ (old_undo, Qt))
2468 { 2706 {
2469 /* Represent all the above changes by a special undo entry. */ 2707 /* Represent all the above changes by a special undo entry. */
2470 BSET (current_buffer, undo_list, 2708 bset_undo_list (current_buffer,
2471 Fcons (list3 (Qapply, 2709 Fcons (list3 (Qapply,
2472 intern ("set-buffer-multibyte"), 2710 intern ("set-buffer-multibyte"),
2473 NILP (flag) ? Qt : Qnil), 2711 NILP (flag) ? Qt : Qnil),
2474 old_undo)); 2712 old_undo));
2475 } 2713 }
2476 2714
2477 UNGCPRO; 2715 UNGCPRO;
@@ -3238,7 +3476,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3238 if (prev) 3476 if (prev)
3239 prev->next = next; 3477 prev->next = next;
3240 else 3478 else
3241 buffer_set_overlays_before (buf, next); 3479 set_buffer_overlays_before (buf, next);
3242 3480
3243 /* Search thru overlays_after for where to put it. */ 3481 /* Search thru overlays_after for where to put it. */
3244 other_prev = NULL; 3482 other_prev = NULL;
@@ -3260,7 +3498,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3260 if (other_prev) 3498 if (other_prev)
3261 other_prev->next = tail; 3499 other_prev->next = tail;
3262 else 3500 else
3263 buffer_set_overlays_after (buf, tail); 3501 set_buffer_overlays_after (buf, tail);
3264 tail = prev; 3502 tail = prev;
3265 } 3503 }
3266 else 3504 else
@@ -3296,7 +3534,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3296 if (prev) 3534 if (prev)
3297 prev->next = next; 3535 prev->next = next;
3298 else 3536 else
3299 buffer_set_overlays_after (buf, next); 3537 set_buffer_overlays_after (buf, next);
3300 3538
3301 /* Search thru overlays_before for where to put it. */ 3539 /* Search thru overlays_before for where to put it. */
3302 other_prev = NULL; 3540 other_prev = NULL;
@@ -3318,7 +3556,7 @@ recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
3318 if (other_prev) 3556 if (other_prev)
3319 other_prev->next = tail; 3557 other_prev->next = tail;
3320 else 3558 else
3321 buffer_set_overlays_before (buf, tail); 3559 set_buffer_overlays_before (buf, tail);
3322 tail = prev; 3560 tail = prev;
3323 } 3561 }
3324 } 3562 }
@@ -3423,7 +3661,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3423 beforep = tail; 3661 beforep = tail;
3424 } 3662 }
3425 if (!parent) 3663 if (!parent)
3426 buffer_set_overlays_before (current_buffer, tail->next); 3664 set_buffer_overlays_before (current_buffer, tail->next);
3427 else 3665 else
3428 parent->next = tail->next; 3666 parent->next = tail->next;
3429 tail = tail->next; 3667 tail = tail->next;
@@ -3469,7 +3707,7 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3469 beforep = tail; 3707 beforep = tail;
3470 } 3708 }
3471 if (!parent) 3709 if (!parent)
3472 buffer_set_overlays_after (current_buffer, tail->next); 3710 set_buffer_overlays_after (current_buffer, tail->next);
3473 else 3711 else
3474 parent->next = tail->next; 3712 parent->next = tail->next;
3475 tail = tail->next; 3713 tail = tail->next;
@@ -3483,14 +3721,14 @@ fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
3483 if (beforep) 3721 if (beforep)
3484 { 3722 {
3485 beforep->next = current_buffer->overlays_before; 3723 beforep->next = current_buffer->overlays_before;
3486 buffer_set_overlays_before (current_buffer, before_list); 3724 set_buffer_overlays_before (current_buffer, before_list);
3487 } 3725 }
3488 recenter_overlay_lists (current_buffer, current_buffer->overlay_center); 3726 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3489 3727
3490 if (afterp) 3728 if (afterp)
3491 { 3729 {
3492 afterp->next = current_buffer->overlays_after; 3730 afterp->next = current_buffer->overlays_after;
3493 buffer_set_overlays_after (current_buffer, after_list); 3731 set_buffer_overlays_after (current_buffer, after_list);
3494 } 3732 }
3495 recenter_overlay_lists (current_buffer, current_buffer->overlay_center); 3733 recenter_overlay_lists (current_buffer, current_buffer->overlay_center);
3496} 3734}
@@ -3567,7 +3805,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos)
3567 if (!right_pair) 3805 if (!right_pair)
3568 { 3806 {
3569 found->next = bp->overlays_before; 3807 found->next = bp->overlays_before;
3570 buffer_set_overlays_before (bp, found); 3808 set_buffer_overlays_before (bp, found);
3571 } 3809 }
3572 else 3810 else
3573 { 3811 {
@@ -3645,13 +3883,13 @@ for the rear of the overlay advance when text is inserted there
3645 { 3883 {
3646 if (b->overlays_after) 3884 if (b->overlays_after)
3647 XOVERLAY (overlay)->next = b->overlays_after; 3885 XOVERLAY (overlay)->next = b->overlays_after;
3648 buffer_set_overlays_after (b, XOVERLAY (overlay)); 3886 set_buffer_overlays_after (b, XOVERLAY (overlay));
3649 } 3887 }
3650 else 3888 else
3651 { 3889 {
3652 if (b->overlays_before) 3890 if (b->overlays_before)
3653 XOVERLAY (overlay)->next = b->overlays_before; 3891 XOVERLAY (overlay)->next = b->overlays_before;
3654 buffer_set_overlays_before (b, XOVERLAY (overlay)); 3892 set_buffer_overlays_before (b, XOVERLAY (overlay));
3655 } 3893 }
3656 3894
3657 /* This puts it in the right list, and in the right order. */ 3895 /* This puts it in the right list, and in the right order. */
@@ -3716,8 +3954,8 @@ unchain_both (struct buffer *b, Lisp_Object overlay)
3716{ 3954{
3717 struct Lisp_Overlay *ov = XOVERLAY (overlay); 3955 struct Lisp_Overlay *ov = XOVERLAY (overlay);
3718 3956
3719 buffer_set_overlays_before (b, unchain_overlay (b->overlays_before, ov)); 3957 set_buffer_overlays_before (b, unchain_overlay (b->overlays_before, ov));
3720 buffer_set_overlays_after (b, unchain_overlay (b->overlays_after, ov)); 3958 set_buffer_overlays_after (b, unchain_overlay (b->overlays_after, ov));
3721 eassert (XOVERLAY (overlay)->next == NULL); 3959 eassert (XOVERLAY (overlay)->next == NULL);
3722} 3960}
3723 3961
@@ -3812,12 +4050,12 @@ buffer. */)
3812 if (n_end < b->overlay_center) 4050 if (n_end < b->overlay_center)
3813 { 4051 {
3814 XOVERLAY (overlay)->next = b->overlays_after; 4052 XOVERLAY (overlay)->next = b->overlays_after;
3815 buffer_set_overlays_after (b, XOVERLAY (overlay)); 4053 set_buffer_overlays_after (b, XOVERLAY (overlay));
3816 } 4054 }
3817 else 4055 else
3818 { 4056 {
3819 XOVERLAY (overlay)->next = b->overlays_before; 4057 XOVERLAY (overlay)->next = b->overlays_before;
3820 buffer_set_overlays_before (b, XOVERLAY (overlay)); 4058 set_buffer_overlays_before (b, XOVERLAY (overlay));
3821 } 4059 }
3822 4060
3823 /* This puts it in the right list, and in the right order. */ 4061 /* This puts it in the right list, and in the right order. */
@@ -4913,8 +5151,8 @@ init_buffer_once (void)
4913 /* No one will share the text with these buffers, but let's play it safe. */ 5151 /* No one will share the text with these buffers, but let's play it safe. */
4914 buffer_defaults.indirections = 0; 5152 buffer_defaults.indirections = 0;
4915 buffer_local_symbols.indirections = 0; 5153 buffer_local_symbols.indirections = 0;
4916 buffer_set_intervals (&buffer_defaults, NULL); 5154 set_buffer_intervals (&buffer_defaults, NULL);
4917 buffer_set_intervals (&buffer_local_symbols, NULL); 5155 set_buffer_intervals (&buffer_local_symbols, NULL);
4918 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); 5156 XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
4919 XSETBUFFER (Vbuffer_defaults, &buffer_defaults); 5157 XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
4920 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); 5158 XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
@@ -4924,55 +5162,55 @@ init_buffer_once (void)
4924 /* Must do these before making the first buffer! */ 5162 /* Must do these before making the first buffer! */
4925 5163
4926 /* real setup is done in bindings.el */ 5164 /* real setup is done in bindings.el */
4927 BSET (&buffer_defaults, mode_line_format, build_pure_c_string ("%-")); 5165 bset_mode_line_format (&buffer_defaults, build_pure_c_string ("%-"));
4928 BSET (&buffer_defaults, header_line_format, Qnil); 5166 bset_header_line_format (&buffer_defaults, Qnil);
4929 BSET (&buffer_defaults, abbrev_mode, Qnil); 5167 bset_abbrev_mode (&buffer_defaults, Qnil);
4930 BSET (&buffer_defaults, overwrite_mode, Qnil); 5168 bset_overwrite_mode (&buffer_defaults, Qnil);
4931 BSET (&buffer_defaults, case_fold_search, Qt); 5169 bset_case_fold_search (&buffer_defaults, Qt);
4932 BSET (&buffer_defaults, auto_fill_function, Qnil); 5170 bset_auto_fill_function (&buffer_defaults, Qnil);
4933 BSET (&buffer_defaults, selective_display, Qnil); 5171 bset_selective_display (&buffer_defaults, Qnil);
4934 BSET (&buffer_defaults, selective_display_ellipses, Qt); 5172 bset_selective_display_ellipses (&buffer_defaults, Qt);
4935 BSET (&buffer_defaults, abbrev_table, Qnil); 5173 bset_abbrev_table (&buffer_defaults, Qnil);
4936 BSET (&buffer_defaults, display_table, Qnil); 5174 bset_display_table (&buffer_defaults, Qnil);
4937 BSET (&buffer_defaults, undo_list, Qnil); 5175 bset_undo_list (&buffer_defaults, Qnil);
4938 BSET (&buffer_defaults, mark_active, Qnil); 5176 bset_mark_active (&buffer_defaults, Qnil);
4939 BSET (&buffer_defaults, file_format, Qnil); 5177 bset_file_format (&buffer_defaults, Qnil);
4940 BSET (&buffer_defaults, auto_save_file_format, Qt); 5178 bset_auto_save_file_format (&buffer_defaults, Qt);
4941 buffer_set_overlays_before (&buffer_defaults, NULL); 5179 set_buffer_overlays_before (&buffer_defaults, NULL);
4942 buffer_set_overlays_after (&buffer_defaults, NULL); 5180 set_buffer_overlays_after (&buffer_defaults, NULL);
4943 buffer_defaults.overlay_center = BEG; 5181 buffer_defaults.overlay_center = BEG;
4944 5182
4945 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8); 5183 XSETFASTINT (BVAR (&buffer_defaults, tab_width), 8);
4946 BSET (&buffer_defaults, truncate_lines, Qnil); 5184 bset_truncate_lines (&buffer_defaults, Qnil);
4947 BSET (&buffer_defaults, word_wrap, Qnil); 5185 bset_word_wrap (&buffer_defaults, Qnil);
4948 BSET (&buffer_defaults, ctl_arrow, Qt); 5186 bset_ctl_arrow (&buffer_defaults, Qt);
4949 BSET (&buffer_defaults, bidi_display_reordering, Qt); 5187 bset_bidi_display_reordering (&buffer_defaults, Qt);
4950 BSET (&buffer_defaults, bidi_paragraph_direction, Qnil); 5188 bset_bidi_paragraph_direction (&buffer_defaults, Qnil);
4951 BSET (&buffer_defaults, cursor_type, Qt); 5189 bset_cursor_type (&buffer_defaults, Qt);
4952 BSET (&buffer_defaults, extra_line_spacing, Qnil); 5190 bset_extra_line_spacing (&buffer_defaults, Qnil);
4953 BSET (&buffer_defaults, cursor_in_non_selected_windows, Qt); 5191 bset_cursor_in_non_selected_windows (&buffer_defaults, Qt);
4954 5192
4955 BSET (&buffer_defaults, enable_multibyte_characters, Qt); 5193 bset_enable_multibyte_characters (&buffer_defaults, Qt);
4956 BSET (&buffer_defaults, buffer_file_coding_system, Qnil); 5194 bset_buffer_file_coding_system (&buffer_defaults, Qnil);
4957 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70); 5195 XSETFASTINT (BVAR (&buffer_defaults, fill_column), 70);
4958 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0); 5196 XSETFASTINT (BVAR (&buffer_defaults, left_margin), 0);
4959 BSET (&buffer_defaults, cache_long_line_scans, Qnil); 5197 bset_cache_long_line_scans (&buffer_defaults, Qnil);
4960 BSET (&buffer_defaults, file_truename, Qnil); 5198 bset_file_truename (&buffer_defaults, Qnil);
4961 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0); 5199 XSETFASTINT (BVAR (&buffer_defaults, display_count), 0);
4962 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0); 5200 XSETFASTINT (BVAR (&buffer_defaults, left_margin_cols), 0);
4963 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0); 5201 XSETFASTINT (BVAR (&buffer_defaults, right_margin_cols), 0);
4964 BSET (&buffer_defaults, left_fringe_width, Qnil); 5202 bset_left_fringe_width (&buffer_defaults, Qnil);
4965 BSET (&buffer_defaults, right_fringe_width, Qnil); 5203 bset_right_fringe_width (&buffer_defaults, Qnil);
4966 BSET (&buffer_defaults, fringes_outside_margins, Qnil); 5204 bset_fringes_outside_margins (&buffer_defaults, Qnil);
4967 BSET (&buffer_defaults, scroll_bar_width, Qnil); 5205 bset_scroll_bar_width (&buffer_defaults, Qnil);
4968 BSET (&buffer_defaults, vertical_scroll_bar_type, Qt); 5206 bset_vertical_scroll_bar_type (&buffer_defaults, Qt);
4969 BSET (&buffer_defaults, indicate_empty_lines, Qnil); 5207 bset_indicate_empty_lines (&buffer_defaults, Qnil);
4970 BSET (&buffer_defaults, indicate_buffer_boundaries, Qnil); 5208 bset_indicate_buffer_boundaries (&buffer_defaults, Qnil);
4971 BSET (&buffer_defaults, fringe_indicator_alist, Qnil); 5209 bset_fringe_indicator_alist (&buffer_defaults, Qnil);
4972 BSET (&buffer_defaults, fringe_cursor_alist, Qnil); 5210 bset_fringe_cursor_alist (&buffer_defaults, Qnil);
4973 BSET (&buffer_defaults, scroll_up_aggressively, Qnil); 5211 bset_scroll_up_aggressively (&buffer_defaults, Qnil);
4974 BSET (&buffer_defaults, scroll_down_aggressively, Qnil); 5212 bset_scroll_down_aggressively (&buffer_defaults, Qnil);
4975 BSET (&buffer_defaults, display_time, Qnil); 5213 bset_display_time (&buffer_defaults, Qnil);
4976 5214
4977 /* Assign the local-flags to the slots that have default values. 5215 /* Assign the local-flags to the slots that have default values.
4978 The local flag is a bit that is used in the buffer 5216 The local flag is a bit that is used in the buffer
@@ -4984,24 +5222,24 @@ init_buffer_once (void)
4984 5222
4985 /* 0 means not a lisp var, -1 means always local, else mask */ 5223 /* 0 means not a lisp var, -1 means always local, else mask */
4986 memset (&buffer_local_flags, 0, sizeof buffer_local_flags); 5224 memset (&buffer_local_flags, 0, sizeof buffer_local_flags);
4987 BSET (&buffer_local_flags, filename, make_number (-1)); 5225 bset_filename (&buffer_local_flags, make_number (-1));
4988 BSET (&buffer_local_flags, directory, make_number (-1)); 5226 bset_directory (&buffer_local_flags, make_number (-1));
4989 BSET (&buffer_local_flags, backed_up, make_number (-1)); 5227 bset_backed_up (&buffer_local_flags, make_number (-1));
4990 BSET (&buffer_local_flags, save_length, make_number (-1)); 5228 bset_save_length (&buffer_local_flags, make_number (-1));
4991 BSET (&buffer_local_flags, auto_save_file_name, make_number (-1)); 5229 bset_auto_save_file_name (&buffer_local_flags, make_number (-1));
4992 BSET (&buffer_local_flags, read_only, make_number (-1)); 5230 bset_read_only (&buffer_local_flags, make_number (-1));
4993 BSET (&buffer_local_flags, major_mode, make_number (-1)); 5231 bset_major_mode (&buffer_local_flags, make_number (-1));
4994 BSET (&buffer_local_flags, mode_name, make_number (-1)); 5232 bset_mode_name (&buffer_local_flags, make_number (-1));
4995 BSET (&buffer_local_flags, undo_list, make_number (-1)); 5233 bset_undo_list (&buffer_local_flags, make_number (-1));
4996 BSET (&buffer_local_flags, mark_active, make_number (-1)); 5234 bset_mark_active (&buffer_local_flags, make_number (-1));
4997 BSET (&buffer_local_flags, point_before_scroll, make_number (-1)); 5235 bset_point_before_scroll (&buffer_local_flags, make_number (-1));
4998 BSET (&buffer_local_flags, file_truename, make_number (-1)); 5236 bset_file_truename (&buffer_local_flags, make_number (-1));
4999 BSET (&buffer_local_flags, invisibility_spec, make_number (-1)); 5237 bset_invisibility_spec (&buffer_local_flags, make_number (-1));
5000 BSET (&buffer_local_flags, file_format, make_number (-1)); 5238 bset_file_format (&buffer_local_flags, make_number (-1));
5001 BSET (&buffer_local_flags, auto_save_file_format, make_number (-1)); 5239 bset_auto_save_file_format (&buffer_local_flags, make_number (-1));
5002 BSET (&buffer_local_flags, display_count, make_number (-1)); 5240 bset_display_count (&buffer_local_flags, make_number (-1));
5003 BSET (&buffer_local_flags, display_time, make_number (-1)); 5241 bset_display_time (&buffer_local_flags, make_number (-1));
5004 BSET (&buffer_local_flags, enable_multibyte_characters, make_number (-1)); 5242 bset_enable_multibyte_characters (&buffer_local_flags, make_number (-1));
5005 5243
5006 idx = 1; 5244 idx = 1;
5007 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx; 5245 XSETFASTINT (BVAR (&buffer_local_flags, mode_line_format), idx); ++idx;
@@ -5057,7 +5295,7 @@ init_buffer_once (void)
5057 QSFundamental = build_pure_c_string ("Fundamental"); 5295 QSFundamental = build_pure_c_string ("Fundamental");
5058 5296
5059 Qfundamental_mode = intern_c_string ("fundamental-mode"); 5297 Qfundamental_mode = intern_c_string ("fundamental-mode");
5060 BSET (&buffer_defaults, major_mode, Qfundamental_mode); 5298 bset_major_mode (&buffer_defaults, Qfundamental_mode);
5061 5299
5062 Qmode_class = intern_c_string ("mode-class"); 5300 Qmode_class = intern_c_string ("mode-class");
5063 5301
@@ -5120,13 +5358,13 @@ init_buffer (void)
5120 len++; 5358 len++;
5121 } 5359 }
5122 5360
5123 BSET (current_buffer, directory, make_unibyte_string (pwd, len)); 5361 bset_directory (current_buffer, make_unibyte_string (pwd, len));
5124 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters))) 5362 if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
5125 /* At this moment, we still don't know how to decode the 5363 /* At this moment, we still don't know how to decode the
5126 directory name. So, we keep the bytes in multibyte form so 5364 directory name. So, we keep the bytes in multibyte form so
5127 that ENCODE_FILE correctly gets the original bytes. */ 5365 that ENCODE_FILE correctly gets the original bytes. */
5128 BSET (current_buffer, directory, 5366 bset_directory
5129 string_to_multibyte (BVAR (current_buffer, directory))); 5367 (current_buffer, string_to_multibyte (BVAR (current_buffer, directory)));
5130 5368
5131 /* Add /: to the front of the name 5369 /* Add /: to the front of the name
5132 if it would otherwise be treated as magic. */ 5370 if it would otherwise be treated as magic. */
@@ -5137,11 +5375,12 @@ init_buffer (void)
5137 However, it is not necessary to turn / into /:/. 5375 However, it is not necessary to turn / into /:/.
5138 So avoid doing that. */ 5376 So avoid doing that. */
5139 && strcmp ("/", SSDATA (BVAR (current_buffer, directory)))) 5377 && strcmp ("/", SSDATA (BVAR (current_buffer, directory))))
5140 BSET (current_buffer, directory, 5378 bset_directory
5141 concat2 (build_string ("/:"), BVAR (current_buffer, directory))); 5379 (current_buffer,
5380 concat2 (build_string ("/:"), BVAR (current_buffer, directory)));
5142 5381
5143 temp = get_minibuffer (0); 5382 temp = get_minibuffer (0);
5144 BSET (XBUFFER (temp), directory, BVAR (current_buffer, directory)); 5383 bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
5145 5384
5146 free (pwd); 5385 free (pwd);
5147} 5386}
diff --git a/src/buffer.h b/src/buffer.h
index 7a6bddee5ec..6c63c52dc47 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -477,7 +477,6 @@ struct buffer_text
477/* Most code should use this macro to access Lisp fields in struct buffer. */ 477/* Most code should use this macro to access Lisp fields in struct buffer. */
478 478
479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) 479#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
480#define BSET(buf, field, value) ((buf)->INTERNAL_FIELD (field) = (value))
481 480
482/* This is the structure that the buffer Lisp object points to. */ 481/* This is the structure that the buffer Lisp object points to. */
483 482
@@ -862,6 +861,104 @@ struct buffer
862 Lisp_Object INTERNAL_FIELD (undo_list); 861 Lisp_Object INTERNAL_FIELD (undo_list);
863}; 862};
864 863
864/* Most code should use these functions to set Lisp fields in struct
865 buffer. */
866BUFFER_INLINE void
867bset_bidi_paragraph_direction (struct buffer *b, Lisp_Object val)
868{
869 b->INTERNAL_FIELD (bidi_paragraph_direction) = val;
870}
871BUFFER_INLINE void
872bset_case_canon_table (struct buffer *b, Lisp_Object val)
873{
874 b->INTERNAL_FIELD (case_canon_table) = val;
875}
876BUFFER_INLINE void
877bset_case_eqv_table (struct buffer *b, Lisp_Object val)
878{
879 b->INTERNAL_FIELD (case_eqv_table) = val;
880}
881BUFFER_INLINE void
882bset_directory (struct buffer *b, Lisp_Object val)
883{
884 b->INTERNAL_FIELD (directory) = val;
885}
886BUFFER_INLINE void
887bset_display_count (struct buffer *b, Lisp_Object val)
888{
889 b->INTERNAL_FIELD (display_count) = val;
890}
891BUFFER_INLINE void
892bset_display_time (struct buffer *b, Lisp_Object val)
893{
894 b->INTERNAL_FIELD (display_time) = val;
895}
896BUFFER_INLINE void
897bset_downcase_table (struct buffer *b, Lisp_Object val)
898{
899 b->INTERNAL_FIELD (downcase_table) = val;
900}
901BUFFER_INLINE void
902bset_enable_multibyte_characters (struct buffer *b, Lisp_Object val)
903{
904 b->INTERNAL_FIELD (enable_multibyte_characters) = val;
905}
906BUFFER_INLINE void
907bset_filename (struct buffer *b, Lisp_Object val)
908{
909 b->INTERNAL_FIELD (filename) = val;
910}
911BUFFER_INLINE void
912bset_keymap (struct buffer *b, Lisp_Object val)
913{
914 b->INTERNAL_FIELD (keymap) = val;
915}
916BUFFER_INLINE void
917bset_last_selected_window (struct buffer *b, Lisp_Object val)
918{
919 b->INTERNAL_FIELD (last_selected_window) = val;
920}
921BUFFER_INLINE void
922bset_local_var_alist (struct buffer *b, Lisp_Object val)
923{
924 b->INTERNAL_FIELD (local_var_alist) = val;
925}
926BUFFER_INLINE void
927bset_mark_active (struct buffer *b, Lisp_Object val)
928{
929 b->INTERNAL_FIELD (mark_active) = val;
930}
931BUFFER_INLINE void
932bset_point_before_scroll (struct buffer *b, Lisp_Object val)
933{
934 b->INTERNAL_FIELD (point_before_scroll) = val;
935}
936BUFFER_INLINE void
937bset_read_only (struct buffer *b, Lisp_Object val)
938{
939 b->INTERNAL_FIELD (read_only) = val;
940}
941BUFFER_INLINE void
942bset_truncate_lines (struct buffer *b, Lisp_Object val)
943{
944 b->INTERNAL_FIELD (truncate_lines) = val;
945}
946BUFFER_INLINE void
947bset_undo_list (struct buffer *b, Lisp_Object val)
948{
949 b->INTERNAL_FIELD (undo_list) = val;
950}
951BUFFER_INLINE void
952bset_upcase_table (struct buffer *b, Lisp_Object val)
953{
954 b->INTERNAL_FIELD (upcase_table) = val;
955}
956BUFFER_INLINE void
957bset_width_table (struct buffer *b, Lisp_Object val)
958{
959 b->INTERNAL_FIELD (width_table) = val;
960}
961
865 962
866/* Chain of all buffers, including killed ones. */ 963/* Chain of all buffers, including killed ones. */
867 964
@@ -953,7 +1050,7 @@ extern Lisp_Object Qfirst_change_hook;
953/* Get text properties of B. */ 1050/* Get text properties of B. */
954 1051
955BUFFER_INLINE INTERVAL 1052BUFFER_INLINE INTERVAL
956buffer_get_intervals (struct buffer *b) 1053buffer_intervals (struct buffer *b)
957{ 1054{
958 eassert (b->text != NULL); 1055 eassert (b->text != NULL);
959 return b->text->intervals; 1056 return b->text->intervals;
@@ -962,26 +1059,12 @@ buffer_get_intervals (struct buffer *b)
962/* Set text properties of B to I. */ 1059/* Set text properties of B to I. */
963 1060
964BUFFER_INLINE void 1061BUFFER_INLINE void
965buffer_set_intervals (struct buffer *b, INTERVAL i) 1062set_buffer_intervals (struct buffer *b, INTERVAL i)
966{ 1063{
967 eassert (b->text != NULL); 1064 eassert (b->text != NULL);
968 b->text->intervals = i; 1065 b->text->intervals = i;
969} 1066}
970 1067
971/* Set an appropriate overlay of B. */
972
973BUFFER_INLINE void
974buffer_set_overlays_before (struct buffer *b, struct Lisp_Overlay *o)
975{
976 b->overlays_before = o;
977}
978
979BUFFER_INLINE void
980buffer_set_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
981{
982 b->overlays_after = o;
983}
984
985/* Non-zero if current buffer has overlays. */ 1068/* Non-zero if current buffer has overlays. */
986 1069
987BUFFER_INLINE int 1070BUFFER_INLINE int
@@ -1120,18 +1203,36 @@ extern int last_per_buffer_idx;
1120#define PER_BUFFER_IDX(OFFSET) \ 1203#define PER_BUFFER_IDX(OFFSET) \
1121 XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags)) 1204 XINT (*(Lisp_Object *)((OFFSET) + (char *) &buffer_local_flags))
1122 1205
1123/* Return the default value of the per-buffer variable at offset 1206/* Functions to get and set default value of the per-buffer
1124 OFFSET in the buffer structure. */ 1207 variable at offset OFFSET in the buffer structure. */
1208
1209BUFFER_INLINE Lisp_Object
1210per_buffer_default (int offset)
1211{
1212 return *(Lisp_Object *)(offset + (char *) &buffer_defaults);
1213}
1214
1215BUFFER_INLINE void
1216set_per_buffer_default (int offset, Lisp_Object value)
1217{
1218 *(Lisp_Object *)(offset + (char *) &buffer_defaults) = value;
1219}
1125 1220
1126#define PER_BUFFER_DEFAULT(OFFSET) \ 1221/* Functions to get and set buffer-local value of the per-buffer
1127 (*(Lisp_Object *)((OFFSET) + (char *) &buffer_defaults)) 1222 variable at offset OFFSET in the buffer structure. */
1223
1224BUFFER_INLINE Lisp_Object
1225per_buffer_value (struct buffer *b, int offset)
1226{
1227 return *(Lisp_Object *)(offset + (char *) b);
1228}
1128 1229
1129/* Return the buffer-local value of the per-buffer variable at offset 1230BUFFER_INLINE void
1130 OFFSET in the buffer structure. */ 1231set_per_buffer_value (struct buffer *b, int offset, Lisp_Object value)
1232{
1233 *(Lisp_Object *)(offset + (char *) b) = value;
1234}
1131 1235
1132#define PER_BUFFER_VALUE(BUFFER, OFFSET) \
1133 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
1134
1135/* Downcase a character C, or make no change if that cannot be done. */ 1236/* Downcase a character C, or make no change if that cannot be done. */
1136BUFFER_INLINE int 1237BUFFER_INLINE int
1137downcase (int c) 1238downcase (int c)
diff --git a/src/callint.c b/src/callint.c
index e0133864674..36a59e812f2 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -372,7 +372,7 @@ invoke it. If KEYS is omitted or nil, the return value of
372 Vthis_command = save_this_command; 372 Vthis_command = save_this_command;
373 Vthis_original_command = save_this_original_command; 373 Vthis_original_command = save_this_original_command;
374 Vreal_this_command = save_real_this_command; 374 Vreal_this_command = save_real_this_command;
375 KSET (current_kboard, Vlast_command, save_last_command); 375 kset_last_command (current_kboard, save_last_command);
376 376
377 temporarily_switch_to_single_kboard (NULL); 377 temporarily_switch_to_single_kboard (NULL);
378 return unbind_to (speccount, apply1 (function, specs)); 378 return unbind_to (speccount, apply1 (function, specs));
@@ -843,7 +843,7 @@ invoke it. If KEYS is omitted or nil, the return value of
843 Vthis_command = save_this_command; 843 Vthis_command = save_this_command;
844 Vthis_original_command = save_this_original_command; 844 Vthis_original_command = save_this_original_command;
845 Vreal_this_command = save_real_this_command; 845 Vreal_this_command = save_real_this_command;
846 KSET (current_kboard, Vlast_command, save_last_command); 846 kset_last_command (current_kboard, save_last_command);
847 847
848 { 848 {
849 Lisp_Object val; 849 Lisp_Object val;
diff --git a/src/callproc.c b/src/callproc.c
index 10a80168fb2..4bf1da04e1a 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -65,10 +65,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65#include "nsterm.h" 65#include "nsterm.h"
66#endif 66#endif
67 67
68#ifndef USE_CRT_DLL
69extern char **environ;
70#endif
71
72#ifdef HAVE_SETPGID 68#ifdef HAVE_SETPGID
73#if !defined (USG) 69#if !defined (USG)
74#undef setpgrp 70#undef setpgrp
diff --git a/src/casetab.c b/src/casetab.c
index 6097299047a..a163d5204f8 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -128,13 +128,13 @@ set_case_table (Lisp_Object table, int standard)
128 up = Fmake_char_table (Qcase_table, Qnil); 128 up = Fmake_char_table (Qcase_table, Qnil);
129 map_char_table (set_identity, Qnil, table, up); 129 map_char_table (set_identity, Qnil, table, up);
130 map_char_table (shuffle, Qnil, table, up); 130 map_char_table (shuffle, Qnil, table, up);
131 char_table_set_extras (table, 0, up); 131 set_char_table_extras (table, 0, up);
132 } 132 }
133 133
134 if (NILP (canon)) 134 if (NILP (canon))
135 { 135 {
136 canon = Fmake_char_table (Qcase_table, Qnil); 136 canon = Fmake_char_table (Qcase_table, Qnil);
137 char_table_set_extras (table, 1, canon); 137 set_char_table_extras (table, 1, canon);
138 map_char_table (set_canon, Qnil, table, table); 138 map_char_table (set_canon, Qnil, table, table);
139 } 139 }
140 140
@@ -143,11 +143,11 @@ set_case_table (Lisp_Object table, int standard)
143 eqv = Fmake_char_table (Qcase_table, Qnil); 143 eqv = Fmake_char_table (Qcase_table, Qnil);
144 map_char_table (set_identity, Qnil, canon, eqv); 144 map_char_table (set_identity, Qnil, canon, eqv);
145 map_char_table (shuffle, Qnil, canon, eqv); 145 map_char_table (shuffle, Qnil, canon, eqv);
146 char_table_set_extras (table, 2, eqv); 146 set_char_table_extras (table, 2, eqv);
147 } 147 }
148 148
149 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 149 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
150 char_table_set_extras (canon, 2, eqv); 150 set_char_table_extras (canon, 2, eqv);
151 151
152 if (standard) 152 if (standard)
153 { 153 {
@@ -158,10 +158,10 @@ set_case_table (Lisp_Object table, int standard)
158 } 158 }
159 else 159 else
160 { 160 {
161 BSET (current_buffer, downcase_table, table); 161 bset_downcase_table (current_buffer, table);
162 BSET (current_buffer, upcase_table, up); 162 bset_upcase_table (current_buffer, up);
163 BSET (current_buffer, case_canon_table, canon); 163 bset_case_canon_table (current_buffer, canon);
164 BSET (current_buffer, case_eqv_table, eqv); 164 bset_case_eqv_table (current_buffer, eqv);
165 } 165 }
166 166
167 return table; 167 return table;
@@ -260,7 +260,7 @@ init_casetab_once (void)
260 260
261 down = Fmake_char_table (Qcase_table, Qnil); 261 down = Fmake_char_table (Qcase_table, Qnil);
262 Vascii_downcase_table = down; 262 Vascii_downcase_table = down;
263 CSET (XCHAR_TABLE (down), purpose, Qcase_table); 263 set_char_table_purpose (down, Qcase_table);
264 264
265 for (i = 0; i < 128; i++) 265 for (i = 0; i < 128; i++)
266 { 266 {
@@ -268,10 +268,10 @@ init_casetab_once (void)
268 CHAR_TABLE_SET (down, i, make_number (c)); 268 CHAR_TABLE_SET (down, i, make_number (c));
269 } 269 }
270 270
271 char_table_set_extras (down, 1, Fcopy_sequence (down)); 271 set_char_table_extras (down, 1, Fcopy_sequence (down));
272 272
273 up = Fmake_char_table (Qcase_table, Qnil); 273 up = Fmake_char_table (Qcase_table, Qnil);
274 char_table_set_extras (down, 0, up); 274 set_char_table_extras (down, 0, up);
275 275
276 for (i = 0; i < 128; i++) 276 for (i = 0; i < 128; i++)
277 { 277 {
@@ -281,7 +281,7 @@ init_casetab_once (void)
281 CHAR_TABLE_SET (up, i, make_number (c)); 281 CHAR_TABLE_SET (up, i, make_number (c));
282 } 282 }
283 283
284 char_table_set_extras (down, 2, Fcopy_sequence (up)); 284 set_char_table_extras (down, 2, Fcopy_sequence (up));
285 285
286 /* Fill in what isn't filled in. */ 286 /* Fill in what isn't filled in. */
287 set_case_table (down, 1); 287 set_case_table (down, 1);
diff --git a/src/category.c b/src/category.c
index 246a7d35a6d..1c9085fd558 100644
--- a/src/category.c
+++ b/src/category.c
@@ -40,6 +40,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
40#include "category.h" 40#include "category.h"
41#include "keymap.h" 41#include "keymap.h"
42 42
43/* This setter is used only in this file, so it can be private. */
44static inline void
45bset_category_table (struct buffer *b, Lisp_Object val)
46{
47 b->INTERNAL_FIELD (category_table) = val;
48}
49
43/* The version number of the latest category table. Each category 50/* The version number of the latest category table. Each category
44 table has a unique version number. It is assigned a new number 51 table has a unique version number. It is assigned a new number
45 also when it is modified. When a regular expression is compiled 52 also when it is modified. When a regular expression is compiled
@@ -70,7 +77,7 @@ hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
70 EMACS_UINT hash; 77 EMACS_UINT hash;
71 78
72 if (NILP (XCHAR_TABLE (table)->extras[1])) 79 if (NILP (XCHAR_TABLE (table)->extras[1]))
73 char_table_set_extras 80 set_char_table_extras
74 (table, 1, 81 (table, 1,
75 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), 82 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
76 make_float (DEFAULT_REHASH_SIZE), 83 make_float (DEFAULT_REHASH_SIZE),
@@ -136,7 +143,7 @@ the current buffer's category table. */)
136 error ("Category `%c' is already defined", (int) XFASTINT (category)); 143 error ("Category `%c' is already defined", (int) XFASTINT (category));
137 if (!NILP (Vpurify_flag)) 144 if (!NILP (Vpurify_flag))
138 docstring = Fpurecopy (docstring); 145 docstring = Fpurecopy (docstring);
139 CATEGORY_DOCSTRING (table, XFASTINT (category)) = docstring; 146 SET_CATEGORY_DOCSTRING (table, XFASTINT (category), docstring);
140 147
141 return Qnil; 148 return Qnil;
142} 149}
@@ -238,9 +245,9 @@ copy_category_table (Lisp_Object table)
238 table = copy_char_table (table); 245 table = copy_char_table (table);
239 246
240 if (! NILP (XCHAR_TABLE (table)->defalt)) 247 if (! NILP (XCHAR_TABLE (table)->defalt))
241 CSET (XCHAR_TABLE (table), defalt, 248 set_char_table_defalt (table,
242 Fcopy_sequence (XCHAR_TABLE (table)->defalt)); 249 Fcopy_sequence (XCHAR_TABLE (table)->defalt));
243 char_table_set_extras 250 set_char_table_extras
244 (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0])); 251 (table, 0, Fcopy_sequence (XCHAR_TABLE (table)->extras[0]));
245 map_char_table (copy_category_entry, Qnil, table, table); 252 map_char_table (copy_category_entry, Qnil, table, table);
246 253
@@ -270,9 +277,9 @@ DEFUN ("make-category-table", Fmake_category_table, Smake_category_table,
270 int i; 277 int i;
271 278
272 val = Fmake_char_table (Qcategory_table, Qnil); 279 val = Fmake_char_table (Qcategory_table, Qnil);
273 CSET (XCHAR_TABLE (val), defalt, MAKE_CATEGORY_SET); 280 set_char_table_defalt (val, MAKE_CATEGORY_SET);
274 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 281 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
275 char_table_set_contents (val, i, MAKE_CATEGORY_SET); 282 set_char_table_contents (val, i, MAKE_CATEGORY_SET);
276 Fset_char_table_extra_slot (val, make_number (0), 283 Fset_char_table_extra_slot (val, make_number (0),
277 Fmake_vector (make_number (95), Qnil)); 284 Fmake_vector (make_number (95), Qnil));
278 return val; 285 return val;
@@ -285,7 +292,7 @@ Return TABLE. */)
285{ 292{
286 int idx; 293 int idx;
287 table = check_category_table (table); 294 table = check_category_table (table);
288 BSET (current_buffer, category_table, table); 295 bset_category_table (current_buffer, table);
289 /* Indicate that this buffer now has a specified category table. */ 296 /* Indicate that this buffer now has a specified category table. */
290 idx = PER_BUFFER_VAR_IDX (category_table); 297 idx = PER_BUFFER_VAR_IDX (category_table);
291 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 298 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
@@ -466,7 +473,7 @@ init_category_once (void)
466 473
467 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil); 474 Vstandard_category_table = Fmake_char_table (Qcategory_table, Qnil);
468 /* Set a category set which contains nothing to the default. */ 475 /* Set a category set which contains nothing to the default. */
469 CSET (XCHAR_TABLE (Vstandard_category_table), defalt, MAKE_CATEGORY_SET); 476 set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
470 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0), 477 Fset_char_table_extra_slot (Vstandard_category_table, make_number (0),
471 Fmake_vector (make_number (95), Qnil)); 478 Fmake_vector (make_number (95), Qnil));
472} 479}
diff --git a/src/category.h b/src/category.h
index f29034acff1..9fb981ed383 100644
--- a/src/category.h
+++ b/src/category.h
@@ -96,8 +96,12 @@ CHAR_HAS_CATEGORY (int ch, int category)
96#define Vstandard_category_table BVAR (&buffer_defaults, category_table) 96#define Vstandard_category_table BVAR (&buffer_defaults, category_table)
97 97
98/* Return the doc string of CATEGORY in category table TABLE. */ 98/* Return the doc string of CATEGORY in category table TABLE. */
99#define CATEGORY_DOCSTRING(table, category) \ 99#define CATEGORY_DOCSTRING(table, category) \
100 XVECTOR (Fchar_table_extra_slot (table, make_number (0)))->contents[(category) - ' '] 100 AREF (Fchar_table_extra_slot (table, make_number (0)), ((category) - ' '))
101
102/* Set the doc string of CATEGORY to VALUE in category table TABLE. */
103#define SET_CATEGORY_DOCSTRING(table, category, value) \
104 ASET (Fchar_table_extra_slot (table, make_number (0)), ((category) - ' '), value)
101 105
102/* Return the version number of category table TABLE. Not used for 106/* Return the version number of category table TABLE. Not used for
103 the moment. */ 107 the moment. */
diff --git a/src/charset.c b/src/charset.c
index 87c16e12008..3e286fa947d 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1131,7 +1131,7 @@ usage: (define-charset-internal ...) */)
1131 { 1131 {
1132 new_definition_p = 0; 1132 new_definition_p = 0;
1133 id = XFASTINT (CHARSET_SYMBOL_ID (args[charset_arg_name])); 1133 id = XFASTINT (CHARSET_SYMBOL_ID (args[charset_arg_name]));
1134 set_hash_value (hash_table, charset.hash_index, attrs); 1134 set_hash_value_slot (hash_table, charset.hash_index, attrs);
1135 } 1135 }
1136 else 1136 else
1137 { 1137 {
diff --git a/src/chartab.c b/src/chartab.c
index 6d3f83499d8..711a49ed397 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -115,8 +115,8 @@ the char-table has no extra slot. */)
115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; 115 size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
116 vector = Fmake_vector (make_number (size), init); 116 vector = Fmake_vector (make_number (size), init);
117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE); 117 XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
118 CSET (XCHAR_TABLE (vector), parent, Qnil); 118 set_char_table_parent (vector, Qnil);
119 CSET (XCHAR_TABLE (vector), purpose, purpose); 119 set_char_table_purpose (vector, purpose);
120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector)); 120 XSETCHAR_TABLE (vector, XCHAR_TABLE (vector));
121 return vector; 121 return vector;
122} 122}
@@ -155,21 +155,17 @@ char_table_ascii (Lisp_Object table)
155static Lisp_Object 155static Lisp_Object
156copy_sub_char_table (Lisp_Object table) 156copy_sub_char_table (Lisp_Object table)
157{ 157{
158 Lisp_Object copy;
159 int depth = XINT (XSUB_CHAR_TABLE (table)->depth); 158 int depth = XINT (XSUB_CHAR_TABLE (table)->depth);
160 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char); 159 int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char);
161 Lisp_Object val; 160 Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil);
162 int i; 161 int i;
163 162
164 copy = make_sub_char_table (depth, min_char, Qnil);
165 /* Recursively copy any sub char-tables. */ 163 /* Recursively copy any sub char-tables. */
166 for (i = 0; i < chartab_size[depth]; i++) 164 for (i = 0; i < chartab_size[depth]; i++)
167 { 165 {
168 val = XSUB_CHAR_TABLE (table)->contents[i]; 166 Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[i];
169 if (SUB_CHAR_TABLE_P (val)) 167 set_sub_char_table_contents
170 sub_char_table_set_contents (copy, i, copy_sub_char_table (val)); 168 (copy, i, SUB_CHAR_TABLE_P (val) ? copy_sub_char_table (val) : val);
171 else
172 sub_char_table_set_contents (copy, i, val);
173 } 169 }
174 170
175 return copy; 171 return copy;
@@ -185,19 +181,19 @@ copy_char_table (Lisp_Object table)
185 181
186 copy = Fmake_vector (make_number (size), Qnil); 182 copy = Fmake_vector (make_number (size), Qnil);
187 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE); 183 XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
188 CSET (XCHAR_TABLE (copy), defalt, XCHAR_TABLE (table)->defalt); 184 set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
189 CSET (XCHAR_TABLE (copy), parent, XCHAR_TABLE (table)->parent); 185 set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
190 CSET (XCHAR_TABLE (copy), purpose, XCHAR_TABLE (table)->purpose); 186 set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
191 for (i = 0; i < chartab_size[0]; i++) 187 for (i = 0; i < chartab_size[0]; i++)
192 char_table_set_contents 188 set_char_table_contents
193 (copy, i, 189 (copy, i,
194 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i]) 190 (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
195 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i]) 191 ? copy_sub_char_table (XCHAR_TABLE (table)->contents[i])
196 : XCHAR_TABLE (table)->contents[i])); 192 : XCHAR_TABLE (table)->contents[i]));
197 CSET (XCHAR_TABLE (copy), ascii, char_table_ascii (copy)); 193 set_char_table_ascii (copy, char_table_ascii (copy));
198 size -= VECSIZE (struct Lisp_Char_Table) - 1; 194 size -= VECSIZE (struct Lisp_Char_Table) - 1;
199 for (i = 0; i < size; i++) 195 for (i = 0; i < size; i++)
200 char_table_set_extras (copy, i, XCHAR_TABLE (table)->extras[i]); 196 set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
201 197
202 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy)); 198 XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
203 return copy; 199 return copy;
@@ -395,7 +391,7 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
395 Lisp_Object sub; 391 Lisp_Object sub;
396 392
397 if (depth == 3) 393 if (depth == 3)
398 sub_char_table_set_contents (table, i, val); 394 set_sub_char_table_contents (table, i, val);
399 else 395 else
400 { 396 {
401 sub = tbl->contents[i]; 397 sub = tbl->contents[i];
@@ -408,21 +404,21 @@ sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
408 sub = make_sub_char_table (depth + 1, 404 sub = make_sub_char_table (depth + 1,
409 min_char + i * chartab_chars[depth], 405 min_char + i * chartab_chars[depth],
410 sub); 406 sub);
411 sub_char_table_set_contents (table, i, sub); 407 set_sub_char_table_contents (table, i, sub);
412 } 408 }
413 } 409 }
414 sub_char_table_set (sub, c, val, is_uniprop); 410 sub_char_table_set (sub, c, val, is_uniprop);
415 } 411 }
416} 412}
417 413
418Lisp_Object 414void
419char_table_set (Lisp_Object table, int c, Lisp_Object val) 415char_table_set (Lisp_Object table, int c, Lisp_Object val)
420{ 416{
421 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 417 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
422 418
423 if (ASCII_CHAR_P (c) 419 if (ASCII_CHAR_P (c)
424 && SUB_CHAR_TABLE_P (tbl->ascii)) 420 && SUB_CHAR_TABLE_P (tbl->ascii))
425 sub_char_table_set_contents (tbl->ascii, c, val); 421 set_sub_char_table_contents (tbl->ascii, c, val);
426 else 422 else
427 { 423 {
428 int i = CHARTAB_IDX (c, 0, 0); 424 int i = CHARTAB_IDX (c, 0, 0);
@@ -432,13 +428,12 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
432 if (! SUB_CHAR_TABLE_P (sub)) 428 if (! SUB_CHAR_TABLE_P (sub))
433 { 429 {
434 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 430 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
435 char_table_set_contents (table, i, sub); 431 set_char_table_contents (table, i, sub);
436 } 432 }
437 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table)); 433 sub_char_table_set (sub, c, val, UNIPROP_TABLE_P (table));
438 if (ASCII_CHAR_P (c)) 434 if (ASCII_CHAR_P (c))
439 CSET (tbl, ascii, char_table_ascii (table)); 435 set_char_table_ascii (table, char_table_ascii (table));
440 } 436 }
441 return val;
442} 437}
443 438
444static void 439static void
@@ -460,7 +455,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
460 if (c > to) 455 if (c > to)
461 break; 456 break;
462 if (from <= c && c + chars_in_block - 1 <= to) 457 if (from <= c && c + chars_in_block - 1 <= to)
463 sub_char_table_set_contents (table, i, val); 458 set_sub_char_table_contents (table, i, val);
464 else 459 else
465 { 460 {
466 Lisp_Object sub = tbl->contents[i]; 461 Lisp_Object sub = tbl->contents[i];
@@ -471,7 +466,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
471 else 466 else
472 { 467 {
473 sub = make_sub_char_table (depth + 1, c, sub); 468 sub = make_sub_char_table (depth + 1, c, sub);
474 sub_char_table_set_contents (table, i, sub); 469 set_sub_char_table_contents (table, i, sub);
475 } 470 }
476 } 471 }
477 sub_char_table_set_range (sub, from, to, val, is_uniprop); 472 sub_char_table_set_range (sub, from, to, val, is_uniprop);
@@ -480,7 +475,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
480} 475}
481 476
482 477
483Lisp_Object 478void
484char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val) 479char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
485{ 480{
486 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 481 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
@@ -499,22 +494,21 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
499 if (c > to) 494 if (c > to)
500 break; 495 break;
501 if (from <= c && c + chartab_chars[0] - 1 <= to) 496 if (from <= c && c + chartab_chars[0] - 1 <= to)
502 char_table_set_contents (table, i, val); 497 set_char_table_contents (table, i, val);
503 else 498 else
504 { 499 {
505 Lisp_Object sub = tbl->contents[i]; 500 Lisp_Object sub = tbl->contents[i];
506 if (! SUB_CHAR_TABLE_P (sub)) 501 if (! SUB_CHAR_TABLE_P (sub))
507 { 502 {
508 sub = make_sub_char_table (1, i * chartab_chars[0], sub); 503 sub = make_sub_char_table (1, i * chartab_chars[0], sub);
509 char_table_set_contents (table, i, sub); 504 set_char_table_contents (table, i, sub);
510 } 505 }
511 sub_char_table_set_range (sub, from, to, val, is_uniprop); 506 sub_char_table_set_range (sub, from, to, val, is_uniprop);
512 } 507 }
513 } 508 }
514 if (ASCII_CHAR_P (from)) 509 if (ASCII_CHAR_P (from))
515 CSET (tbl, ascii, char_table_ascii (table)); 510 set_char_table_ascii (table, char_table_ascii (table));
516 } 511 }
517 return val;
518} 512}
519 513
520 514
@@ -562,7 +556,7 @@ Return PARENT. PARENT must be either nil or another char-table. */)
562 error ("Attempt to make a chartable be its own parent"); 556 error ("Attempt to make a chartable be its own parent");
563 } 557 }
564 558
565 CSET (XCHAR_TABLE (char_table), parent, parent); 559 set_char_table_parent (char_table, parent);
566 560
567 return parent; 561 return parent;
568} 562}
@@ -593,7 +587,7 @@ DEFUN ("set-char-table-extra-slot", Fset_char_table_extra_slot,
593 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table))) 587 || XINT (n) >= CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (char_table)))
594 args_out_of_range (char_table, n); 588 args_out_of_range (char_table, n);
595 589
596 char_table_set_extras (char_table, XINT (n), value); 590 set_char_table_extras (char_table, XINT (n), value);
597 return value; 591 return value;
598} 592}
599 593
@@ -640,12 +634,12 @@ or a character code. Return VALUE. */)
640 { 634 {
641 int i; 635 int i;
642 636
643 CSET (XCHAR_TABLE (char_table), ascii, value); 637 set_char_table_ascii (char_table, value);
644 for (i = 0; i < chartab_size[0]; i++) 638 for (i = 0; i < chartab_size[0]; i++)
645 char_table_set_contents (char_table, i, value); 639 set_char_table_contents (char_table, i, value);
646 } 640 }
647 else if (EQ (range, Qnil)) 641 else if (EQ (range, Qnil))
648 CSET (XCHAR_TABLE (char_table), defalt, value); 642 set_char_table_defalt (char_table, value);
649 else if (CHARACTERP (range)) 643 else if (CHARACTERP (range))
650 char_table_set (char_table, XINT (range), value); 644 char_table_set (char_table, XINT (range), value);
651 else if (CONSP (range)) 645 else if (CONSP (range))
@@ -695,7 +689,7 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
695 if (SUB_CHAR_TABLE_P (elt)) 689 if (SUB_CHAR_TABLE_P (elt))
696 { 690 {
697 elt = optimize_sub_char_table (elt, test); 691 elt = optimize_sub_char_table (elt, test);
698 sub_char_table_set_contents (table, 0, elt); 692 set_sub_char_table_contents (table, 0, elt);
699 } 693 }
700 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1; 694 optimizable = SUB_CHAR_TABLE_P (elt) ? 0 : 1;
701 for (i = 1; i < chartab_size[depth]; i++) 695 for (i = 1; i < chartab_size[depth]; i++)
@@ -704,7 +698,7 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
704 if (SUB_CHAR_TABLE_P (this)) 698 if (SUB_CHAR_TABLE_P (this))
705 { 699 {
706 this = optimize_sub_char_table (this, test); 700 this = optimize_sub_char_table (this, test);
707 sub_char_table_set_contents (table, i, this); 701 set_sub_char_table_contents (table, i, this);
708 } 702 }
709 if (optimizable 703 if (optimizable
710 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */ 704 && (NILP (test) ? NILP (Fequal (this, elt)) /* defaults to `equal'. */
@@ -732,11 +726,11 @@ equivalent and can be merged. It defaults to `equal'. */)
732 { 726 {
733 elt = XCHAR_TABLE (char_table)->contents[i]; 727 elt = XCHAR_TABLE (char_table)->contents[i];
734 if (SUB_CHAR_TABLE_P (elt)) 728 if (SUB_CHAR_TABLE_P (elt))
735 char_table_set_contents 729 set_char_table_contents
736 (char_table, i, optimize_sub_char_table (elt, test)); 730 (char_table, i, optimize_sub_char_table (elt, test));
737 } 731 }
738 /* Reset the `ascii' cache, in case it got optimized away. */ 732 /* Reset the `ascii' cache, in case it got optimized away. */
739 CSET (XCHAR_TABLE (char_table), ascii, char_table_ascii (char_table)); 733 set_char_table_ascii (char_table, char_table_ascii (char_table));
740 734
741 return Qnil; 735 return Qnil;
742} 736}
@@ -828,9 +822,9 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
828 822
829 /* This is to get a value of FROM in PARENT 823 /* This is to get a value of FROM in PARENT
830 without checking the parent of PARENT. */ 824 without checking the parent of PARENT. */
831 CSET (XCHAR_TABLE (parent), parent, Qnil); 825 set_char_table_parent (parent, Qnil);
832 val = CHAR_TABLE_REF (parent, from); 826 val = CHAR_TABLE_REF (parent, from);
833 CSET (XCHAR_TABLE (parent), parent, temp); 827 set_char_table_parent (parent, temp);
834 XSETCDR (range, make_number (c - 1)); 828 XSETCDR (range, make_number (c - 1));
835 val = map_sub_char_table (c_function, function, 829 val = map_sub_char_table (c_function, function,
836 parent, arg, val, range, 830 parent, arg, val, range,
@@ -910,9 +904,9 @@ map_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
910 temp = XCHAR_TABLE (parent)->parent; 904 temp = XCHAR_TABLE (parent)->parent;
911 /* This is to get a value of FROM in PARENT without checking the 905 /* This is to get a value of FROM in PARENT without checking the
912 parent of PARENT. */ 906 parent of PARENT. */
913 CSET (XCHAR_TABLE (parent), parent, Qnil); 907 set_char_table_parent (parent, Qnil);
914 val = CHAR_TABLE_REF (parent, from); 908 val = CHAR_TABLE_REF (parent, from);
915 CSET (XCHAR_TABLE (parent), parent, temp); 909 set_char_table_parent (parent, temp);
916 val = map_sub_char_table (c_function, function, parent, arg, val, range, 910 val = map_sub_char_table (c_function, function, parent, arg, val, range,
917 parent); 911 parent);
918 table = parent; 912 table = parent;
@@ -1149,7 +1143,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1149 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); 1143 Lisp_Object sub = make_sub_char_table (3, min_char, Qnil);
1150 const unsigned char *p, *pend; 1144 const unsigned char *p, *pend;
1151 1145
1152 sub_char_table_set_contents (table, idx, sub); 1146 set_sub_char_table_contents (table, idx, sub);
1153 p = SDATA (val), pend = p + SBYTES (val); 1147 p = SDATA (val), pend = p + SBYTES (val);
1154 if (*p == 1) 1148 if (*p == 1)
1155 { 1149 {
@@ -1159,7 +1153,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1159 while (p < pend && idx < chartab_chars[2]) 1153 while (p < pend && idx < chartab_chars[2])
1160 { 1154 {
1161 int v = STRING_CHAR_ADVANCE (p); 1155 int v = STRING_CHAR_ADVANCE (p);
1162 sub_char_table_set_contents 1156 set_sub_char_table_contents
1163 (sub, idx++, v > 0 ? make_number (v) : Qnil); 1157 (sub, idx++, v > 0 ? make_number (v) : Qnil);
1164 } 1158 }
1165 } 1159 }
@@ -1185,7 +1179,7 @@ uniprop_table_uncompress (Lisp_Object table, int idx)
1185 } 1179 }
1186 } 1180 }
1187 while (count-- > 0) 1181 while (count-- > 0)
1188 sub_char_table_set_contents (sub, idx++, make_number (v)); 1182 set_sub_char_table_contents (sub, idx++, make_number (v));
1189 } 1183 }
1190 } 1184 }
1191/* It seems that we don't need this function because C code won't need 1185/* It seems that we don't need this function because C code won't need
@@ -1288,7 +1282,7 @@ uniprop_encode_value_numeric (Lisp_Object table, Lisp_Object value)
1288 1282
1289 args[0] = XCHAR_TABLE (table)->extras[4]; 1283 args[0] = XCHAR_TABLE (table)->extras[4];
1290 args[1] = Fmake_vector (make_number (1), value); 1284 args[1] = Fmake_vector (make_number (1), value);
1291 char_table_set_extras (table, 4, Fvconcat (2, args)); 1285 set_char_table_extras (table, 4, Fvconcat (2, args));
1292 } 1286 }
1293 return make_number (i); 1287 return make_number (i);
1294} 1288}
@@ -1350,7 +1344,7 @@ uniprop_table (Lisp_Object prop)
1350 : ! NILP (val)) 1344 : ! NILP (val))
1351 return Qnil; 1345 return Qnil;
1352 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */ 1346 /* Prepare ASCII values in advance for CHAR_TABLE_REF. */
1353 CSET (XCHAR_TABLE (table), ascii, char_table_ascii (table)); 1347 set_char_table_ascii (table, char_table_ascii (table));
1354 return table; 1348 return table;
1355} 1349}
1356 1350
diff --git a/src/cmds.c b/src/cmds.c
index 24778fae6e3..b416135ee9e 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -301,7 +301,7 @@ At the end, it runs `post-self-insert-hook'. */)
301 added be explicit calls to undo-boundary. */ 301 added be explicit calls to undo-boundary. */
302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) 302 && EQ (BVAR (current_buffer, undo_list), last_undo_boundary))
303 /* Remove the undo_boundary that was just pushed. */ 303 /* Remove the undo_boundary that was just pushed. */
304 BSET (current_buffer, undo_list, XCDR (BVAR (current_buffer, undo_list))); 304 bset_undo_list (current_buffer, XCDR (BVAR (current_buffer, undo_list)));
305 305
306 /* Barf if the key that invoked this was not a character. */ 306 /* Barf if the key that invoked this was not a character. */
307 if (!CHARACTERP (last_command_event)) 307 if (!CHARACTERP (last_command_event))
diff --git a/src/coding.c b/src/coding.c
index c601a18b26e..971686dc180 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7112,7 +7112,7 @@ decode_coding (struct coding_system *coding)
7112 record_first_change (); 7112 record_first_change ();
7113 7113
7114 undo_list = BVAR (current_buffer, undo_list); 7114 undo_list = BVAR (current_buffer, undo_list);
7115 BSET (current_buffer, undo_list, Qt); 7115 bset_undo_list (current_buffer, Qt);
7116 } 7116 }
7117 7117
7118 coding->consumed = coding->consumed_char = 0; 7118 coding->consumed = coding->consumed_char = 0;
@@ -7209,7 +7209,7 @@ decode_coding (struct coding_system *coding)
7209 decode_eol (coding); 7209 decode_eol (coding);
7210 if (BUFFERP (coding->dst_object)) 7210 if (BUFFERP (coding->dst_object))
7211 { 7211 {
7212 BSET (current_buffer, undo_list, undo_list); 7212 bset_undo_list (current_buffer, undo_list);
7213 record_insert (coding->dst_pos, coding->produced_char); 7213 record_insert (coding->dst_pos, coding->produced_char);
7214 } 7214 }
7215 return coding->result; 7215 return coding->result;
@@ -7577,8 +7577,8 @@ make_conversion_work_buffer (int multibyte)
7577 doesn't compile new regexps. */ 7577 doesn't compile new regexps. */
7578 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt); 7578 Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
7579 Ferase_buffer (); 7579 Ferase_buffer ();
7580 BSET (current_buffer, undo_list, Qt); 7580 bset_undo_list (current_buffer, Qt);
7581 BSET (current_buffer, enable_multibyte_characters, multibyte ? Qt : Qnil); 7581 bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil);
7582 set_buffer_internal (current); 7582 set_buffer_internal (current);
7583 return workbuf; 7583 return workbuf;
7584} 7584}
@@ -9302,10 +9302,10 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9302 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9302 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9303 terminal_coding->src_multibyte = 1; 9303 terminal_coding->src_multibyte = 1;
9304 terminal_coding->dst_multibyte = 0; 9304 terminal_coding->dst_multibyte = 0;
9305 if (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK) 9305 tset_charset_list
9306 TSET (term, charset_list, coding_charset_list (terminal_coding)); 9306 (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK
9307 else 9307 ? coding_charset_list (terminal_coding)
9308 TSET (term, charset_list, Fcons (make_number (charset_ascii), Qnil)); 9308 : Fcons (make_number (charset_ascii), Qnil)));
9309 return Qnil; 9309 return Qnil;
9310} 9310}
9311 9311
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 */
178#endif 178#endif
179 179
180#include <string.h> 180#include <string.h>
181/* If you think about removing the line below, note that the
182 MS-Windows build relies on it for declaration of 'environ' needed
183 by a few source files. */
181#include <stdlib.h> 184#include <stdlib.h>
182 185
183#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ 186#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
diff --git a/src/data.c b/src/data.c
index d0ef5734abc..f812c280b40 100644
--- a/src/data.c
+++ b/src/data.c
@@ -543,7 +543,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
543 else 543 else
544 { 544 {
545 swap_in_symval_forwarding (sym, blv); 545 swap_in_symval_forwarding (sym, blv);
546 valcontents = BLV_VALUE (blv); 546 valcontents = blv_value (blv);
547 } 547 }
548 break; 548 break;
549 } 549 }
@@ -847,7 +847,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
847 return *XOBJFWD (valcontents)->objvar; 847 return *XOBJFWD (valcontents)->objvar;
848 848
849 case Lisp_Fwd_Buffer_Obj: 849 case Lisp_Fwd_Buffer_Obj:
850 return PER_BUFFER_VALUE (current_buffer, 850 return per_buffer_value (current_buffer,
851 XBUFFER_OBJFWD (valcontents)->offset); 851 XBUFFER_OBJFWD (valcontents)->offset);
852 852
853 case Lisp_Fwd_Kboard_Obj: 853 case Lisp_Fwd_Kboard_Obj:
@@ -919,7 +919,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
919 b = XBUFFER (lbuf); 919 b = XBUFFER (lbuf);
920 920
921 if (! PER_BUFFER_VALUE_P (b, idx)) 921 if (! PER_BUFFER_VALUE_P (b, idx))
922 PER_BUFFER_VALUE (b, offset) = newval; 922 set_per_buffer_value (b, offset, newval);
923 } 923 }
924 } 924 }
925 break; 925 break;
@@ -937,7 +937,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
937 937
938 if (buf == NULL) 938 if (buf == NULL)
939 buf = current_buffer; 939 buf = current_buffer;
940 PER_BUFFER_VALUE (buf, offset) = newval; 940 set_per_buffer_value (buf, offset, newval);
941 } 941 }
942 break; 942 break;
943 943
@@ -964,16 +964,16 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
964 964
965 /* Unload the previously loaded binding. */ 965 /* Unload the previously loaded binding. */
966 if (blv->fwd) 966 if (blv->fwd)
967 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 967 set_blv_value (blv, do_symval_forwarding (blv->fwd));
968 968
969 /* Select the global binding in the symbol. */ 969 /* Select the global binding in the symbol. */
970 blv->valcell = blv->defcell; 970 set_blv_valcell (blv, blv->defcell);
971 if (blv->fwd) 971 if (blv->fwd)
972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); 972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
973 973
974 /* Indicate that the global binding is set up now. */ 974 /* Indicate that the global binding is set up now. */
975 blv->where = Qnil; 975 set_blv_where (blv, Qnil);
976 SET_BLV_FOUND (blv, 0); 976 set_blv_found (blv, 0);
977} 977}
978 978
979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1001,7 +1001,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1001 /* Unload the previously loaded binding. */ 1001 /* Unload the previously loaded binding. */
1002 tem1 = blv->valcell; 1002 tem1 = blv->valcell;
1003 if (blv->fwd) 1003 if (blv->fwd)
1004 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1004 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1005 /* Choose the new binding. */ 1005 /* Choose the new binding. */
1006 { 1006 {
1007 Lisp_Object var; 1007 Lisp_Object var;
@@ -1009,7 +1009,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1009 if (blv->frame_local) 1009 if (blv->frame_local)
1010 { 1010 {
1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); 1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1012 blv->where = selected_frame; 1012 set_blv_where (blv, selected_frame);
1013 } 1013 }
1014 else 1014 else
1015 { 1015 {
@@ -1021,9 +1021,9 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1021 tem1 = blv->defcell; 1021 tem1 = blv->defcell;
1022 1022
1023 /* Load the new binding. */ 1023 /* Load the new binding. */
1024 blv->valcell = tem1; 1024 set_blv_valcell (blv, tem1);
1025 if (blv->fwd) 1025 if (blv->fwd)
1026 store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); 1026 store_symval_forwarding (blv->fwd, blv_value (blv), NULL);
1027 } 1027 }
1028} 1028}
1029 1029
@@ -1050,7 +1050,7 @@ find_symbol_value (Lisp_Object symbol)
1050 { 1050 {
1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1052 swap_in_symval_forwarding (sym, blv); 1052 swap_in_symval_forwarding (sym, blv);
1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); 1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv);
1054 } 1054 }
1055 /* FALLTHROUGH */ 1055 /* FALLTHROUGH */
1056 case SYMBOL_FORWARDED: 1056 case SYMBOL_FORWARDED:
@@ -1175,7 +1175,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1175 1175
1176 /* Write out `realvalue' to the old loaded binding. */ 1176 /* Write out `realvalue' to the old loaded binding. */
1177 if (blv->fwd) 1177 if (blv->fwd)
1178 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1178 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1179 1179
1180 /* Find the new binding. */ 1180 /* Find the new binding. */
1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
@@ -1183,7 +1183,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1183 (blv->frame_local 1183 (blv->frame_local
1184 ? XFRAME (where)->param_alist 1184 ? XFRAME (where)->param_alist
1185 : BVAR (XBUFFER (where), local_var_alist))); 1185 : BVAR (XBUFFER (where), local_var_alist)));
1186 blv->where = where; 1186 set_blv_where (blv, where);
1187 blv->found = 1; 1187 blv->found = 1;
1188 1188
1189 if (NILP (tem1)) 1189 if (NILP (tem1))
@@ -1213,17 +1213,18 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1213 bindings, not for frame-local bindings. */ 1213 bindings, not for frame-local bindings. */
1214 eassert (!blv->frame_local); 1214 eassert (!blv->frame_local);
1215 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1215 tem1 = Fcons (symbol, XCDR (blv->defcell));
1216 BSET (XBUFFER (where), local_var_alist, 1216 bset_local_var_alist
1217 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); 1217 (XBUFFER (where),
1218 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1218 } 1219 }
1219 } 1220 }
1220 1221
1221 /* Record which binding is now loaded. */ 1222 /* Record which binding is now loaded. */
1222 blv->valcell = tem1; 1223 set_blv_valcell (blv, tem1);
1223 } 1224 }
1224 1225
1225 /* Store the new value in the cons cell. */ 1226 /* Store the new value in the cons cell. */
1226 SET_BLV_VALUE (blv, newval); 1227 set_blv_value (blv, newval);
1227 1228
1228 if (blv->fwd) 1229 if (blv->fwd)
1229 { 1230 {
@@ -1308,7 +1309,7 @@ default_value (Lisp_Object symbol)
1308 { 1309 {
1309 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1310 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1310 if (PER_BUFFER_IDX (offset) != 0) 1311 if (PER_BUFFER_IDX (offset) != 0)
1311 return PER_BUFFER_DEFAULT (offset); 1312 return per_buffer_default (offset);
1312 } 1313 }
1313 1314
1314 /* For other variables, get the current value. */ 1315 /* For other variables, get the current value. */
@@ -1395,7 +1396,7 @@ for this variable. */)
1395 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1396 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1396 int idx = PER_BUFFER_IDX (offset); 1397 int idx = PER_BUFFER_IDX (offset);
1397 1398
1398 PER_BUFFER_DEFAULT (offset) = value; 1399 set_per_buffer_default (offset, value);
1399 1400
1400 /* If this variable is not always local in all buffers, 1401 /* If this variable is not always local in all buffers,
1401 set it in the buffers that don't nominally have a local value. */ 1402 set it in the buffers that don't nominally have a local value. */
@@ -1405,7 +1406,7 @@ for this variable. */)
1405 1406
1406 FOR_EACH_BUFFER (b) 1407 FOR_EACH_BUFFER (b)
1407 if (!PER_BUFFER_VALUE_P (b, idx)) 1408 if (!PER_BUFFER_VALUE_P (b, idx))
1408 PER_BUFFER_VALUE (b, offset) = value; 1409 set_per_buffer_value (b, offset, value);
1409 } 1410 }
1410 return value; 1411 return value;
1411 } 1412 }
@@ -1479,12 +1480,12 @@ make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents
1479 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); 1480 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
1480 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); 1481 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1481 blv->fwd = forwarded ? valcontents.fwd : NULL; 1482 blv->fwd = forwarded ? valcontents.fwd : NULL;
1482 blv->where = Qnil; 1483 set_blv_where (blv, Qnil);
1483 blv->frame_local = 0; 1484 blv->frame_local = 0;
1484 blv->local_if_set = 0; 1485 blv->local_if_set = 0;
1485 blv->defcell = tem; 1486 set_blv_defcell (blv, tem);
1486 blv->valcell = tem; 1487 set_blv_valcell (blv, tem);
1487 SET_BLV_FOUND (blv, 0); 1488 set_blv_found (blv, 0);
1488 return blv; 1489 return blv;
1489} 1490}
1490 1491
@@ -1653,17 +1654,16 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1653 default value. */ 1654 default value. */
1654 find_symbol_value (variable); 1655 find_symbol_value (variable);
1655 1656
1656 BSET (current_buffer, local_var_alist, 1657 bset_local_var_alist
1657 Fcons (Fcons (variable, XCDR (blv->defcell)), 1658 (current_buffer,
1658 BVAR (current_buffer, local_var_alist))); 1659 Fcons (Fcons (variable, XCDR (blv->defcell)),
1660 BVAR (current_buffer, local_var_alist)));
1659 1661
1660 /* Make sure symbol does not think it is set up for this buffer; 1662 /* Make sure symbol does not think it is set up for this buffer;
1661 force it to look once again for this buffer's value. */ 1663 force it to look once again for this buffer's value. */
1662 if (current_buffer == XBUFFER (blv->where)) 1664 if (current_buffer == XBUFFER (blv->where))
1663 blv->where = Qnil; 1665 set_blv_where (blv, Qnil);
1664 /* blv->valcell = blv->defcell; 1666 set_blv_found (blv, 0);
1665 * SET_BLV_FOUND (blv, 0); */
1666 blv->found = 0;
1667 } 1667 }
1668 1668
1669 /* If the symbol forwards into a C variable, then load the binding 1669 /* If the symbol forwards into a C variable, then load the binding
@@ -1705,8 +1705,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1705 if (idx > 0) 1705 if (idx > 0)
1706 { 1706 {
1707 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); 1707 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
1708 PER_BUFFER_VALUE (current_buffer, offset) 1708 set_per_buffer_value (current_buffer, offset,
1709 = PER_BUFFER_DEFAULT (offset); 1709 per_buffer_default (offset));
1710 } 1710 }
1711 } 1711 }
1712 return variable; 1712 return variable;
@@ -1723,8 +1723,9 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1725 if (!NILP (tem)) 1725 if (!NILP (tem))
1726 BSET (current_buffer, local_var_alist, 1726 bset_local_var_alist
1727 Fdelq (tem, BVAR (current_buffer, local_var_alist))); 1727 (current_buffer,
1728 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1728 1729
1729 /* If the symbol is set up with the current buffer's binding 1730 /* If the symbol is set up with the current buffer's binding
1730 loaded, recompute its value. We have to do it now, or else 1731 loaded, recompute its value. We have to do it now, or else
@@ -1733,9 +1734,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1733 Lisp_Object buf; XSETBUFFER (buf, current_buffer); 1734 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
1734 if (EQ (buf, blv->where)) 1735 if (EQ (buf, blv->where))
1735 { 1736 {
1736 blv->where = Qnil; 1737 set_blv_where (blv, Qnil);
1737 /* blv->valcell = blv->defcell;
1738 * SET_BLV_FOUND (blv, 0); */
1739 blv->found = 0; 1738 blv->found = 0;
1740 find_symbol_value (variable); 1739 find_symbol_value (variable);
1741 } 1740 }
@@ -1857,11 +1856,11 @@ BUFFER defaults to the current buffer. */)
1857 if (EQ (variable, XCAR (elt))) 1856 if (EQ (variable, XCAR (elt)))
1858 { 1857 {
1859 eassert (!blv->frame_local); 1858 eassert (!blv->frame_local);
1860 eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1859 eassert (blv_found (blv) || !EQ (blv->where, tmp));
1861 return Qt; 1860 return Qt;
1862 } 1861 }
1863 } 1862 }
1864 eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1863 eassert (!blv_found (blv) || !EQ (blv->where, tmp));
1865 return Qnil; 1864 return Qnil;
1866 } 1865 }
1867 case SYMBOL_FORWARDED: 1866 case SYMBOL_FORWARDED:
@@ -1951,7 +1950,7 @@ If the current binding is global (the default), the value is nil. */)
1951 if (!NILP (Flocal_variable_p (variable, Qnil))) 1950 if (!NILP (Flocal_variable_p (variable, Qnil)))
1952 return Fcurrent_buffer (); 1951 return Fcurrent_buffer ();
1953 else if (sym->redirect == SYMBOL_LOCALIZED 1952 else if (sym->redirect == SYMBOL_LOCALIZED
1954 && BLV_FOUND (SYMBOL_BLV (sym))) 1953 && blv_found (SYMBOL_BLV (sym)))
1955 return SYMBOL_BLV (sym)->where; 1954 return SYMBOL_BLV (sym)->where;
1956 else 1955 else
1957 return Qnil; 1956 return Qnil;
diff --git a/src/dbusbind.c b/src/dbusbind.c
index c1b1310454c..f63f2948304 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1039,11 +1039,13 @@ xd_remove_watch (DBusWatch *watch, void *data)
1039 return; 1039 return;
1040 1040
1041 /* Unset session environment. */ 1041 /* Unset session environment. */
1042#if 0
1042 if (XSYMBOL (QCdbus_session_bus) == data) 1043 if (XSYMBOL (QCdbus_session_bus) == data)
1043 { 1044 {
1044 // XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS"); 1045 XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
1045 // unsetenv ("DBUS_SESSION_BUS_ADDRESS"); 1046 unsetenv ("DBUS_SESSION_BUS_ADDRESS");
1046 } 1047 }
1048#endif
1047 1049
1048 if (flags & DBUS_WATCH_WRITABLE) 1050 if (flags & DBUS_WATCH_WRITABLE)
1049 delete_write_fd (fd); 1051 delete_write_fd (fd);
diff --git a/src/dispnew.c b/src/dispnew.c
index 3288faba61b..ce7c4ebcb4c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -621,7 +621,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
621 are invalidated below. */ 621 are invalidated below. */
622 if (INTEGERP (w->window_end_vpos) 622 if (INTEGERP (w->window_end_vpos)
623 && XFASTINT (w->window_end_vpos) >= i) 623 && XFASTINT (w->window_end_vpos) >= i)
624 WSET (w, window_end_valid, Qnil); 624 wset_window_end_valid (w, Qnil);
625 625
626 while (i < matrix->nrows) 626 while (i < matrix->nrows)
627 matrix->rows[i++].enabled_p = 0; 627 matrix->rows[i++].enabled_p = 0;
@@ -878,7 +878,7 @@ clear_window_matrices (struct window *w, int desired_p)
878 else 878 else
879 { 879 {
880 clear_glyph_matrix (w->current_matrix); 880 clear_glyph_matrix (w->current_matrix);
881 WSET (w, window_end_valid, Qnil); 881 wset_window_end_valid (w, Qnil);
882 } 882 }
883 } 883 }
884 884
@@ -1887,14 +1887,14 @@ adjust_frame_glyphs_initially (void)
1887 int top_margin = FRAME_TOP_MARGIN (sf); 1887 int top_margin = FRAME_TOP_MARGIN (sf);
1888 1888
1889 /* Do it for the root window. */ 1889 /* Do it for the root window. */
1890 WSET (root, top_line, make_number (top_margin)); 1890 wset_top_line (root, make_number (top_margin));
1891 WSET (root, total_lines, make_number (frame_lines - 1 - top_margin)); 1891 wset_total_lines (root, make_number (frame_lines - 1 - top_margin));
1892 WSET (root, total_cols, make_number (frame_cols)); 1892 wset_total_cols (root, make_number (frame_cols));
1893 1893
1894 /* Do it for the mini-buffer window. */ 1894 /* Do it for the mini-buffer window. */
1895 WSET (mini, top_line, make_number (frame_lines - 1)); 1895 wset_top_line (mini, make_number (frame_lines - 1));
1896 WSET (mini, total_lines, make_number (1)); 1896 wset_total_lines (mini, make_number (1));
1897 WSET (mini, total_cols, make_number (frame_cols)); 1897 wset_total_cols (mini, make_number (frame_cols));
1898 1898
1899 adjust_frame_glyphs (sf); 1899 adjust_frame_glyphs (sf);
1900 glyphs_initialized_initially_p = 1; 1900 glyphs_initialized_initially_p = 1;
@@ -2166,10 +2166,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2166 if (NILP (f->menu_bar_window)) 2166 if (NILP (f->menu_bar_window))
2167 { 2167 {
2168 Lisp_Object frame; 2168 Lisp_Object frame;
2169 FSET (f, menu_bar_window, make_window ()); 2169 fset_menu_bar_window (f, make_window ());
2170 w = XWINDOW (f->menu_bar_window); 2170 w = XWINDOW (f->menu_bar_window);
2171 XSETFRAME (frame, f); 2171 XSETFRAME (frame, f);
2172 WSET (w, frame, frame); 2172 wset_frame (w, frame);
2173 w->pseudo_window_p = 1; 2173 w->pseudo_window_p = 1;
2174 } 2174 }
2175 else 2175 else
@@ -2177,10 +2177,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2177 2177
2178 /* Set window dimensions to frame dimensions and allocate or 2178 /* Set window dimensions to frame dimensions and allocate or
2179 adjust glyph matrices of W. */ 2179 adjust glyph matrices of W. */
2180 WSET (w, top_line, make_number (0)); 2180 wset_top_line (w, make_number (0));
2181 WSET (w, left_col, make_number (0)); 2181 wset_left_col (w, make_number (0));
2182 WSET (w, total_lines, make_number (FRAME_MENU_BAR_LINES (f))); 2182 wset_total_lines (w, make_number (FRAME_MENU_BAR_LINES (f)));
2183 WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); 2183 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f)));
2184 allocate_matrices_for_window_redisplay (w); 2184 allocate_matrices_for_window_redisplay (w);
2185 } 2185 }
2186#endif /* not USE_X_TOOLKIT && not USE_GTK */ 2186#endif /* not USE_X_TOOLKIT && not USE_GTK */
@@ -2194,19 +2194,19 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2194 if (NILP (f->tool_bar_window)) 2194 if (NILP (f->tool_bar_window))
2195 { 2195 {
2196 Lisp_Object frame; 2196 Lisp_Object frame;
2197 FSET (f, tool_bar_window, make_window ()); 2197 fset_tool_bar_window (f, make_window ());
2198 w = XWINDOW (f->tool_bar_window); 2198 w = XWINDOW (f->tool_bar_window);
2199 XSETFRAME (frame, f); 2199 XSETFRAME (frame, f);
2200 WSET (w, frame, frame); 2200 wset_frame (w, frame);
2201 w->pseudo_window_p = 1; 2201 w->pseudo_window_p = 1;
2202 } 2202 }
2203 else 2203 else
2204 w = XWINDOW (f->tool_bar_window); 2204 w = XWINDOW (f->tool_bar_window);
2205 2205
2206 WSET (w, top_line, make_number (FRAME_MENU_BAR_LINES (f))); 2206 wset_top_line (w, make_number (FRAME_MENU_BAR_LINES (f)));
2207 WSET (w, left_col, make_number (0)); 2207 wset_left_col (w, make_number (0));
2208 WSET (w, total_lines, make_number (FRAME_TOOL_BAR_LINES (f))); 2208 wset_total_lines (w, make_number (FRAME_TOOL_BAR_LINES (f)));
2209 WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); 2209 wset_total_cols (w, make_number (FRAME_TOTAL_COLS (f)));
2210 allocate_matrices_for_window_redisplay (w); 2210 allocate_matrices_for_window_redisplay (w);
2211 } 2211 }
2212#endif 2212#endif
@@ -2272,7 +2272,7 @@ free_glyphs (struct frame *f)
2272 free_glyph_matrix (w->desired_matrix); 2272 free_glyph_matrix (w->desired_matrix);
2273 free_glyph_matrix (w->current_matrix); 2273 free_glyph_matrix (w->current_matrix);
2274 w->desired_matrix = w->current_matrix = NULL; 2274 w->desired_matrix = w->current_matrix = NULL;
2275 FSET (f, menu_bar_window, Qnil); 2275 fset_menu_bar_window (f, Qnil);
2276 } 2276 }
2277 2277
2278 /* Free the tool bar window and its glyph matrices. */ 2278 /* Free the tool bar window and its glyph matrices. */
@@ -2282,7 +2282,7 @@ free_glyphs (struct frame *f)
2282 free_glyph_matrix (w->desired_matrix); 2282 free_glyph_matrix (w->desired_matrix);
2283 free_glyph_matrix (w->current_matrix); 2283 free_glyph_matrix (w->current_matrix);
2284 w->desired_matrix = w->current_matrix = NULL; 2284 w->desired_matrix = w->current_matrix = NULL;
2285 FSET (f, tool_bar_window, Qnil); 2285 fset_tool_bar_window (f, Qnil);
2286 } 2286 }
2287 2287
2288 /* Release frame glyph matrices. Reset fields to zero in 2288 /* Release frame glyph matrices. Reset fields to zero in
@@ -3220,8 +3220,8 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
3220 /* Swap tool-bar strings. We swap because we want to 3220 /* Swap tool-bar strings. We swap because we want to
3221 reuse strings. */ 3221 reuse strings. */
3222 tem = f->current_tool_bar_string; 3222 tem = f->current_tool_bar_string;
3223 FSET (f, current_tool_bar_string, f->desired_tool_bar_string); 3223 fset_current_tool_bar_string (f, f->desired_tool_bar_string);
3224 FSET (f, desired_tool_bar_string, tem); 3224 fset_desired_tool_bar_string (f, tem);
3225 } 3225 }
3226 } 3226 }
3227 3227
@@ -5744,7 +5744,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
5744 FrameCols (FRAME_TTY (f)) = newwidth; 5744 FrameCols (FRAME_TTY (f)) = newwidth;
5745 5745
5746 if (WINDOWP (f->tool_bar_window)) 5746 if (WINDOWP (f->tool_bar_window))
5747 WSET (XWINDOW (f->tool_bar_window), total_cols, make_number (newwidth)); 5747 wset_total_cols (XWINDOW (f->tool_bar_window), make_number (newwidth));
5748 } 5748 }
5749 5749
5750 FRAME_LINES (f) = newheight; 5750 FRAME_LINES (f) = newheight;
@@ -6044,8 +6044,7 @@ pass nil for VARIABLE. */)
6044 (Lisp_Object variable) 6044 (Lisp_Object variable)
6045{ 6045{
6046 Lisp_Object state, tail, frame, buf; 6046 Lisp_Object state, tail, frame, buf;
6047 Lisp_Object *vecp, *end; 6047 ptrdiff_t n, idx;
6048 ptrdiff_t n;
6049 6048
6050 if (! NILP (variable)) 6049 if (! NILP (variable))
6051 { 6050 {
@@ -6057,18 +6056,16 @@ pass nil for VARIABLE. */)
6057 else 6056 else
6058 state = frame_and_buffer_state; 6057 state = frame_and_buffer_state;
6059 6058
6060 vecp = XVECTOR (state)->contents; 6059 idx = 0;
6061 end = vecp + ASIZE (state);
6062
6063 FOR_EACH_FRAME (tail, frame) 6060 FOR_EACH_FRAME (tail, frame)
6064 { 6061 {
6065 if (vecp == end) 6062 if (idx == ASIZE (state))
6066 goto changed; 6063 goto changed;
6067 if (!EQ (*vecp++, frame)) 6064 if (!EQ (AREF (state, idx++), frame))
6068 goto changed; 6065 goto changed;
6069 if (vecp == end) 6066 if (idx == ASIZE (state))
6070 goto changed; 6067 goto changed;
6071 if (!EQ (*vecp++, XFRAME (frame)->name)) 6068 if (!EQ (AREF (state, idx++), XFRAME (frame)->name))
6072 goto changed; 6069 goto changed;
6073 } 6070 }
6074 /* Check that the buffer info matches. */ 6071 /* Check that the buffer info matches. */
@@ -6078,23 +6075,23 @@ pass nil for VARIABLE. */)
6078 /* Ignore buffers that aren't included in buffer lists. */ 6075 /* Ignore buffers that aren't included in buffer lists. */
6079 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') 6076 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
6080 continue; 6077 continue;
6081 if (vecp == end) 6078 if (idx == ASIZE (state))
6082 goto changed; 6079 goto changed;
6083 if (!EQ (*vecp++, buf)) 6080 if (!EQ (AREF (state, idx++), buf))
6084 goto changed; 6081 goto changed;
6085 if (vecp == end) 6082 if (idx == ASIZE (state))
6086 goto changed; 6083 goto changed;
6087 if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only))) 6084 if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), read_only)))
6088 goto changed; 6085 goto changed;
6089 if (vecp == end) 6086 if (idx == ASIZE (state))
6090 goto changed; 6087 goto changed;
6091 if (!EQ (*vecp++, Fbuffer_modified_p (buf))) 6088 if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf)))
6092 goto changed; 6089 goto changed;
6093 } 6090 }
6094 if (vecp == end) 6091 if (idx == ASIZE (state))
6095 goto changed; 6092 goto changed;
6096 /* Detect deletion of a buffer at the end of the list. */ 6093 /* Detect deletion of a buffer at the end of the list. */
6097 if (EQ (*vecp, Qlambda)) 6094 if (EQ (AREF (state, idx), Qlambda))
6098 return Qnil; 6095 return Qnil;
6099 6096
6100 /* Come here if we decide the data has changed. */ 6097 /* Come here if we decide the data has changed. */
@@ -6121,11 +6118,13 @@ pass nil for VARIABLE. */)
6121 } 6118 }
6122 6119
6123 /* Record the new data in the (possibly reallocated) vector. */ 6120 /* Record the new data in the (possibly reallocated) vector. */
6124 vecp = XVECTOR (state)->contents; 6121 idx = 0;
6125 FOR_EACH_FRAME (tail, frame) 6122 FOR_EACH_FRAME (tail, frame)
6126 { 6123 {
6127 *vecp++ = frame; 6124 ASET (state, idx, frame);
6128 *vecp++ = XFRAME (frame)->name; 6125 idx++;
6126 ASET (state, idx, XFRAME (frame)->name);
6127 idx++;
6129 } 6128 }
6130 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 6129 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
6131 { 6130 {
@@ -6133,19 +6132,23 @@ pass nil for VARIABLE. */)
6133 /* Ignore buffers that aren't included in buffer lists. */ 6132 /* Ignore buffers that aren't included in buffer lists. */
6134 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') 6133 if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ')
6135 continue; 6134 continue;
6136 *vecp++ = buf; 6135 ASET (state, idx, buf);
6137 *vecp++ = BVAR (XBUFFER (buf), read_only); 6136 idx++;
6138 *vecp++ = Fbuffer_modified_p (buf); 6137 ASET (state, idx, BVAR (XBUFFER (buf), read_only));
6138 idx++;
6139 ASET (state, idx, Fbuffer_modified_p (buf));
6140 idx++;
6139 } 6141 }
6140 /* Fill up the vector with lambdas (always at least one). */ 6142 /* Fill up the vector with lambdas (always at least one). */
6141 *vecp++ = Qlambda; 6143 ASET (state, idx, Qlambda);
6142 while (vecp - XVECTOR (state)->contents 6144 idx++;
6143 < ASIZE (state)) 6145 while (idx < ASIZE (state))
6144 *vecp++ = Qlambda; 6146 {
6147 ASET (state, idx, Qlambda);
6148 idx++;
6149 }
6145 /* Make sure we didn't overflow the vector. */ 6150 /* Make sure we didn't overflow the vector. */
6146 if (vecp - XVECTOR (state)->contents 6151 eassert (idx <= ASIZE (state));
6147 > ASIZE (state))
6148 abort ();
6149 return Qt; 6152 return Qt;
6150} 6153}
6151 6154
diff --git a/src/dosfns.c b/src/dosfns.c
index e3adf25d79f..21676f4b4f5 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -473,7 +473,7 @@ x_set_title (struct frame *f, Lisp_Object name)
473 473
474 update_mode_lines = 1; 474 update_mode_lines = 1;
475 475
476 FSET (f, title, name); 476 fset_title (f, name);
477 477
478 if (NILP (name)) 478 if (NILP (name))
479 name = f->name; 479 name = f->name;
diff --git a/src/editfns.c b/src/editfns.c
index b7feb733782..0bd632d14b7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -58,10 +58,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58#include "window.h" 58#include "window.h"
59#include "blockinput.h" 59#include "blockinput.h"
60 60
61#ifndef USE_CRT_DLL
62extern char **environ;
63#endif
64
65#define TM_YEAR_BASE 1900 61#define TM_YEAR_BASE 1900
66 62
67#ifdef WINDOWSNT 63#ifdef WINDOWSNT
@@ -881,7 +877,7 @@ save_excursion_restore (Lisp_Object info)
881 info = XCDR (info); 877 info = XCDR (info);
882 tem = XCAR (info); 878 tem = XCAR (info);
883 tem1 = BVAR (current_buffer, mark_active); 879 tem1 = BVAR (current_buffer, mark_active);
884 BSET (current_buffer, mark_active, tem); 880 bset_mark_active (current_buffer, tem);
885 881
886 /* If mark is active now, and either was not active 882 /* If mark is active now, and either was not active
887 or was at a different place, run the activate hook. */ 883 or was at a different place, run the activate hook. */
@@ -2815,13 +2811,15 @@ determines whether case is significant or ignored. */)
2815static Lisp_Object 2811static Lisp_Object
2816subst_char_in_region_unwind (Lisp_Object arg) 2812subst_char_in_region_unwind (Lisp_Object arg)
2817{ 2813{
2818 return BSET (current_buffer, undo_list, arg); 2814 bset_undo_list (current_buffer, arg);
2815 return arg;
2819} 2816}
2820 2817
2821static Lisp_Object 2818static Lisp_Object
2822subst_char_in_region_unwind_1 (Lisp_Object arg) 2819subst_char_in_region_unwind_1 (Lisp_Object arg)
2823{ 2820{
2824 return BSET (current_buffer, filename, arg); 2821 bset_filename (current_buffer, arg);
2822 return arg;
2825} 2823}
2826 2824
2827DEFUN ("subst-char-in-region", Fsubst_char_in_region, 2825DEFUN ("subst-char-in-region", Fsubst_char_in_region,
@@ -2895,11 +2893,11 @@ Both characters must have the same length of multi-byte form. */)
2895 { 2893 {
2896 record_unwind_protect (subst_char_in_region_unwind, 2894 record_unwind_protect (subst_char_in_region_unwind,
2897 BVAR (current_buffer, undo_list)); 2895 BVAR (current_buffer, undo_list));
2898 BSET (current_buffer, undo_list, Qt); 2896 bset_undo_list (current_buffer, Qt);
2899 /* Don't do file-locking. */ 2897 /* Don't do file-locking. */
2900 record_unwind_protect (subst_char_in_region_unwind_1, 2898 record_unwind_protect (subst_char_in_region_unwind_1,
2901 BVAR (current_buffer, filename)); 2899 BVAR (current_buffer, filename));
2902 BSET (current_buffer, filename, Qnil); 2900 bset_filename (current_buffer, Qnil);
2903 } 2901 }
2904 2902
2905 if (pos_byte < GPT_BYTE) 2903 if (pos_byte < GPT_BYTE)
@@ -2981,7 +2979,7 @@ Both characters must have the same length of multi-byte form. */)
2981 INC_POS (pos_byte_next); 2979 INC_POS (pos_byte_next);
2982 2980
2983 if (! NILP (noundo)) 2981 if (! NILP (noundo))
2984 BSET (current_buffer, undo_list, tem); 2982 bset_undo_list (current_buffer, tem);
2985 2983
2986 UNGCPRO; 2984 UNGCPRO;
2987 } 2985 }
@@ -3644,13 +3642,13 @@ usage: (format STRING &rest OBJECTS) */)
3644 ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1; 3642 ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1;
3645 char *p; 3643 char *p;
3646 Lisp_Object buf_save_value IF_LINT (= {0}); 3644 Lisp_Object buf_save_value IF_LINT (= {0});
3647 register char *format, *end, *format_start; 3645 char *format, *end, *format_start;
3648 ptrdiff_t formatlen, nchars; 3646 ptrdiff_t formatlen, nchars;
3649 /* Nonzero if the format is multibyte. */ 3647 /* True if the format is multibyte. */
3650 int multibyte_format = 0; 3648 bool multibyte_format = 0;
3651 /* Nonzero if the output should be a multibyte string, 3649 /* True if the output should be a multibyte string,
3652 which is true if any of the inputs is one. */ 3650 which is true if any of the inputs is one. */
3653 int multibyte = 0; 3651 bool multibyte = 0;
3654 /* When we make a multibyte string, we must pay attention to the 3652 /* When we make a multibyte string, we must pay attention to the
3655 byte combining problem, i.e., a byte may be combined with a 3653 byte combining problem, i.e., a byte may be combined with a
3656 multibyte character of the previous string. This flag tells if we 3654 multibyte character of the previous string. This flag tells if we
@@ -3936,7 +3934,7 @@ usage: (format STRING &rest OBJECTS) */)
3936 3934
3937 /* If this argument has text properties, record where 3935 /* If this argument has text properties, record where
3938 in the result string it appears. */ 3936 in the result string it appears. */
3939 if (string_get_intervals (args[n])) 3937 if (string_intervals (args[n]))
3940 info[n].intervals = arg_intervals = 1; 3938 info[n].intervals = arg_intervals = 1;
3941 3939
3942 continue; 3940 continue;
@@ -4280,7 +4278,7 @@ usage: (format STRING &rest OBJECTS) */)
4280 arguments has text properties, set up text properties of the 4278 arguments has text properties, set up text properties of the
4281 result string. */ 4279 result string. */
4282 4280
4283 if (string_get_intervals (args[0]) || arg_intervals) 4281 if (string_intervals (args[0]) || arg_intervals)
4284 { 4282 {
4285 Lisp_Object len, new_len, props; 4283 Lisp_Object len, new_len, props;
4286 struct gcpro gcpro1; 4284 struct gcpro gcpro1;
@@ -4530,7 +4528,7 @@ Transposing beyond buffer boundaries is an error. */)
4530 Lisp_Object buf; 4528 Lisp_Object buf;
4531 4529
4532 XSETBUFFER (buf, current_buffer); 4530 XSETBUFFER (buf, current_buffer);
4533 cur_intv = buffer_get_intervals (current_buffer); 4531 cur_intv = buffer_intervals (current_buffer);
4534 4532
4535 validate_region (&startr1, &endr1); 4533 validate_region (&startr1, &endr1);
4536 validate_region (&startr2, &endr2); 4534 validate_region (&startr2, &endr2);
diff --git a/src/emacs.c b/src/emacs.c
index 8d458c612cc..9e7efcabbf7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -642,10 +642,6 @@ argmatch (char **argv, int argc, const char *sstr, const char *lstr,
642static void 642static void
643malloc_initialize_hook (void) 643malloc_initialize_hook (void)
644{ 644{
645#ifndef USE_CRT_DLL
646 extern char **environ;
647#endif
648
649 if (initialized) 645 if (initialized)
650 { 646 {
651 if (!malloc_using_checking) 647 if (!malloc_using_checking)
diff --git a/src/eval.c b/src/eval.c
index f3f14d60e1c..c41e3f54d4d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -133,7 +133,21 @@ Lisp_Object inhibit_lisp_code;
133static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); 133static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
134static int interactive_p (int); 134static int interactive_p (int);
135static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 135static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
136 136
137/* Functions to set Lisp_Object slots of struct specbinding. */
138
139static inline void
140set_specpdl_symbol (Lisp_Object symbol)
141{
142 specpdl_ptr->symbol = symbol;
143}
144
145static inline void
146set_specpdl_old_value (Lisp_Object oldval)
147{
148 specpdl_ptr->old_value = oldval;
149}
150
137void 151void
138init_eval_once (void) 152init_eval_once (void)
139{ 153{
@@ -3136,8 +3150,8 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3136 case SYMBOL_PLAINVAL: 3150 case SYMBOL_PLAINVAL:
3137 /* The most common case is that of a non-constant symbol with a 3151 /* The most common case is that of a non-constant symbol with a
3138 trivial value. Make that as fast as we can. */ 3152 trivial value. Make that as fast as we can. */
3139 specpdl_ptr->symbol = symbol; 3153 set_specpdl_symbol (symbol);
3140 specpdl_ptr->old_value = SYMBOL_VAL (sym); 3154 set_specpdl_old_value (SYMBOL_VAL (sym));
3141 specpdl_ptr->func = NULL; 3155 specpdl_ptr->func = NULL;
3142 ++specpdl_ptr; 3156 ++specpdl_ptr;
3143 if (!sym->constant) 3157 if (!sym->constant)
@@ -3152,7 +3166,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3152 { 3166 {
3153 Lisp_Object ovalue = find_symbol_value (symbol); 3167 Lisp_Object ovalue = find_symbol_value (symbol);
3154 specpdl_ptr->func = 0; 3168 specpdl_ptr->func = 0;
3155 specpdl_ptr->old_value = ovalue; 3169 set_specpdl_old_value (ovalue);
3156 3170
3157 eassert (sym->redirect != SYMBOL_LOCALIZED 3171 eassert (sym->redirect != SYMBOL_LOCALIZED
3158 || (EQ (SYMBOL_BLV (sym)->where, 3172 || (EQ (SYMBOL_BLV (sym)->where,
@@ -3169,12 +3183,12 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3169 if (!NILP (Flocal_variable_p (symbol, Qnil))) 3183 if (!NILP (Flocal_variable_p (symbol, Qnil)))
3170 { 3184 {
3171 eassert (sym->redirect != SYMBOL_LOCALIZED 3185 eassert (sym->redirect != SYMBOL_LOCALIZED
3172 || (BLV_FOUND (SYMBOL_BLV (sym)) 3186 || (blv_found (SYMBOL_BLV (sym))
3173 && EQ (cur_buf, SYMBOL_BLV (sym)->where))); 3187 && EQ (cur_buf, SYMBOL_BLV (sym)->where)));
3174 where = cur_buf; 3188 where = cur_buf;
3175 } 3189 }
3176 else if (sym->redirect == SYMBOL_LOCALIZED 3190 else if (sym->redirect == SYMBOL_LOCALIZED
3177 && BLV_FOUND (SYMBOL_BLV (sym))) 3191 && blv_found (SYMBOL_BLV (sym)))
3178 where = SYMBOL_BLV (sym)->where; 3192 where = SYMBOL_BLV (sym)->where;
3179 else 3193 else
3180 where = Qnil; 3194 where = Qnil;
@@ -3186,7 +3200,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3186 let_shadows_buffer_binding_p which is itself only used 3200 let_shadows_buffer_binding_p which is itself only used
3187 in set_internal for local_if_set. */ 3201 in set_internal for local_if_set. */
3188 eassert (NILP (where) || EQ (where, cur_buf)); 3202 eassert (NILP (where) || EQ (where, cur_buf));
3189 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf)); 3203 set_specpdl_symbol (Fcons (symbol, Fcons (where, cur_buf)));
3190 3204
3191 /* If SYMBOL is a per-buffer variable which doesn't have a 3205 /* If SYMBOL is a per-buffer variable which doesn't have a
3192 buffer-local value here, make the `let' change the global 3206 buffer-local value here, make the `let' change the global
@@ -3203,7 +3217,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3203 } 3217 }
3204 } 3218 }
3205 else 3219 else
3206 specpdl_ptr->symbol = symbol; 3220 set_specpdl_symbol (symbol);
3207 3221
3208 specpdl_ptr++; 3222 specpdl_ptr++;
3209 set_internal (symbol, value, Qnil, 1); 3223 set_internal (symbol, value, Qnil, 1);
@@ -3221,8 +3235,8 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
3221 if (specpdl_ptr == specpdl + specpdl_size) 3235 if (specpdl_ptr == specpdl + specpdl_size)
3222 grow_specpdl (); 3236 grow_specpdl ();
3223 specpdl_ptr->func = function; 3237 specpdl_ptr->func = function;
3224 specpdl_ptr->symbol = Qnil; 3238 set_specpdl_symbol (Qnil);
3225 specpdl_ptr->old_value = arg; 3239 set_specpdl_old_value (arg);
3226 specpdl_ptr++; 3240 specpdl_ptr++;
3227} 3241}
3228 3242
diff --git a/src/fileio.c b/src/fileio.c
index 5991a238ffc..6deca0bf1e1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -766,7 +766,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
766#endif /* DOS_NT */ 766#endif /* DOS_NT */
767 ptrdiff_t length; 767 ptrdiff_t length;
768 Lisp_Object handler, result, handled_name; 768 Lisp_Object handler, result, handled_name;
769 int multibyte; 769 bool multibyte;
770 Lisp_Object hdir; 770 Lisp_Object hdir;
771 771
772 CHECK_STRING (name); 772 CHECK_STRING (name);
@@ -1566,7 +1566,7 @@ those `/' is discarded. */)
1566 char *target = NULL; 1566 char *target = NULL;
1567 int total = 0; 1567 int total = 0;
1568 int substituted = 0; 1568 int substituted = 0;
1569 int multibyte; 1569 bool multibyte;
1570 char *xnm; 1570 char *xnm;
1571 Lisp_Object handler; 1571 Lisp_Object handler;
1572 1572
@@ -3146,12 +3146,12 @@ decide_coding_unwind (Lisp_Object unwind_data)
3146 set_buffer_internal (XBUFFER (buffer)); 3146 set_buffer_internal (XBUFFER (buffer));
3147 adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE); 3147 adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
3148 adjust_overlays_for_delete (BEG, Z - BEG); 3148 adjust_overlays_for_delete (BEG, Z - BEG);
3149 buffer_set_intervals (current_buffer, NULL); 3149 set_buffer_intervals (current_buffer, NULL);
3150 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3150 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
3151 3151
3152 /* Now we are safe to change the buffer's multibyteness directly. */ 3152 /* Now we are safe to change the buffer's multibyteness directly. */
3153 BSET (current_buffer, enable_multibyte_characters, multibyte); 3153 bset_enable_multibyte_characters (current_buffer, multibyte);
3154 BSET (current_buffer, undo_list, undo_list); 3154 bset_undo_list (current_buffer, undo_list);
3155 3155
3156 return Qnil; 3156 return Qnil;
3157} 3157}
@@ -3487,16 +3487,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3487 buf = XBUFFER (workbuf); 3487 buf = XBUFFER (workbuf);
3488 3488
3489 delete_all_overlays (buf); 3489 delete_all_overlays (buf);
3490 BSET (buf, directory, BVAR (current_buffer, directory)); 3490 bset_directory (buf, BVAR (current_buffer, directory));
3491 BSET (buf, read_only, Qnil); 3491 bset_read_only (buf, Qnil);
3492 BSET (buf, filename, Qnil); 3492 bset_filename (buf, Qnil);
3493 BSET (buf, undo_list, Qt); 3493 bset_undo_list (buf, Qt);
3494 eassert (buf->overlays_before == NULL); 3494 eassert (buf->overlays_before == NULL);
3495 eassert (buf->overlays_after == NULL); 3495 eassert (buf->overlays_after == NULL);
3496 3496
3497 set_buffer_internal (buf); 3497 set_buffer_internal (buf);
3498 Ferase_buffer (); 3498 Ferase_buffer ();
3499 BSET (buf, enable_multibyte_characters, Qnil); 3499 bset_enable_multibyte_characters (buf, Qnil);
3500 3500
3501 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0); 3501 insert_1_both ((char *) read_buf, nread, nread, 0, 0, 0);
3502 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 3502 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -4105,8 +4105,8 @@ variable `last-coding-system-used' to the coding system actually used. */)
4105 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), 4105 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
4106 Fcons (BVAR (current_buffer, undo_list), 4106 Fcons (BVAR (current_buffer, undo_list),
4107 Fcurrent_buffer ())); 4107 Fcurrent_buffer ()));
4108 BSET (current_buffer, enable_multibyte_characters, Qnil); 4108 bset_enable_multibyte_characters (current_buffer, Qnil);
4109 BSET (current_buffer, undo_list, Qt); 4109 bset_undo_list (current_buffer, Qt);
4110 record_unwind_protect (decide_coding_unwind, unwind_data); 4110 record_unwind_protect (decide_coding_unwind, unwind_data);
4111 4111
4112 if (inserted > 0 && ! NILP (Vset_auto_coding_function)) 4112 if (inserted > 0 && ! NILP (Vset_auto_coding_function))
@@ -4154,7 +4154,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4154 && NILP (replace)) 4154 && NILP (replace))
4155 /* Visiting a file with these coding system makes the buffer 4155 /* Visiting a file with these coding system makes the buffer
4156 unibyte. */ 4156 unibyte. */
4157 BSET (current_buffer, enable_multibyte_characters, Qnil); 4157 bset_enable_multibyte_characters (current_buffer, Qnil);
4158 } 4158 }
4159 4159
4160 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 4160 coding.dst_multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -4197,13 +4197,13 @@ variable `last-coding-system-used' to the coding system actually used. */)
4197 if (!NILP (visit)) 4197 if (!NILP (visit))
4198 { 4198 {
4199 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange) 4199 if (!EQ (BVAR (current_buffer, undo_list), Qt) && !nochange)
4200 BSET (current_buffer, undo_list, Qnil); 4200 bset_undo_list (current_buffer, Qnil);
4201 4201
4202 if (NILP (handler)) 4202 if (NILP (handler))
4203 { 4203 {
4204 current_buffer->modtime = mtime; 4204 current_buffer->modtime = mtime;
4205 current_buffer->modtime_size = st.st_size; 4205 current_buffer->modtime_size = st.st_size;
4206 BSET (current_buffer, filename, orig_filename); 4206 bset_filename (current_buffer, orig_filename);
4207 } 4207 }
4208 4208
4209 SAVE_MODIFF = MODIFF; 4209 SAVE_MODIFF = MODIFF;
@@ -4248,7 +4248,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4248 4248
4249 /* Save old undo list and don't record undo for decoding. */ 4249 /* Save old undo list and don't record undo for decoding. */
4250 old_undo = BVAR (current_buffer, undo_list); 4250 old_undo = BVAR (current_buffer, undo_list);
4251 BSET (current_buffer, undo_list, Qt); 4251 bset_undo_list (current_buffer, Qt);
4252 4252
4253 if (NILP (replace)) 4253 if (NILP (replace))
4254 { 4254 {
@@ -4340,7 +4340,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4340 4340
4341 if (NILP (visit)) 4341 if (NILP (visit))
4342 { 4342 {
4343 BSET (current_buffer, undo_list, old_undo); 4343 bset_undo_list (current_buffer, old_undo);
4344 if (CONSP (old_undo) && inserted != old_inserted) 4344 if (CONSP (old_undo) && inserted != old_inserted)
4345 { 4345 {
4346 /* Adjust the last undo record for the size change during 4346 /* Adjust the last undo record for the size change during
@@ -4355,7 +4355,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4355 else 4355 else
4356 /* If undo_list was Qt before, keep it that way. 4356 /* If undo_list was Qt before, keep it that way.
4357 Otherwise start with an empty undo_list. */ 4357 Otherwise start with an empty undo_list. */
4358 BSET (current_buffer, undo_list, EQ (old_undo, Qt) ? Qt : Qnil); 4358 bset_undo_list (current_buffer, EQ (old_undo, Qt) ? Qt : Qnil);
4359 4359
4360 unbind_to (count1, Qnil); 4360 unbind_to (count1, Qnil);
4361 } 4361 }
@@ -4595,7 +4595,7 @@ This calls `write-region-annotate-functions' at the start, and
4595 { 4595 {
4596 SAVE_MODIFF = MODIFF; 4596 SAVE_MODIFF = MODIFF;
4597 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4597 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4598 BSET (current_buffer, filename, visit_file); 4598 bset_filename (current_buffer, visit_file);
4599 } 4599 }
4600 UNGCPRO; 4600 UNGCPRO;
4601 return val; 4601 return val;
@@ -4811,7 +4811,7 @@ This calls `write-region-annotate-functions' at the start, and
4811 { 4811 {
4812 SAVE_MODIFF = MODIFF; 4812 SAVE_MODIFF = MODIFF;
4813 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); 4813 XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
4814 BSET (current_buffer, filename, visit_file); 4814 bset_filename (current_buffer, visit_file);
4815 update_mode_lines++; 4815 update_mode_lines++;
4816 } 4816 }
4817 else if (quietly) 4817 else if (quietly)
@@ -5306,7 +5306,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5306 FILE *stream = NULL; 5306 FILE *stream = NULL;
5307 ptrdiff_t count = SPECPDL_INDEX (); 5307 ptrdiff_t count = SPECPDL_INDEX ();
5308 int orig_minibuffer_auto_raise = minibuffer_auto_raise; 5308 int orig_minibuffer_auto_raise = minibuffer_auto_raise;
5309 int old_message_p = 0; 5309 bool old_message_p = 0;
5310 struct gcpro gcpro1, gcpro2; 5310 struct gcpro gcpro1, gcpro2;
5311 5311
5312 if (max_specpdl_size < specpdl_size + 40) 5312 if (max_specpdl_size < specpdl_size + 40)
diff --git a/src/fns.c b/src/fns.c
index 039c208b0d3..3225fefc5e3 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -628,7 +628,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
628 ptrdiff_t thislen_byte = SBYTES (this); 628 ptrdiff_t thislen_byte = SBYTES (this);
629 629
630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); 630 memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
631 if (string_get_intervals (this)) 631 if (string_intervals (this))
632 { 632 {
633 textprops[num_textprops].argnum = argnum; 633 textprops[num_textprops].argnum = argnum;
634 textprops[num_textprops].from = 0; 634 textprops[num_textprops].from = 0;
@@ -640,7 +640,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
640 /* Copy a single-byte string to a multibyte string. */ 640 /* Copy a single-byte string to a multibyte string. */
641 else if (STRINGP (this) && STRINGP (val)) 641 else if (STRINGP (this) && STRINGP (val))
642 { 642 {
643 if (string_get_intervals (this)) 643 if (string_intervals (this))
644 { 644 {
645 textprops[num_textprops].argnum = argnum; 645 textprops[num_textprops].argnum = argnum;
646 textprops[num_textprops].from = 0; 646 textprops[num_textprops].from = 0;
@@ -1060,7 +1060,7 @@ If you're not sure, whether to use `string-as-multibyte' or
1060 str_as_multibyte (SDATA (new_string), nbytes, 1060 str_as_multibyte (SDATA (new_string), nbytes,
1061 SBYTES (string), NULL); 1061 SBYTES (string), NULL);
1062 string = new_string; 1062 string = new_string;
1063 string_set_intervals (string, NULL); 1063 set_string_intervals (string, NULL);
1064 } 1064 }
1065 return string; 1065 return string;
1066} 1066}
@@ -2139,19 +2139,15 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2139 register ptrdiff_t size, idx; 2139 register ptrdiff_t size, idx;
2140 2140
2141 if (VECTORP (array)) 2141 if (VECTORP (array))
2142 { 2142 for (idx = 0, size = ASIZE (array); idx < size; idx++)
2143 register Lisp_Object *p = XVECTOR (array)->contents; 2143 ASET (array, idx, item);
2144 size = ASIZE (array);
2145 for (idx = 0; idx < size; idx++)
2146 p[idx] = item;
2147 }
2148 else if (CHAR_TABLE_P (array)) 2144 else if (CHAR_TABLE_P (array))
2149 { 2145 {
2150 int i; 2146 int i;
2151 2147
2152 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++) 2148 for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
2153 char_table_set_contents (array, i, item); 2149 set_char_table_contents (array, i, item);
2154 CSET (XCHAR_TABLE (array), defalt, item); 2150 set_char_table_defalt (array, item);
2155 } 2151 }
2156 else if (STRINGP (array)) 2152 else if (STRINGP (array))
2157 { 2153 {
@@ -3663,7 +3659,7 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
3663 3659
3664 /* Set up the free list. */ 3660 /* Set up the free list. */
3665 for (i = 0; i < sz - 1; ++i) 3661 for (i = 0; i < sz - 1; ++i)
3666 set_hash_next (h, i, make_number (i + 1)); 3662 set_hash_next_slot (h, i, make_number (i + 1));
3667 h->next_free = make_number (0); 3663 h->next_free = make_number (0);
3668 3664
3669 XSET_HASH_TABLE (table, h); 3665 XSET_HASH_TABLE (table, h);
@@ -3760,17 +3756,17 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3760 } 3756 }
3761#endif 3757#endif
3762 3758
3763 h->key_and_value = larger_vector (h->key_and_value, 3759 set_hash_key_and_value (h, larger_vector (h->key_and_value,
3764 2 * (new_size - old_size), -1); 3760 2 * (new_size - old_size), -1));
3765 h->next = larger_vector (h->next, new_size - old_size, -1); 3761 set_hash_next (h, larger_vector (h->next, new_size - old_size, -1));
3766 h->hash = larger_vector (h->hash, new_size - old_size, -1); 3762 set_hash_hash (h, larger_vector (h->hash, new_size - old_size, -1));
3767 h->index = Fmake_vector (make_number (index_size), Qnil); 3763 set_hash_index (h, Fmake_vector (make_number (index_size), Qnil));
3768 3764
3769 /* Update the free list. Do it so that new entries are added at 3765 /* Update the free list. Do it so that new entries are added at
3770 the end of the free list. This makes some operations like 3766 the end of the free list. This makes some operations like
3771 maphash faster. */ 3767 maphash faster. */
3772 for (i = old_size; i < new_size - 1; ++i) 3768 for (i = old_size; i < new_size - 1; ++i)
3773 set_hash_next (h, i, make_number (i + 1)); 3769 set_hash_next_slot (h, i, make_number (i + 1));
3774 3770
3775 if (!NILP (h->next_free)) 3771 if (!NILP (h->next_free))
3776 { 3772 {
@@ -3781,7 +3777,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3781 !NILP (next)) 3777 !NILP (next))
3782 last = next; 3778 last = next;
3783 3779
3784 set_hash_next (h, XFASTINT (last), make_number (old_size)); 3780 set_hash_next_slot (h, XFASTINT (last), make_number (old_size));
3785 } 3781 }
3786 else 3782 else
3787 XSETFASTINT (h->next_free, old_size); 3783 XSETFASTINT (h->next_free, old_size);
@@ -3792,8 +3788,8 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
3792 { 3788 {
3793 EMACS_UINT hash_code = XUINT (HASH_HASH (h, i)); 3789 EMACS_UINT hash_code = XUINT (HASH_HASH (h, i));
3794 ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index); 3790 ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
3795 set_hash_next (h, i, HASH_INDEX (h, start_of_bucket)); 3791 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
3796 set_hash_index (h, start_of_bucket, make_number (i)); 3792 set_hash_index_slot (h, start_of_bucket, make_number (i));
3797 } 3793 }
3798 } 3794 }
3799} 3795}
@@ -3852,16 +3848,16 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value,
3852 /* Store key/value in the key_and_value vector. */ 3848 /* Store key/value in the key_and_value vector. */
3853 i = XFASTINT (h->next_free); 3849 i = XFASTINT (h->next_free);
3854 h->next_free = HASH_NEXT (h, i); 3850 h->next_free = HASH_NEXT (h, i);
3855 set_hash_key (h, i, key); 3851 set_hash_key_slot (h, i, key);
3856 set_hash_value (h, i, value); 3852 set_hash_value_slot (h, i, value);
3857 3853
3858 /* Remember its hash code. */ 3854 /* Remember its hash code. */
3859 set_hash_hash (h, i, make_number (hash)); 3855 set_hash_hash_slot (h, i, make_number (hash));
3860 3856
3861 /* Add new entry to its collision chain. */ 3857 /* Add new entry to its collision chain. */
3862 start_of_bucket = hash % ASIZE (h->index); 3858 start_of_bucket = hash % ASIZE (h->index);
3863 set_hash_next (h, i, HASH_INDEX (h, start_of_bucket)); 3859 set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
3864 set_hash_index (h, start_of_bucket, make_number (i)); 3860 set_hash_index_slot (h, start_of_bucket, make_number (i));
3865 return i; 3861 return i;
3866} 3862}
3867 3863
@@ -3892,16 +3888,16 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
3892 { 3888 {
3893 /* Take entry out of collision chain. */ 3889 /* Take entry out of collision chain. */
3894 if (NILP (prev)) 3890 if (NILP (prev))
3895 set_hash_index (h, start_of_bucket, HASH_NEXT (h, i)); 3891 set_hash_index_slot (h, start_of_bucket, HASH_NEXT (h, i));
3896 else 3892 else
3897 set_hash_next (h, XFASTINT (prev), HASH_NEXT (h, i)); 3893 set_hash_next_slot (h, XFASTINT (prev), HASH_NEXT (h, i));
3898 3894
3899 /* Clear slots in key_and_value and add the slots to 3895 /* Clear slots in key_and_value and add the slots to
3900 the free list. */ 3896 the free list. */
3901 set_hash_key (h, i, Qnil); 3897 set_hash_key_slot (h, i, Qnil);
3902 set_hash_value (h, i, Qnil); 3898 set_hash_value_slot (h, i, Qnil);
3903 set_hash_hash (h, i, Qnil); 3899 set_hash_hash_slot (h, i, Qnil);
3904 set_hash_next (h, i, h->next_free); 3900 set_hash_next_slot (h, i, h->next_free);
3905 h->next_free = make_number (i); 3901 h->next_free = make_number (i);
3906 h->count--; 3902 h->count--;
3907 eassert (h->count >= 0); 3903 eassert (h->count >= 0);
@@ -3927,10 +3923,10 @@ hash_clear (struct Lisp_Hash_Table *h)
3927 3923
3928 for (i = 0; i < size; ++i) 3924 for (i = 0; i < size; ++i)
3929 { 3925 {
3930 set_hash_next (h, i, i < size - 1 ? make_number (i + 1) : Qnil); 3926 set_hash_next_slot (h, i, i < size - 1 ? make_number (i + 1) : Qnil);
3931 set_hash_key (h, i, Qnil); 3927 set_hash_key_slot (h, i, Qnil);
3932 set_hash_value (h, i, Qnil); 3928 set_hash_value_slot (h, i, Qnil);
3933 set_hash_hash (h, i, Qnil); 3929 set_hash_hash_slot (h, i, Qnil);
3934 } 3930 }
3935 3931
3936 for (i = 0; i < ASIZE (h->index); ++i) 3932 for (i = 0; i < ASIZE (h->index); ++i)
@@ -3971,8 +3967,8 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
3971 for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) 3967 for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next)
3972 { 3968 {
3973 ptrdiff_t i = XFASTINT (idx); 3969 ptrdiff_t i = XFASTINT (idx);
3974 int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); 3970 bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
3975 int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); 3971 bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
3976 int remove_p; 3972 int remove_p;
3977 3973
3978 if (EQ (h->weak, Qkey)) 3974 if (EQ (h->weak, Qkey))
@@ -3994,18 +3990,18 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
3994 { 3990 {
3995 /* Take out of collision chain. */ 3991 /* Take out of collision chain. */
3996 if (NILP (prev)) 3992 if (NILP (prev))
3997 set_hash_index (h, bucket, next); 3993 set_hash_index_slot (h, bucket, next);
3998 else 3994 else
3999 set_hash_next (h, XFASTINT (prev), next); 3995 set_hash_next_slot (h, XFASTINT (prev), next);
4000 3996
4001 /* Add to free list. */ 3997 /* Add to free list. */
4002 set_hash_next (h, i, h->next_free); 3998 set_hash_next_slot (h, i, h->next_free);
4003 h->next_free = idx; 3999 h->next_free = idx;
4004 4000
4005 /* Clear key, value, and hash. */ 4001 /* Clear key, value, and hash. */
4006 set_hash_key (h, i, Qnil); 4002 set_hash_key_slot (h, i, Qnil);
4007 set_hash_value (h, i, Qnil); 4003 set_hash_value_slot (h, i, Qnil);
4008 set_hash_hash (h, i, Qnil); 4004 set_hash_hash_slot (h, i, Qnil);
4009 4005
4010 h->count--; 4006 h->count--;
4011 } 4007 }
@@ -4512,7 +4508,7 @@ VALUE. In any case, return VALUE. */)
4512 4508
4513 i = hash_lookup (h, key, &hash); 4509 i = hash_lookup (h, key, &hash);
4514 if (i >= 0) 4510 if (i >= 0)
4515 set_hash_value (h, i, value); 4511 set_hash_value_slot (h, i, value);
4516 else 4512 else
4517 hash_put (h, key, value, hash); 4513 hash_put (h, key, value, hash);
4518 4514
diff --git a/src/fontset.c b/src/fontset.c
index 82d668a3871..01e38fe45e5 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -185,8 +185,7 @@ void (*check_window_system_func) (void);
185 185
186 186
187/* Prototype declarations for static functions. */ 187/* Prototype declarations for static functions. */
188static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, 188static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
189 Lisp_Object);
190static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, 189static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *,
191 int, int); 190 int, int);
192static void reorder_font_vector (Lisp_Object, struct font *); 191static void reorder_font_vector (Lisp_Object, struct font *);
@@ -213,27 +212,71 @@ fontset_id_valid_p (int id)
213/* Return the fontset with ID. No check of ID's validness. */ 212/* Return the fontset with ID. No check of ID's validness. */
214#define FONTSET_FROM_ID(id) AREF (Vfontset_table, id) 213#define FONTSET_FROM_ID(id) AREF (Vfontset_table, id)
215 214
216/* Macros to access special values of FONTSET. */ 215/* Access special values of FONTSET. */
217#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
218 216
219/* Macros to access special values of (base) FONTSET. */ 217#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0]
220#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] 218static void
221#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] 219set_fontset_id (Lisp_Object fontset, Lisp_Object id)
222/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */ 220{
221 set_char_table_extras (fontset, 0, id);
222}
223
224/* Access special values of (base) FONTSET. */
225
226#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
227static void
228set_fontset_name (Lisp_Object fontset, Lisp_Object name)
229{
230 set_char_table_extras (fontset, 1, name);
231}
232
233#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
234static void
235set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii)
236{
237 set_char_table_extras (fontset, 4, ascii);
238}
239
240/* Access special values of (realized) FONTSET. */
241
242#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
243static void
244set_fontset_base (Lisp_Object fontset, Lisp_Object base)
245{
246 set_char_table_extras (fontset, 2, base);
247}
248
249#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
250static void
251set_fontset_frame (Lisp_Object fontset, Lisp_Object frame)
252{
253 set_char_table_extras (fontset, 3, frame);
254}
223 255
224/* Macros to access special values of (realized) FONTSET. */ 256#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
225#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 257static void
226#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 258set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face)
227/* #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] */ 259{
228#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 260 set_char_table_extras (fontset, 5, face);
229/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */ 261}
230#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 262
263#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
264static void
265set_fontset_default (Lisp_Object fontset, Lisp_Object def)
266{
267 set_char_table_extras (fontset, 7, def);
268}
231 269
232/* For both base and realized fontset. */ 270/* For both base and realized fontset. */
233#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
234 271
235#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) 272#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8]
273static void
274set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
275{
276 set_char_table_extras (fontset, 8, fallback);
277}
236 278
279#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
237 280
238/* Macros for FONT-DEF and RFONT-DEF of fontset. */ 281/* Macros for FONT-DEF and RFONT-DEF of fontset. */
239#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \ 282#define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \
@@ -265,7 +308,7 @@ fontset_id_valid_p (int id)
265#define RFONT_DEF_NEW(rfont_def, font_def) \ 308#define RFONT_DEF_NEW(rfont_def, font_def) \
266 do { \ 309 do { \
267 (rfont_def) = Fmake_vector (make_number (4), Qnil); \ 310 (rfont_def) = Fmake_vector (make_number (4), Qnil); \
268 ASET ((rfont_def), 1, (font_def)); \ 311 ASET ((rfont_def), 1, (font_def)); \
269 RFONT_DEF_SET_SCORE ((rfont_def), 0); \ 312 RFONT_DEF_SET_SCORE ((rfont_def), 0); \
270 } while (0) 313 } while (0)
271 314
@@ -307,15 +350,17 @@ fontset_ref (Lisp_Object fontset, int c)
307 replace with ELT, if ADD is `prepend', prepend ELT, otherwise, 350 replace with ELT, if ADD is `prepend', prepend ELT, otherwise,
308 append ELT. */ 351 append ELT. */
309 352
310#define FONTSET_ADD(fontset, range, elt, add) \ 353#define FONTSET_ADD(fontset, range, elt, add) \
311 (NILP (add) \ 354 (NILP (add) \
312 ? (NILP (range) \ 355 ? (NILP (range) \
313 ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \ 356 ? (set_fontset_fallback \
314 : Fset_char_table_range ((fontset), (range), \ 357 (fontset, Fmake_vector (make_number (1), (elt)))) \
315 Fmake_vector (make_number (1), (elt)))) \ 358 : ((void) \
359 Fset_char_table_range (fontset, range, \
360 Fmake_vector (make_number (1), elt)))) \
316 : fontset_add ((fontset), (range), (elt), (add))) 361 : fontset_add ((fontset), (range), (elt), (add)))
317 362
318static Lisp_Object 363static void
319fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add) 364fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add)
320{ 365{
321 Lisp_Object args[2]; 366 Lisp_Object args[2];
@@ -341,10 +386,9 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec
341 else 386 else
342 { 387 {
343 args[idx] = FONTSET_FALLBACK (fontset); 388 args[idx] = FONTSET_FALLBACK (fontset);
344 FONTSET_FALLBACK (fontset) 389 set_fontset_fallback
345 = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args); 390 (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args));
346 } 391 }
347 return Qnil;
348} 392}
349 393
350static int 394static int
@@ -485,7 +529,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
485 if (c >= 0) 529 if (c >= 0)
486 char_table_set_range (fontset, from, to, font_group); 530 char_table_set_range (fontset, from, to, font_group);
487 else 531 else
488 FONTSET_FALLBACK (fontset) = font_group; 532 set_fontset_fallback (fontset, font_group);
489 return font_group; 533 return font_group;
490} 534}
491 535
@@ -720,8 +764,9 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
720 if (! EQ (base_fontset, Vdefault_fontset)) 764 if (! EQ (base_fontset, Vdefault_fontset))
721 { 765 {
722 if (NILP (FONTSET_DEFAULT (fontset))) 766 if (NILP (FONTSET_DEFAULT (fontset)))
723 FONTSET_DEFAULT (fontset) 767 set_fontset_default
724 = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); 768 (fontset,
769 make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset));
725 FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); 770 FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil);
726 default_rfont_def 771 default_rfont_def
727 = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); 772 = 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)
781 826
782 fontset = Fmake_char_table (Qfontset, Qnil); 827 fontset = Fmake_char_table (Qfontset, Qnil);
783 828
784 FONTSET_ID (fontset) = make_number (id); 829 set_fontset_id (fontset, make_number (id));
785 if (NILP (base)) 830 if (NILP (base))
786 { 831 set_fontset_name (fontset, name);
787 FONTSET_NAME (fontset) = name;
788 }
789 else 832 else
790 { 833 {
791 FONTSET_NAME (fontset) = Qnil; 834 set_fontset_name (fontset, Qnil);
792 FONTSET_FRAME (fontset) = frame; 835 set_fontset_frame (fontset, frame);
793 FONTSET_BASE (fontset) = base; 836 set_fontset_base (fontset, base);
794 } 837 }
795 838
796 ASET (Vfontset_table, id, fontset); 839 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
958 else 1001 else
959 { 1002 {
960 face_id = face_for_font (f, Qnil, face); 1003 face_id = face_for_font (f, Qnil, face);
961 FONTSET_NOFONT_FACE (fontset) = make_number (face_id); 1004 set_fontset_nofont_face (fontset, make_number (face_id));
962 } 1005 }
963 } 1006 }
964 eassert (face_id >= 0); 1007 eassert (face_id >= 0);
@@ -1580,7 +1623,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1580 Lisp_Object tail, fr, alist; 1623 Lisp_Object tail, fr, alist;
1581 int fontset_id = XINT (FONTSET_ID (fontset)); 1624 int fontset_id = XINT (FONTSET_ID (fontset));
1582 1625
1583 FONTSET_ASCII (fontset) = fontname; 1626 set_fontset_ascii (fontset, fontname);
1584 name = FONTSET_NAME (fontset); 1627 name = FONTSET_NAME (fontset);
1585 FOR_EACH_FRAME (tail, fr) 1628 FOR_EACH_FRAME (tail, fr)
1586 { 1629 {
@@ -1658,7 +1701,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
1658 len = font_unparse_xlfd (font_spec, 0, xlfd, 256); 1701 len = font_unparse_xlfd (font_spec, 0, xlfd, 256);
1659 if (len < 0) 1702 if (len < 0)
1660 error ("Invalid fontset name (perhaps too long): %s", SDATA (name)); 1703 error ("Invalid fontset name (perhaps too long): %s", SDATA (name));
1661 FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len); 1704 set_fontset_ascii (fontset, make_unibyte_string (xlfd, len));
1662 } 1705 }
1663 else 1706 else
1664 { 1707 {
@@ -1744,7 +1787,7 @@ fontset_from_font (Lisp_Object font_object)
1744 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil); 1787 Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil);
1745 } 1788 }
1746 1789
1747 FONTSET_ASCII (fontset) = font_name; 1790 set_fontset_ascii (fontset, font_name);
1748 1791
1749 return XINT (FONTSET_ID (fontset)); 1792 return XINT (FONTSET_ID (fontset));
1750} 1793}
@@ -1916,7 +1959,7 @@ format is the same as above. */)
1916 if (!EQ (fontset, Vdefault_fontset)) 1959 if (!EQ (fontset, Vdefault_fontset))
1917 { 1960 {
1918 tables[1] = Fmake_char_table (Qnil, Qnil); 1961 tables[1] = Fmake_char_table (Qnil, Qnil);
1919 char_table_set_extras (tables[0], 0, tables[1]); 1962 set_char_table_extras (tables[0], 0, tables[1]);
1920 fontsets[1] = Vdefault_fontset; 1963 fontsets[1] = Vdefault_fontset;
1921 } 1964 }
1922 1965
@@ -1979,7 +2022,7 @@ format is the same as above. */)
1979 if (c <= MAX_5_BYTE_CHAR) 2022 if (c <= MAX_5_BYTE_CHAR)
1980 char_table_set_range (tables[k], c, to, alist); 2023 char_table_set_range (tables[k], c, to, alist);
1981 else 2024 else
1982 CSET (XCHAR_TABLE (tables[k]), defalt, alist); 2025 set_char_table_defalt (tables[k], alist);
1983 2026
1984 /* At last, change each elements to font names. */ 2027 /* At last, change each elements to font names. */
1985 for (; CONSP (alist); alist = XCDR (alist)) 2028 for (; CONSP (alist); alist = XCDR (alist))
@@ -2161,9 +2204,10 @@ syms_of_fontset (void)
2161 2204
2162 Vdefault_fontset = Fmake_char_table (Qfontset, Qnil); 2205 Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
2163 staticpro (&Vdefault_fontset); 2206 staticpro (&Vdefault_fontset);
2164 FONTSET_ID (Vdefault_fontset) = make_number (0); 2207 set_fontset_id (Vdefault_fontset, make_number (0));
2165 FONTSET_NAME (Vdefault_fontset) 2208 set_fontset_name
2166 = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); 2209 (Vdefault_fontset,
2210 build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
2167 ASET (Vfontset_table, 0, Vdefault_fontset); 2211 ASET (Vfontset_table, 0, Vdefault_fontset);
2168 next_fontset_id = 1; 2212 next_fontset_id = 1;
2169 2213
diff --git a/src/frame.c b/src/frame.c
index 9dabae55abc..a00f44a1e5a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21 21
22#define FRAME_INLINE EXTERN_INLINE
23
22#include <stdio.h> 24#include <stdio.h>
23#include <errno.h> 25#include <errno.h>
24#include <limits.h> 26#include <limits.h>
@@ -127,6 +129,18 @@ static Lisp_Object Qdelete_frame_functions;
127static void x_report_frame_params (struct frame *, Lisp_Object *); 129static void x_report_frame_params (struct frame *, Lisp_Object *);
128#endif 130#endif
129 131
132/* These setters are used only in this file, so they can be private. */
133static inline void
134fset_buffer_predicate (struct frame *f, Lisp_Object val)
135{
136 f->buffer_predicate = val;
137}
138static inline void
139fset_minibuffer_window (struct frame *f, Lisp_Object val)
140{
141 f->minibuffer_window = val;
142}
143
130 144
131static void 145static void
132set_menu_bar_lines_1 (Lisp_Object window, int n) 146set_menu_bar_lines_1 (Lisp_Object window, int n)
@@ -134,8 +148,8 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
134 struct window *w = XWINDOW (window); 148 struct window *w = XWINDOW (window);
135 149
136 w->last_modified = 0; 150 w->last_modified = 0;
137 WSET (w, top_line, make_number (XFASTINT (w->top_line) + n)); 151 wset_top_line (w, make_number (XFASTINT (w->top_line) + n));
138 WSET (w, total_lines, make_number (XFASTINT (w->total_lines) - n)); 152 wset_total_lines (w, make_number (XFASTINT (w->total_lines) - n));
139 153
140 /* Handle just the top child in a vertical split. */ 154 /* Handle just the top child in a vertical split. */
141 if (!NILP (w->vchild)) 155 if (!NILP (w->vchild))
@@ -271,7 +285,7 @@ make_frame (int mini_p)
271 285
272 /* Initialize Lisp data. Note that allocate_frame initializes all 286 /* Initialize Lisp data. Note that allocate_frame initializes all
273 Lisp data to nil, so do it only for slots which should not be nil. */ 287 Lisp data to nil, so do it only for slots which should not be nil. */
274 FSET (f, tool_bar_position, Qtop); 288 fset_tool_bar_position (f, Qtop);
275 289
276 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all 290 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
277 non-Lisp data, so do it only for slots which should not be zero. 291 non-Lisp data, so do it only for slots which should not be zero.
@@ -291,20 +305,20 @@ make_frame (int mini_p)
291 if (mini_p) 305 if (mini_p)
292 { 306 {
293 mini_window = make_window (); 307 mini_window = make_window ();
294 WSET (XWINDOW (root_window), next, mini_window); 308 wset_next (XWINDOW (root_window), mini_window);
295 WSET (XWINDOW (mini_window), prev, root_window); 309 wset_prev (XWINDOW (mini_window), root_window);
296 XWINDOW (mini_window)->mini = 1; 310 XWINDOW (mini_window)->mini = 1;
297 WSET (XWINDOW (mini_window), frame, frame); 311 wset_frame (XWINDOW (mini_window), frame);
298 FSET (f, minibuffer_window, mini_window); 312 fset_minibuffer_window (f, mini_window);
299 } 313 }
300 else 314 else
301 { 315 {
302 mini_window = Qnil; 316 mini_window = Qnil;
303 WSET (XWINDOW (root_window), next, Qnil); 317 wset_next (XWINDOW (root_window), Qnil);
304 FSET (f, minibuffer_window, Qnil); 318 fset_minibuffer_window (f, Qnil);
305 } 319 }
306 320
307 WSET (XWINDOW (root_window), frame, frame); 321 wset_frame (XWINDOW (root_window), frame);
308 322
309 /* 10 is arbitrary, 323 /* 10 is arbitrary,
310 just so that there is "something there." 324 just so that there is "something there."
@@ -313,21 +327,21 @@ make_frame (int mini_p)
313 SET_FRAME_COLS (f, 10); 327 SET_FRAME_COLS (f, 10);
314 FRAME_LINES (f) = 10; 328 FRAME_LINES (f) = 10;
315 329
316 WSET (XWINDOW (root_window), total_cols, make_number (10)); 330 wset_total_cols (XWINDOW (root_window), make_number (10));
317 WSET (XWINDOW (root_window), total_lines, make_number (mini_p ? 9 : 10)); 331 wset_total_lines (XWINDOW (root_window), make_number (mini_p ? 9 : 10));
318 332
319 if (mini_p) 333 if (mini_p)
320 { 334 {
321 WSET (XWINDOW (mini_window), total_cols, make_number (10)); 335 wset_total_cols (XWINDOW (mini_window), make_number (10));
322 WSET (XWINDOW (mini_window), top_line, make_number (9)); 336 wset_top_line (XWINDOW (mini_window), make_number (9));
323 WSET (XWINDOW (mini_window), total_lines, make_number (1)); 337 wset_total_lines (XWINDOW (mini_window), make_number (1));
324 } 338 }
325 339
326 /* Choose a buffer for the frame's root window. */ 340 /* Choose a buffer for the frame's root window. */
327 { 341 {
328 Lisp_Object buf; 342 Lisp_Object buf;
329 343
330 WSET (XWINDOW (root_window), buffer, Qt); 344 wset_buffer (XWINDOW (root_window), Qt);
331 buf = Fcurrent_buffer (); 345 buf = Fcurrent_buffer ();
332 /* If buf is a 'hidden' buffer (i.e. one whose name starts with 346 /* If buf is a 'hidden' buffer (i.e. one whose name starts with
333 a space), try to find another one. */ 347 a space), try to find another one. */
@@ -341,12 +355,12 @@ make_frame (int mini_p)
341 etc. Running Lisp functions at this point surely ends in a 355 etc. Running Lisp functions at this point surely ends in a
342 SEGV. */ 356 SEGV. */
343 set_window_buffer (root_window, buf, 0, 0); 357 set_window_buffer (root_window, buf, 0, 0);
344 FSET (f, buffer_list, Fcons (buf, Qnil)); 358 fset_buffer_list (f, Fcons (buf, Qnil));
345 } 359 }
346 360
347 if (mini_p) 361 if (mini_p)
348 { 362 {
349 WSET (XWINDOW (mini_window), buffer, Qt); 363 wset_buffer (XWINDOW (mini_window), Qt);
350 set_window_buffer (mini_window, 364 set_window_buffer (mini_window,
351 (NILP (Vminibuffer_list) 365 (NILP (Vminibuffer_list)
352 ? get_minibuffer (0) 366 ? get_minibuffer (0)
@@ -354,8 +368,8 @@ make_frame (int mini_p)
354 0, 0); 368 0, 0);
355 } 369 }
356 370
357 FSET (f, root_window, root_window); 371 fset_root_window (f, root_window);
358 FSET (f, selected_window, root_window); 372 fset_selected_window (f, root_window);
359 /* Make sure this window seems more recently used than 373 /* Make sure this window seems more recently used than
360 a newly-created, never-selected window. */ 374 a newly-created, never-selected window. */
361 XWINDOW (f->selected_window)->use_time = ++window_select_count; 375 XWINDOW (f->selected_window)->use_time = ++window_select_count;
@@ -395,8 +409,8 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
395 XSETFRAME (frame_dummy, f); 409 XSETFRAME (frame_dummy, f);
396 GCPRO1 (frame_dummy); 410 GCPRO1 (frame_dummy);
397 /* If there's no minibuffer frame to use, create one. */ 411 /* If there's no minibuffer frame to use, create one. */
398 KSET (kb, Vdefault_minibuffer_frame, 412 kset_default_minibuffer_frame
399 call1 (intern ("make-initial-minibuffer-frame"), display)); 413 (kb, call1 (intern ("make-initial-minibuffer-frame"), display));
400 UNGCPRO; 414 UNGCPRO;
401 } 415 }
402 416
@@ -404,7 +418,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
404 = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; 418 = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window;
405 } 419 }
406 420
407 FSET (f, minibuffer_window, mini_window); 421 fset_minibuffer_window (f, mini_window);
408 422
409 /* Make the chosen minibuffer window display the proper minibuffer, 423 /* Make the chosen minibuffer window display the proper minibuffer,
410 unless it is already showing a minibuffer. */ 424 unless it is already showing a minibuffer. */
@@ -441,11 +455,12 @@ make_minibuffer_frame (void)
441 Avoid infinite looping on the window chain by marking next pointer 455 Avoid infinite looping on the window chain by marking next pointer
442 as nil. */ 456 as nil. */
443 457
444 mini_window = FSET (f, minibuffer_window, f->root_window); 458 mini_window = f->root_window;
459 fset_minibuffer_window (f, mini_window);
445 XWINDOW (mini_window)->mini = 1; 460 XWINDOW (mini_window)->mini = 1;
446 WSET (XWINDOW (mini_window), next, Qnil); 461 wset_next (XWINDOW (mini_window), Qnil);
447 WSET (XWINDOW (mini_window), prev, Qnil); 462 wset_prev (XWINDOW (mini_window), Qnil);
448 WSET (XWINDOW (mini_window), frame, frame); 463 wset_frame (XWINDOW (mini_window), frame);
449 464
450 /* Put the proper buffer in that window. */ 465 /* Put the proper buffer in that window. */
451 466
@@ -484,7 +499,7 @@ make_initial_frame (void)
484 Vframe_list = Fcons (frame, Vframe_list); 499 Vframe_list = Fcons (frame, Vframe_list);
485 500
486 tty_frame_count = 1; 501 tty_frame_count = 1;
487 FSET (f, name, build_pure_c_string ("F1")); 502 fset_name (f, build_pure_c_string ("F1"));
488 503
489 f->visible = 1; 504 f->visible = 1;
490 f->async_visible = 1; 505 f->async_visible = 1;
@@ -525,7 +540,7 @@ make_terminal_frame (struct terminal *terminal)
525 XSETFRAME (frame, f); 540 XSETFRAME (frame, f);
526 Vframe_list = Fcons (frame, Vframe_list); 541 Vframe_list = Fcons (frame, Vframe_list);
527 542
528 FSET (f, name, make_formatted_string (name, "F%"pMd, ++tty_frame_count)); 543 fset_name (f, make_formatted_string (name, "F%"pMd, ++tty_frame_count));
529 544
530 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ 545 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
531 f->async_visible = 1; /* Don't let visible be cleared later. */ 546 f->async_visible = 1; /* Don't let visible be cleared later. */
@@ -695,7 +710,7 @@ affects all frames on the same terminal device. */)
695 710
696 /* Make the frame face alist be frame-specific, so that each 711 /* Make the frame face alist be frame-specific, so that each
697 frame could change its face definitions independently. */ 712 frame could change its face definitions independently. */
698 FSET (f, face_alist, Fcopy_alist (sf->face_alist)); 713 fset_face_alist (f, Fcopy_alist (sf->face_alist));
699 /* Simple Fcopy_alist isn't enough, because we need the contents of 714 /* Simple Fcopy_alist isn't enough, because we need the contents of
700 the vectors which are the CDRs of associations in face_alist to 715 the vectors which are the CDRs of associations in face_alist to
701 be copied as well. */ 716 be copied as well. */
@@ -849,7 +864,7 @@ to that frame. */)
849 (Lisp_Object event) 864 (Lisp_Object event)
850{ 865{
851 /* Preserve prefix arg that the command loop just cleared. */ 866 /* Preserve prefix arg that the command loop just cleared. */
852 KSET (current_kboard, Vprefix_arg, Vcurrent_prefix_arg); 867 kset_prefix_arg (current_kboard, Vcurrent_prefix_arg);
853 Frun_hooks (1, &Qmouse_leave_buffer_hook); 868 Frun_hooks (1, &Qmouse_leave_buffer_hook);
854 return do_switch_frame (event, 0, 0, Qnil); 869 return do_switch_frame (event, 0, 0, Qnil);
855} 870}
@@ -1282,7 +1297,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1282 /* Mark all the windows that used to be on FRAME as deleted, and then 1297 /* Mark all the windows that used to be on FRAME as deleted, and then
1283 remove the reference to them. */ 1298 remove the reference to them. */
1284 delete_all_child_windows (f->root_window); 1299 delete_all_child_windows (f->root_window);
1285 FSET (f, root_window, Qnil); 1300 fset_root_window (f, Qnil);
1286 1301
1287 Vframe_list = Fdelq (frame, Vframe_list); 1302 Vframe_list = Fdelq (frame, Vframe_list);
1288 FRAME_SET_VISIBLE (f, 0); 1303 FRAME_SET_VISIBLE (f, 0);
@@ -1291,7 +1306,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1291 garbage collection. The frame object itself may not be garbage 1306 garbage collection. The frame object itself may not be garbage
1292 collected until much later, because recent_keys and other data 1307 collected until much later, because recent_keys and other data
1293 structures can still refer to it. */ 1308 structures can still refer to it. */
1294 FSET (f, menu_bar_vector, Qnil); 1309 fset_menu_bar_vector (f, Qnil);
1295 1310
1296 free_font_driver_list (f); 1311 free_font_driver_list (f);
1297 xfree (f->namebuf); 1312 xfree (f->namebuf);
@@ -1443,11 +1458,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1443 if (NILP (frame_with_minibuf)) 1458 if (NILP (frame_with_minibuf))
1444 abort (); 1459 abort ();
1445 1460
1446 KSET (kb, Vdefault_minibuffer_frame, frame_with_minibuf); 1461 kset_default_minibuffer_frame (kb, frame_with_minibuf);
1447 } 1462 }
1448 else 1463 else
1449 /* No frames left on this kboard--say no minibuffer either. */ 1464 /* No frames left on this kboard--say no minibuffer either. */
1450 KSET (kb, Vdefault_minibuffer_frame, Qnil); 1465 kset_default_minibuffer_frame (kb, Qnil);
1451 } 1466 }
1452 1467
1453 /* Cause frame titles to update--necessary if we now have just one frame. */ 1468 /* Cause frame titles to update--necessary if we now have just one frame. */
@@ -1685,7 +1700,7 @@ make_frame_visible_1 (Lisp_Object window)
1685 w = XWINDOW (window); 1700 w = XWINDOW (window);
1686 1701
1687 if (!NILP (w->buffer)) 1702 if (!NILP (w->buffer))
1688 BSET (XBUFFER (w->buffer), display_time, Fcurrent_time ()); 1703 bset_display_time (XBUFFER (w->buffer), Fcurrent_time ());
1689 1704
1690 if (!NILP (w->vchild)) 1705 if (!NILP (w->vchild))
1691 make_frame_visible_1 (w->vchild); 1706 make_frame_visible_1 (w->vchild);
@@ -1919,7 +1934,7 @@ The redirection lasts until `redirect-frame-focus' is called to change it. */)
1919 1934
1920 f = XFRAME (frame); 1935 f = XFRAME (frame);
1921 1936
1922 FSET (f, focus_frame, focus_frame); 1937 fset_focus_frame (f, focus_frame);
1923 1938
1924 if (FRAME_TERMINAL (f)->frame_rehighlight_hook) 1939 if (FRAME_TERMINAL (f)->frame_rehighlight_hook)
1925 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f); 1940 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f);
@@ -1984,10 +1999,10 @@ frames_discard_buffer (Lisp_Object buffer)
1984 1999
1985 FOR_EACH_FRAME (tail, frame) 2000 FOR_EACH_FRAME (tail, frame)
1986 { 2001 {
1987 FSET (XFRAME (frame), buffer_list, 2002 fset_buffer_list
1988 Fdelq (buffer, XFRAME (frame)->buffer_list)); 2003 (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buffer_list));
1989 FSET (XFRAME (frame), buried_buffer_list, 2004 fset_buried_buffer_list
1990 Fdelq (buffer, XFRAME (frame)->buried_buffer_list)); 2005 (XFRAME (frame), Fdelq (buffer, XFRAME (frame)->buried_buffer_list));
1991 } 2006 }
1992} 2007}
1993 2008
@@ -2054,7 +2069,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
2054 error ("Frame names of the form F<num> are usurped by Emacs"); 2069 error ("Frame names of the form F<num> are usurped by Emacs");
2055 } 2070 }
2056 2071
2057 FSET (f, name, name); 2072 fset_name (f, name);
2058 update_mode_lines = 1; 2073 update_mode_lines = 1;
2059} 2074}
2060 2075
@@ -2071,7 +2086,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2071 for (; CONSP (val); val = XCDR (val)) 2086 for (; CONSP (val); val = XCDR (val))
2072 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2087 if (!NILP (Fbuffer_live_p (XCAR (val))))
2073 list = Fcons (XCAR (val), list); 2088 list = Fcons (XCAR (val), list);
2074 FSET (f, buffer_list, Fnreverse (list)); 2089 fset_buffer_list (f, Fnreverse (list));
2075 return; 2090 return;
2076 } 2091 }
2077 if (EQ (prop, Qburied_buffer_list)) 2092 if (EQ (prop, Qburied_buffer_list))
@@ -2080,7 +2095,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2080 for (; CONSP (val); val = XCDR (val)) 2095 for (; CONSP (val); val = XCDR (val))
2081 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2096 if (!NILP (Fbuffer_live_p (XCAR (val))))
2082 list = Fcons (XCAR (val), list); 2097 list = Fcons (XCAR (val), list);
2083 FSET (f, buried_buffer_list, Fnreverse (list)); 2098 fset_buried_buffer_list (f, Fnreverse (list));
2084 return; 2099 return;
2085 } 2100 }
2086 2101
@@ -2098,7 +2113,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2098 case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break; 2113 case SYMBOL_PLAINVAL: case SYMBOL_FORWARDED: break;
2099 case SYMBOL_LOCALIZED: 2114 case SYMBOL_LOCALIZED:
2100 { struct Lisp_Buffer_Local_Value *blv = sym->val.blv; 2115 { struct Lisp_Buffer_Local_Value *blv = sym->val.blv;
2101 if (blv->frame_local && BLV_FOUND (blv) && XFRAME (blv->where) == f) 2116 if (blv->frame_local && blv_found (blv) && XFRAME (blv->where) == f)
2102 swap_in_global_binding (sym); 2117 swap_in_global_binding (sym);
2103 break; 2118 break;
2104 } 2119 }
@@ -2117,7 +2132,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2117 /* Update the frame parameter alist. */ 2132 /* Update the frame parameter alist. */
2118 old_alist_elt = Fassq (prop, f->param_alist); 2133 old_alist_elt = Fassq (prop, f->param_alist);
2119 if (EQ (old_alist_elt, Qnil)) 2134 if (EQ (old_alist_elt, Qnil))
2120 FSET (f, param_alist, Fcons (Fcons (prop, val), f->param_alist)); 2135 fset_param_alist (f, Fcons (Fcons (prop, val), f->param_alist));
2121 else 2136 else
2122 Fsetcdr (old_alist_elt, val); 2137 Fsetcdr (old_alist_elt, val);
2123 2138
@@ -2125,7 +2140,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2125 in addition to the alist. */ 2140 in addition to the alist. */
2126 2141
2127 if (EQ (prop, Qbuffer_predicate)) 2142 if (EQ (prop, Qbuffer_predicate))
2128 FSET (f, buffer_predicate, val); 2143 fset_buffer_predicate (f, val);
2129 2144
2130 if (! FRAME_WINDOW_P (f)) 2145 if (! FRAME_WINDOW_P (f))
2131 { 2146 {
@@ -2145,7 +2160,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2145 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); 2160 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2146 2161
2147 /* Install the chosen minibuffer window, with proper buffer. */ 2162 /* Install the chosen minibuffer window, with proper buffer. */
2148 FSET (f, minibuffer_window, val); 2163 fset_minibuffer_window (f, val);
2149 } 2164 }
2150} 2165}
2151 2166
diff --git a/src/frame.h b/src/frame.h
index e07974fb4d2..92fbda42c70 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -25,6 +25,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#include "dispextern.h" 26#include "dispextern.h"
27 27
28INLINE_HEADER_BEGIN
29#ifndef FRAME_INLINE
30# define FRAME_INLINE INLINE
31#endif
32
28 33
29/* Miscellanea. */ 34/* Miscellanea. */
30 35
@@ -80,10 +85,6 @@ struct terminal;
80 85
81struct font_driver_list; 86struct font_driver_list;
82 87
83/* Most code should use this macro to set Lisp field in struct frame. */
84
85#define FSET(f, field, value) ((f)->field = (value))
86
87struct frame 88struct frame
88{ 89{
89 struct vectorlike_header header; 90 struct vectorlike_header header;
@@ -499,6 +500,109 @@ struct frame
499 unsigned long foreground_pixel; 500 unsigned long foreground_pixel;
500}; 501};
501 502
503/* Most code should use these functions to set Lisp fields in struct frame. */
504
505FRAME_INLINE void
506fset_buffer_list (struct frame *f, Lisp_Object val)
507{
508 f->buffer_list = val;
509}
510FRAME_INLINE void
511fset_buried_buffer_list (struct frame *f, Lisp_Object val)
512{
513 f->buried_buffer_list = val;
514}
515FRAME_INLINE void
516fset_condemned_scroll_bars (struct frame *f, Lisp_Object val)
517{
518 f->condemned_scroll_bars = val;
519}
520FRAME_INLINE void
521fset_current_tool_bar_string (struct frame *f, Lisp_Object val)
522{
523 f->current_tool_bar_string = val;
524}
525FRAME_INLINE void
526fset_desired_tool_bar_string (struct frame *f, Lisp_Object val)
527{
528 f->desired_tool_bar_string = val;
529}
530FRAME_INLINE void
531fset_face_alist (struct frame *f, Lisp_Object val)
532{
533 f->face_alist = val;
534}
535FRAME_INLINE void
536fset_focus_frame (struct frame *f, Lisp_Object val)
537{
538 f->focus_frame = val;
539}
540FRAME_INLINE void
541fset_icon_name (struct frame *f, Lisp_Object val)
542{
543 f->icon_name = val;
544}
545FRAME_INLINE void
546fset_menu_bar_items (struct frame *f, Lisp_Object val)
547{
548 f->menu_bar_items = val;
549}
550FRAME_INLINE void
551fset_menu_bar_vector (struct frame *f, Lisp_Object val)
552{
553 f->menu_bar_vector = val;
554}
555FRAME_INLINE void
556fset_menu_bar_window (struct frame *f, Lisp_Object val)
557{
558 f->menu_bar_window = val;
559}
560FRAME_INLINE void
561fset_name (struct frame *f, Lisp_Object val)
562{
563 f->name = val;
564}
565FRAME_INLINE void
566fset_param_alist (struct frame *f, Lisp_Object val)
567{
568 f->param_alist = val;
569}
570FRAME_INLINE void
571fset_root_window (struct frame *f, Lisp_Object val)
572{
573 f->root_window = val;
574}
575FRAME_INLINE void
576fset_scroll_bars (struct frame *f, Lisp_Object val)
577{
578 f->scroll_bars = val;
579}
580FRAME_INLINE void
581fset_selected_window (struct frame *f, Lisp_Object val)
582{
583 f->selected_window = val;
584}
585FRAME_INLINE void
586fset_title (struct frame *f, Lisp_Object val)
587{
588 f->title = val;
589}
590FRAME_INLINE void
591fset_tool_bar_items (struct frame *f, Lisp_Object val)
592{
593 f->tool_bar_items = val;
594}
595FRAME_INLINE void
596fset_tool_bar_position (struct frame *f, Lisp_Object val)
597{
598 f->tool_bar_position = val;
599}
600FRAME_INLINE void
601fset_tool_bar_window (struct frame *f, Lisp_Object val)
602{
603 f->tool_bar_window = val;
604}
605
502#define FRAME_KBOARD(f) ((f)->terminal->kboard) 606#define FRAME_KBOARD(f) ((f)->terminal->kboard)
503 607
504/* Return a pointer to the image cache of frame F. */ 608/* Return a pointer to the image cache of frame F. */
@@ -1146,4 +1250,6 @@ extern void set_frame_menubar (FRAME_PTR, int, int);
1146 1250
1147#endif /* HAVE_WINDOW_SYSTEM */ 1251#endif /* HAVE_WINDOW_SYSTEM */
1148 1252
1253INLINE_HEADER_END
1254
1149#endif /* not EMACS_FRAME_H */ 1255#endif /* not EMACS_FRAME_H */
diff --git a/src/gnutls.c b/src/gnutls.c
index 5189f2098cf..a2573f6bd99 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -830,7 +830,7 @@ one trustfile (usually a CA bundle). */)
830 XPROCESS (proc)->gnutls_state = NULL; 830 XPROCESS (proc)->gnutls_state = NULL;
831 XPROCESS (proc)->gnutls_x509_cred = NULL; 831 XPROCESS (proc)->gnutls_x509_cred = NULL;
832 XPROCESS (proc)->gnutls_anon_cred = NULL; 832 XPROCESS (proc)->gnutls_anon_cred = NULL;
833 PSET (XPROCESS (proc), gnutls_cred_type, type); 833 pset_gnutls_cred_type (XPROCESS (proc), type);
834 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY; 834 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_EMPTY;
835 835
836 GNUTLS_LOG (1, max_log_level, "allocating credentials"); 836 GNUTLS_LOG (1, max_log_level, "allocating credentials");
diff --git a/src/indent.c b/src/indent.c
index 881e5d7ddaf..160b8c7479e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -141,7 +141,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab)
141 struct Lisp_Vector *widthtab; 141 struct Lisp_Vector *widthtab;
142 142
143 if (!VECTORP (BVAR (buf, width_table))) 143 if (!VECTORP (BVAR (buf, width_table)))
144 BSET (buf, width_table, Fmake_vector (make_number (256), make_number (0))); 144 bset_width_table (buf, Fmake_vector (make_number (256), make_number (0)));
145 widthtab = XVECTOR (BVAR (buf, width_table)); 145 widthtab = XVECTOR (BVAR (buf, width_table));
146 if (widthtab->header.size != 256) 146 if (widthtab->header.size != 256)
147 abort (); 147 abort ();
@@ -166,7 +166,7 @@ width_run_cache_on_off (void)
166 { 166 {
167 free_region_cache (current_buffer->width_run_cache); 167 free_region_cache (current_buffer->width_run_cache);
168 current_buffer->width_run_cache = 0; 168 current_buffer->width_run_cache = 0;
169 BSET (current_buffer, width_table, Qnil); 169 bset_width_table (current_buffer, Qnil);
170 } 170 }
171 } 171 }
172 else 172 else
@@ -336,7 +336,7 @@ current_column (void)
336 336
337 /* If the buffer has overlays, text properties, 337 /* If the buffer has overlays, text properties,
338 or multibyte characters, use a more general algorithm. */ 338 or multibyte characters, use a more general algorithm. */
339 if (buffer_get_intervals (current_buffer) 339 if (buffer_intervals (current_buffer)
340 || buffer_has_overlays () 340 || buffer_has_overlays ()
341 || Z != Z_BYTE) 341 || Z != Z_BYTE)
342 return current_column_1 (); 342 return current_column_1 ();
@@ -2003,7 +2003,7 @@ whether or not it is currently displayed in some window. */)
2003 old_buffer = w->buffer; 2003 old_buffer = w->buffer;
2004 old_charpos = XMARKER (w->pointm)->charpos; 2004 old_charpos = XMARKER (w->pointm)->charpos;
2005 old_bytepos = XMARKER (w->pointm)->bytepos; 2005 old_bytepos = XMARKER (w->pointm)->bytepos;
2006 WSET (w, buffer, Fcurrent_buffer ()); 2006 wset_buffer (w, Fcurrent_buffer ());
2007 set_marker_both (w->pointm, w->buffer, 2007 set_marker_both (w->pointm, w->buffer,
2008 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); 2008 BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer));
2009 } 2009 }
@@ -2146,7 +2146,7 @@ whether or not it is currently displayed in some window. */)
2146 2146
2147 if (BUFFERP (old_buffer)) 2147 if (BUFFERP (old_buffer))
2148 { 2148 {
2149 WSET (w, buffer, old_buffer); 2149 wset_buffer (w, old_buffer);
2150 set_marker_both (w->pointm, w->buffer, 2150 set_marker_both (w->pointm, w->buffer,
2151 old_charpos, old_bytepos); 2151 old_charpos, old_bytepos);
2152 } 2152 }
diff --git a/src/insdel.c b/src/insdel.c
index 14d2dab084d..1dceb67bffa 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -844,10 +844,10 @@ insert_1_both (const char *string,
844 PT + nchars, PT_BYTE + nbytes, 844 PT + nchars, PT_BYTE + nbytes,
845 before_markers); 845 before_markers);
846 846
847 if (buffer_get_intervals (current_buffer)) 847 if (buffer_intervals (current_buffer))
848 offset_intervals (current_buffer, PT, nchars); 848 offset_intervals (current_buffer, PT, nchars);
849 849
850 if (!inherit && buffer_get_intervals (current_buffer)) 850 if (!inherit && buffer_intervals (current_buffer))
851 set_text_properties (make_number (PT), make_number (PT + nchars), 851 set_text_properties (make_number (PT), make_number (PT + nchars),
852 Qnil, Qnil, Qnil); 852 Qnil, Qnil, Qnil);
853 853
@@ -976,7 +976,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
976 976
977 offset_intervals (current_buffer, PT, nchars); 977 offset_intervals (current_buffer, PT, nchars);
978 978
979 intervals = string_get_intervals (string); 979 intervals = string_intervals (string);
980 /* Get the intervals for the part of the string we are inserting. */ 980 /* Get the intervals for the part of the string we are inserting. */
981 if (nbytes < SBYTES (string)) 981 if (nbytes < SBYTES (string))
982 intervals = copy_intervals (intervals, pos, nchars); 982 intervals = copy_intervals (intervals, pos, nchars);
@@ -1017,7 +1017,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
1017 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, 1017 adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes,
1018 GPT, GPT_BYTE, 0); 1018 GPT, GPT_BYTE, 0);
1019 1019
1020 if (buffer_get_intervals (current_buffer)) 1020 if (buffer_intervals (current_buffer))
1021 { 1021 {
1022 offset_intervals (current_buffer, GPT - nchars, nchars); 1022 offset_intervals (current_buffer, GPT - nchars, nchars);
1023 graft_intervals_into_buffer (NULL, GPT - nchars, nchars, 1023 graft_intervals_into_buffer (NULL, GPT - nchars, nchars,
@@ -1157,11 +1157,11 @@ insert_from_buffer_1 (struct buffer *buf,
1157 PT_BYTE + outgoing_nbytes, 1157 PT_BYTE + outgoing_nbytes,
1158 0); 1158 0);
1159 1159
1160 if (buffer_get_intervals (current_buffer)) 1160 if (buffer_intervals (current_buffer))
1161 offset_intervals (current_buffer, PT, nchars); 1161 offset_intervals (current_buffer, PT, nchars);
1162 1162
1163 /* Get the intervals for the part of the string we are inserting. */ 1163 /* Get the intervals for the part of the string we are inserting. */
1164 intervals = buffer_get_intervals (buf); 1164 intervals = buffer_intervals (buf);
1165 if (nchars < BUF_Z (buf) - BUF_BEG (buf)) 1165 if (nchars < BUF_Z (buf) - BUF_BEG (buf))
1166 { 1166 {
1167 if (buf == current_buffer && PT <= from) 1167 if (buf == current_buffer && PT <= from)
@@ -1226,7 +1226,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1226 else if (len < nchars_del) 1226 else if (len < nchars_del)
1227 adjust_overlays_for_delete (from, nchars_del - len); 1227 adjust_overlays_for_delete (from, nchars_del - len);
1228 1228
1229 if (buffer_get_intervals (current_buffer)) 1229 if (buffer_intervals (current_buffer))
1230 offset_intervals (current_buffer, from, len - nchars_del); 1230 offset_intervals (current_buffer, from, len - nchars_del);
1231 1231
1232 if (from < PT) 1232 if (from < PT)
@@ -1412,7 +1412,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1412 1412
1413 /* Get the intervals for the part of the string we are inserting-- 1413 /* Get the intervals for the part of the string we are inserting--
1414 not including the combined-before bytes. */ 1414 not including the combined-before bytes. */
1415 intervals = string_get_intervals (new); 1415 intervals = string_intervals (new);
1416 /* Insert those intervals. */ 1416 /* Insert those intervals. */
1417 graft_intervals_into_buffer (intervals, from, inschars, 1417 graft_intervals_into_buffer (intervals, from, inschars,
1418 current_buffer, inherit); 1418 current_buffer, inherit);
@@ -1792,7 +1792,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
1792 if (! preserve_chars_modiff) 1792 if (! preserve_chars_modiff)
1793 CHARS_MODIFF = MODIFF; 1793 CHARS_MODIFF = MODIFF;
1794 1794
1795 BSET (buffer, point_before_scroll, Qnil); 1795 bset_point_before_scroll (buffer, Qnil);
1796 1796
1797 if (buffer != old_buffer) 1797 if (buffer != old_buffer)
1798 set_buffer_internal (old_buffer); 1798 set_buffer_internal (old_buffer);
@@ -1822,7 +1822,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
1822 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) 1822 if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
1823 ++windows_or_buffers_changed; 1823 ++windows_or_buffers_changed;
1824 1824
1825 if (buffer_get_intervals (current_buffer)) 1825 if (buffer_intervals (current_buffer))
1826 { 1826 {
1827 if (preserve_ptr) 1827 if (preserve_ptr)
1828 { 1828 {
diff --git a/src/intervals.c b/src/intervals.c
index b0ef7c8d3b9..0a85e20e5d9 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -62,6 +62,38 @@ static INTERVAL reproduce_tree (INTERVAL, INTERVAL);
62 62
63/* Utility functions for intervals. */ 63/* Utility functions for intervals. */
64 64
65/* Use these functions to set Lisp_Object
66 or pointer slots of struct interval. */
67
68static inline void
69set_interval_object (INTERVAL i, Lisp_Object obj)
70{
71 eassert (BUFFERP (obj) || STRINGP (obj));
72 i->up_obj = 1;
73 i->up.obj = obj;
74}
75
76static inline void
77set_interval_left (INTERVAL i, INTERVAL left)
78{
79 i->left = left;
80}
81
82static inline void
83set_interval_right (INTERVAL i, INTERVAL right)
84{
85 i->right = right;
86}
87
88/* Make the parent of D be whatever the parent of S is, regardless
89 of the type. This is used when balancing an interval tree. */
90
91static inline void
92copy_interval_parent (INTERVAL d, INTERVAL s)
93{
94 d->up = s->up;
95 d->up_obj = s->up_obj;
96}
65 97
66/* Create the root interval of some object, a buffer or string. */ 98/* Create the root interval of some object, a buffer or string. */
67 99
@@ -79,18 +111,18 @@ create_root_interval (Lisp_Object parent)
79 new->total_length = (BUF_Z (XBUFFER (parent)) 111 new->total_length = (BUF_Z (XBUFFER (parent))
80 - BUF_BEG (XBUFFER (parent))); 112 - BUF_BEG (XBUFFER (parent)));
81 eassert (0 <= TOTAL_LENGTH (new)); 113 eassert (0 <= TOTAL_LENGTH (new));
82 buffer_set_intervals (XBUFFER (parent), new); 114 set_buffer_intervals (XBUFFER (parent), new);
83 new->position = BEG; 115 new->position = BEG;
84 } 116 }
85 else if (STRINGP (parent)) 117 else if (STRINGP (parent))
86 { 118 {
87 new->total_length = SCHARS (parent); 119 new->total_length = SCHARS (parent);
88 eassert (0 <= TOTAL_LENGTH (new)); 120 eassert (0 <= TOTAL_LENGTH (new));
89 string_set_intervals (parent, new); 121 set_string_intervals (parent, new);
90 new->position = 0; 122 new->position = 0;
91 } 123 }
92 124
93 interval_set_object (new, parent); 125 set_interval_object (new, parent);
94 126
95 return new; 127 return new;
96} 128}
@@ -104,7 +136,7 @@ copy_properties (register INTERVAL source, register INTERVAL target)
104 return; 136 return;
105 137
106 COPY_INTERVAL_CACHE (source, target); 138 COPY_INTERVAL_CACHE (source, target);
107 interval_set_plist (target, Fcopy_sequence (source->plist)); 139 set_interval_plist (target, Fcopy_sequence (source->plist));
108} 140}
109 141
110/* Merge the properties of interval SOURCE into the properties 142/* Merge the properties of interval SOURCE into the properties
@@ -140,7 +172,7 @@ merge_properties (register INTERVAL source, register INTERVAL target)
140 if (NILP (val)) 172 if (NILP (val))
141 { 173 {
142 val = XCAR (o); 174 val = XCAR (o);
143 interval_set_plist (target, Fcons (sym, Fcons (val, target->plist))); 175 set_interval_plist (target, Fcons (sym, Fcons (val, target->plist)));
144 } 176 }
145 o = XCDR (o); 177 o = XCDR (o);
146 } 178 }
@@ -322,21 +354,21 @@ rotate_right (INTERVAL interval)
322 if (! ROOT_INTERVAL_P (interval)) 354 if (! ROOT_INTERVAL_P (interval))
323 { 355 {
324 if (AM_LEFT_CHILD (interval)) 356 if (AM_LEFT_CHILD (interval))
325 interval_set_left (INTERVAL_PARENT (interval), B); 357 set_interval_left (INTERVAL_PARENT (interval), B);
326 else 358 else
327 interval_set_right (INTERVAL_PARENT (interval), B); 359 set_interval_right (INTERVAL_PARENT (interval), B);
328 } 360 }
329 interval_copy_parent (B, interval); 361 copy_interval_parent (B, interval);
330 362
331 /* Make B the parent of A */ 363 /* Make B the parent of A */
332 i = B->right; 364 i = B->right;
333 interval_set_right (B, interval); 365 set_interval_right (B, interval);
334 interval_set_parent (interval, B); 366 set_interval_parent (interval, B);
335 367
336 /* Make A point to c */ 368 /* Make A point to c */
337 interval_set_left (interval, i); 369 set_interval_left (interval, i);
338 if (i) 370 if (i)
339 interval_set_parent (i, interval); 371 set_interval_parent (i, interval);
340 372
341 /* A's total length is decreased by the length of B and its left child. */ 373 /* A's total length is decreased by the length of B and its left child. */
342 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval); 374 interval->total_length -= B->total_length - LEFT_TOTAL_LENGTH (interval);
@@ -369,21 +401,21 @@ rotate_left (INTERVAL interval)
369 if (! ROOT_INTERVAL_P (interval)) 401 if (! ROOT_INTERVAL_P (interval))
370 { 402 {
371 if (AM_LEFT_CHILD (interval)) 403 if (AM_LEFT_CHILD (interval))
372 interval_set_left (INTERVAL_PARENT (interval), B); 404 set_interval_left (INTERVAL_PARENT (interval), B);
373 else 405 else
374 interval_set_right (INTERVAL_PARENT (interval), B); 406 set_interval_right (INTERVAL_PARENT (interval), B);
375 } 407 }
376 interval_copy_parent (B, interval); 408 copy_interval_parent (B, interval);
377 409
378 /* Make B the parent of A */ 410 /* Make B the parent of A */
379 i = B->left; 411 i = B->left;
380 interval_set_left (B, interval); 412 set_interval_left (B, interval);
381 interval_set_parent (interval, B); 413 set_interval_parent (interval, B);
382 414
383 /* Make A point to c */ 415 /* Make A point to c */
384 interval_set_right (interval, i); 416 set_interval_right (interval, i);
385 if (i) 417 if (i)
386 interval_set_parent (i, interval); 418 set_interval_parent (i, interval);
387 419
388 /* A's total length is decreased by the length of B and its right child. */ 420 /* A's total length is decreased by the length of B and its right child. */
389 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval); 421 interval->total_length -= B->total_length - RIGHT_TOTAL_LENGTH (interval);
@@ -455,9 +487,9 @@ balance_possible_root_interval (register INTERVAL interval)
455 if (have_parent) 487 if (have_parent)
456 { 488 {
457 if (BUFFERP (parent)) 489 if (BUFFERP (parent))
458 buffer_set_intervals (XBUFFER (parent), interval); 490 set_buffer_intervals (XBUFFER (parent), interval);
459 else if (STRINGP (parent)) 491 else if (STRINGP (parent))
460 string_set_intervals (parent, interval); 492 set_string_intervals (parent, interval);
461 } 493 }
462 494
463 return interval; 495 return interval;
@@ -493,9 +525,9 @@ buffer_balance_intervals (struct buffer *b)
493 INTERVAL i; 525 INTERVAL i;
494 526
495 eassert (b != NULL); 527 eassert (b != NULL);
496 i = buffer_get_intervals (b); 528 i = buffer_intervals (b);
497 if (i) 529 if (i)
498 buffer_set_intervals (b, balance_an_interval (i)); 530 set_buffer_intervals (b, balance_an_interval (i));
499} 531}
500 532
501/* Split INTERVAL into two pieces, starting the second piece at 533/* Split INTERVAL into two pieces, starting the second piece at
@@ -519,20 +551,20 @@ split_interval_right (INTERVAL interval, ptrdiff_t offset)
519 ptrdiff_t new_length = LENGTH (interval) - offset; 551 ptrdiff_t new_length = LENGTH (interval) - offset;
520 552
521 new->position = position + offset; 553 new->position = position + offset;
522 interval_set_parent (new, interval); 554 set_interval_parent (new, interval);
523 555
524 if (NULL_RIGHT_CHILD (interval)) 556 if (NULL_RIGHT_CHILD (interval))
525 { 557 {
526 interval_set_right (interval, new); 558 set_interval_right (interval, new);
527 new->total_length = new_length; 559 new->total_length = new_length;
528 eassert (0 <= TOTAL_LENGTH (new)); 560 eassert (0 <= TOTAL_LENGTH (new));
529 } 561 }
530 else 562 else
531 { 563 {
532 /* Insert the new node between INTERVAL and its right child. */ 564 /* Insert the new node between INTERVAL and its right child. */
533 interval_set_right (new, interval->right); 565 set_interval_right (new, interval->right);
534 interval_set_parent (interval->right, new); 566 set_interval_parent (interval->right, new);
535 interval_set_right (interval, new); 567 set_interval_right (interval, new);
536 new->total_length = new_length + new->right->total_length; 568 new->total_length = new_length + new->right->total_length;
537 eassert (0 <= TOTAL_LENGTH (new)); 569 eassert (0 <= TOTAL_LENGTH (new));
538 balance_an_interval (new); 570 balance_an_interval (new);
@@ -564,20 +596,20 @@ split_interval_left (INTERVAL interval, ptrdiff_t offset)
564 596
565 new->position = interval->position; 597 new->position = interval->position;
566 interval->position = interval->position + offset; 598 interval->position = interval->position + offset;
567 interval_set_parent (new, interval); 599 set_interval_parent (new, interval);
568 600
569 if (NULL_LEFT_CHILD (interval)) 601 if (NULL_LEFT_CHILD (interval))
570 { 602 {
571 interval_set_left (interval, new); 603 set_interval_left (interval, new);
572 new->total_length = new_length; 604 new->total_length = new_length;
573 eassert (0 <= TOTAL_LENGTH (new)); 605 eassert (0 <= TOTAL_LENGTH (new));
574 } 606 }
575 else 607 else
576 { 608 {
577 /* Insert the new node between INTERVAL and its left child. */ 609 /* Insert the new node between INTERVAL and its left child. */
578 interval_set_left (new, interval->left); 610 set_interval_left (new, interval->left);
579 interval_set_parent (new->left, new); 611 set_interval_parent (new->left, new);
580 interval_set_left (interval, new); 612 set_interval_left (interval, new);
581 new->total_length = new_length + new->left->total_length; 613 new->total_length = new_length + new->left->total_length;
582 eassert (0 <= TOTAL_LENGTH (new)); 614 eassert (0 <= TOTAL_LENGTH (new));
583 balance_an_interval (new); 615 balance_an_interval (new);
@@ -952,20 +984,20 @@ adjust_intervals_for_insertion (INTERVAL tree,
952 RESET_INTERVAL (&newi); 984 RESET_INTERVAL (&newi);
953 pleft = prev ? prev->plist : Qnil; 985 pleft = prev ? prev->plist : Qnil;
954 pright = i ? i->plist : Qnil; 986 pright = i ? i->plist : Qnil;
955 interval_set_plist (&newi, merge_properties_sticky (pleft, pright)); 987 set_interval_plist (&newi, merge_properties_sticky (pleft, pright));
956 988
957 if (! prev) /* i.e. position == BEG */ 989 if (! prev) /* i.e. position == BEG */
958 { 990 {
959 if (! intervals_equal (i, &newi)) 991 if (! intervals_equal (i, &newi))
960 { 992 {
961 i = split_interval_left (i, length); 993 i = split_interval_left (i, length);
962 interval_set_plist (i, newi.plist); 994 set_interval_plist (i, newi.plist);
963 } 995 }
964 } 996 }
965 else if (! intervals_equal (prev, &newi)) 997 else if (! intervals_equal (prev, &newi))
966 { 998 {
967 prev = split_interval_right (prev, position - prev->position); 999 prev = split_interval_right (prev, position - prev->position);
968 interval_set_plist (prev, newi.plist); 1000 set_interval_plist (prev, newi.plist);
969 if (i && intervals_equal (prev, i)) 1001 if (i && intervals_equal (prev, i))
970 merge_interval_right (prev); 1002 merge_interval_right (prev);
971 } 1003 }
@@ -1190,8 +1222,8 @@ delete_node (register INTERVAL i)
1190 this->total_length += migrate_amt; 1222 this->total_length += migrate_amt;
1191 } 1223 }
1192 eassert (0 <= TOTAL_LENGTH (this)); 1224 eassert (0 <= TOTAL_LENGTH (this));
1193 interval_set_left (this, migrate); 1225 set_interval_left (this, migrate);
1194 interval_set_parent (migrate, this); 1226 set_interval_parent (migrate, this);
1195 1227
1196 return i->right; 1228 return i->right;
1197} 1229}
@@ -1216,12 +1248,12 @@ delete_interval (register INTERVAL i)
1216 GET_INTERVAL_OBJECT (owner, i); 1248 GET_INTERVAL_OBJECT (owner, i);
1217 parent = delete_node (i); 1249 parent = delete_node (i);
1218 if (parent) 1250 if (parent)
1219 interval_set_object (parent, owner); 1251 set_interval_object (parent, owner);
1220 1252
1221 if (BUFFERP (owner)) 1253 if (BUFFERP (owner))
1222 buffer_set_intervals (XBUFFER (owner), parent); 1254 set_buffer_intervals (XBUFFER (owner), parent);
1223 else if (STRINGP (owner)) 1255 else if (STRINGP (owner))
1224 string_set_intervals (owner, parent); 1256 set_string_intervals (owner, parent);
1225 else 1257 else
1226 abort (); 1258 abort ();
1227 1259
@@ -1231,15 +1263,15 @@ delete_interval (register INTERVAL i)
1231 parent = INTERVAL_PARENT (i); 1263 parent = INTERVAL_PARENT (i);
1232 if (AM_LEFT_CHILD (i)) 1264 if (AM_LEFT_CHILD (i))
1233 { 1265 {
1234 interval_set_left (parent, delete_node (i)); 1266 set_interval_left (parent, delete_node (i));
1235 if (parent->left) 1267 if (parent->left)
1236 interval_set_parent (parent->left, parent); 1268 set_interval_parent (parent->left, parent);
1237 } 1269 }
1238 else 1270 else
1239 { 1271 {
1240 interval_set_right (parent, delete_node (i)); 1272 set_interval_right (parent, delete_node (i));
1241 if (parent->right) 1273 if (parent->right)
1242 interval_set_parent (parent->right, parent); 1274 set_interval_parent (parent->right, parent);
1243 } 1275 }
1244} 1276}
1245 1277
@@ -1320,8 +1352,8 @@ static void
1320adjust_intervals_for_deletion (struct buffer *buffer, 1352adjust_intervals_for_deletion (struct buffer *buffer,
1321 ptrdiff_t start, ptrdiff_t length) 1353 ptrdiff_t start, ptrdiff_t length)
1322{ 1354{
1323 register ptrdiff_t left_to_delete = length; 1355 ptrdiff_t left_to_delete = length;
1324 register INTERVAL tree = buffer_get_intervals (buffer); 1356 INTERVAL tree = buffer_intervals (buffer);
1325 Lisp_Object parent; 1357 Lisp_Object parent;
1326 ptrdiff_t offset; 1358 ptrdiff_t offset;
1327 1359
@@ -1336,7 +1368,7 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1336 1368
1337 if (length == TOTAL_LENGTH (tree)) 1369 if (length == TOTAL_LENGTH (tree))
1338 { 1370 {
1339 buffer_set_intervals (buffer, NULL); 1371 set_buffer_intervals (buffer, NULL);
1340 return; 1372 return;
1341 } 1373 }
1342 1374
@@ -1353,10 +1385,10 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1353 { 1385 {
1354 left_to_delete -= interval_deletion_adjustment (tree, start - offset, 1386 left_to_delete -= interval_deletion_adjustment (tree, start - offset,
1355 left_to_delete); 1387 left_to_delete);
1356 tree = buffer_get_intervals (buffer); 1388 tree = buffer_intervals (buffer);
1357 if (left_to_delete == tree->total_length) 1389 if (left_to_delete == tree->total_length)
1358 { 1390 {
1359 buffer_set_intervals (buffer, NULL); 1391 set_buffer_intervals (buffer, NULL);
1360 return; 1392 return;
1361 } 1393 }
1362 } 1394 }
@@ -1370,11 +1402,11 @@ adjust_intervals_for_deletion (struct buffer *buffer,
1370void 1402void
1371offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) 1403offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length)
1372{ 1404{
1373 if (!buffer_get_intervals (buffer) || length == 0) 1405 if (!buffer_intervals (buffer) || length == 0)
1374 return; 1406 return;
1375 1407
1376 if (length > 0) 1408 if (length > 0)
1377 adjust_intervals_for_insertion (buffer_get_intervals (buffer), 1409 adjust_intervals_for_insertion (buffer_intervals (buffer),
1378 start, length); 1410 start, length);
1379 else 1411 else
1380 { 1412 {
@@ -1510,9 +1542,9 @@ reproduce_interval (INTERVAL source)
1510 copy_properties (source, target); 1542 copy_properties (source, target);
1511 1543
1512 if (! NULL_LEFT_CHILD (source)) 1544 if (! NULL_LEFT_CHILD (source))
1513 interval_set_left (target, reproduce_tree (source->left, target)); 1545 set_interval_left (target, reproduce_tree (source->left, target));
1514 if (! NULL_RIGHT_CHILD (source)) 1546 if (! NULL_RIGHT_CHILD (source))
1515 interval_set_right (target, reproduce_tree (source->right, target)); 1547 set_interval_right (target, reproduce_tree (source->right, target));
1516 1548
1517 return target; 1549 return target;
1518} 1550}
@@ -1525,18 +1557,16 @@ reproduce_interval (INTERVAL source)
1525static INTERVAL 1557static INTERVAL
1526reproduce_tree (INTERVAL source, INTERVAL parent) 1558reproduce_tree (INTERVAL source, INTERVAL parent)
1527{ 1559{
1528 register INTERVAL target = reproduce_interval (source); 1560 INTERVAL target = reproduce_interval (source);
1529 1561 set_interval_parent (target, parent);
1530 interval_set_parent (target, parent);
1531 return target; 1562 return target;
1532} 1563}
1533 1564
1534static INTERVAL 1565static INTERVAL
1535reproduce_tree_obj (INTERVAL source, Lisp_Object parent) 1566reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
1536{ 1567{
1537 register INTERVAL target = reproduce_interval (source); 1568 INTERVAL target = reproduce_interval (source);
1538 1569 set_interval_object (target, parent);
1539 interval_set_object (target, parent);
1540 return target; 1570 return target;
1541} 1571}
1542 1572
@@ -1582,12 +1612,10 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
1582 ptrdiff_t length, struct buffer *buffer, 1612 ptrdiff_t length, struct buffer *buffer,
1583 int inherit) 1613 int inherit)
1584{ 1614{
1585 register INTERVAL under, over, this; 1615 INTERVAL tree = buffer_intervals (buffer);
1586 register INTERVAL tree; 1616 INTERVAL under, over, this;
1587 ptrdiff_t over_used; 1617 ptrdiff_t over_used;
1588 1618
1589 tree = buffer_get_intervals (buffer);
1590
1591 /* If the new text has no properties, then with inheritance it 1619 /* If the new text has no properties, then with inheritance it
1592 becomes part of whatever interval it was inserted into. 1620 becomes part of whatever interval it was inserted into.
1593 To prevent inheritance, we must clear out the properties 1621 To prevent inheritance, we must clear out the properties
@@ -1616,9 +1644,9 @@ graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
1616 Lisp_Object buf; 1644 Lisp_Object buf;
1617 1645
1618 XSETBUFFER (buf, buffer); 1646 XSETBUFFER (buf, buffer);
1619 buffer_set_intervals (buffer, reproduce_tree_obj (source, buf)); 1647 set_buffer_intervals (buffer, reproduce_tree_obj (source, buf));
1620 buffer_get_intervals (buffer)->position = BUF_BEG (buffer); 1648 buffer_intervals (buffer)->position = BUF_BEG (buffer);
1621 eassert (buffer_get_intervals (buffer)->up_obj == 1); 1649 eassert (buffer_intervals (buffer)->up_obj == 1);
1622 return; 1650 return;
1623 } 1651 }
1624 else if (!tree) 1652 else if (!tree)
@@ -1859,7 +1887,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1859 int have_overlays; 1887 int have_overlays;
1860 ptrdiff_t original_position; 1888 ptrdiff_t original_position;
1861 1889
1862 BSET (current_buffer, point_before_scroll, Qnil); 1890 bset_point_before_scroll (current_buffer, Qnil);
1863 1891
1864 if (charpos == PT) 1892 if (charpos == PT)
1865 return; 1893 return;
@@ -1876,7 +1904,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1876 1904
1877 /* If we have no text properties and overlays, 1905 /* If we have no text properties and overlays,
1878 then we can do it quickly. */ 1906 then we can do it quickly. */
1879 if (!buffer_get_intervals (current_buffer) && ! have_overlays) 1907 if (!buffer_intervals (current_buffer) && ! have_overlays)
1880 { 1908 {
1881 temp_set_point_both (current_buffer, charpos, bytepos); 1909 temp_set_point_both (current_buffer, charpos, bytepos);
1882 return; 1910 return;
@@ -1885,7 +1913,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1885 /* Set TO to the interval containing the char after CHARPOS, 1913 /* Set TO to the interval containing the char after CHARPOS,
1886 and TOPREV to the interval containing the char before CHARPOS. 1914 and TOPREV to the interval containing the char before CHARPOS.
1887 Either one may be null. They may be equal. */ 1915 Either one may be null. They may be equal. */
1888 to = find_interval (buffer_get_intervals (current_buffer), charpos); 1916 to = find_interval (buffer_intervals (current_buffer), charpos);
1889 if (charpos == BEGV) 1917 if (charpos == BEGV)
1890 toprev = 0; 1918 toprev = 0;
1891 else if (to && to->position == charpos) 1919 else if (to && to->position == charpos)
@@ -1899,7 +1927,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
1899 and FROMPREV to the interval containing the char before PT. 1927 and FROMPREV to the interval containing the char before PT.
1900 Either one may be null. They may be equal. */ 1928 Either one may be null. They may be equal. */
1901 /* We could cache this and save time. */ 1929 /* We could cache this and save time. */
1902 from = find_interval (buffer_get_intervals (current_buffer), buffer_point); 1930 from = find_interval (buffer_intervals (current_buffer), buffer_point);
1903 if (buffer_point == BEGV) 1931 if (buffer_point == BEGV)
1904 fromprev = 0; 1932 fromprev = 0;
1905 else if (from && from->position == PT) 1933 else if (from && from->position == PT)
@@ -2005,7 +2033,7 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
2005 /* Set TO to the interval containing the char after CHARPOS, 2033 /* Set TO to the interval containing the char after CHARPOS,
2006 and TOPREV to the interval containing the char before CHARPOS. 2034 and TOPREV to the interval containing the char before CHARPOS.
2007 Either one may be null. They may be equal. */ 2035 Either one may be null. They may be equal. */
2008 to = find_interval (buffer_get_intervals (current_buffer), charpos); 2036 to = find_interval (buffer_intervals (current_buffer), charpos);
2009 if (charpos == BEGV) 2037 if (charpos == BEGV)
2010 toprev = 0; 2038 toprev = 0;
2011 else if (to && to->position == charpos) 2039 else if (to && to->position == charpos)
@@ -2138,11 +2166,11 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
2138 INTERVAL i, prev, next; 2166 INTERVAL i, prev, next;
2139 2167
2140 if (NILP (object)) 2168 if (NILP (object))
2141 i = find_interval (buffer_get_intervals (current_buffer), pos); 2169 i = find_interval (buffer_intervals (current_buffer), pos);
2142 else if (BUFFERP (object)) 2170 else if (BUFFERP (object))
2143 i = find_interval (buffer_get_intervals (XBUFFER (object)), pos); 2171 i = find_interval (buffer_intervals (XBUFFER (object)), pos);
2144 else if (STRINGP (object)) 2172 else if (STRINGP (object))
2145 i = find_interval (string_get_intervals (object), pos); 2173 i = find_interval (string_intervals (object), pos);
2146 else 2174 else
2147 abort (); 2175 abort ();
2148 2176
@@ -2269,13 +2297,13 @@ void
2269copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, 2297copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
2270 ptrdiff_t position, ptrdiff_t length) 2298 ptrdiff_t position, ptrdiff_t length)
2271{ 2299{
2272 INTERVAL interval_copy = copy_intervals (buffer_get_intervals (buffer), 2300 INTERVAL interval_copy = copy_intervals (buffer_intervals (buffer),
2273 position, length); 2301 position, length);
2274 if (!interval_copy) 2302 if (!interval_copy)
2275 return; 2303 return;
2276 2304
2277 interval_set_object (interval_copy, string); 2305 set_interval_object (interval_copy, string);
2278 string_set_intervals (string, interval_copy); 2306 set_string_intervals (string, interval_copy);
2279} 2307}
2280 2308
2281/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. 2309/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise.
@@ -2288,8 +2316,8 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
2288 ptrdiff_t pos = 0; 2316 ptrdiff_t pos = 0;
2289 ptrdiff_t end = SCHARS (s1); 2317 ptrdiff_t end = SCHARS (s1);
2290 2318
2291 i1 = find_interval (string_get_intervals (s1), 0); 2319 i1 = find_interval (string_intervals (s1), 0);
2292 i2 = find_interval (string_get_intervals (s2), 0); 2320 i2 = find_interval (string_intervals (s2), 0);
2293 2321
2294 while (pos < end) 2322 while (pos < end)
2295 { 2323 {
@@ -2414,13 +2442,13 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2414 { 2442 {
2415 if ((i)->left) 2443 if ((i)->left)
2416 { 2444 {
2417 interval_set_plist (i, i->left->plist); 2445 set_interval_plist (i, i->left->plist);
2418 (i)->left->total_length = 0; 2446 (i)->left->total_length = 0;
2419 delete_interval ((i)->left); 2447 delete_interval ((i)->left);
2420 } 2448 }
2421 else 2449 else
2422 { 2450 {
2423 interval_set_plist (i, i->right->plist); 2451 set_interval_plist (i, i->right->plist);
2424 (i)->right->total_length = 0; 2452 (i)->right->total_length = 0;
2425 delete_interval ((i)->right); 2453 delete_interval ((i)->right);
2426 } 2454 }
@@ -2434,7 +2462,7 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
2434void 2462void
2435set_intervals_multibyte (int multi_flag) 2463set_intervals_multibyte (int multi_flag)
2436{ 2464{
2437 INTERVAL i = buffer_get_intervals (current_buffer); 2465 INTERVAL i = buffer_intervals (current_buffer);
2438 2466
2439 if (i) 2467 if (i)
2440 set_intervals_multibyte_1 (i, multi_flag, BEG, BEG_BYTE, Z, Z_BYTE); 2468 set_intervals_multibyte_1 (i, multi_flag, BEG, BEG_BYTE, Z, Z_BYTE);
diff --git a/src/intervals.h b/src/intervals.h
index a5166c6376f..01e72d7c9db 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -137,47 +137,16 @@ struct interval
137 or pointer slots of struct interval. */ 137 or pointer slots of struct interval. */
138 138
139INTERVALS_INLINE void 139INTERVALS_INLINE void
140interval_set_parent (INTERVAL i, INTERVAL parent) 140set_interval_parent (INTERVAL i, INTERVAL parent)
141{ 141{
142 i->up_obj = 0; 142 i->up_obj = 0;
143 i->up.interval = parent; 143 i->up.interval = parent;
144} 144}
145 145
146INTERVALS_INLINE void 146INTERVALS_INLINE void
147interval_set_object (INTERVAL i, Lisp_Object obj) 147set_interval_plist (INTERVAL i, Lisp_Object plist)
148{
149 eassert (BUFFERP (obj) || STRINGP (obj));
150 i->up_obj = 1;
151 i->up.obj = obj;
152}
153
154INTERVALS_INLINE void
155interval_set_left (INTERVAL i, INTERVAL left)
156{
157 i->left = left;
158}
159
160INTERVALS_INLINE void
161interval_set_right (INTERVAL i, INTERVAL right)
162{
163 i->right = right;
164}
165
166INTERVALS_INLINE Lisp_Object
167interval_set_plist (INTERVAL i, Lisp_Object plist)
168{ 148{
169 i->plist = plist; 149 i->plist = plist;
170 return plist;
171}
172
173/* Make the parent of D be whatever the parent of S is, regardless
174 of the type. This is used when balancing an interval tree. */
175
176INTERVALS_INLINE void
177interval_copy_parent (INTERVAL d, INTERVAL s)
178{
179 d->up = s->up;
180 d->up_obj = s->up_obj;
181} 150}
182 151
183/* Get the parent interval, if any, otherwise a null pointer. Useful 152/* Get the parent interval, if any, otherwise a null pointer. Useful
@@ -191,11 +160,11 @@ interval_copy_parent (INTERVAL d, INTERVAL s)
191{ \ 160{ \
192 (i)->total_length = (i)->position = 0; \ 161 (i)->total_length = (i)->position = 0; \
193 (i)->left = (i)->right = NULL; \ 162 (i)->left = (i)->right = NULL; \
194 interval_set_parent (i, NULL); \ 163 set_interval_parent (i, NULL); \
195 (i)->write_protect = 0; \ 164 (i)->write_protect = 0; \
196 (i)->visible = 0; \ 165 (i)->visible = 0; \
197 (i)->front_sticky = (i)->rear_sticky = 0; \ 166 (i)->front_sticky = (i)->rear_sticky = 0; \
198 interval_set_plist (i, Qnil); \ 167 set_interval_plist (i, Qnil); \
199} 168}
200 169
201/* Copy the cached property values of interval FROM to interval TO. */ 170/* Copy the cached property values of interval FROM to interval TO. */
diff --git a/src/keyboard.c b/src/keyboard.c
index b26a2c88e5d..3d4061accfc 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21
22#define KEYBOARD_INLINE EXTERN_INLINE
23
21#include <signal.h> 24#include <signal.h>
22#include <stdio.h> 25#include <stdio.h>
23#include <setjmp.h> 26#include <setjmp.h>
@@ -469,6 +472,53 @@ static void handle_user_signal (int);
469static char *find_user_signal_name (int); 472static char *find_user_signal_name (int);
470static int store_user_signal_events (void); 473static int store_user_signal_events (void);
471 474
475/* These setters are used only in this file, so they can be private. */
476static inline void
477kset_echo_string (struct kboard *kb, Lisp_Object val)
478{
479 kb->INTERNAL_FIELD (echo_string) = val;
480}
481static inline void
482kset_kbd_queue (struct kboard *kb, Lisp_Object val)
483{
484 kb->INTERNAL_FIELD (kbd_queue) = val;
485}
486static inline void
487kset_keyboard_translate_table (struct kboard *kb, Lisp_Object val)
488{
489 kb->INTERNAL_FIELD (Vkeyboard_translate_table) = val;
490}
491static inline void
492kset_last_prefix_arg (struct kboard *kb, Lisp_Object val)
493{
494 kb->INTERNAL_FIELD (Vlast_prefix_arg) = val;
495}
496static inline void
497kset_last_repeatable_command (struct kboard *kb, Lisp_Object val)
498{
499 kb->INTERNAL_FIELD (Vlast_repeatable_command) = val;
500}
501static inline void
502kset_local_function_key_map (struct kboard *kb, Lisp_Object val)
503{
504 kb->INTERNAL_FIELD (Vlocal_function_key_map) = val;
505}
506static inline void
507kset_overriding_terminal_local_map (struct kboard *kb, Lisp_Object val)
508{
509 kb->INTERNAL_FIELD (Voverriding_terminal_local_map) = val;
510}
511static inline void
512kset_real_last_command (struct kboard *kb, Lisp_Object val)
513{
514 kb->INTERNAL_FIELD (Vreal_last_command) = val;
515}
516static inline void
517kset_system_key_syms (struct kboard *kb, Lisp_Object val)
518{
519 kb->INTERNAL_FIELD (system_key_syms) = val;
520}
521
472 522
473/* Add C to the echo string, if echoing is going on. 523/* Add C to the echo string, if echoing is going on.
474 C can be a character, which is printed prettily ("M-C-x" and all that 524 C can be a character, which is printed prettily ("M-C-x" and all that
@@ -551,8 +601,9 @@ echo_char (Lisp_Object c)
551 else if (STRINGP (echo_string)) 601 else if (STRINGP (echo_string))
552 echo_string = concat2 (echo_string, build_string (" ")); 602 echo_string = concat2 (echo_string, build_string (" "));
553 603
554 KSET (current_kboard, echo_string, 604 kset_echo_string
555 concat2 (echo_string, make_string (buffer, ptr - buffer))); 605 (current_kboard,
606 concat2 (echo_string, make_string (buffer, ptr - buffer)));
556 607
557 echo_now (); 608 echo_now ();
558 } 609 }
@@ -597,8 +648,9 @@ echo_dash (void)
597 648
598 /* Put a dash at the end of the buffer temporarily, 649 /* Put a dash at the end of the buffer temporarily,
599 but make it go away when the next character is added. */ 650 but make it go away when the next character is added. */
600 KSET (current_kboard, echo_string, 651 kset_echo_string
601 concat2 (KVAR (current_kboard, echo_string), build_string ("-"))); 652 (current_kboard,
653 concat2 (KVAR (current_kboard, echo_string), build_string ("-")));
602 echo_now (); 654 echo_now ();
603} 655}
604 656
@@ -660,7 +712,7 @@ cancel_echoing (void)
660{ 712{
661 current_kboard->immediate_echo = 0; 713 current_kboard->immediate_echo = 0;
662 current_kboard->echo_after_prompt = -1; 714 current_kboard->echo_after_prompt = -1;
663 KSET (current_kboard, echo_string, Qnil); 715 kset_echo_string (current_kboard, Qnil);
664 ok_to_echo_at_next_pause = NULL; 716 ok_to_echo_at_next_pause = NULL;
665 echo_kboard = NULL; 717 echo_kboard = NULL;
666 echo_message_buffer = Qnil; 718 echo_message_buffer = Qnil;
@@ -684,9 +736,9 @@ static void
684echo_truncate (ptrdiff_t nchars) 736echo_truncate (ptrdiff_t nchars)
685{ 737{
686 if (STRINGP (KVAR (current_kboard, echo_string))) 738 if (STRINGP (KVAR (current_kboard, echo_string)))
687 KSET (current_kboard, echo_string, 739 kset_echo_string (current_kboard,
688 Fsubstring (KVAR (current_kboard, echo_string), 740 Fsubstring (KVAR (current_kboard, echo_string),
689 make_number (0), make_number (nchars))); 741 make_number (0), make_number (nchars)));
690 truncate_echo_area (nchars); 742 truncate_echo_area (nchars);
691} 743}
692 744
@@ -1016,8 +1068,8 @@ cmd_error (Lisp_Object data)
1016 Vstandard_input = Qt; 1068 Vstandard_input = Qt;
1017 Vexecuting_kbd_macro = Qnil; 1069 Vexecuting_kbd_macro = Qnil;
1018 executing_kbd_macro = Qnil; 1070 executing_kbd_macro = Qnil;
1019 KSET (current_kboard, Vprefix_arg, Qnil); 1071 kset_prefix_arg (current_kboard, Qnil);
1020 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1072 kset_last_prefix_arg (current_kboard, Qnil);
1021 cancel_echoing (); 1073 cancel_echoing ();
1022 1074
1023 /* Avoid unquittable loop if data contains a circular list. */ 1075 /* Avoid unquittable loop if data contains a circular list. */
@@ -1338,8 +1390,8 @@ command_loop_1 (void)
1338#endif 1390#endif
1339 int already_adjusted = 0; 1391 int already_adjusted = 0;
1340 1392
1341 KSET (current_kboard, Vprefix_arg, Qnil); 1393 kset_prefix_arg (current_kboard, Qnil);
1342 KSET (current_kboard, Vlast_prefix_arg, Qnil); 1394 kset_last_prefix_arg (current_kboard, Qnil);
1343 Vdeactivate_mark = Qnil; 1395 Vdeactivate_mark = Qnil;
1344 waiting_for_input = 0; 1396 waiting_for_input = 0;
1345 cancel_echoing (); 1397 cancel_echoing ();
@@ -1371,10 +1423,10 @@ command_loop_1 (void)
1371 } 1423 }
1372 1424
1373 /* Do this after running Vpost_command_hook, for consistency. */ 1425 /* Do this after running Vpost_command_hook, for consistency. */
1374 KSET (current_kboard, Vlast_command, Vthis_command); 1426 kset_last_command (current_kboard, Vthis_command);
1375 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1427 kset_real_last_command (current_kboard, Vreal_this_command);
1376 if (!CONSP (last_command_event)) 1428 if (!CONSP (last_command_event))
1377 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1429 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1378 1430
1379 while (1) 1431 while (1)
1380 { 1432 {
@@ -1546,7 +1598,7 @@ command_loop_1 (void)
1546 keys = Fkey_description (keys, Qnil); 1598 keys = Fkey_description (keys, Qnil);
1547 bitch_at_user (); 1599 bitch_at_user ();
1548 message_with_string ("%s is undefined", keys, 0); 1600 message_with_string ("%s is undefined", keys, 0);
1549 KSET (current_kboard, defining_kbd_macro, Qnil); 1601 kset_defining_kbd_macro (current_kboard, Qnil);
1550 update_mode_lines = 1; 1602 update_mode_lines = 1;
1551 /* If this is a down-mouse event, don't reset prefix-arg; 1603 /* If this is a down-mouse event, don't reset prefix-arg;
1552 pass it to the command run by the up event. */ 1604 pass it to the command run by the up event. */
@@ -1556,10 +1608,10 @@ command_loop_1 (void)
1556 = parse_modifiers (EVENT_HEAD (last_command_event)); 1608 = parse_modifiers (EVENT_HEAD (last_command_event));
1557 int modifiers = XINT (XCAR (XCDR (breakdown))); 1609 int modifiers = XINT (XCAR (XCDR (breakdown)));
1558 if (!(modifiers & down_modifier)) 1610 if (!(modifiers & down_modifier))
1559 KSET (current_kboard, Vprefix_arg, Qnil); 1611 kset_prefix_arg (current_kboard, Qnil);
1560 } 1612 }
1561 else 1613 else
1562 KSET (current_kboard, Vprefix_arg, Qnil); 1614 kset_prefix_arg (current_kboard, Qnil);
1563 } 1615 }
1564 else 1616 else
1565 { 1617 {
@@ -1596,7 +1648,7 @@ command_loop_1 (void)
1596 unbind_to (scount, Qnil); 1648 unbind_to (scount, Qnil);
1597#endif 1649#endif
1598 } 1650 }
1599 KSET (current_kboard, Vlast_prefix_arg, Vcurrent_prefix_arg); 1651 kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
1600 1652
1601 safe_run_hooks (Qpost_command_hook); 1653 safe_run_hooks (Qpost_command_hook);
1602 1654
@@ -1627,10 +1679,10 @@ command_loop_1 (void)
1627 if (NILP (KVAR (current_kboard, Vprefix_arg)) 1679 if (NILP (KVAR (current_kboard, Vprefix_arg))
1628 || CONSP (last_command_event)) 1680 || CONSP (last_command_event))
1629 { 1681 {
1630 KSET (current_kboard, Vlast_command, Vthis_command); 1682 kset_last_command (current_kboard, Vthis_command);
1631 KSET (current_kboard, Vreal_last_command, Vreal_this_command); 1683 kset_real_last_command (current_kboard, Vreal_this_command);
1632 if (!CONSP (last_command_event)) 1684 if (!CONSP (last_command_event))
1633 KSET (current_kboard, Vlast_repeatable_command, Vreal_this_command); 1685 kset_last_repeatable_command (current_kboard, Vreal_this_command);
1634 cancel_echoing (); 1686 cancel_echoing ();
1635 this_command_key_count = 0; 1687 this_command_key_count = 0;
1636 this_command_key_count_reset = 0; 1688 this_command_key_count_reset = 0;
@@ -2573,7 +2625,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2573 abort (); 2625 abort ();
2574 } 2626 }
2575 if (!CONSP (last)) 2627 if (!CONSP (last))
2576 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2628 kset_kbd_queue (kb, Fcons (c, Qnil));
2577 else 2629 else
2578 XSETCDR (last, Fcons (c, Qnil)); 2630 XSETCDR (last, Fcons (c, Qnil));
2579 kb->kbd_queue_has_data = 1; 2631 kb->kbd_queue_has_data = 1;
@@ -2745,8 +2797,8 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2745 if (!CONSP (KVAR (current_kboard, kbd_queue))) 2797 if (!CONSP (KVAR (current_kboard, kbd_queue)))
2746 abort (); 2798 abort ();
2747 c = XCAR (KVAR (current_kboard, kbd_queue)); 2799 c = XCAR (KVAR (current_kboard, kbd_queue));
2748 KSET (current_kboard, kbd_queue, 2800 kset_kbd_queue (current_kboard,
2749 XCDR (KVAR (current_kboard, kbd_queue))); 2801 XCDR (KVAR (current_kboard, kbd_queue)));
2750 if (NILP (KVAR (current_kboard, kbd_queue))) 2802 if (NILP (KVAR (current_kboard, kbd_queue)))
2751 current_kboard->kbd_queue_has_data = 0; 2803 current_kboard->kbd_queue_has_data = 0;
2752 input_pending = readable_events (0); 2804 input_pending = readable_events (0);
@@ -2813,7 +2865,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2813 abort (); 2865 abort ();
2814 } 2866 }
2815 if (!CONSP (last)) 2867 if (!CONSP (last))
2816 KSET (kb, kbd_queue, Fcons (c, Qnil)); 2868 kset_kbd_queue (kb, Fcons (c, Qnil));
2817 else 2869 else
2818 XSETCDR (last, Fcons (c, Qnil)); 2870 XSETCDR (last, Fcons (c, Qnil));
2819 kb->kbd_queue_has_data = 1; 2871 kb->kbd_queue_has_data = 1;
@@ -3071,7 +3123,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
3071 3123
3072 cancel_echoing (); 3124 cancel_echoing ();
3073 ok_to_echo_at_next_pause = saved_ok_to_echo; 3125 ok_to_echo_at_next_pause = saved_ok_to_echo;
3074 KSET (current_kboard, echo_string, saved_echo_string); 3126 kset_echo_string (current_kboard, saved_echo_string);
3075 current_kboard->echo_after_prompt = saved_echo_after_prompt; 3127 current_kboard->echo_after_prompt = saved_echo_after_prompt;
3076 if (saved_immediate_echo) 3128 if (saved_immediate_echo)
3077 echo_now (); 3129 echo_now ();
@@ -3542,9 +3594,9 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3542 3594
3543 if (single_kboard && kb != current_kboard) 3595 if (single_kboard && kb != current_kboard)
3544 { 3596 {
3545 KSET (kb, kbd_queue, 3597 kset_kbd_queue
3546 Fcons (make_lispy_switch_frame (event->frame_or_window), 3598 (kb, Fcons (make_lispy_switch_frame (event->frame_or_window),
3547 Fcons (make_number (c), Qnil))); 3599 Fcons (make_number (c), Qnil)));
3548 kb->kbd_queue_has_data = 1; 3600 kb->kbd_queue_has_data = 1;
3549 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++) 3601 for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
3550 { 3602 {
@@ -4367,7 +4419,6 @@ timer_check_2 (void)
4367 4419
4368 while (CONSP (timers) || CONSP (idle_timers)) 4420 while (CONSP (timers) || CONSP (idle_timers))
4369 { 4421 {
4370 Lisp_Object *vector;
4371 Lisp_Object timer = Qnil, idle_timer = Qnil; 4422 Lisp_Object timer = Qnil, idle_timer = Qnil;
4372 EMACS_TIME timer_time, idle_timer_time; 4423 EMACS_TIME timer_time, idle_timer_time;
4373 EMACS_TIME difference; 4424 EMACS_TIME difference;
@@ -4443,15 +4494,14 @@ timer_check_2 (void)
4443 /* If timer is ripe, run it if it hasn't been run. */ 4494 /* If timer is ripe, run it if it hasn't been run. */
4444 if (ripe) 4495 if (ripe)
4445 { 4496 {
4446 vector = XVECTOR (chosen_timer)->contents; 4497 if (NILP (AREF (chosen_timer, 0)))
4447 if (NILP (vector[0]))
4448 { 4498 {
4449 ptrdiff_t count = SPECPDL_INDEX (); 4499 ptrdiff_t count = SPECPDL_INDEX ();
4450 Lisp_Object old_deactivate_mark = Vdeactivate_mark; 4500 Lisp_Object old_deactivate_mark = Vdeactivate_mark;
4451 4501
4452 /* Mark the timer as triggered to prevent problems if the lisp 4502 /* Mark the timer as triggered to prevent problems if the lisp
4453 code fails to reschedule it right. */ 4503 code fails to reschedule it right. */
4454 vector[0] = Qt; 4504 ASET (chosen_timer, 0, Qt);
4455 4505
4456 specbind (Qinhibit_quit, Qt); 4506 specbind (Qinhibit_quit, Qt);
4457 4507
@@ -5416,7 +5466,7 @@ make_lispy_event (struct input_event *event)
5416 /* We need to use an alist rather than a vector as the cache 5466 /* We need to use an alist rather than a vector as the cache
5417 since we can't make a vector long enough. */ 5467 since we can't make a vector long enough. */
5418 if (NILP (KVAR (current_kboard, system_key_syms))) 5468 if (NILP (KVAR (current_kboard, system_key_syms)))
5419 KSET (current_kboard, system_key_syms, Fcons (Qnil, Qnil)); 5469 kset_system_key_syms (current_kboard, Fcons (Qnil, Qnil));
5420 return modify_event_symbol (event->code, 5470 return modify_event_symbol (event->code,
5421 event->modifiers, 5471 event->modifiers,
5422 Qfunction_key, 5472 Qfunction_key,
@@ -8395,7 +8445,6 @@ init_tool_bar_items (Lisp_Object reuse)
8395static void 8445static void
8396append_tool_bar_item (void) 8446append_tool_bar_item (void)
8397{ 8447{
8398 Lisp_Object *to, *from;
8399 ptrdiff_t incr = 8448 ptrdiff_t incr =
8400 (ntool_bar_items 8449 (ntool_bar_items
8401 - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); 8450 - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS));
@@ -8407,9 +8456,8 @@ append_tool_bar_item (void)
8407 8456
8408 /* Append entries from tool_bar_item_properties to the end of 8457 /* Append entries from tool_bar_item_properties to the end of
8409 tool_bar_items_vector. */ 8458 tool_bar_items_vector. */
8410 to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; 8459 vcopy (tool_bar_items_vector, ntool_bar_items,
8411 from = XVECTOR (tool_bar_item_properties)->contents; 8460 XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
8412 memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to);
8413 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; 8461 ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
8414} 8462}
8415 8463
@@ -8739,11 +8787,11 @@ read_char_minibuf_menu_prompt (int commandflag,
8739 is not used on replay. 8787 is not used on replay.
8740 */ 8788 */
8741 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro); 8789 orig_defn_macro = KVAR (current_kboard, defining_kbd_macro);
8742 KSET (current_kboard, defining_kbd_macro, Qnil); 8790 kset_defining_kbd_macro (current_kboard, Qnil);
8743 do 8791 do
8744 obj = read_char (commandflag, 0, 0, Qt, 0, NULL); 8792 obj = read_char (commandflag, 0, 0, Qt, 0, NULL);
8745 while (BUFFERP (obj)); 8793 while (BUFFERP (obj));
8746 KSET (current_kboard, defining_kbd_macro, orig_defn_macro); 8794 kset_defining_kbd_macro (current_kboard, orig_defn_macro);
8747 8795
8748 if (!INTEGERP (obj)) 8796 if (!INTEGERP (obj))
8749 return obj; 8797 return obj;
@@ -9099,7 +9147,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9099 /* Install the string STR as the beginning of the string of 9147 /* Install the string STR as the beginning of the string of
9100 echoing, so that it serves as a prompt for the next 9148 echoing, so that it serves as a prompt for the next
9101 character. */ 9149 character. */
9102 KSET (current_kboard, echo_string, prompt); 9150 kset_echo_string (current_kboard, prompt);
9103 current_kboard->echo_after_prompt = SCHARS (prompt); 9151 current_kboard->echo_after_prompt = SCHARS (prompt);
9104 echo_now (); 9152 echo_now ();
9105 } 9153 }
@@ -9345,15 +9393,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9345 9393
9346 if (!NILP (delayed_switch_frame)) 9394 if (!NILP (delayed_switch_frame))
9347 { 9395 {
9348 KSET (interrupted_kboard, kbd_queue, 9396 kset_kbd_queue
9349 Fcons (delayed_switch_frame, 9397 (interrupted_kboard,
9350 KVAR (interrupted_kboard, kbd_queue))); 9398 Fcons (delayed_switch_frame,
9399 KVAR (interrupted_kboard, kbd_queue)));
9351 delayed_switch_frame = Qnil; 9400 delayed_switch_frame = Qnil;
9352 } 9401 }
9353 9402
9354 while (t > 0) 9403 while (t > 0)
9355 KSET (interrupted_kboard, kbd_queue, 9404 kset_kbd_queue
9356 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue))); 9405 (interrupted_kboard,
9406 Fcons (keybuf[--t], KVAR (interrupted_kboard, kbd_queue)));
9357 9407
9358 /* If the side queue is non-empty, ensure it begins with a 9408 /* If the side queue is non-empty, ensure it begins with a
9359 switch-frame, so we'll replay it in the right context. */ 9409 switch-frame, so we'll replay it in the right context. */
@@ -9365,9 +9415,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9365 { 9415 {
9366 Lisp_Object frame; 9416 Lisp_Object frame;
9367 XSETFRAME (frame, interrupted_frame); 9417 XSETFRAME (frame, interrupted_frame);
9368 KSET (interrupted_kboard, kbd_queue, 9418 kset_kbd_queue
9369 Fcons (make_lispy_switch_frame (frame), 9419 (interrupted_kboard,
9370 KVAR (interrupted_kboard, kbd_queue))); 9420 Fcons (make_lispy_switch_frame (frame),
9421 KVAR (interrupted_kboard, kbd_queue)));
9371 } 9422 }
9372 mock_input = 0; 9423 mock_input = 0;
9373 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); 9424 orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
@@ -10261,7 +10312,7 @@ a special event, so ignore the prefix argument and don't clear it. */)
10261 { 10312 {
10262 prefixarg = KVAR (current_kboard, Vprefix_arg); 10313 prefixarg = KVAR (current_kboard, Vprefix_arg);
10263 Vcurrent_prefix_arg = prefixarg; 10314 Vcurrent_prefix_arg = prefixarg;
10264 KSET (current_kboard, Vprefix_arg, Qnil); 10315 kset_prefix_arg (current_kboard, Qnil);
10265 } 10316 }
10266 else 10317 else
10267 prefixarg = Qnil; 10318 prefixarg = Qnil;
@@ -10435,10 +10486,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
10435 else 10486 else
10436 { 10487 {
10437 val = Fvector (NUM_RECENT_KEYS, keys); 10488 val = Fvector (NUM_RECENT_KEYS, keys);
10438 memcpy (XVECTOR (val)->contents, keys + recent_keys_index, 10489 vcopy (val, 0, keys + recent_keys_index,
10439 (NUM_RECENT_KEYS - recent_keys_index) * word_size); 10490 NUM_RECENT_KEYS - recent_keys_index);
10440 memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, 10491 vcopy (val, NUM_RECENT_KEYS - recent_keys_index,
10441 keys, recent_keys_index * word_size); 10492 keys, recent_keys_index);
10442 return val; 10493 return val;
10443 } 10494 }
10444} 10495}
@@ -11256,30 +11307,30 @@ The `posn-' functions access elements of such lists. */)
11256void 11307void
11257init_kboard (KBOARD *kb) 11308init_kboard (KBOARD *kb)
11258{ 11309{
11259 KSET (kb, Voverriding_terminal_local_map, Qnil); 11310 kset_overriding_terminal_local_map (kb, Qnil);
11260 KSET (kb, Vlast_command, Qnil); 11311 kset_last_command (kb, Qnil);
11261 KSET (kb, Vreal_last_command, Qnil); 11312 kset_real_last_command (kb, Qnil);
11262 KSET (kb, Vkeyboard_translate_table, Qnil); 11313 kset_keyboard_translate_table (kb, Qnil);
11263 KSET (kb, Vlast_repeatable_command, Qnil); 11314 kset_last_repeatable_command (kb, Qnil);
11264 KSET (kb, Vprefix_arg, Qnil); 11315 kset_prefix_arg (kb, Qnil);
11265 KSET (kb, Vlast_prefix_arg, Qnil); 11316 kset_last_prefix_arg (kb, Qnil);
11266 KSET (kb, kbd_queue, Qnil); 11317 kset_kbd_queue (kb, Qnil);
11267 kb->kbd_queue_has_data = 0; 11318 kb->kbd_queue_has_data = 0;
11268 kb->immediate_echo = 0; 11319 kb->immediate_echo = 0;
11269 KSET (kb, echo_string, Qnil); 11320 kset_echo_string (kb, Qnil);
11270 kb->echo_after_prompt = -1; 11321 kb->echo_after_prompt = -1;
11271 kb->kbd_macro_buffer = 0; 11322 kb->kbd_macro_buffer = 0;
11272 kb->kbd_macro_bufsize = 0; 11323 kb->kbd_macro_bufsize = 0;
11273 KSET (kb, defining_kbd_macro, Qnil); 11324 kset_defining_kbd_macro (kb, Qnil);
11274 KSET (kb, Vlast_kbd_macro, Qnil); 11325 kset_last_kbd_macro (kb, Qnil);
11275 kb->reference_count = 0; 11326 kb->reference_count = 0;
11276 KSET (kb, Vsystem_key_alist, Qnil); 11327 kset_system_key_alist (kb, Qnil);
11277 KSET (kb, system_key_syms, Qnil); 11328 kset_system_key_syms (kb, Qnil);
11278 KSET (kb, Vwindow_system, Qt); /* Unset. */ 11329 kset_window_system (kb, Qt); /* Unset. */
11279 KSET (kb, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 11330 kset_input_decode_map (kb, Fmake_sparse_keymap (Qnil));
11280 KSET (kb, Vlocal_function_key_map, Fmake_sparse_keymap (Qnil)); 11331 kset_local_function_key_map (kb, Fmake_sparse_keymap (Qnil));
11281 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map); 11332 Fset_keymap_parent (KVAR (kb, Vlocal_function_key_map), Vfunction_key_map);
11282 KSET (kb, Vdefault_minibuffer_frame, Qnil); 11333 kset_default_minibuffer_frame (kb, Qnil);
11283} 11334}
11284 11335
11285/* 11336/*
@@ -11355,7 +11406,7 @@ init_keyboard (void)
11355 init_kboard (current_kboard); 11406 init_kboard (current_kboard);
11356 /* A value of nil for Vwindow_system normally means a tty, but we also use 11407 /* A value of nil for Vwindow_system normally means a tty, but we also use
11357 it for the initial terminal since there is no window system there. */ 11408 it for the initial terminal since there is no window system there. */
11358 KSET (current_kboard, Vwindow_system, Qnil); 11409 kset_window_system (current_kboard, Qnil);
11359 11410
11360 if (!noninteractive) 11411 if (!noninteractive)
11361 { 11412 {
diff --git a/src/keyboard.h b/src/keyboard.h
index f83643d6f6e..91484b3649b 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -19,10 +19,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include "systime.h" /* for EMACS_TIME, Time */ 19#include "systime.h" /* for EMACS_TIME, Time */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22INLINE_HEADER_BEGIN
23#ifndef KEYBOARD_INLINE
24# define KEYBOARD_INLINE INLINE
25#endif
26
22/* Most code should use this macro to access Lisp fields in struct kboard. */ 27/* Most code should use this macro to access Lisp fields in struct kboard. */
23 28
24#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) 29#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
25#define KSET(kboard, field, value) ((kboard)->INTERNAL_FIELD (field) = (value))
26 30
27/* Each KBOARD represents one logical input stream from which Emacs 31/* Each KBOARD represents one logical input stream from which Emacs
28 gets input. If we are using ordinary terminals, it has one KBOARD 32 gets input. If we are using ordinary terminals, it has one KBOARD
@@ -173,6 +177,47 @@ struct kboard
173 char echo_after_prompt; 177 char echo_after_prompt;
174 }; 178 };
175 179
180KEYBOARD_INLINE void
181kset_default_minibuffer_frame (struct kboard *kb, Lisp_Object val)
182{
183 kb->INTERNAL_FIELD (Vdefault_minibuffer_frame) = val;
184}
185KEYBOARD_INLINE void
186kset_defining_kbd_macro (struct kboard *kb, Lisp_Object val)
187{
188 kb->INTERNAL_FIELD (defining_kbd_macro) = val;
189}
190KEYBOARD_INLINE void
191kset_input_decode_map (struct kboard *kb, Lisp_Object val)
192{
193 kb->INTERNAL_FIELD (Vinput_decode_map) = val;
194}
195KEYBOARD_INLINE void
196kset_last_command (struct kboard *kb, Lisp_Object val)
197{
198 kb->INTERNAL_FIELD (Vlast_command) = val;
199}
200KEYBOARD_INLINE void
201kset_last_kbd_macro (struct kboard *kb, Lisp_Object val)
202{
203 kb->INTERNAL_FIELD (Vlast_kbd_macro) = val;
204}
205KEYBOARD_INLINE void
206kset_prefix_arg (struct kboard *kb, Lisp_Object val)
207{
208 kb->INTERNAL_FIELD (Vprefix_arg) = val;
209}
210KEYBOARD_INLINE void
211kset_system_key_alist (struct kboard *kb, Lisp_Object val)
212{
213 kb->INTERNAL_FIELD (Vsystem_key_alist) = val;
214}
215KEYBOARD_INLINE void
216kset_window_system (struct kboard *kb, Lisp_Object val)
217{
218 kb->INTERNAL_FIELD (Vwindow_system) = val;
219}
220
176/* Temporarily used before a frame has been opened. */ 221/* Temporarily used before a frame has been opened. */
177extern KBOARD *initial_kboard; 222extern KBOARD *initial_kboard;
178 223
@@ -510,3 +555,5 @@ extern void mark_kboards (void);
510#ifdef WINDOWSNT 555#ifdef WINDOWSNT
511extern const char *const lispy_function_keys[]; 556extern const char *const lispy_function_keys[];
512#endif 557#endif
558
559INLINE_HEADER_END
diff --git a/src/keymap.c b/src/keymap.c
index c550b37c1d6..21f7dcb5d37 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1854,7 +1854,7 @@ If KEYMAP is nil, that means no local keymap. */)
1854 if (!NILP (keymap)) 1854 if (!NILP (keymap))
1855 keymap = get_keymap (keymap, 1, 1); 1855 keymap = get_keymap (keymap, 1, 1);
1856 1856
1857 BSET (current_buffer, keymap, keymap); 1857 bset_keymap (current_buffer, keymap);
1858 1858
1859 return Qnil; 1859 return Qnil;
1860} 1860}
diff --git a/src/lisp.h b/src/lisp.h
index 8ac01211a1f..d9a7c9d0bdc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -124,7 +124,7 @@ extern _Noreturn void die (const char *, const char *, int);
124 eassert macro altogether, e.g., if XSTRING (x) uses eassert to test 124 eassert macro altogether, e.g., if XSTRING (x) uses eassert to test
125 STRINGP (x), but a particular use of XSTRING is invoked only after 125 STRINGP (x), but a particular use of XSTRING is invoked only after
126 testing that STRINGP (x) is true, making the test redundant. */ 126 testing that STRINGP (x) is true, making the test redundant. */
127extern int suppress_checking EXTERNALLY_VISIBLE; 127extern bool suppress_checking EXTERNALLY_VISIBLE;
128 128
129# define eassert(cond) \ 129# define eassert(cond) \
130 ((cond) || suppress_checking \ 130 ((cond) || suppress_checking \
@@ -702,7 +702,7 @@ struct Lisp_Cons
702#define CDR_SAFE(c) \ 702#define CDR_SAFE(c) \
703 (CONSP ((c)) ? XCDR ((c)) : Qnil) 703 (CONSP ((c)) ? XCDR ((c)) : Qnil)
704 704
705/* Nonzero if STR is a multibyte string. */ 705/* True if STR is a multibyte string. */
706#define STRING_MULTIBYTE(STR) \ 706#define STRING_MULTIBYTE(STR) \
707 (XSTRING (STR)->size_byte >= 0) 707 (XSTRING (STR)->size_byte >= 0)
708 708
@@ -923,7 +923,7 @@ enum
923 8-bit European characters. Do not check validity of CT. */ 923 8-bit European characters. Do not check validity of CT. */
924#define CHAR_TABLE_SET(CT, IDX, VAL) \ 924#define CHAR_TABLE_SET(CT, IDX, VAL) \
925 (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \ 925 (ASCII_CHAR_P (IDX) && SUB_CHAR_TABLE_P (XCHAR_TABLE (CT)->ascii) \
926 ? sub_char_table_set_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \ 926 ? set_sub_char_table_contents (XCHAR_TABLE (CT)->ascii, IDX, VAL) \
927 : char_table_set (CT, IDX, VAL)) 927 : char_table_set (CT, IDX, VAL))
928 928
929enum CHARTAB_SIZE_BITS 929enum CHARTAB_SIZE_BITS
@@ -936,12 +936,6 @@ enum CHARTAB_SIZE_BITS
936 936
937extern const int chartab_size[4]; 937extern const int chartab_size[4];
938 938
939/* Most code should use this macro to set non-array Lisp fields in struct
940 Lisp_Char_Table. For CONTENTS and EXTRAS, use char_table_set_contents
941 and char_table_set_extras, respectively. */
942
943#define CSET(c, field, value) ((c)->field = (value))
944
945struct Lisp_Char_Table 939struct Lisp_Char_Table
946 { 940 {
947 /* HEADER.SIZE is the vector's size field, which also holds the 941 /* HEADER.SIZE is the vector's size field, which also holds the
@@ -990,7 +984,7 @@ struct Lisp_Sub_Char_Table
990 /* Minimum character covered by the sub char-table. */ 984 /* Minimum character covered by the sub char-table. */
991 Lisp_Object min_char; 985 Lisp_Object min_char;
992 986
993 /* Use sub_char_table_set_contents to set this. */ 987 /* Use set_sub_char_table_contents to set this. */
994 Lisp_Object contents[1]; 988 Lisp_Object contents[1];
995 }; 989 };
996 990
@@ -1472,14 +1466,6 @@ struct Lisp_Buffer_Local_Value
1472 Lisp_Object valcell; 1466 Lisp_Object valcell;
1473 }; 1467 };
1474 1468
1475#define BLV_FOUND(blv) \
1476 (eassert ((blv)->found == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found)
1477#define SET_BLV_FOUND(blv, v) \
1478 (eassert ((v) == !EQ ((blv)->defcell, (blv)->valcell)), (blv)->found = (v))
1479
1480#define BLV_VALUE(blv) (XCDR ((blv)->valcell))
1481#define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
1482
1483/* Like Lisp_Objfwd except that value lives in a slot in the 1469/* Like Lisp_Objfwd except that value lives in a slot in the
1484 current kboard. */ 1470 current kboard. */
1485struct Lisp_Kboard_Objfwd 1471struct Lisp_Kboard_Objfwd
@@ -2358,32 +2344,67 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
2358 XVECTOR (array)->contents[idx] = val; 2344 XVECTOR (array)->contents[idx] = val;
2359} 2345}
2360 2346
2347/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */
2348
2361LISP_INLINE void 2349LISP_INLINE void
2362set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) 2350vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
2351{
2352 eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
2353 memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
2354}
2355
2356/* Functions to modify hash tables. */
2357
2358LISP_INLINE void
2359set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value)
2360{
2361 h->key_and_value = key_and_value;
2362}
2363
2364LISP_INLINE void
2365set_hash_key_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2363{ 2366{
2364 gc_aset (h->key_and_value, 2 * idx, val); 2367 gc_aset (h->key_and_value, 2 * idx, val);
2365} 2368}
2366 2369
2367LISP_INLINE void 2370LISP_INLINE void
2368set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) 2371set_hash_value_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2369{ 2372{
2370 gc_aset (h->key_and_value, 2 * idx + 1, val); 2373 gc_aset (h->key_and_value, 2 * idx + 1, val);
2371} 2374}
2372 2375
2373LISP_INLINE void 2376LISP_INLINE void
2374set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) 2377set_hash_next (struct Lisp_Hash_Table *h, Lisp_Object next)
2378{
2379 h->next = next;
2380}
2381
2382LISP_INLINE void
2383set_hash_next_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2375{ 2384{
2376 gc_aset (h->next, idx, val); 2385 gc_aset (h->next, idx, val);
2377} 2386}
2378 2387
2379LISP_INLINE void 2388LISP_INLINE void
2380set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) 2389set_hash_hash (struct Lisp_Hash_Table *h, Lisp_Object hash)
2390{
2391 h->hash = hash;
2392}
2393
2394LISP_INLINE void
2395set_hash_hash_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2381{ 2396{
2382 gc_aset (h->hash, idx, val); 2397 gc_aset (h->hash, idx, val);
2383} 2398}
2384 2399
2385LISP_INLINE void 2400LISP_INLINE void
2386set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val) 2401set_hash_index (struct Lisp_Hash_Table *h, Lisp_Object index)
2402{
2403 h->index = index;
2404}
2405
2406LISP_INLINE void
2407set_hash_index_slot (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
2387{ 2408{
2388 gc_aset (h->index, idx, val); 2409 gc_aset (h->index, idx, val);
2389} 2410}
@@ -2415,6 +2436,52 @@ set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
2415 XSYMBOL (sym)->next = next; 2436 XSYMBOL (sym)->next = next;
2416} 2437}
2417 2438
2439/* Buffer-local (also frame-local) variable access functions. */
2440
2441LISP_INLINE int
2442blv_found (struct Lisp_Buffer_Local_Value *blv)
2443{
2444 eassert (blv->found == !EQ (blv->defcell, blv->valcell));
2445 return blv->found;
2446}
2447
2448LISP_INLINE void
2449set_blv_found (struct Lisp_Buffer_Local_Value *blv, int found)
2450{
2451 eassert (found == !EQ (blv->defcell, blv->valcell));
2452 blv->found = found;
2453}
2454
2455LISP_INLINE Lisp_Object
2456blv_value (struct Lisp_Buffer_Local_Value *blv)
2457{
2458 return XCDR (blv->valcell);
2459}
2460
2461LISP_INLINE void
2462set_blv_value (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2463{
2464 XSETCDR (blv->valcell, val);
2465}
2466
2467LISP_INLINE void
2468set_blv_where (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2469{
2470 blv->where = val;
2471}
2472
2473LISP_INLINE void
2474set_blv_defcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2475{
2476 blv->defcell = val;
2477}
2478
2479LISP_INLINE void
2480set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val)
2481{
2482 blv->valcell = val;
2483}
2484
2418/* Set overlay's property list. */ 2485/* Set overlay's property list. */
2419 2486
2420LISP_INLINE void 2487LISP_INLINE void
@@ -2426,7 +2493,7 @@ set_overlay_plist (Lisp_Object overlay, Lisp_Object plist)
2426/* Get text properties of S. */ 2493/* Get text properties of S. */
2427 2494
2428LISP_INLINE INTERVAL 2495LISP_INLINE INTERVAL
2429string_get_intervals (Lisp_Object s) 2496string_intervals (Lisp_Object s)
2430{ 2497{
2431 return XSTRING (s)->intervals; 2498 return XSTRING (s)->intervals;
2432} 2499}
@@ -2434,29 +2501,53 @@ string_get_intervals (Lisp_Object s)
2434/* Set text properties of S to I. */ 2501/* Set text properties of S to I. */
2435 2502
2436LISP_INLINE void 2503LISP_INLINE void
2437string_set_intervals (Lisp_Object s, INTERVAL i) 2504set_string_intervals (Lisp_Object s, INTERVAL i)
2438{ 2505{
2439 XSTRING (s)->intervals = i; 2506 XSTRING (s)->intervals = i;
2440} 2507}
2441 2508
2509/* Set a Lisp slot in TABLE to VAL. Most code should use this instead
2510 of setting slots directly. */
2511
2512LISP_INLINE void
2513set_char_table_ascii (Lisp_Object table, Lisp_Object val)
2514{
2515 XCHAR_TABLE (table)->ascii = val;
2516}
2517LISP_INLINE void
2518set_char_table_defalt (Lisp_Object table, Lisp_Object val)
2519{
2520 XCHAR_TABLE (table)->defalt = val;
2521}
2522LISP_INLINE void
2523set_char_table_parent (Lisp_Object table, Lisp_Object val)
2524{
2525 XCHAR_TABLE (table)->parent = val;
2526}
2527LISP_INLINE void
2528set_char_table_purpose (Lisp_Object table, Lisp_Object val)
2529{
2530 XCHAR_TABLE (table)->purpose = val;
2531}
2532
2442/* Set different slots in (sub)character tables. */ 2533/* Set different slots in (sub)character tables. */
2443 2534
2444LISP_INLINE void 2535LISP_INLINE void
2445char_table_set_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) 2536set_char_table_extras (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2446{ 2537{
2447 eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table))); 2538 eassert (0 <= idx && idx < CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (table)));
2448 XCHAR_TABLE (table)->extras[idx] = val; 2539 XCHAR_TABLE (table)->extras[idx] = val;
2449} 2540}
2450 2541
2451LISP_INLINE void 2542LISP_INLINE void
2452char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) 2543set_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2453{ 2544{
2454 eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0)); 2545 eassert (0 <= idx && idx < (1 << CHARTAB_SIZE_BITS_0));
2455 XCHAR_TABLE (table)->contents[idx] = val; 2546 XCHAR_TABLE (table)->contents[idx] = val;
2456} 2547}
2457 2548
2458LISP_INLINE void 2549LISP_INLINE void
2459sub_char_table_set_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) 2550set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
2460{ 2551{
2461 XSUB_CHAR_TABLE (table)->contents[idx] = val; 2552 XSUB_CHAR_TABLE (table)->contents[idx] = val;
2462} 2553}
@@ -2708,7 +2799,7 @@ extern Lisp_Object echo_area_buffer[2];
2708extern void add_to_log (const char *, Lisp_Object, Lisp_Object); 2799extern void add_to_log (const char *, Lisp_Object, Lisp_Object);
2709extern void check_message_stack (void); 2800extern void check_message_stack (void);
2710extern void setup_echo_area_for_printing (int); 2801extern void setup_echo_area_for_printing (int);
2711extern int push_message (void); 2802extern bool push_message (void);
2712extern Lisp_Object pop_message_unwind (Lisp_Object); 2803extern Lisp_Object pop_message_unwind (Lisp_Object);
2713extern Lisp_Object restore_message_unwind (Lisp_Object); 2804extern Lisp_Object restore_message_unwind (Lisp_Object);
2714extern void restore_message (void); 2805extern void restore_message (void);
@@ -2751,7 +2842,7 @@ extern void uninterrupt_malloc (void);
2751extern void malloc_warning (const char *); 2842extern void malloc_warning (const char *);
2752extern _Noreturn void memory_full (size_t); 2843extern _Noreturn void memory_full (size_t);
2753extern _Noreturn void buffer_memory_full (ptrdiff_t); 2844extern _Noreturn void buffer_memory_full (ptrdiff_t);
2754extern int survives_gc_p (Lisp_Object); 2845extern bool survives_gc_p (Lisp_Object);
2755extern void mark_object (Lisp_Object); 2846extern void mark_object (Lisp_Object);
2756#if defined REL_ALLOC && !defined SYSTEM_MALLOC 2847#if defined REL_ALLOC && !defined SYSTEM_MALLOC
2757extern void refill_memory_reserve (void); 2848extern void refill_memory_reserve (void);
@@ -2790,8 +2881,8 @@ extern Lisp_Object make_uninit_string (EMACS_INT);
2790extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); 2881extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT);
2791extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); 2882extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t);
2792extern Lisp_Object make_specified_string (const char *, 2883extern Lisp_Object make_specified_string (const char *,
2793 ptrdiff_t, ptrdiff_t, int); 2884 ptrdiff_t, ptrdiff_t, bool);
2794extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); 2885extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, bool);
2795extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); 2886extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t);
2796 2887
2797/* Make a string allocated in pure space, use STR as string data. */ 2888/* Make a string allocated in pure space, use STR as string data. */
@@ -2825,8 +2916,8 @@ extern struct window *allocate_window (void);
2825extern struct frame *allocate_frame (void); 2916extern struct frame *allocate_frame (void);
2826extern struct Lisp_Process *allocate_process (void); 2917extern struct Lisp_Process *allocate_process (void);
2827extern struct terminal *allocate_terminal (void); 2918extern struct terminal *allocate_terminal (void);
2828extern int gc_in_progress; 2919extern bool gc_in_progress;
2829extern int abort_on_gc; 2920extern bool abort_on_gc;
2830extern Lisp_Object make_float (double); 2921extern Lisp_Object make_float (double);
2831extern void display_malloc_warning (void); 2922extern void display_malloc_warning (void);
2832extern ptrdiff_t inhibit_garbage_collection (void); 2923extern ptrdiff_t inhibit_garbage_collection (void);
@@ -2859,9 +2950,8 @@ extern Lisp_Object copy_char_table (Lisp_Object);
2859extern Lisp_Object char_table_ref (Lisp_Object, int); 2950extern Lisp_Object char_table_ref (Lisp_Object, int);
2860extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, 2951extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
2861 int *, int *); 2952 int *, int *);
2862extern Lisp_Object char_table_set (Lisp_Object, int, Lisp_Object); 2953extern void char_table_set (Lisp_Object, int, Lisp_Object);
2863extern Lisp_Object char_table_set_range (Lisp_Object, int, int, 2954extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object);
2864 Lisp_Object);
2865extern int char_table_translate (Lisp_Object, int); 2955extern int char_table_translate (Lisp_Object, int);
2866extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, 2956extern void map_char_table (void (*) (Lisp_Object, Lisp_Object,
2867 Lisp_Object), 2957 Lisp_Object),
diff --git a/src/lread.c b/src/lread.c
index 94ae4dd4282..b0413c98765 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -189,7 +189,7 @@ static int readbyte_from_string (int, Lisp_Object);
189static int unread_char; 189static int unread_char;
190 190
191static int 191static int
192readchar (Lisp_Object readcharfun, int *multibyte) 192readchar (Lisp_Object readcharfun, bool *multibyte)
193{ 193{
194 Lisp_Object tem; 194 Lisp_Object tem;
195 register int c; 195 register int c;
@@ -2354,9 +2354,9 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
2354static Lisp_Object 2354static Lisp_Object
2355read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) 2355read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2356{ 2356{
2357 register int c; 2357 int c;
2358 unsigned uninterned_symbol = 0; 2358 bool uninterned_symbol = 0;
2359 int multibyte; 2359 bool multibyte;
2360 2360
2361 *pch = 0; 2361 *pch = 0;
2362 load_each_byte = 0; 2362 load_each_byte = 0;
@@ -3189,8 +3189,8 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
3189 /* Check for text properties in each interval. 3189 /* Check for text properties in each interval.
3190 substitute_in_interval contains part of the logic. */ 3190 substitute_in_interval contains part of the logic. */
3191 3191
3192 INTERVAL root_interval = string_get_intervals (subtree); 3192 INTERVAL root_interval = string_intervals (subtree);
3193 Lisp_Object arg = Fcons (object, placeholder); 3193 Lisp_Object arg = Fcons (object, placeholder);
3194 3194
3195 traverse_intervals_noorder (root_interval, 3195 traverse_intervals_noorder (root_interval,
3196 &substitute_in_interval, arg); 3196 &substitute_in_interval, arg);
@@ -3211,7 +3211,7 @@ substitute_in_interval (INTERVAL interval, Lisp_Object arg)
3211 Lisp_Object object = Fcar (arg); 3211 Lisp_Object object = Fcar (arg);
3212 Lisp_Object placeholder = Fcdr (arg); 3212 Lisp_Object placeholder = Fcdr (arg);
3213 3213
3214 SUBSTITUTE (interval->plist, interval_set_plist (interval, true_value)); 3214 SUBSTITUTE (interval->plist, set_interval_plist (interval, true_value));
3215} 3215}
3216 3216
3217 3217
@@ -3406,7 +3406,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3406 /* Delay handling the bytecode slot until we know whether 3406 /* Delay handling the bytecode slot until we know whether
3407 it is lazily-loaded (we can tell by whether the 3407 it is lazily-loaded (we can tell by whether the
3408 constants slot is nil). */ 3408 constants slot is nil). */
3409 ptr[COMPILED_CONSTANTS] = item; 3409 ASET (vector, COMPILED_CONSTANTS, item);
3410 item = Qnil; 3410 item = Qnil;
3411 } 3411 }
3412 else if (i == COMPILED_CONSTANTS) 3412 else if (i == COMPILED_CONSTANTS)
@@ -3432,7 +3432,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3432 } 3432 }
3433 3433
3434 /* Now handle the bytecode slot. */ 3434 /* Now handle the bytecode slot. */
3435 ptr[COMPILED_BYTECODE] = bytestr; 3435 ASET (vector, COMPILED_BYTECODE, bytestr);
3436 } 3436 }
3437 else if (i == COMPILED_DOC_STRING 3437 else if (i == COMPILED_DOC_STRING
3438 && STRINGP (item) 3438 && STRINGP (item)
@@ -3444,7 +3444,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3444 item = Fstring_as_multibyte (item); 3444 item = Fstring_as_multibyte (item);
3445 } 3445 }
3446 } 3446 }
3447 ptr[i] = item; 3447 ASET (vector, i, item);
3448 otem = XCONS (tem); 3448 otem = XCONS (tem);
3449 tem = Fcdr (tem); 3449 tem = Fcdr (tem);
3450 free_cons (otem); 3450 free_cons (otem);
diff --git a/src/macros.c b/src/macros.c
index d74d12e6158..e81068181b9 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -127,7 +127,7 @@ macro before appending to it. */)
127 127
128 message ("Appending to kbd macro..."); 128 message ("Appending to kbd macro...");
129 } 129 }
130 KSET (current_kboard, defining_kbd_macro, Qt); 130 kset_defining_kbd_macro (current_kboard, Qt);
131 131
132 return Qnil; 132 return Qnil;
133} 133}
@@ -137,12 +137,13 @@ macro before appending to it. */)
137void 137void
138end_kbd_macro (void) 138end_kbd_macro (void)
139{ 139{
140 KSET (current_kboard, defining_kbd_macro, Qnil); 140 kset_defining_kbd_macro (current_kboard, Qnil);
141 update_mode_lines++; 141 update_mode_lines++;
142 KSET (current_kboard, Vlast_kbd_macro, 142 kset_last_kbd_macro
143 make_event_array ((current_kboard->kbd_macro_end 143 (current_kboard,
144 - current_kboard->kbd_macro_buffer), 144 make_event_array ((current_kboard->kbd_macro_end
145 current_kboard->kbd_macro_buffer)); 145 - current_kboard->kbd_macro_buffer),
146 current_kboard->kbd_macro_buffer));
146} 147}
147 148
148DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p", 149DEFUN ("end-kbd-macro", Fend_kbd_macro, Send_kbd_macro, 0, 2, "p",
@@ -330,7 +331,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */)
330 executing_kbd_macro = final; 331 executing_kbd_macro = final;
331 executing_kbd_macro_index = 0; 332 executing_kbd_macro_index = 0;
332 333
333 KSET (current_kboard, Vprefix_arg, Qnil); 334 kset_prefix_arg (current_kboard, Qnil);
334 335
335 if (!NILP (loopfunc)) 336 if (!NILP (loopfunc))
336 { 337 {
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 9c13f561a04..bdb292099bc 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -1448,6 +1448,7 @@ $(BLD)/unexw32.$(O) : \
1448$(BLD)/vm-limit.$(O) : \ 1448$(BLD)/vm-limit.$(O) : \
1449 $(SRC)/vm-limit.c \ 1449 $(SRC)/vm-limit.c \
1450 $(SRC)/mem-limits.h \ 1450 $(SRC)/mem-limits.h \
1451 $(NT_INC)/unistd.h \
1451 $(CONFIG_H) \ 1452 $(CONFIG_H) \
1452 $(LISP_H) 1453 $(LISP_H)
1453 1454
diff --git a/src/minibuf.c b/src/minibuf.c
index 06ea415db62..2154d1654df 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -565,11 +565,11 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
565 565
566 /* Defeat (setq-default truncate-lines t), since truncated lines do 566 /* Defeat (setq-default truncate-lines t), since truncated lines do
567 not work correctly in minibuffers. (Bug#5715, etc) */ 567 not work correctly in minibuffers. (Bug#5715, etc) */
568 BSET (current_buffer, truncate_lines, Qnil); 568 bset_truncate_lines (current_buffer, Qnil);
569 569
570 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 570 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
571 if (inherit_input_method) 571 if (inherit_input_method)
572 BSET (current_buffer, enable_multibyte_characters, enable_multibyte); 572 bset_enable_multibyte_characters (current_buffer, enable_multibyte);
573 573
574 /* The current buffer's default directory is usually the right thing 574 /* The current buffer's default directory is usually the right thing
575 for our minibuffer here. However, if you're typing a command at 575 for our minibuffer here. However, if you're typing a command at
@@ -580,7 +580,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
580 you think of something better to do? Find another buffer with a 580 you think of something better to do? Find another buffer with a
581 better directory, and use that one instead. */ 581 better directory, and use that one instead. */
582 if (STRINGP (ambient_dir)) 582 if (STRINGP (ambient_dir))
583 BSET (current_buffer, directory, ambient_dir); 583 bset_directory (current_buffer, ambient_dir);
584 else 584 else
585 { 585 {
586 Lisp_Object buf_list; 586 Lisp_Object buf_list;
@@ -594,8 +594,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
594 other_buf = XCDR (XCAR (buf_list)); 594 other_buf = XCDR (XCAR (buf_list));
595 if (STRINGP (BVAR (XBUFFER (other_buf), directory))) 595 if (STRINGP (BVAR (XBUFFER (other_buf), directory)))
596 { 596 {
597 BSET (current_buffer, directory, 597 bset_directory (current_buffer,
598 BVAR (XBUFFER (other_buf), directory)); 598 BVAR (XBUFFER (other_buf), directory));
599 break; 599 break;
600 } 600 }
601 } 601 }
@@ -672,7 +672,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
672 } 672 }
673 673
674 clear_message (1, 1); 674 clear_message (1, 1);
675 BSET (current_buffer, keymap, map); 675 bset_keymap (current_buffer, map);
676 676
677 /* Turn on an input method stored in INPUT_METHOD if any. */ 677 /* Turn on an input method stored in INPUT_METHOD if any. */
678 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method))) 678 if (STRINGP (input_method) && !NILP (Ffboundp (Qactivate_input_method)))
@@ -681,7 +681,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
681 Frun_hooks (1, &Qminibuffer_setup_hook); 681 Frun_hooks (1, &Qminibuffer_setup_hook);
682 682
683 /* Don't allow the user to undo past this point. */ 683 /* Don't allow the user to undo past this point. */
684 BSET (current_buffer, undo_list, Qnil); 684 bset_undo_list (current_buffer, Qnil);
685 685
686 recursive_edit_1 (); 686 recursive_edit_1 ();
687 687
diff --git a/src/msdos.c b/src/msdos.c
index bcb7fbe75e0..a214456d104 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -520,8 +520,8 @@ dos_set_window_size (int *rows, int *cols)
520 520
521 /* If the user specified a special video mode for these dimensions, 521 /* If the user specified a special video mode for these dimensions,
522 use that mode. */ 522 use that mode. */
523 video_mode 523 video_mode
524 = Fsymbol_value (Fintern_soft (make_formatted_string 524 = Fsymbol_value (Fintern_soft (make_formatted_string
525 (video_name, "screen-dimensions-%dx%d", 525 (video_name, "screen-dimensions-%dx%d",
526 *rows, *cols), Qnil)); 526 *rows, *cols), Qnil));
527 527
@@ -1801,7 +1801,7 @@ internal_terminal_init (void)
1801 } 1801 }
1802 1802
1803 tty = FRAME_TTY (sf); 1803 tty = FRAME_TTY (sf);
1804 KSET (current_kboard, Vwindow_system, Qpc); 1804 kset_window_system (current_kboard, Qpc);
1805 sf->output_method = output_msdos_raw; 1805 sf->output_method = output_msdos_raw;
1806 if (init_needed) 1806 if (init_needed)
1807 { 1807 {
@@ -2434,10 +2434,10 @@ and then the scan code. */)
2434 else 2434 else
2435 { 2435 {
2436 val = Fvector (NUM_RECENT_DOSKEYS, keys); 2436 val = Fvector (NUM_RECENT_DOSKEYS, keys);
2437 memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index, 2437 vcopy (val, 0, keys + recent_doskeys_index,
2438 (NUM_RECENT_DOSKEYS - recent_doskeys_index) * word_size); 2438 NUM_RECENT_DOSKEYS - recent_doskeys_index);
2439 memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, 2439 vcopy (val, NUM_RECENT_DOSKEYS - recent_doskeys_index,
2440 keys, recent_doskeys_index * word_size); 2440 keys, recent_doskeys_index);
2441 return val; 2441 return val;
2442 } 2442 }
2443} 2443}
diff --git a/src/nsfns.m b/src/nsfns.m
index 1b39f0257a5..e8b5d22077a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -447,7 +447,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
447 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) 447 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
448 return; 448 return;
449 449
450 FSET (f, icon_name, arg); 450 fset_icon_name (f, arg);
451 451
452 if (NILP (arg)) 452 if (NILP (arg))
453 { 453 {
@@ -539,7 +539,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
539 if (! NILP (Fstring_equal (name, f->name))) 539 if (! NILP (Fstring_equal (name, f->name)))
540 return; 540 return;
541 541
542 FSET (f, name, name); 542 fset_name (f, name);
543 543
544 /* title overrides explicit name */ 544 /* title overrides explicit name */
545 if (! NILP (f->title)) 545 if (! NILP (f->title))
@@ -590,7 +590,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
590 590
591 update_mode_lines = 1; 591 update_mode_lines = 1;
592 592
593 FSET (f, title, name); 593 fset_title (f, name);
594 594
595 if (NILP (name)) 595 if (NILP (name))
596 name = f->name; 596 name = f->name;
@@ -676,7 +676,7 @@ ns_set_name_as_filename (struct frame *f)
676 676
677 [[view window] setRepresentedFilename: fstr]; 677 [[view window] setRepresentedFilename: fstr];
678 [[view window] setTitle: str]; 678 [[view window] setTitle: str];
679 FSET (f, name, name); 679 fset_name (f, name);
680 } 680 }
681 681
682 [pool release]; 682 [pool release];
@@ -1204,11 +1204,11 @@ This function is an internal primitive--use `make-frame' instead. */)
1204 1204
1205 FRAME_FONTSET (f) = -1; 1205 FRAME_FONTSET (f) = -1;
1206 1206
1207 FSET (f, icon_name, x_get_arg (dpyinfo, parms, Qicon_name, 1207 fset_icon_name (f, x_get_arg (dpyinfo, parms, Qicon_name,
1208 "iconName", "Title", 1208 "iconName", "Title",
1209 RES_TYPE_STRING)); 1209 RES_TYPE_STRING));
1210 if (! STRINGP (f->icon_name)) 1210 if (! STRINGP (f->icon_name))
1211 FSET (f, icon_name, Qnil); 1211 fset_icon_name (f, Qnil);
1212 1212
1213 FRAME_NS_DISPLAY_INFO (f) = dpyinfo; 1213 FRAME_NS_DISPLAY_INFO (f) = dpyinfo;
1214 1214
@@ -1231,12 +1231,12 @@ This function is an internal primitive--use `make-frame' instead. */)
1231 be set. */ 1231 be set. */
1232 if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name)) 1232 if (EQ (name, Qunbound) || NILP (name) || ! STRINGP (name))
1233 { 1233 {
1234 FSET (f, name, build_string ([ns_app_name UTF8String])); 1234 fset_name (f, build_string ([ns_app_name UTF8String]));
1235 f->explicit_name = 0; 1235 f->explicit_name = 0;
1236 } 1236 }
1237 else 1237 else
1238 { 1238 {
1239 FSET (f, name, name); 1239 fset_name (f, name);
1240 f->explicit_name = 1; 1240 f->explicit_name = 1;
1241 specbind (Qx_resource_name, name); 1241 specbind (Qx_resource_name, name);
1242 } 1242 }
@@ -1391,13 +1391,13 @@ This function is an internal primitive--use `make-frame' instead. */)
1391 if (FRAME_HAS_MINIBUF_P (f) 1391 if (FRAME_HAS_MINIBUF_P (f)
1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 1392 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 1393 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
1394 KSET (kb, Vdefault_minibuffer_frame, frame); 1394 kset_default_minibuffer_frame (kb, frame);
1395 1395
1396 /* All remaining specified parameters, which have not been "used" 1396 /* All remaining specified parameters, which have not been "used"
1397 by x_get_arg and friends, now go in the misc. alist of the frame. */ 1397 by x_get_arg and friends, now go in the misc. alist of the frame. */
1398 for (tem = parms; CONSP (tem); tem = XCDR (tem)) 1398 for (tem = parms; CONSP (tem); tem = XCDR (tem))
1399 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 1399 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
1400 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 1400 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
1401 1401
1402 UNGCPRO; 1402 UNGCPRO;
1403 1403
diff --git a/src/nsfont.m b/src/nsfont.m
index 1f8d28cd238..412a6777c64 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -270,10 +270,11 @@ ns_ascii_average_width (NSFont *sfont)
270 270
271 if (!ascii_printable) 271 if (!ascii_printable)
272 { 272 {
273 char chars[95]; 273 char chars[96];
274 int ch; 274 int ch;
275 for (ch = 0; ch < 95; ch++) 275 for (ch = 0; ch < 95; ch++)
276 chars[ch] = ' ' + ch; 276 chars[ch] = ' ' + ch;
277 chars[95] = '\0';
277 278
278 ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars]; 279 ascii_printable = [[NSString alloc] initWithFormat: @"%s", chars];
279 } 280 }
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 657b9306942..e8a0b43a01b 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -214,7 +214,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
214 if (! NILP (Vlucid_menu_bar_dirty_flag)) 214 if (! NILP (Vlucid_menu_bar_dirty_flag))
215 call0 (Qrecompute_lucid_menubar); 215 call0 (Qrecompute_lucid_menubar);
216 safe_run_hooks (Qmenu_bar_update_hook); 216 safe_run_hooks (Qmenu_bar_update_hook);
217 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 217 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
218 218
219 /* Now ready to go */ 219 /* Now ready to go */
220 items = FRAME_MENU_BAR_ITEMS (f); 220 items = FRAME_MENU_BAR_ITEMS (f);
@@ -340,7 +340,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
340 } 340 }
341 /* The menu items are different, so store them in the frame */ 341 /* The menu items are different, so store them in the frame */
342 /* FIXME: this is not correct for single-submenu case */ 342 /* FIXME: this is not correct for single-submenu case */
343 FSET (f, menu_bar_vector, menu_items); 343 fset_menu_bar_vector (f, menu_items);
344 f->menu_bar_items_used = menu_items_used; 344 f->menu_bar_items_used = menu_items_used;
345 345
346 /* Calls restore_menu_items, etc., as they were outside */ 346 /* Calls restore_menu_items, etc., as they were outside */
diff --git a/src/nsterm.m b/src/nsterm.m
index a628a248c77..12ca52684e6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1032,7 +1032,7 @@ ns_frame_rehighlight (struct frame *frame)
1032 : dpyinfo->x_focus_frame); 1032 : dpyinfo->x_focus_frame);
1033 if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 1033 if (!FRAME_LIVE_P (dpyinfo->x_highlight_frame))
1034 { 1034 {
1035 FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); 1035 fset_focus_frame (dpyinfo->x_focus_frame, Qnil);
1036 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; 1036 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame;
1037 } 1037 }
1038 } 1038 }
@@ -3698,7 +3698,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3698 { 3698 {
3699 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar); 3699 bar = XNS_SCROLL_BAR (window->vertical_scroll_bar);
3700 [bar removeFromSuperview]; 3700 [bar removeFromSuperview];
3701 WSET (window, vertical_scroll_bar, Qnil); 3701 wset_vertical_scroll_bar (window, Qnil);
3702 } 3702 }
3703 ns_clear_frame_area (f, sb_left, top, width, height); 3703 ns_clear_frame_area (f, sb_left, top, width, height);
3704 UNBLOCK_INPUT; 3704 UNBLOCK_INPUT;
@@ -3709,7 +3709,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3709 { 3709 {
3710 ns_clear_frame_area (f, sb_left, top, width, height); 3710 ns_clear_frame_area (f, sb_left, top, width, height);
3711 bar = [[EmacsScroller alloc] initFrame: r window: win]; 3711 bar = [[EmacsScroller alloc] initFrame: r window: win];
3712 WSET (window, vertical_scroll_bar, make_save_value (bar, 0)); 3712 wset_vertical_scroll_bar (window, make_save_value (bar, 0));
3713 } 3713 }
3714 else 3714 else
3715 { 3715 {
@@ -4093,7 +4093,7 @@ ns_term_init (Lisp_Object display_name)
4093 4093
4094 terminal->kboard = xmalloc (sizeof *terminal->kboard); 4094 terminal->kboard = xmalloc (sizeof *terminal->kboard);
4095 init_kboard (terminal->kboard); 4095 init_kboard (terminal->kboard);
4096 KSET (terminal->kboard, Vwindow_system, Qns); 4096 kset_window_system (terminal->kboard, Qns);
4097 terminal->kboard->next_kboard = all_kboards; 4097 terminal->kboard->next_kboard = all_kboards;
4098 all_kboards = terminal->kboard; 4098 all_kboards = terminal->kboard;
4099 /* Don't let the initial kboard remain current longer than necessary. 4099 /* Don't let the initial kboard remain current longer than necessary.
@@ -4600,11 +4600,15 @@ not_in_argv (NSString *arg)
4600 4600
4601 SELECT_TYPE readfds, writefds, *wfds; 4601 SELECT_TYPE readfds, writefds, *wfds;
4602 EMACS_TIME timeout, *tmo; 4602 EMACS_TIME timeout, *tmo;
4603 NSAutoreleasePool *pool = nil;
4603 4604
4604 /* NSTRACE (fd_handler); */ 4605 /* NSTRACE (fd_handler); */
4605 4606
4606 for (;;) 4607 for (;;)
4607 { 4608 {
4609 [pool release];
4610 pool = [[NSAutoreleasePool alloc] init];
4611
4608 if (waiting) 4612 if (waiting)
4609 { 4613 {
4610 SELECT_TYPE fds; 4614 SELECT_TYPE fds;
@@ -6388,7 +6392,7 @@ not_in_argv (NSString *arg)
6388{ 6392{
6389 NSTRACE (EmacsScroller_dealloc); 6393 NSTRACE (EmacsScroller_dealloc);
6390 if (!NILP (win)) 6394 if (!NILP (win))
6391 WSET (XWINDOW (win), vertical_scroll_bar, Qnil); 6395 wset_vertical_scroll_bar (XWINDOW (win), Qnil);
6392 [super dealloc]; 6396 [super dealloc];
6393} 6397}
6394 6398
diff --git a/src/print.c b/src/print.c
index 23ad6c0a256..64449aeaf2a 100644
--- a/src/print.c
+++ b/src/print.c
@@ -494,14 +494,14 @@ temp_output_buffer_setup (const char *bufname)
494 494
495 Fkill_all_local_variables (); 495 Fkill_all_local_variables ();
496 delete_all_overlays (current_buffer); 496 delete_all_overlays (current_buffer);
497 BSET (current_buffer, directory, BVAR (old, directory)); 497 bset_directory (current_buffer, BVAR (old, directory));
498 BSET (current_buffer, read_only, Qnil); 498 bset_read_only (current_buffer, Qnil);
499 BSET (current_buffer, filename, Qnil); 499 bset_filename (current_buffer, Qnil);
500 BSET (current_buffer, undo_list, Qt); 500 bset_undo_list (current_buffer, Qt);
501 eassert (current_buffer->overlays_before == NULL); 501 eassert (current_buffer->overlays_before == NULL);
502 eassert (current_buffer->overlays_after == NULL); 502 eassert (current_buffer->overlays_after == NULL);
503 BSET (current_buffer, enable_multibyte_characters, 503 bset_enable_multibyte_characters
504 BVAR (&buffer_defaults, enable_multibyte_characters)); 504 (current_buffer, BVAR (&buffer_defaults, enable_multibyte_characters));
505 specbind (Qinhibit_read_only, Qt); 505 specbind (Qinhibit_read_only, Qt);
506 specbind (Qinhibit_modification_hooks, Qt); 506 specbind (Qinhibit_modification_hooks, Qt);
507 Ferase_buffer (); 507 Ferase_buffer ();
@@ -586,6 +586,7 @@ A printed representation of an object is text which describes that object. */)
586 (Lisp_Object object, Lisp_Object noescape) 586 (Lisp_Object object, Lisp_Object noescape)
587{ 587{
588 Lisp_Object printcharfun; 588 Lisp_Object printcharfun;
589 bool prev_abort_on_gc;
589 /* struct gcpro gcpro1, gcpro2; */ 590 /* struct gcpro gcpro1, gcpro2; */
590 Lisp_Object save_deactivate_mark; 591 Lisp_Object save_deactivate_mark;
591 ptrdiff_t count = SPECPDL_INDEX (); 592 ptrdiff_t count = SPECPDL_INDEX ();
@@ -601,7 +602,8 @@ A printed representation of an object is text which describes that object. */)
601 No need for specbind, since errors deactivate the mark. */ 602 No need for specbind, since errors deactivate the mark. */
602 save_deactivate_mark = Vdeactivate_mark; 603 save_deactivate_mark = Vdeactivate_mark;
603 /* GCPRO2 (object, save_deactivate_mark); */ 604 /* GCPRO2 (object, save_deactivate_mark); */
604 abort_on_gc++; 605 prev_abort_on_gc = abort_on_gc;
606 abort_on_gc = 1;
605 607
606 printcharfun = Vprin1_to_string_buffer; 608 printcharfun = Vprin1_to_string_buffer;
607 PRINTPREPARE; 609 PRINTPREPARE;
@@ -625,7 +627,7 @@ A printed representation of an object is text which describes that object. */)
625 Vdeactivate_mark = save_deactivate_mark; 627 Vdeactivate_mark = save_deactivate_mark;
626 /* UNGCPRO; */ 628 /* UNGCPRO; */
627 629
628 abort_on_gc--; 630 abort_on_gc = prev_abort_on_gc;
629 return unbind_to (count, object); 631 return unbind_to (count, object);
630} 632}
631 633
@@ -1194,7 +1196,7 @@ print_preprocess (Lisp_Object obj)
1194 { 1196 {
1195 case Lisp_String: 1197 case Lisp_String:
1196 /* A string may have text properties, which can be circular. */ 1198 /* A string may have text properties, which can be circular. */
1197 traverse_intervals_noorder (string_get_intervals (obj), 1199 traverse_intervals_noorder (string_intervals (obj),
1198 print_preprocess_string, Qnil); 1200 print_preprocess_string, Qnil);
1199 break; 1201 break;
1200 1202
@@ -1297,7 +1299,7 @@ static Lisp_Object
1297print_prune_string_charset (Lisp_Object string) 1299print_prune_string_charset (Lisp_Object string)
1298{ 1300{
1299 print_check_string_result = 0; 1301 print_check_string_result = 0;
1300 traverse_intervals (string_get_intervals (string), 0, 1302 traverse_intervals (string_intervals (string), 0,
1301 print_check_string_charset_prop, string); 1303 print_check_string_charset_prop, string);
1302 if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) 1304 if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
1303 { 1305 {
@@ -1408,7 +1410,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1408 if (! EQ (Vprint_charset_text_property, Qt)) 1410 if (! EQ (Vprint_charset_text_property, Qt))
1409 obj = print_prune_string_charset (obj); 1411 obj = print_prune_string_charset (obj);
1410 1412
1411 if (string_get_intervals (obj)) 1413 if (string_intervals (obj))
1412 { 1414 {
1413 PRINTCHAR ('#'); 1415 PRINTCHAR ('#');
1414 PRINTCHAR ('('); 1416 PRINTCHAR ('(');
@@ -1499,9 +1501,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1499 } 1501 }
1500 PRINTCHAR ('\"'); 1502 PRINTCHAR ('\"');
1501 1503
1502 if (string_get_intervals (obj)) 1504 if (string_intervals (obj))
1503 { 1505 {
1504 traverse_intervals (string_get_intervals (obj), 1506 traverse_intervals (string_intervals (obj),
1505 0, print_interval, printcharfun); 1507 0, print_interval, printcharfun);
1506 PRINTCHAR (')'); 1508 PRINTCHAR (')');
1507 } 1509 }
diff --git a/src/process.c b/src/process.c
index a43655e4da8..7f6f6bafbea 100644
--- a/src/process.c
+++ b/src/process.c
@@ -20,6 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21 21
22#include <config.h> 22#include <config.h>
23
24#define PROCESS_INLINE EXTERN_INLINE
25
23#include <signal.h> 26#include <signal.h>
24#include <stdio.h> 27#include <stdio.h>
25#include <errno.h> 28#include <errno.h>
@@ -334,6 +337,88 @@ static struct sockaddr_and_len {
334/* Maximum number of bytes to send to a pty without an eof. */ 337/* Maximum number of bytes to send to a pty without an eof. */
335static int pty_max_bytes; 338static int pty_max_bytes;
336 339
340/* These setters are used only in this file, so they can be private. */
341static inline void
342pset_buffer (struct Lisp_Process *p, Lisp_Object val)
343{
344 p->buffer = val;
345}
346static inline void
347pset_command (struct Lisp_Process *p, Lisp_Object val)
348{
349 p->command = val;
350}
351static inline void
352pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
353{
354 p->decode_coding_system = val;
355}
356static inline void
357pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
358{
359 p->decoding_buf = val;
360}
361static inline void
362pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
363{
364 p->encode_coding_system = val;
365}
366static inline void
367pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
368{
369 p->encoding_buf = val;
370}
371static inline void
372pset_filter (struct Lisp_Process *p, Lisp_Object val)
373{
374 p->filter = val;
375}
376static inline void
377pset_log (struct Lisp_Process *p, Lisp_Object val)
378{
379 p->log = val;
380}
381static inline void
382pset_mark (struct Lisp_Process *p, Lisp_Object val)
383{
384 p->mark = val;
385}
386static inline void
387pset_name (struct Lisp_Process *p, Lisp_Object val)
388{
389 p->name = val;
390}
391static inline void
392pset_plist (struct Lisp_Process *p, Lisp_Object val)
393{
394 p->plist = val;
395}
396static inline void
397pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
398{
399 p->sentinel = val;
400}
401static inline void
402pset_status (struct Lisp_Process *p, Lisp_Object val)
403{
404 p->status = val;
405}
406static inline void
407pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
408{
409 p->tty_name = val;
410}
411static inline void
412pset_type (struct Lisp_Process *p, Lisp_Object val)
413{
414 p->type = val;
415}
416static inline void
417pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
418{
419 p->write_queue = val;
420}
421
337 422
338 423
339static struct fd_callback_data 424static struct fd_callback_data
@@ -428,7 +513,7 @@ static void
428update_status (struct Lisp_Process *p) 513update_status (struct Lisp_Process *p)
429{ 514{
430 eassert (p->raw_status_new); 515 eassert (p->raw_status_new);
431 PSET (p, status, status_convert (p->raw_status)); 516 pset_status (p, status_convert (p->raw_status));
432 p->raw_status_new = 0; 517 p->raw_status_new = 0;
433} 518}
434 519
@@ -626,8 +711,8 @@ make_process (Lisp_Object name)
626 p = allocate_process (); 711 p = allocate_process ();
627 /* Initialize Lisp data. Note that allocate_process initializes all 712 /* Initialize Lisp data. Note that allocate_process initializes all
628 Lisp data to nil, so do it only for slots which should not be nil. */ 713 Lisp data to nil, so do it only for slots which should not be nil. */
629 PSET (p, status, Qrun); 714 pset_status (p, Qrun);
630 PSET (p, mark, Fmake_marker ()); 715 pset_mark (p, Fmake_marker ());
631 716
632 /* Initialize non-Lisp data. Note that allocate_process zeroes out all 717 /* Initialize non-Lisp data. Note that allocate_process zeroes out all
633 non-Lisp data, so do it only for slots which should not be zero. */ 718 non-Lisp data, so do it only for slots which should not be zero. */
@@ -648,7 +733,7 @@ make_process (Lisp_Object name)
648 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i)); 733 name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
649 } 734 }
650 name = name1; 735 name = name1;
651 PSET (p, name, name); 736 pset_name (p, name);
652 XSETPROCESS (val, p); 737 XSETPROCESS (val, p);
653 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist); 738 Vprocess_alist = Fcons (Fcons (name, val), Vprocess_alist);
654 return val; 739 return val;
@@ -745,7 +830,7 @@ nil, indicating the current buffer's process. */)
745 p->raw_status_new = 0; 830 p->raw_status_new = 0;
746 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 831 if (NETCONN1_P (p) || SERIALCONN1_P (p))
747 { 832 {
748 PSET (p, status, Fcons (Qexit, Fcons (make_number (0), Qnil))); 833 pset_status (p, Fcons (Qexit, Fcons (make_number (0), Qnil)));
749 p->tick = ++process_tick; 834 p->tick = ++process_tick;
750 status_notify (p); 835 status_notify (p);
751 redisplay_preserve_echo_area (13); 836 redisplay_preserve_echo_area (13);
@@ -774,7 +859,7 @@ nil, indicating the current buffer's process. */)
774 { 859 {
775 Fkill_process (process, Qnil); 860 Fkill_process (process, Qnil);
776 /* Do this now, since remove_process will make sigchld_handler do nothing. */ 861 /* Do this now, since remove_process will make sigchld_handler do nothing. */
777 PSET (p, status, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); 862 pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil)));
778 p->tick = ++process_tick; 863 p->tick = ++process_tick;
779 status_notify (p); 864 status_notify (p);
780 redisplay_preserve_echo_area (13); 865 redisplay_preserve_echo_area (13);
@@ -901,9 +986,9 @@ Return BUFFER. */)
901 if (!NILP (buffer)) 986 if (!NILP (buffer))
902 CHECK_BUFFER (buffer); 987 CHECK_BUFFER (buffer);
903 p = XPROCESS (process); 988 p = XPROCESS (process);
904 PSET (p, buffer, buffer); 989 pset_buffer (p, buffer);
905 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 990 if (NETCONN1_P (p) || SERIALCONN1_P (p))
906 PSET (p, childp, Fplist_put (p->childp, QCbuffer, buffer)); 991 pset_childp (p, Fplist_put (p->childp, QCbuffer, buffer));
907 setup_process_coding_systems (process); 992 setup_process_coding_systems (process);
908 return buffer; 993 return buffer;
909} 994}
@@ -974,9 +1059,9 @@ The string argument is normally a multibyte string, except:
974 } 1059 }
975 } 1060 }
976 1061
977 PSET (p, filter, filter); 1062 pset_filter (p, filter);
978 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1063 if (NETCONN1_P (p) || SERIALCONN1_P (p))
979 PSET (p, childp, Fplist_put (p->childp, QCfilter, filter)); 1064 pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
980 setup_process_coding_systems (process); 1065 setup_process_coding_systems (process);
981 return filter; 1066 return filter;
982} 1067}
@@ -1003,9 +1088,9 @@ It gets two arguments: the process, and a string describing the change. */)
1003 CHECK_PROCESS (process); 1088 CHECK_PROCESS (process);
1004 p = XPROCESS (process); 1089 p = XPROCESS (process);
1005 1090
1006 PSET (p, sentinel, sentinel); 1091 pset_sentinel (p, sentinel);
1007 if (NETCONN1_P (p) || SERIALCONN1_P (p)) 1092 if (NETCONN1_P (p) || SERIALCONN1_P (p))
1008 PSET (p, childp, Fplist_put (p->childp, QCsentinel, sentinel)); 1093 pset_childp (p, Fplist_put (p->childp, QCsentinel, sentinel));
1009 return sentinel; 1094 return sentinel;
1010} 1095}
1011 1096
@@ -1138,7 +1223,7 @@ DEFUN ("set-process-plist", Fset_process_plist, Sset_process_plist,
1138 CHECK_PROCESS (process); 1223 CHECK_PROCESS (process);
1139 CHECK_LIST (plist); 1224 CHECK_LIST (plist);
1140 1225
1141 PSET (XPROCESS (process), plist, plist); 1226 pset_plist (XPROCESS (process), plist);
1142 return plist; 1227 return plist;
1143} 1228}
1144 1229
@@ -1324,18 +1409,18 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1324 itself; it's all taken care of here. */ 1409 itself; it's all taken care of here. */
1325 record_unwind_protect (start_process_unwind, proc); 1410 record_unwind_protect (start_process_unwind, proc);
1326 1411
1327 PSET (XPROCESS (proc), childp, Qt); 1412 pset_childp (XPROCESS (proc), Qt);
1328 PSET (XPROCESS (proc), plist, Qnil); 1413 pset_plist (XPROCESS (proc), Qnil);
1329 PSET (XPROCESS (proc), type, Qreal); 1414 pset_type (XPROCESS (proc), Qreal);
1330 PSET (XPROCESS (proc), buffer, buffer); 1415 pset_buffer (XPROCESS (proc), buffer);
1331 PSET (XPROCESS (proc), sentinel, Qnil); 1416 pset_sentinel (XPROCESS (proc), Qnil);
1332 PSET (XPROCESS (proc), filter, Qnil); 1417 pset_filter (XPROCESS (proc), Qnil);
1333 PSET (XPROCESS (proc), command, Flist (nargs - 2, args + 2)); 1418 pset_command (XPROCESS (proc), Flist (nargs - 2, args + 2));
1334 1419
1335#ifdef HAVE_GNUTLS 1420#ifdef HAVE_GNUTLS
1336 /* AKA GNUTLS_INITSTAGE(proc). */ 1421 /* AKA GNUTLS_INITSTAGE(proc). */
1337 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY; 1422 XPROCESS (proc)->gnutls_initstage = GNUTLS_STAGE_EMPTY;
1338 PSET (XPROCESS (proc), gnutls_cred_type, Qnil); 1423 pset_gnutls_cred_type (XPROCESS (proc), Qnil);
1339#endif 1424#endif
1340 1425
1341#ifdef ADAPTIVE_READ_BUFFERING 1426#ifdef ADAPTIVE_READ_BUFFERING
@@ -1375,7 +1460,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1375 else if (CONSP (Vdefault_process_coding_system)) 1460 else if (CONSP (Vdefault_process_coding_system))
1376 val = XCAR (Vdefault_process_coding_system); 1461 val = XCAR (Vdefault_process_coding_system);
1377 } 1462 }
1378 PSET (XPROCESS (proc), decode_coding_system, val); 1463 pset_decode_coding_system (XPROCESS (proc), val);
1379 1464
1380 val = Vcoding_system_for_write; 1465 val = Vcoding_system_for_write;
1381 if (NILP (val)) 1466 if (NILP (val))
@@ -1395,7 +1480,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1395 else if (CONSP (Vdefault_process_coding_system)) 1480 else if (CONSP (Vdefault_process_coding_system))
1396 val = XCDR (Vdefault_process_coding_system); 1481 val = XCDR (Vdefault_process_coding_system);
1397 } 1482 }
1398 PSET (XPROCESS (proc), encode_coding_system, val); 1483 pset_encode_coding_system (XPROCESS (proc), val);
1399 /* Note: At this moment, the above coding system may leave 1484 /* Note: At this moment, the above coding system may leave
1400 text-conversion or eol-conversion unspecified. They will be 1485 text-conversion or eol-conversion unspecified. They will be
1401 decided after we read output from the process and decode it by 1486 decided after we read output from the process and decode it by
@@ -1404,9 +1489,9 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1404 } 1489 }
1405 1490
1406 1491
1407 PSET (XPROCESS (proc), decoding_buf, empty_unibyte_string); 1492 pset_decoding_buf (XPROCESS (proc), empty_unibyte_string);
1408 XPROCESS (proc)->decoding_carryover = 0; 1493 XPROCESS (proc)->decoding_carryover = 0;
1409 PSET (XPROCESS (proc), encoding_buf, empty_unibyte_string); 1494 pset_encoding_buf (XPROCESS (proc), empty_unibyte_string);
1410 1495
1411 XPROCESS (proc)->inherit_coding_system_flag 1496 XPROCESS (proc)->inherit_coding_system_flag
1412 = !(NILP (buffer) || !inherit_process_coding_system); 1497 = !(NILP (buffer) || !inherit_process_coding_system);
@@ -1538,9 +1623,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1538 /* Use volatile to protect variables from being clobbered by longjmp. */ 1623 /* Use volatile to protect variables from being clobbered by longjmp. */
1539 volatile int forkin, forkout; 1624 volatile int forkin, forkout;
1540 volatile int pty_flag = 0; 1625 volatile int pty_flag = 0;
1541#ifndef USE_CRT_DLL
1542 extern char **environ;
1543#endif
1544 1626
1545 inchannel = outchannel = -1; 1627 inchannel = outchannel = -1;
1546 1628
@@ -1628,7 +1710,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1628 more portable (see USG_SUBTTY_WORKS above). */ 1710 more portable (see USG_SUBTTY_WORKS above). */
1629 1711
1630 XPROCESS (process)->pty_flag = pty_flag; 1712 XPROCESS (process)->pty_flag = pty_flag;
1631 PSET (XPROCESS (process), status, Qrun); 1713 pset_status (XPROCESS (process), Qrun);
1632 1714
1633 /* Delay interrupts until we have a chance to store 1715 /* Delay interrupts until we have a chance to store
1634 the new fork's pid in its process structure */ 1716 the new fork's pid in its process structure */
@@ -1867,10 +1949,10 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1867 1949
1868#ifdef HAVE_PTYS 1950#ifdef HAVE_PTYS
1869 if (pty_flag) 1951 if (pty_flag)
1870 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 1952 pset_tty_name (XPROCESS (process), build_string (pty_name));
1871 else 1953 else
1872#endif 1954#endif
1873 PSET (XPROCESS (process), tty_name, Qnil); 1955 pset_tty_name (XPROCESS (process), Qnil);
1874 1956
1875#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1957#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1876 /* Wait for child_setup to complete in case that vfork is 1958 /* Wait for child_setup to complete in case that vfork is
@@ -1965,7 +2047,7 @@ create_pty (Lisp_Object process)
1965 more portable (see USG_SUBTTY_WORKS above). */ 2047 more portable (see USG_SUBTTY_WORKS above). */
1966 2048
1967 XPROCESS (process)->pty_flag = pty_flag; 2049 XPROCESS (process)->pty_flag = pty_flag;
1968 PSET (XPROCESS (process), status, Qrun); 2050 pset_status (XPROCESS (process), Qrun);
1969 setup_process_coding_systems (process); 2051 setup_process_coding_systems (process);
1970 2052
1971 FD_SET (inchannel, &input_wait_mask); 2053 FD_SET (inchannel, &input_wait_mask);
@@ -1976,10 +2058,10 @@ create_pty (Lisp_Object process)
1976 XPROCESS (process)->pid = -2; 2058 XPROCESS (process)->pid = -2;
1977#ifdef HAVE_PTYS 2059#ifdef HAVE_PTYS
1978 if (pty_flag) 2060 if (pty_flag)
1979 PSET (XPROCESS (process), tty_name, build_string (pty_name)); 2061 pset_tty_name (XPROCESS (process), build_string (pty_name));
1980 else 2062 else
1981#endif 2063#endif
1982 PSET (XPROCESS (process), tty_name, Qnil); 2064 pset_tty_name (XPROCESS (process), Qnil);
1983} 2065}
1984 2066
1985 2067
@@ -2368,7 +2450,7 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2368 2450
2369 if (set_socket_option (s, option, value)) 2451 if (set_socket_option (s, option, value))
2370 { 2452 {
2371 PSET (p, childp, Fplist_put (p->childp, option, value)); 2453 pset_childp (p, Fplist_put (p->childp, option, value));
2372 return Qt; 2454 return Qt;
2373 } 2455 }
2374 2456
@@ -2601,18 +2683,18 @@ usage: (make-serial-process &rest ARGS) */)
2601 if (NILP (buffer)) 2683 if (NILP (buffer))
2602 buffer = name; 2684 buffer = name;
2603 buffer = Fget_buffer_create (buffer); 2685 buffer = Fget_buffer_create (buffer);
2604 PSET (p, buffer, buffer); 2686 pset_buffer (p, buffer);
2605 2687
2606 PSET (p, childp, contact); 2688 pset_childp (p, contact);
2607 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 2689 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
2608 PSET (p, type, Qserial); 2690 pset_type (p, Qserial);
2609 PSET (p, sentinel, Fplist_get (contact, QCsentinel)); 2691 pset_sentinel (p, Fplist_get (contact, QCsentinel));
2610 PSET (p, filter, Fplist_get (contact, QCfilter)); 2692 pset_filter (p, Fplist_get (contact, QCfilter));
2611 PSET (p, log, Qnil); 2693 pset_log (p, Qnil);
2612 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 2694 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
2613 p->kill_without_query = 1; 2695 p->kill_without_query = 1;
2614 if (tem = Fplist_get (contact, QCstop), !NILP (tem)) 2696 if (tem = Fplist_get (contact, QCstop), !NILP (tem))
2615 PSET (p, command, Qt); 2697 pset_command (p, Qt);
2616 p->pty_flag = 0; 2698 p->pty_flag = 0;
2617 2699
2618 if (!EQ (p->command, Qt)) 2700 if (!EQ (p->command, Qt))
@@ -2644,7 +2726,7 @@ usage: (make-serial-process &rest ARGS) */)
2644 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2726 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2645 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2727 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2646 val = Qnil; 2728 val = Qnil;
2647 PSET (p, decode_coding_system, val); 2729 pset_decode_coding_system (p, val);
2648 2730
2649 val = Qnil; 2731 val = Qnil;
2650 if (!NILP (tem)) 2732 if (!NILP (tem))
@@ -2658,12 +2740,12 @@ usage: (make-serial-process &rest ARGS) */)
2658 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters))) 2740 else if ((!NILP (buffer) && NILP (BVAR (XBUFFER (buffer), enable_multibyte_characters)))
2659 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))) 2741 || (NILP (buffer) && NILP (BVAR (&buffer_defaults, enable_multibyte_characters))))
2660 val = Qnil; 2742 val = Qnil;
2661 PSET (p, encode_coding_system, val); 2743 pset_encode_coding_system (p, val);
2662 2744
2663 setup_process_coding_systems (proc); 2745 setup_process_coding_systems (proc);
2664 PSET (p, decoding_buf, empty_unibyte_string); 2746 pset_decoding_buf (p, empty_unibyte_string);
2665 p->decoding_carryover = 0; 2747 p->decoding_carryover = 0;
2666 PSET (p, encoding_buf, empty_unibyte_string); 2748 pset_encoding_buf (p, empty_unibyte_string);
2667 p->inherit_coding_system_flag 2749 p->inherit_coding_system_flag
2668 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 2750 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
2669 2751
@@ -3400,23 +3482,23 @@ usage: (make-network-process &rest ARGS) */)
3400 3482
3401 p = XPROCESS (proc); 3483 p = XPROCESS (proc);
3402 3484
3403 PSET (p, childp, contact); 3485 pset_childp (p, contact);
3404 PSET (p, plist, Fcopy_sequence (Fplist_get (contact, QCplist))); 3486 pset_plist (p, Fcopy_sequence (Fplist_get (contact, QCplist)));
3405 PSET (p, type, Qnetwork); 3487 pset_type (p, Qnetwork);
3406 3488
3407 PSET (p, buffer, buffer); 3489 pset_buffer (p, buffer);
3408 PSET (p, sentinel, sentinel); 3490 pset_sentinel (p, sentinel);
3409 PSET (p, filter, filter); 3491 pset_filter (p, filter);
3410 PSET (p, log, Fplist_get (contact, QClog)); 3492 pset_log (p, Fplist_get (contact, QClog));
3411 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem)) 3493 if (tem = Fplist_get (contact, QCnoquery), !NILP (tem))
3412 p->kill_without_query = 1; 3494 p->kill_without_query = 1;
3413 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3495 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3414 PSET (p, command, Qt); 3496 pset_command (p, Qt);
3415 p->pid = 0; 3497 p->pid = 0;
3416 p->infd = inch; 3498 p->infd = inch;
3417 p->outfd = outch; 3499 p->outfd = outch;
3418 if (is_server && socktype != SOCK_DGRAM) 3500 if (is_server && socktype != SOCK_DGRAM)
3419 PSET (p, status, Qlisten); 3501 pset_status (p, Qlisten);
3420 3502
3421 /* Make the process marker point into the process buffer (if any). */ 3503 /* Make the process marker point into the process buffer (if any). */
3422 if (BUFFERP (buffer)) 3504 if (BUFFERP (buffer))
@@ -3430,7 +3512,7 @@ usage: (make-network-process &rest ARGS) */)
3430 /* We may get here if connect did succeed immediately. However, 3512 /* We may get here if connect did succeed immediately. However,
3431 in that case, we still need to signal this like a non-blocking 3513 in that case, we still need to signal this like a non-blocking
3432 connection. */ 3514 connection. */
3433 PSET (p, status, Qconnect); 3515 pset_status (p, Qconnect);
3434 if (!FD_ISSET (inch, &connect_wait_mask)) 3516 if (!FD_ISSET (inch, &connect_wait_mask))
3435 { 3517 {
3436 FD_SET (inch, &connect_wait_mask); 3518 FD_SET (inch, &connect_wait_mask);
@@ -3497,7 +3579,7 @@ usage: (make-network-process &rest ARGS) */)
3497 else 3579 else
3498 val = Qnil; 3580 val = Qnil;
3499 } 3581 }
3500 PSET (p, decode_coding_system, val); 3582 pset_decode_coding_system (p, val);
3501 3583
3502 if (!NILP (tem)) 3584 if (!NILP (tem))
3503 { 3585 {
@@ -3531,13 +3613,13 @@ usage: (make-network-process &rest ARGS) */)
3531 else 3613 else
3532 val = Qnil; 3614 val = Qnil;
3533 } 3615 }
3534 PSET (p, encode_coding_system, val); 3616 pset_encode_coding_system (p, val);
3535 } 3617 }
3536 setup_process_coding_systems (proc); 3618 setup_process_coding_systems (proc);
3537 3619
3538 PSET (p, decoding_buf, empty_unibyte_string); 3620 pset_decoding_buf (p, empty_unibyte_string);
3539 p->decoding_carryover = 0; 3621 p->decoding_carryover = 0;
3540 PSET (p, encoding_buf, empty_unibyte_string); 3622 pset_encoding_buf (p, empty_unibyte_string);
3541 3623
3542 p->inherit_coding_system_flag 3624 p->inherit_coding_system_flag
3543 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system); 3625 = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
@@ -4150,18 +4232,18 @@ server_accept_connection (Lisp_Object server, int channel)
4150 conv_sockaddr_to_lisp (&saddr.sa, len)); 4232 conv_sockaddr_to_lisp (&saddr.sa, len));
4151#endif 4233#endif
4152 4234
4153 PSET (p, childp, contact); 4235 pset_childp (p, contact);
4154 PSET (p, plist, Fcopy_sequence (ps->plist)); 4236 pset_plist (p, Fcopy_sequence (ps->plist));
4155 PSET (p, type, Qnetwork); 4237 pset_type (p, Qnetwork);
4156 4238
4157 PSET (p, buffer, buffer); 4239 pset_buffer (p, buffer);
4158 PSET (p, sentinel, ps->sentinel); 4240 pset_sentinel (p, ps->sentinel);
4159 PSET (p, filter, ps->filter); 4241 pset_filter (p, ps->filter);
4160 PSET (p, command, Qnil); 4242 pset_command (p, Qnil);
4161 p->pid = 0; 4243 p->pid = 0;
4162 p->infd = s; 4244 p->infd = s;
4163 p->outfd = s; 4245 p->outfd = s;
4164 PSET (p, status, Qrun); 4246 pset_status (p, Qrun);
4165 4247
4166 /* Client processes for accepted connections are not stopped initially. */ 4248 /* Client processes for accepted connections are not stopped initially. */
4167 if (!EQ (p->filter, Qt)) 4249 if (!EQ (p->filter, Qt))
@@ -4178,13 +4260,13 @@ server_accept_connection (Lisp_Object server, int channel)
4178 of the new process should reflect the settings at the time the 4260 of the new process should reflect the settings at the time the
4179 server socket was opened; not the current settings. */ 4261 server socket was opened; not the current settings. */
4180 4262
4181 PSET (p, decode_coding_system, ps->decode_coding_system); 4263 pset_decode_coding_system (p, ps->decode_coding_system);
4182 PSET (p, encode_coding_system, ps->encode_coding_system); 4264 pset_encode_coding_system (p, ps->encode_coding_system);
4183 setup_process_coding_systems (proc); 4265 setup_process_coding_systems (proc);
4184 4266
4185 PSET (p, decoding_buf, empty_unibyte_string); 4267 pset_decoding_buf (p, empty_unibyte_string);
4186 p->decoding_carryover = 0; 4268 p->decoding_carryover = 0;
4187 PSET (p, encoding_buf, empty_unibyte_string); 4269 pset_encoding_buf (p, empty_unibyte_string);
4188 4270
4189 p->inherit_coding_system_flag 4271 p->inherit_coding_system_flag
4190 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag); 4272 = (NILP (buffer) ? 0 : ps->inherit_coding_system_flag);
@@ -4889,7 +4971,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4889 waitpid() will not find the process object to 4971 waitpid() will not find the process object to
4890 delete. Do it here. */ 4972 delete. Do it here. */
4891 p->tick = ++process_tick; 4973 p->tick = ++process_tick;
4892 PSET (p, status, Qfailed); 4974 pset_status (p, Qfailed);
4893 } 4975 }
4894 else 4976 else
4895 kill (getpid (), SIGCHLD); 4977 kill (getpid (), SIGCHLD);
@@ -4909,8 +4991,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4909 if (XPROCESS (proc)->raw_status_new) 4991 if (XPROCESS (proc)->raw_status_new)
4910 update_status (XPROCESS (proc)); 4992 update_status (XPROCESS (proc));
4911 if (EQ (XPROCESS (proc)->status, Qrun)) 4993 if (EQ (XPROCESS (proc)->status, Qrun))
4912 PSET (XPROCESS (proc), status, 4994 pset_status (XPROCESS (proc),
4913 Fcons (Qexit, Fcons (make_number (256), Qnil))); 4995 list2 (Qexit, make_number (256)));
4914 } 4996 }
4915 } 4997 }
4916#ifdef NON_BLOCKING_CONNECT 4998#ifdef NON_BLOCKING_CONNECT
@@ -4958,13 +5040,12 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4958 if (xerrno) 5040 if (xerrno)
4959 { 5041 {
4960 p->tick = ++process_tick; 5042 p->tick = ++process_tick;
4961 PSET (p, status, 5043 pset_status (p, list2 (Qfailed, make_number (xerrno)));
4962 Fcons (Qfailed, Fcons (make_number (xerrno), Qnil)));
4963 deactivate_process (proc); 5044 deactivate_process (proc);
4964 } 5045 }
4965 else 5046 else
4966 { 5047 {
4967 PSET (p, status, Qrun); 5048 pset_status (p, Qrun);
4968 /* Execute the sentinel here. If we had relied on 5049 /* Execute the sentinel here. If we had relied on
4969 status_notify to do it later, it will read input 5050 status_notify to do it later, it will read input
4970 from the process before calling the sentinel. */ 5051 from the process before calling the sentinel. */
@@ -5164,7 +5245,7 @@ read_process_output (Lisp_Object proc, register int channel)
5164 /* A new coding system might be found. */ 5245 /* A new coding system might be found. */
5165 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5246 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5166 { 5247 {
5167 PSET (p, decode_coding_system, Vlast_coding_system_used); 5248 pset_decode_coding_system (p, Vlast_coding_system_used);
5168 5249
5169 /* Don't call setup_coding_system for 5250 /* Don't call setup_coding_system for
5170 proc_decode_coding_system[channel] here. It is done in 5251 proc_decode_coding_system[channel] here. It is done in
@@ -5180,8 +5261,8 @@ read_process_output (Lisp_Object proc, register int channel)
5180 if (NILP (p->encode_coding_system) 5261 if (NILP (p->encode_coding_system)
5181 && proc_encode_coding_system[p->outfd]) 5262 && proc_encode_coding_system[p->outfd])
5182 { 5263 {
5183 PSET (p, encode_coding_system, 5264 pset_encode_coding_system
5184 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5265 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5185 setup_coding_system (p->encode_coding_system, 5266 setup_coding_system (p->encode_coding_system,
5186 proc_encode_coding_system[p->outfd]); 5267 proc_encode_coding_system[p->outfd]);
5187 } 5268 }
@@ -5190,7 +5271,7 @@ read_process_output (Lisp_Object proc, register int channel)
5190 if (coding->carryover_bytes > 0) 5271 if (coding->carryover_bytes > 0)
5191 { 5272 {
5192 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5273 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5193 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5274 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5194 memcpy (SDATA (p->decoding_buf), coding->carryover, 5275 memcpy (SDATA (p->decoding_buf), coding->carryover,
5195 coding->carryover_bytes); 5276 coding->carryover_bytes);
5196 p->decoding_carryover = coding->carryover_bytes; 5277 p->decoding_carryover = coding->carryover_bytes;
@@ -5246,7 +5327,7 @@ read_process_output (Lisp_Object proc, register int channel)
5246 old_begv_byte = BEGV_BYTE; 5327 old_begv_byte = BEGV_BYTE;
5247 old_zv_byte = ZV_BYTE; 5328 old_zv_byte = ZV_BYTE;
5248 5329
5249 BSET (current_buffer, read_only, Qnil); 5330 bset_read_only (current_buffer, Qnil);
5250 5331
5251 /* Insert new output into buffer 5332 /* Insert new output into buffer
5252 at the current end-of-output marker, 5333 at the current end-of-output marker,
@@ -5274,12 +5355,12 @@ read_process_output (Lisp_Object proc, register int channel)
5274 similar code in the previous `if' block. */ 5355 similar code in the previous `if' block. */
5275 if (!EQ (p->decode_coding_system, Vlast_coding_system_used)) 5356 if (!EQ (p->decode_coding_system, Vlast_coding_system_used))
5276 { 5357 {
5277 PSET (p, decode_coding_system, Vlast_coding_system_used); 5358 pset_decode_coding_system (p, Vlast_coding_system_used);
5278 if (NILP (p->encode_coding_system) 5359 if (NILP (p->encode_coding_system)
5279 && proc_encode_coding_system[p->outfd]) 5360 && proc_encode_coding_system[p->outfd])
5280 { 5361 {
5281 PSET (p, encode_coding_system, 5362 pset_encode_coding_system
5282 coding_inherit_eol_type (Vlast_coding_system_used, Qnil)); 5363 (p, coding_inherit_eol_type (Vlast_coding_system_used, Qnil));
5283 setup_coding_system (p->encode_coding_system, 5364 setup_coding_system (p->encode_coding_system,
5284 proc_encode_coding_system[p->outfd]); 5365 proc_encode_coding_system[p->outfd]);
5285 } 5366 }
@@ -5287,7 +5368,7 @@ read_process_output (Lisp_Object proc, register int channel)
5287 if (coding->carryover_bytes > 0) 5368 if (coding->carryover_bytes > 0)
5288 { 5369 {
5289 if (SCHARS (p->decoding_buf) < coding->carryover_bytes) 5370 if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
5290 PSET (p, decoding_buf, make_uninit_string (coding->carryover_bytes)); 5371 pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
5291 memcpy (SDATA (p->decoding_buf), coding->carryover, 5372 memcpy (SDATA (p->decoding_buf), coding->carryover,
5292 coding->carryover_bytes); 5373 coding->carryover_bytes);
5293 p->decoding_carryover = coding->carryover_bytes; 5374 p->decoding_carryover = coding->carryover_bytes;
@@ -5337,7 +5418,7 @@ read_process_output (Lisp_Object proc, register int channel)
5337 Fnarrow_to_region (make_number (old_begv), make_number (old_zv)); 5418 Fnarrow_to_region (make_number (old_begv), make_number (old_zv));
5338 5419
5339 5420
5340 BSET (current_buffer, read_only, old_read_only); 5421 bset_read_only (current_buffer, old_read_only);
5341 SET_PT_BOTH (opoint, opoint_byte); 5422 SET_PT_BOTH (opoint, opoint_byte);
5342 } 5423 }
5343 /* Handling the process output should not deactivate the mark. */ 5424 /* Handling the process output should not deactivate the mark. */
@@ -5404,9 +5485,9 @@ write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
5404 entry = Fcons (obj, Fcons (make_number (offset), make_number (len))); 5485 entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
5405 5486
5406 if (front) 5487 if (front)
5407 PSET (p, write_queue, Fcons (entry, p->write_queue)); 5488 pset_write_queue (p, Fcons (entry, p->write_queue));
5408 else 5489 else
5409 PSET (p, write_queue, nconc2 (p->write_queue, Fcons (entry, Qnil))); 5490 pset_write_queue (p, nconc2 (p->write_queue, Fcons (entry, Qnil)));
5410} 5491}
5411 5492
5412/* Remove the first element in the write_queue of process P, put its 5493/* Remove the first element in the write_queue of process P, put its
@@ -5424,7 +5505,7 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5424 return 0; 5505 return 0;
5425 5506
5426 entry = XCAR (p->write_queue); 5507 entry = XCAR (p->write_queue);
5427 PSET (p, write_queue, XCDR (p->write_queue)); 5508 pset_write_queue (p, XCDR (p->write_queue));
5428 5509
5429 *obj = XCAR (entry); 5510 *obj = XCAR (entry);
5430 offset_length = XCDR (entry); 5511 offset_length = XCDR (entry);
@@ -5471,8 +5552,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5471 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters))) 5552 && !NILP (BVAR (XBUFFER (object), enable_multibyte_characters)))
5472 || EQ (object, Qt)) 5553 || EQ (object, Qt))
5473 { 5554 {
5474 PSET (p, encode_coding_system, 5555 pset_encode_coding_system
5475 complement_process_encoding_system (p->encode_coding_system)); 5556 (p, complement_process_encoding_system (p->encode_coding_system));
5476 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5557 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5477 { 5558 {
5478 /* The coding system for encoding was changed to raw-text 5559 /* The coding system for encoding was changed to raw-text
@@ -5693,7 +5774,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5693 proc = process_sent_to; 5774 proc = process_sent_to;
5694 p = XPROCESS (proc); 5775 p = XPROCESS (proc);
5695 p->raw_status_new = 0; 5776 p->raw_status_new = 0;
5696 PSET (p, status, Fcons (Qexit, Fcons (make_number (256), Qnil))); 5777 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5697 p->tick = ++process_tick; 5778 p->tick = ++process_tick;
5698 deactivate_process (proc); 5779 deactivate_process (proc);
5699 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); 5780 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
@@ -5922,7 +6003,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5922#ifdef SIGCONT 6003#ifdef SIGCONT
5923 case SIGCONT: 6004 case SIGCONT:
5924 p->raw_status_new = 0; 6005 p->raw_status_new = 0;
5925 PSET (p, status, Qrun); 6006 pset_status (p, Qrun);
5926 p->tick = ++process_tick; 6007 p->tick = ++process_tick;
5927 if (!nomsg) 6008 if (!nomsg)
5928 { 6009 {
@@ -6018,7 +6099,7 @@ traffic. */)
6018 FD_CLR (p->infd, &input_wait_mask); 6099 FD_CLR (p->infd, &input_wait_mask);
6019 FD_CLR (p->infd, &non_keyboard_wait_mask); 6100 FD_CLR (p->infd, &non_keyboard_wait_mask);
6020 } 6101 }
6021 PSET (p, command, Qt); 6102 pset_command (p, Qt);
6022 return process; 6103 return process;
6023 } 6104 }
6024#ifndef SIGTSTP 6105#ifndef SIGTSTP
@@ -6054,7 +6135,7 @@ traffic. */)
6054 tcflush (p->infd, TCIFLUSH); 6135 tcflush (p->infd, TCIFLUSH);
6055#endif /* not WINDOWSNT */ 6136#endif /* not WINDOWSNT */
6056 } 6137 }
6057 PSET (p, command, Qnil); 6138 pset_command (p, Qnil);
6058 return process; 6139 return process;
6059 } 6140 }
6060#ifdef SIGCONT 6141#ifdef SIGCONT
@@ -6470,7 +6551,7 @@ sigchld_handler (int signo)
6470static Lisp_Object 6551static Lisp_Object
6471exec_sentinel_unwind (Lisp_Object data) 6552exec_sentinel_unwind (Lisp_Object data)
6472{ 6553{
6473 PSET (XPROCESS (XCAR (data)), sentinel, XCDR (data)); 6554 pset_sentinel (XPROCESS (XCAR (data)), XCDR (data));
6474 return Qnil; 6555 return Qnil;
6475} 6556}
6476 6557
@@ -6516,7 +6597,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
6516 6597
6517 /* Zilch the sentinel while it's running, to avoid recursive invocations; 6598 /* Zilch the sentinel while it's running, to avoid recursive invocations;
6518 assure that it gets restored no matter how the sentinel exits. */ 6599 assure that it gets restored no matter how the sentinel exits. */
6519 PSET (p, sentinel, Qnil); 6600 pset_sentinel (p, Qnil);
6520 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel)); 6601 record_unwind_protect (exec_sentinel_unwind, Fcons (proc, sentinel));
6521 /* Inhibit quit so that random quits don't screw up a running filter. */ 6602 /* Inhibit quit so that random quits don't screw up a running filter. */
6522 specbind (Qinhibit_quit, Qt); 6603 specbind (Qinhibit_quit, Qt);
@@ -6671,13 +6752,13 @@ status_notify (struct Lisp_Process *deleting_process)
6671 before_byte = PT_BYTE; 6752 before_byte = PT_BYTE;
6672 6753
6673 tem = BVAR (current_buffer, read_only); 6754 tem = BVAR (current_buffer, read_only);
6674 BSET (current_buffer, read_only, Qnil); 6755 bset_read_only (current_buffer, Qnil);
6675 insert_string ("\nProcess "); 6756 insert_string ("\nProcess ");
6676 { /* FIXME: temporary kludge */ 6757 { /* FIXME: temporary kludge */
6677 Lisp_Object tem2 = p->name; Finsert (1, &tem2); } 6758 Lisp_Object tem2 = p->name; Finsert (1, &tem2); }
6678 insert_string (" "); 6759 insert_string (" ");
6679 Finsert (1, &msg); 6760 Finsert (1, &msg);
6680 BSET (current_buffer, read_only, tem); 6761 bset_read_only (current_buffer, tem);
6681 set_marker_both (p->mark, p->buffer, PT, PT_BYTE); 6762 set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
6682 6763
6683 if (opoint >= before) 6764 if (opoint >= before)
@@ -6714,8 +6795,8 @@ encode subprocess input. */)
6714 Fcheck_coding_system (decoding); 6795 Fcheck_coding_system (decoding);
6715 Fcheck_coding_system (encoding); 6796 Fcheck_coding_system (encoding);
6716 encoding = coding_inherit_eol_type (encoding, Qnil); 6797 encoding = coding_inherit_eol_type (encoding, Qnil);
6717 PSET (p, decode_coding_system, decoding); 6798 pset_decode_coding_system (p, decoding);
6718 PSET (p, encode_coding_system, encoding); 6799 pset_encode_coding_system (p, encoding);
6719 setup_process_coding_systems (process); 6800 setup_process_coding_systems (process);
6720 6801
6721 return Qnil; 6802 return Qnil;
@@ -6745,8 +6826,8 @@ suppressed. */)
6745 CHECK_PROCESS (process); 6826 CHECK_PROCESS (process);
6746 p = XPROCESS (process); 6827 p = XPROCESS (process);
6747 if (NILP (flag)) 6828 if (NILP (flag))
6748 PSET (p, decode_coding_system, 6829 pset_decode_coding_system
6749 raw_text_coding_system (p->decode_coding_system)); 6830 (p, raw_text_coding_system (p->decode_coding_system));
6750 setup_process_coding_systems (process); 6831 setup_process_coding_systems (process);
6751 6832
6752 return Qnil; 6833 return Qnil;
diff --git a/src/process.h b/src/process.h
index 43cc7ea33c0..55a572117c6 100644
--- a/src/process.h
+++ b/src/process.h
@@ -26,10 +26,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include "gnutls.h" 26#include "gnutls.h"
27#endif 27#endif
28 28
29/* Most code should use these macros to set 29INLINE_HEADER_BEGIN
30 Lisp fields in struct Lisp_Process. */ 30#ifndef PROCESS_INLINE
31 31# define PROCESS_INLINE INLINE
32#define PSET(p, field, value) ((p)->field = (value)) 32#endif
33 33
34/* This structure records information about a subprocess 34/* This structure records information about a subprocess
35 or network connection. */ 35 or network connection. */
@@ -165,6 +165,23 @@ struct Lisp_Process
165 165
166#define ChannelMask(n) (1 << (n)) 166#define ChannelMask(n) (1 << (n))
167 167
168/* Most code should use these functions to set Lisp fields in struct
169 process. */
170
171PROCESS_INLINE void
172pset_childp (struct Lisp_Process *p, Lisp_Object val)
173{
174 p->childp = val;
175}
176
177#ifdef HAVE_GNUTLS
178PROCESS_INLINE void
179pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
180{
181 p->gnutls_cred_type = val;
182}
183#endif
184
168/* True if we are about to fork off a synchronous process or if we 185/* True if we are about to fork off a synchronous process or if we
169 are waiting for it. */ 186 are waiting for it. */
170extern int synch_process_alive; 187extern int synch_process_alive;
@@ -208,3 +225,5 @@ extern void add_read_fd (int fd, fd_callback func, void *data);
208extern void delete_read_fd (int fd); 225extern void delete_read_fd (int fd);
209extern void add_write_fd (int fd, fd_callback func, void *data); 226extern void add_write_fd (int fd, fd_callback func, void *data);
210extern void delete_write_fd (int fd); 227extern void delete_write_fd (int fd);
228
229INLINE_HEADER_END
diff --git a/src/search.c b/src/search.c
index 4bf4d11c33a..0b4f635066c 100644
--- a/src/search.c
+++ b/src/search.c
@@ -278,7 +278,7 @@ looking_at_1 (Lisp_Object string, int posix)
278 save_search_regs (); 278 save_search_regs ();
279 279
280 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 280 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
281 char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, 281 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
282 BVAR (current_buffer, case_eqv_table)); 282 BVAR (current_buffer, case_eqv_table));
283 283
284 CHECK_STRING (string); 284 CHECK_STRING (string);
@@ -393,7 +393,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p
393 } 393 }
394 394
395 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 395 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
396 char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, 396 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
397 BVAR (current_buffer, case_eqv_table)); 397 BVAR (current_buffer, case_eqv_table));
398 398
399 bufp = compile_pattern (regexp, 399 bufp = compile_pattern (regexp,
@@ -990,7 +990,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
990 } 990 }
991 991
992 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ 992 /* This is so set_image_of_range_1 in regex.c can find the EQV table. */
993 char_table_set_extras (BVAR (current_buffer, case_canon_table), 2, 993 set_char_table_extras (BVAR (current_buffer, case_canon_table), 2,
994 BVAR (current_buffer, case_eqv_table)); 994 BVAR (current_buffer, case_eqv_table));
995 995
996 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, 996 np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE,
diff --git a/src/syntax.c b/src/syntax.c
index 69965d1d824..f995b8f2cac 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -149,6 +149,13 @@ static void scan_sexps_forward (struct lisp_parse_state *,
149 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, 149 ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
150 int, Lisp_Object, int); 150 int, Lisp_Object, int);
151static int in_classes (int, Lisp_Object); 151static int in_classes (int, Lisp_Object);
152
153/* This setter is used only in this file, so it can be private. */
154static inline void
155bset_syntax_table (struct buffer *b, Lisp_Object val)
156{
157 b->INTERNAL_FIELD (syntax_table) = val;
158}
152 159
153/* Whether the syntax of the character C has the prefix flag set. */ 160/* Whether the syntax of the character C has the prefix flag set. */
154int syntax_prefix_flag_p (int c) 161int syntax_prefix_flag_p (int c)
@@ -818,7 +825,7 @@ It is a copy of the TABLE, which defaults to the standard syntax table. */)
818 825
819 /* Only the standard syntax table should have a default element. 826 /* Only the standard syntax table should have a default element.
820 Other syntax tables should inherit from parents instead. */ 827 Other syntax tables should inherit from parents instead. */
821 CSET (XCHAR_TABLE (copy), defalt, Qnil); 828 set_char_table_defalt (copy, Qnil);
822 829
823 /* Copied syntax tables should all have parents. 830 /* Copied syntax tables should all have parents.
824 If we copied one with no parent, such as the standard syntax table, 831 If we copied one with no parent, such as the standard syntax table,
@@ -835,7 +842,7 @@ One argument, a syntax table. */)
835{ 842{
836 int idx; 843 int idx;
837 check_syntax_table (table); 844 check_syntax_table (table);
838 BSET (current_buffer, syntax_table, table); 845 bset_syntax_table (current_buffer, table);
839 /* Indicate that this buffer now has a specified syntax table. */ 846 /* Indicate that this buffer now has a specified syntax table. */
840 idx = PER_BUFFER_VAR_IDX (syntax_table); 847 idx = PER_BUFFER_VAR_IDX (syntax_table);
841 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1); 848 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 1);
diff --git a/src/sysdep.c b/src/sysdep.c
index 1dbe8938e46..183ee005227 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2307,8 +2307,7 @@ serial_configure (struct Lisp_Process *p,
2307 error ("tcsetattr() failed: %s", emacs_strerror (errno)); 2307 error ("tcsetattr() failed: %s", emacs_strerror (errno));
2308 2308
2309 childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); 2309 childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
2310 PSET (p, childp, childp2); 2310 pset_childp (p, childp2);
2311
2312} 2311}
2313#endif /* not DOS_NT */ 2312#endif /* not DOS_NT */
2314 2313
diff --git a/src/term.c b/src/term.c
index c5cec3062e3..23e074287c1 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1332,7 +1332,7 @@ term_get_fkeys_1 (void)
1332 1332
1333 /* This can happen if CANNOT_DUMP or with strange options. */ 1333 /* This can happen if CANNOT_DUMP or with strange options. */
1334 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) 1334 if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
1335 KSET (kboard, Vinput_decode_map, Fmake_sparse_keymap (Qnil)); 1335 kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
1336 1336
1337 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) 1337 for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++)
1338 { 1338 {
@@ -3280,7 +3280,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3280 3280
3281 terminal->kboard = xmalloc (sizeof *terminal->kboard); 3281 terminal->kboard = xmalloc (sizeof *terminal->kboard);
3282 init_kboard (terminal->kboard); 3282 init_kboard (terminal->kboard);
3283 KSET (terminal->kboard, Vwindow_system, Qnil); 3283 kset_window_system (terminal->kboard, Qnil);
3284 terminal->kboard->next_kboard = all_kboards; 3284 terminal->kboard->next_kboard = all_kboards;
3285 all_kboards = terminal->kboard; 3285 all_kboards = terminal->kboard;
3286 terminal->kboard->reference_count++; 3286 terminal->kboard->reference_count++;
diff --git a/src/termhooks.h b/src/termhooks.h
index 78d8532e03f..46962a1217d 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -22,6 +22,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include "systime.h" /* for Time */ 23#include "systime.h" /* for Time */
24 24
25INLINE_HEADER_BEGIN
26#ifndef TERMHOOKS_INLINE
27# define TERMHOOKS_INLINE INLINE
28#endif
29
25struct glyph; 30struct glyph;
26struct frame; 31struct frame;
27 32
@@ -321,10 +326,6 @@ struct ns_display_info;
321struct x_display_info; 326struct x_display_info;
322struct w32_display_info; 327struct w32_display_info;
323 328
324/* Most code should use this macro to set Lisp field in struct terminal. */
325
326#define TSET(f, field, value) ((f)->field = (value))
327
328/* Terminal-local parameters. */ 329/* Terminal-local parameters. */
329struct terminal 330struct terminal
330{ 331{
@@ -631,6 +632,18 @@ struct terminal
631 void (*delete_terminal_hook) (struct terminal *); 632 void (*delete_terminal_hook) (struct terminal *);
632}; 633};
633 634
635/* Most code should use these functions to set Lisp fields in struct
636 terminal. */
637TERMHOOKS_INLINE void
638tset_charset_list (struct terminal *t, Lisp_Object val)
639{
640 t->charset_list = val;
641}
642TERMHOOKS_INLINE void
643tset_selection_alist (struct terminal *t, Lisp_Object val)
644{
645 t->Vselection_alist = val;
646}
634 647
635/* Chain of all terminal devices currently in use. */ 648/* Chain of all terminal devices currently in use. */
636extern struct terminal *terminal_list; 649extern struct terminal *terminal_list;
@@ -669,3 +682,5 @@ extern unsigned char *encode_terminal_code (struct glyph *, int,
669#ifdef HAVE_GPM 682#ifdef HAVE_GPM
670extern void close_gpm (int gpm_fd); 683extern void close_gpm (int gpm_fd);
671#endif 684#endif
685
686INLINE_HEADER_END
diff --git a/src/terminal.c b/src/terminal.c
index 53610d9736f..d94164a4e40 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -17,6 +17,9 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include <config.h> 19#include <config.h>
20
21#define TERMHOOKS_INLINE EXTERN_INLINE
22
20#include <stdio.h> 23#include <stdio.h>
21#include <setjmp.h> 24#include <setjmp.h>
22 25
@@ -39,6 +42,13 @@ struct terminal *initial_terminal;
39 42
40static void delete_initial_terminal (struct terminal *); 43static void delete_initial_terminal (struct terminal *);
41 44
45/* This setter is used only in this file, so it can be private. */
46static inline void
47tset_param_alist (struct terminal *t, Lisp_Object val)
48{
49 t->param_alist = val;
50}
51
42 52
43 53
44void 54void
@@ -446,7 +456,7 @@ store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object val
446 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); 456 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
447 if (EQ (old_alist_elt, Qnil)) 457 if (EQ (old_alist_elt, Qnil))
448 { 458 {
449 TSET (t, param_alist, Fcons (Fcons (parameter, value), t->param_alist)); 459 tset_param_alist (t, Fcons (Fcons (parameter, value), t->param_alist));
450 return Qnil; 460 return Qnil;
451 } 461 }
452 else 462 else
diff --git a/src/textprop.c b/src/textprop.c
index ac1980fde78..20d98b0e6f3 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -143,7 +143,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
143 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end) 143 if (!(BUF_BEGV (b) <= XINT (*begin) && XINT (*begin) <= XINT (*end)
144 && XINT (*end) <= BUF_ZV (b))) 144 && XINT (*end) <= BUF_ZV (b)))
145 args_out_of_range (*begin, *end); 145 args_out_of_range (*begin, *end);
146 i = buffer_get_intervals (b); 146 i = buffer_intervals (b);
147 147
148 /* If there's no text, there are no properties. */ 148 /* If there's no text, there are no properties. */
149 if (BUF_BEGV (b) == BUF_ZV (b)) 149 if (BUF_BEGV (b) == BUF_ZV (b))
@@ -161,7 +161,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
161 XSETFASTINT (*begin, XFASTINT (*begin)); 161 XSETFASTINT (*begin, XFASTINT (*begin));
162 if (begin != end) 162 if (begin != end)
163 XSETFASTINT (*end, XFASTINT (*end)); 163 XSETFASTINT (*end, XFASTINT (*end));
164 i = string_get_intervals (object); 164 i = string_intervals (object);
165 165
166 if (len == 0) 166 if (len == 0)
167 return NULL; 167 return NULL;
@@ -338,7 +338,7 @@ set_properties (Lisp_Object properties, INTERVAL interval, Lisp_Object object)
338 } 338 }
339 339
340 /* Store new properties. */ 340 /* Store new properties. */
341 interval_set_plist (interval, Fcopy_sequence (properties)); 341 set_interval_plist (interval, Fcopy_sequence (properties));
342} 342}
343 343
344/* Add the properties of PLIST to the interval I, or set 344/* Add the properties of PLIST to the interval I, or set
@@ -411,7 +411,7 @@ add_properties (Lisp_Object plist, INTERVAL i, Lisp_Object object)
411 record_property_change (i->position, LENGTH (i), 411 record_property_change (i->position, LENGTH (i),
412 sym1, Qnil, object); 412 sym1, Qnil, object);
413 } 413 }
414 interval_set_plist (i, Fcons (sym1, Fcons (val1, i->plist))); 414 set_interval_plist (i, Fcons (sym1, Fcons (val1, i->plist)));
415 changed++; 415 changed++;
416 } 416 }
417 } 417 }
@@ -484,7 +484,7 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
484 } 484 }
485 485
486 if (changed) 486 if (changed)
487 interval_set_plist (i, current_plist); 487 set_interval_plist (i, current_plist);
488 return changed; 488 return changed;
489} 489}
490 490
@@ -510,13 +510,13 @@ interval_of (ptrdiff_t position, Lisp_Object object)
510 510
511 beg = BUF_BEGV (b); 511 beg = BUF_BEGV (b);
512 end = BUF_ZV (b); 512 end = BUF_ZV (b);
513 i = buffer_get_intervals (b); 513 i = buffer_intervals (b);
514 } 514 }
515 else 515 else
516 { 516 {
517 beg = 0; 517 beg = 0;
518 end = SCHARS (object); 518 end = SCHARS (object);
519 i = string_get_intervals (object); 519 i = string_intervals (object);
520 } 520 }
521 521
522 if (!(beg <= position && position <= end)) 522 if (!(beg <= position && position <= end))
@@ -1274,10 +1274,10 @@ set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object properties,
1274 && XFASTINT (start) == 0 1274 && XFASTINT (start) == 0
1275 && XFASTINT (end) == SCHARS (object)) 1275 && XFASTINT (end) == SCHARS (object))
1276 { 1276 {
1277 if (!string_get_intervals (object)) 1277 if (!string_intervals (object))
1278 return Qnil; 1278 return Qnil;
1279 1279
1280 string_set_intervals (object, NULL); 1280 set_string_intervals (object, NULL);
1281 return Qt; 1281 return Qt;
1282 } 1282 }
1283 1283
@@ -1339,7 +1339,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie
1339 return; 1339 return;
1340 1340
1341 if (i == NULL) 1341 if (i == NULL)
1342 i = find_interval (buffer_get_intervals (XBUFFER (buffer)), s); 1342 i = find_interval (buffer_intervals (XBUFFER (buffer)), s);
1343 1343
1344 if (i->position != s) 1344 if (i->position != s)
1345 { 1345 {
@@ -1993,10 +1993,10 @@ void
1993verify_interval_modification (struct buffer *buf, 1993verify_interval_modification (struct buffer *buf,
1994 ptrdiff_t start, ptrdiff_t end) 1994 ptrdiff_t start, ptrdiff_t end)
1995{ 1995{
1996 register INTERVAL intervals = buffer_get_intervals (buf); 1996 INTERVAL intervals = buffer_intervals (buf);
1997 register INTERVAL i; 1997 INTERVAL i;
1998 Lisp_Object hooks; 1998 Lisp_Object hooks;
1999 register Lisp_Object prev_mod_hooks; 1999 Lisp_Object prev_mod_hooks;
2000 Lisp_Object mod_hooks; 2000 Lisp_Object mod_hooks;
2001 struct gcpro gcpro1; 2001 struct gcpro gcpro1;
2002 2002
diff --git a/src/undo.c b/src/undo.c
index cfb67ba5bc8..777e3291806 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -104,9 +104,9 @@ record_point (ptrdiff_t pt)
104 if (at_boundary 104 if (at_boundary
105 && current_buffer == last_boundary_buffer 105 && current_buffer == last_boundary_buffer
106 && last_boundary_position != pt) 106 && last_boundary_position != pt)
107 BSET (current_buffer, undo_list, 107 bset_undo_list (current_buffer,
108 Fcons (make_number (last_boundary_position), 108 Fcons (make_number (last_boundary_position),
109 BVAR (current_buffer, undo_list))); 109 BVAR (current_buffer, undo_list)));
110} 110}
111 111
112/* Record an insertion that just happened or is about to happen, 112/* Record an insertion that just happened or is about to happen,
@@ -142,8 +142,8 @@ record_insert (ptrdiff_t beg, ptrdiff_t length)
142 142
143 XSETFASTINT (lbeg, beg); 143 XSETFASTINT (lbeg, beg);
144 XSETINT (lend, beg + length); 144 XSETINT (lend, beg + length);
145 BSET (current_buffer, undo_list, 145 bset_undo_list (current_buffer,
146 Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list))); 146 Fcons (Fcons (lbeg, lend), BVAR (current_buffer, undo_list)));
147} 147}
148 148
149/* Record that a deletion is about to take place, 149/* Record that a deletion is about to take place,
@@ -168,8 +168,9 @@ record_delete (ptrdiff_t beg, Lisp_Object string)
168 record_point (beg); 168 record_point (beg);
169 } 169 }
170 170
171 BSET (current_buffer, undo_list, 171 bset_undo_list
172 Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list))); 172 (current_buffer,
173 Fcons (Fcons (string, sbeg), BVAR (current_buffer, undo_list)));
173} 174}
174 175
175/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT. 176/* Record the fact that MARKER is about to be adjusted by ADJUSTMENT.
@@ -191,9 +192,10 @@ record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment)
191 Fundo_boundary (); 192 Fundo_boundary ();
192 last_undo_buffer = current_buffer; 193 last_undo_buffer = current_buffer;
193 194
194 BSET (current_buffer, undo_list, 195 bset_undo_list
195 Fcons (Fcons (marker, make_number (adjustment)), 196 (current_buffer,
196 BVAR (current_buffer, undo_list))); 197 Fcons (Fcons (marker, make_number (adjustment)),
198 BVAR (current_buffer, undo_list)));
197} 199}
198 200
199/* Record that a replacement is about to take place, 201/* Record that a replacement is about to take place,
@@ -226,9 +228,10 @@ record_first_change (void)
226 if (base_buffer->base_buffer) 228 if (base_buffer->base_buffer)
227 base_buffer = base_buffer->base_buffer; 229 base_buffer = base_buffer->base_buffer;
228 230
229 BSET (current_buffer, undo_list, 231 bset_undo_list
230 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)), 232 (current_buffer,
231 BVAR (current_buffer, undo_list))); 233 Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
234 BVAR (current_buffer, undo_list)));
232} 235}
233 236
234/* Record a change in property PROP (whose old value was VAL) 237/* Record a change in property PROP (whose old value was VAL)
@@ -266,8 +269,8 @@ record_property_change (ptrdiff_t beg, ptrdiff_t length,
266 XSETINT (lbeg, beg); 269 XSETINT (lbeg, beg);
267 XSETINT (lend, beg + length); 270 XSETINT (lend, beg + length);
268 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend)))); 271 entry = Fcons (Qnil, Fcons (prop, Fcons (value, Fcons (lbeg, lend))));
269 BSET (current_buffer, undo_list, 272 bset_undo_list (current_buffer,
270 Fcons (entry, BVAR (current_buffer, undo_list))); 273 Fcons (entry, BVAR (current_buffer, undo_list)));
271 274
272 current_buffer = obuf; 275 current_buffer = obuf;
273} 276}
@@ -290,11 +293,12 @@ but another undo command will undo to the previous boundary. */)
290 /* If we have preallocated the cons cell to use here, 293 /* If we have preallocated the cons cell to use here,
291 use that one. */ 294 use that one. */
292 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list)); 295 XSETCDR (pending_boundary, BVAR (current_buffer, undo_list));
293 BSET (current_buffer, undo_list, pending_boundary); 296 bset_undo_list (current_buffer, pending_boundary);
294 pending_boundary = Qnil; 297 pending_boundary = Qnil;
295 } 298 }
296 else 299 else
297 BSET (current_buffer, undo_list, Fcons (Qnil, BVAR (current_buffer, undo_list))); 300 bset_undo_list (current_buffer,
301 Fcons (Qnil, BVAR (current_buffer, undo_list)));
298 } 302 }
299 last_boundary_position = PT; 303 last_boundary_position = PT;
300 last_boundary_buffer = current_buffer; 304 last_boundary_buffer = current_buffer;
@@ -435,7 +439,7 @@ truncate_undo_list (struct buffer *b)
435 XSETCDR (last_boundary, Qnil); 439 XSETCDR (last_boundary, Qnil);
436 /* There's nothing we decided to keep, so clear it out. */ 440 /* There's nothing we decided to keep, so clear it out. */
437 else 441 else
438 BSET (b, undo_list, Qnil); 442 bset_undo_list (b, Qnil);
439 443
440 unbind_to (count, Qnil); 444 unbind_to (count, Qnil);
441} 445}
@@ -650,8 +654,9 @@ Return what remains of the list. */)
650 will work right. */ 654 will work right. */
651 if (did_apply 655 if (did_apply
652 && EQ (oldlist, BVAR (current_buffer, undo_list))) 656 && EQ (oldlist, BVAR (current_buffer, undo_list)))
653 BSET (current_buffer, undo_list, 657 bset_undo_list
654 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list))); 658 (current_buffer,
659 Fcons (list3 (Qapply, Qcdr, Qnil), BVAR (current_buffer, undo_list)));
655 660
656 UNGCPRO; 661 UNGCPRO;
657 return unbind_to (count, list); 662 return unbind_to (count, list);
diff --git a/src/unexaix.c b/src/unexaix.c
index 29fa0fd6287..c09156296f7 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -56,8 +56,9 @@ what you give them. Help stamp out software-hoarding! */
56#include <unistd.h> 56#include <unistd.h>
57#include <fcntl.h> 57#include <fcntl.h>
58 58
59#include "mem-limits.h"
60
59char *start_of_text (void); /* Start of text */ 61char *start_of_text (void); /* Start of text */
60extern char *start_of_data (void); /* Start of initialized data */
61 62
62extern int _data; 63extern int _data;
63extern int _text; 64extern int _text;
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 5b269737839..e83042a379d 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -98,7 +98,7 @@ struct aouthdr
98 98
99#include <sys/file.h> 99#include <sys/file.h>
100 100
101extern char *start_of_data (void); /* Start of initialized data */ 101#include "mem-limits.h"
102 102
103static long block_copy_start; /* Old executable start point */ 103static long block_copy_start; /* Old executable start point */
104static struct filehdr f_hdr; /* File header */ 104static struct filehdr f_hdr; /* File header */
diff --git a/src/vm-limit.c b/src/vm-limit.c
index c313a900f2c..cf697b56fdf 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -18,6 +18,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19#include <config.h> 19#include <config.h>
20#include <setjmp.h> 20#include <setjmp.h>
21#include <unistd.h> /* for 'environ', on AIX */
21#include "lisp.h" 22#include "lisp.h"
22#include "mem-limits.h" 23#include "mem-limits.h"
23 24
@@ -268,7 +269,6 @@ start_of_data (void)
268 * is known to live at or near the start of the system crt0.c, and 269 * is known to live at or near the start of the system crt0.c, and
269 * we don't sweat the handful of bytes that might lose. 270 * we don't sweat the handful of bytes that might lose.
270 */ 271 */
271 extern char **environ;
272 return ((POINTER) &environ); 272 return ((POINTER) &environ);
273#else 273#else
274 extern int data_start; 274 extern int data_start;
diff --git a/src/w32.c b/src/w32.c
index 61de234cf70..b460660cb8c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -7023,7 +7023,7 @@ serial_configure (struct Lisp_Process *p, Lisp_Object contact)
7023 error ("SetCommState() failed"); 7023 error ("SetCommState() failed");
7024 7024
7025 childp2 = Fplist_put (childp2, QCsummary, build_string (summary)); 7025 childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
7026 PSET (p, childp, childp2); 7026 pset_childp (p, childp2);
7027} 7027}
7028 7028
7029#ifdef HAVE_GNUTLS 7029#ifdef HAVE_GNUTLS
diff --git a/src/w32fns.c b/src/w32fns.c
index 7779f032104..9c5231f9d93 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1490,7 +1490,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1490 else if (!NILP (arg) || NILP (oldval)) 1490 else if (!NILP (arg) || NILP (oldval))
1491 return; 1491 return;
1492 1492
1493 FSET (f, icon_name, arg); 1493 fset_icon_name (f, arg);
1494 1494
1495#if 0 1495#if 0
1496 if (f->output_data.w32->icon_bitmap != 0) 1496 if (f->output_data.w32->icon_bitmap != 0)
@@ -1686,7 +1686,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1686 if (! NILP (Fstring_equal (name, f->name))) 1686 if (! NILP (Fstring_equal (name, f->name)))
1687 return; 1687 return;
1688 1688
1689 FSET (f, name, name); 1689 fset_name (f, name);
1690 1690
1691 /* For setting the frame title, the title parameter should override 1691 /* For setting the frame title, the title parameter should override
1692 the name parameter. */ 1692 the name parameter. */
@@ -1734,7 +1734,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1734 1734
1735 update_mode_lines = 1; 1735 update_mode_lines = 1;
1736 1736
1737 FSET (f, title, name); 1737 fset_title (f, name);
1738 1738
1739 if (NILP (name)) 1739 if (NILP (name))
1740 name = f->name; 1740 name = f->name;
@@ -3925,7 +3925,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
3925 3925
3926 f->explicit_name = 0; 3926 f->explicit_name = 0;
3927 name = f->name; 3927 name = f->name;
3928 FSET (f, name, Qnil); 3928 fset_name (f, Qnil);
3929 x_set_name (f, name, explicit); 3929 x_set_name (f, name, explicit);
3930 } 3930 }
3931 3931
@@ -4174,11 +4174,11 @@ This function is an internal primitive--use `make-frame' instead. */)
4174 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 4174 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
4175 FRAME_FONTSET (f) = -1; 4175 FRAME_FONTSET (f) = -1;
4176 4176
4177 FSET (f, icon_name, 4177 fset_icon_name
4178 x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", 4178 (f, x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title",
4179 RES_TYPE_STRING)); 4179 RES_TYPE_STRING));
4180 if (! STRINGP (f->icon_name)) 4180 if (! STRINGP (f->icon_name))
4181 FSET (f, icon_name, Qnil); 4181 fset_icon_name (f, Qnil);
4182 4182
4183/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ 4183/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
4184 4184
@@ -4207,12 +4207,12 @@ This function is an internal primitive--use `make-frame' instead. */)
4207 be set. */ 4207 be set. */
4208 if (EQ (name, Qunbound) || NILP (name)) 4208 if (EQ (name, Qunbound) || NILP (name))
4209 { 4209 {
4210 FSET (f, name, build_string (dpyinfo->w32_id_name)); 4210 fset_name (f, build_string (dpyinfo->w32_id_name));
4211 f->explicit_name = 0; 4211 f->explicit_name = 0;
4212 } 4212 }
4213 else 4213 else
4214 { 4214 {
4215 FSET (f, name, name); 4215 fset_name (f, name);
4216 f->explicit_name = 1; 4216 f->explicit_name = 1;
4217 /* use the frame's title when getting resources for this frame. */ 4217 /* use the frame's title when getting resources for this frame. */
4218 specbind (Qx_resource_name, name); 4218 specbind (Qx_resource_name, name);
@@ -4381,13 +4381,13 @@ This function is an internal primitive--use `make-frame' instead. */)
4381 if (FRAME_HAS_MINIBUF_P (f) 4381 if (FRAME_HAS_MINIBUF_P (f)
4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 4382 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 4383 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
4384 KSET (kb, Vdefault_minibuffer_frame, frame); 4384 kset_default_minibuffer_frame (kb, frame);
4385 4385
4386 /* All remaining specified parameters, which have not been "used" 4386 /* All remaining specified parameters, which have not been "used"
4387 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4387 by x_get_arg and friends, now go in the misc. alist of the frame. */
4388 for (tem = parameters; CONSP (tem); tem = XCDR (tem)) 4388 for (tem = parameters; CONSP (tem); tem = XCDR (tem))
4389 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 4389 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
4390 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 4390 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
4391 4391
4392 UNGCPRO; 4392 UNGCPRO;
4393 4393
@@ -5242,7 +5242,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5242 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); 5242 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0);
5243 old_buffer = current_buffer; 5243 old_buffer = current_buffer;
5244 set_buffer_internal_1 (XBUFFER (buffer)); 5244 set_buffer_internal_1 (XBUFFER (buffer));
5245 BSET (current_buffer, truncate_lines, Qnil); 5245 bset_truncate_lines (current_buffer, Qnil);
5246 specbind (Qinhibit_read_only, Qt); 5246 specbind (Qinhibit_read_only, Qt);
5247 specbind (Qinhibit_modification_hooks, Qt); 5247 specbind (Qinhibit_modification_hooks, Qt);
5248 Ferase_buffer (); 5248 Ferase_buffer ();
@@ -5261,7 +5261,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5261 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 5261 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
5262 5262
5263 FRAME_FONTSET (f) = -1; 5263 FRAME_FONTSET (f) = -1;
5264 FSET (f, icon_name, Qnil); 5264 fset_icon_name (f, Qnil);
5265 5265
5266#ifdef GLYPH_DEBUG 5266#ifdef GLYPH_DEBUG
5267 image_cache_refcount = 5267 image_cache_refcount =
@@ -5276,12 +5276,12 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5276 be set. */ 5276 be set. */
5277 if (EQ (name, Qunbound) || NILP (name)) 5277 if (EQ (name, Qunbound) || NILP (name))
5278 { 5278 {
5279 FSET (f, name, build_string (dpyinfo->w32_id_name)); 5279 fset_name (f, build_string (dpyinfo->w32_id_name));
5280 f->explicit_name = 0; 5280 f->explicit_name = 0;
5281 } 5281 }
5282 else 5282 else
5283 { 5283 {
5284 FSET (f, name, name); 5284 fset_name (f, name);
5285 f->explicit_name = 1; 5285 f->explicit_name = 1;
5286 /* use the frame's title when getting resources for this frame. */ 5286 /* use the frame's title when getting resources for this frame. */
5287 specbind (Qx_resource_name, name); 5287 specbind (Qx_resource_name, name);
@@ -5647,8 +5647,8 @@ Text larger than the specified size is clipped. */)
5647 5647
5648 /* Set up the frame's root window. */ 5648 /* Set up the frame's root window. */
5649 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5649 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5650 WSET (w, left_col, make_number (0)); 5650 wset_left_col (w, make_number (0));
5651 WSET (w, top_line, make_number (0)); 5651 wset_top_line (w, make_number (0));
5652 5652
5653 if (CONSP (Vx_max_tooltip_size) 5653 if (CONSP (Vx_max_tooltip_size)
5654 && INTEGERP (XCAR (Vx_max_tooltip_size)) 5654 && INTEGERP (XCAR (Vx_max_tooltip_size))
@@ -5656,13 +5656,13 @@ Text larger than the specified size is clipped. */)
5656 && INTEGERP (XCDR (Vx_max_tooltip_size)) 5656 && INTEGERP (XCDR (Vx_max_tooltip_size))
5657 && XINT (XCDR (Vx_max_tooltip_size)) > 0) 5657 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
5658 { 5658 {
5659 WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); 5659 wset_total_cols (w, XCAR (Vx_max_tooltip_size));
5660 WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); 5660 wset_total_lines (w, XCDR (Vx_max_tooltip_size));
5661 } 5661 }
5662 else 5662 else
5663 { 5663 {
5664 WSET (w, total_cols, make_number (80)); 5664 wset_total_cols (w, make_number (80));
5665 WSET (w, total_lines, make_number (40)); 5665 wset_total_lines (w, make_number (40));
5666 } 5666 }
5667 5667
5668 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5668 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
@@ -5672,7 +5672,7 @@ Text larger than the specified size is clipped. */)
5672 /* Display the tooltip text in a temporary buffer. */ 5672 /* Display the tooltip text in a temporary buffer. */
5673 old_buffer = current_buffer; 5673 old_buffer = current_buffer;
5674 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5674 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5675 BSET (current_buffer, truncate_lines, Qnil); 5675 bset_truncate_lines (current_buffer, Qnil);
5676 clear_glyph_matrix (w->desired_matrix); 5676 clear_glyph_matrix (w->desired_matrix);
5677 clear_glyph_matrix (w->current_matrix); 5677 clear_glyph_matrix (w->current_matrix);
5678 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5678 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -5733,7 +5733,7 @@ Text larger than the specified size is clipped. */)
5733 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5733 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5734 not in pixels. */ 5734 not in pixels. */
5735 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5735 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5736 WSET (w, total_cols, make_number (width)); 5736 wset_total_cols (w, make_number (width));
5737 FRAME_TOTAL_COLS (f) = width; 5737 FRAME_TOTAL_COLS (f) = width;
5738 adjust_glyphs (f); 5738 adjust_glyphs (f);
5739 w->pseudo_window_p = 1; 5739 w->pseudo_window_p = 1;
diff --git a/src/w32menu.c b/src/w32menu.c
index 02302c2d594..3aa4c8bc96d 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -413,7 +413,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
413 /* Run the hooks. */ 413 /* Run the hooks. */
414 safe_run_hooks (Qactivate_menubar_hook); 414 safe_run_hooks (Qactivate_menubar_hook);
415 safe_run_hooks (Qmenu_bar_update_hook); 415 safe_run_hooks (Qmenu_bar_update_hook);
416 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 416 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
417 417
418 items = FRAME_MENU_BAR_ITEMS (f); 418 items = FRAME_MENU_BAR_ITEMS (f);
419 419
@@ -500,7 +500,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
500 return; 500 return;
501 } 501 }
502 502
503 FSET (f, menu_bar_vector, menu_items); 503 fset_menu_bar_vector (f, menu_items);
504 f->menu_bar_items_used = menu_items_used; 504 f->menu_bar_items_used = menu_items_used;
505 505
506 /* This undoes save_menu_items. */ 506 /* This undoes save_menu_items. */
@@ -615,7 +615,7 @@ initialize_frame_menubar (FRAME_PTR f)
615{ 615{
616 /* This function is called before the first chance to redisplay 616 /* This function is called before the first chance to redisplay
617 the frame. It has to be, so the frame will have the right size. */ 617 the frame. It has to be, so the frame will have the right size. */
618 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 618 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
619 set_frame_menubar (f, 1, 1); 619 set_frame_menubar (f, 1, 1);
620} 620}
621 621
diff --git a/src/w32term.c b/src/w32term.c
index 7da9433d3f1..6948a98998e 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -2972,7 +2972,7 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo)
2972 : dpyinfo->w32_focus_frame); 2972 : dpyinfo->w32_focus_frame);
2973 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 2973 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame))
2974 { 2974 {
2975 FSET (dpyinfo->w32_focus_frame, focus_frame, Qnil); 2975 fset_focus_frame (dpyinfo->w32_focus_frame, Qnil);
2976 dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; 2976 dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame;
2977 } 2977 }
2978 } 2978 }
@@ -3646,7 +3646,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3646 bar->next = FRAME_SCROLL_BARS (f); 3646 bar->next = FRAME_SCROLL_BARS (f);
3647 bar->prev = Qnil; 3647 bar->prev = Qnil;
3648 XSETVECTOR (barobj, bar); 3648 XSETVECTOR (barobj, bar);
3649 FSET (f, scroll_bars, barobj); 3649 fset_scroll_bars (f, barobj);
3650 if (! NILP (bar->next)) 3650 if (! NILP (bar->next))
3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
3652 3652
@@ -3670,7 +3670,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); 3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
3671 3671
3672 /* Dissociate this scroll bar from its window. */ 3672 /* Dissociate this scroll bar from its window. */
3673 WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); 3673 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
3674 3674
3675 UNBLOCK_INPUT; 3675 UNBLOCK_INPUT;
3676} 3676}
@@ -3808,7 +3808,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3808 3808
3809 w32_set_scroll_bar_thumb (bar, portion, position, whole); 3809 w32_set_scroll_bar_thumb (bar, portion, position, whole);
3810 XSETVECTOR (barobj, bar); 3810 XSETVECTOR (barobj, bar);
3811 WSET (w, vertical_scroll_bar, barobj); 3811 wset_vertical_scroll_bar (w, barobj);
3812} 3812}
3813 3813
3814 3814
@@ -3832,12 +3832,12 @@ w32_condemn_scroll_bars (FRAME_PTR frame)
3832 { 3832 {
3833 Lisp_Object bar; 3833 Lisp_Object bar;
3834 bar = FRAME_SCROLL_BARS (frame); 3834 bar = FRAME_SCROLL_BARS (frame);
3835 FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); 3835 fset_scroll_bars (frame, XSCROLL_BAR (bar)->next);
3836 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); 3836 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
3837 XSCROLL_BAR (bar)->prev = Qnil; 3837 XSCROLL_BAR (bar)->prev = Qnil;
3838 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) 3838 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
3839 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; 3839 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar;
3840 FSET (frame, condemned_scroll_bars, bar); 3840 fset_condemned_scroll_bars (frame, bar);
3841 } 3841 }
3842} 3842}
3843 3843
@@ -3869,7 +3869,7 @@ w32_redeem_scroll_bar (struct window *window)
3869 return; 3869 return;
3870 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 3870 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
3871 window->vertical_scroll_bar)) 3871 window->vertical_scroll_bar))
3872 FSET (f, condemned_scroll_bars, bar->next); 3872 fset_condemned_scroll_bars (f, bar->next);
3873 else 3873 else
3874 /* If its prev pointer is nil, it must be at the front of 3874 /* If its prev pointer is nil, it must be at the front of
3875 one or the other! */ 3875 one or the other! */
@@ -3884,7 +3884,7 @@ w32_redeem_scroll_bar (struct window *window)
3884 bar->next = FRAME_SCROLL_BARS (f); 3884 bar->next = FRAME_SCROLL_BARS (f);
3885 bar->prev = Qnil; 3885 bar->prev = Qnil;
3886 XSETVECTOR (barobj, bar); 3886 XSETVECTOR (barobj, bar);
3887 FSET (f, scroll_bars, barobj); 3887 fset_scroll_bars (f, barobj);
3888 if (! NILP (bar->next)) 3888 if (! NILP (bar->next))
3889 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 3889 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
3890} 3890}
@@ -3901,7 +3901,7 @@ w32_judge_scroll_bars (FRAME_PTR f)
3901 3901
3902 /* Clear out the condemned list now so we won't try to process any 3902 /* Clear out the condemned list now so we won't try to process any
3903 more events on the hapless scroll bars. */ 3903 more events on the hapless scroll bars. */
3904 FSET (f, condemned_scroll_bars, Qnil); 3904 fset_condemned_scroll_bars (f, Qnil);
3905 3905
3906 for (; ! NILP (bar); bar = next) 3906 for (; ! NILP (bar); bar = next)
3907 { 3907 {
@@ -6232,7 +6232,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6232 terminal like X does. */ 6232 terminal like X does. */
6233 terminal->kboard = xmalloc (sizeof (KBOARD)); 6233 terminal->kboard = xmalloc (sizeof (KBOARD));
6234 init_kboard (terminal->kboard); 6234 init_kboard (terminal->kboard);
6235 KSET (terminal->kboard, Vwindow_system, intern ("w32")); 6235 kset_window_system (terminal->kboard, intern ("w32"));
6236 terminal->kboard->next_kboard = all_kboards; 6236 terminal->kboard->next_kboard = all_kboards;
6237 all_kboards = terminal->kboard; 6237 all_kboards = terminal->kboard;
6238 /* Don't let the initial kboard remain current longer than necessary. 6238 /* Don't let the initial kboard remain current longer than necessary.
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 06f7b1bd192..50532acaff3 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -320,7 +320,23 @@ uniscribe_shape (Lisp_Object lgstring)
320 } 320 }
321 if (SUCCEEDED (result)) 321 if (SUCCEEDED (result))
322 { 322 {
323 int j, from, to; 323 int j, from, to, adj_offset = 0;
324
325 /* For RTL text, the Uniscribe shaper prepares the
326 values in ADVANCES array for layout in reverse order,
327 whereby "advance width" is applied to move the pen in
328 reverse direction and _before_ drawing the glyph.
329 Since we draw glyphs in their normal left-to-right
330 order, we need to adjust the coordinates of each
331 non-base glyph in a grapheme cluster via X-OFF
332 component of the gstring's ADJUSTMENT sub-vector.
333 This loop computes the initial value of the
334 adjustment for the base character, which is then
335 updated for each successive glyph in the grapheme
336 cluster. */
337 if (items[i].a.fRTL)
338 for (j = 1; j < nglyphs; j++)
339 adj_offset += advances[j];
324 340
325 from = 0; 341 from = 0;
326 to = from; 342 to = from;
@@ -392,9 +408,11 @@ uniscribe_shape (Lisp_Object lgstring)
392 408
393 if (SUCCEEDED (result)) 409 if (SUCCEEDED (result))
394 { 410 {
395 LGLYPH_SET_LBEARING (lglyph, char_metric.abcA); 411 int lbearing = char_metric.abcA;
396 LGLYPH_SET_RBEARING (lglyph, (char_metric.abcA 412 int rbearing = char_metric.abcA + char_metric.abcB;
397 + char_metric.abcB)); 413
414 LGLYPH_SET_LBEARING (lglyph, lbearing);
415 LGLYPH_SET_RBEARING (lglyph, rbearing);
398 } 416 }
399 else 417 else
400 { 418 {
@@ -402,18 +420,43 @@ uniscribe_shape (Lisp_Object lgstring)
402 LGLYPH_SET_RBEARING (lglyph, advances[j]); 420 LGLYPH_SET_RBEARING (lglyph, advances[j]);
403 } 421 }
404 422
405 if (offsets[j].du || offsets[j].dv) 423 if (offsets[j].du || offsets[j].dv
424 /* For non-base glyphs of RTL grapheme clusters,
425 adjust the X offset even if both DU and DV
426 are zero. */
427 || (!attributes[j].fClusterStart && items[i].a.fRTL))
406 { 428 {
407 Lisp_Object vec; 429 Lisp_Object vec;
408 vec = Fmake_vector (make_number (3), Qnil); 430 vec = Fmake_vector (make_number (3), Qnil);
409 ASET (vec, 0, make_number (offsets[j].du)); 431 if (items[i].a.fRTL)
432 {
433 /* Empirically, it looks like Uniscribe
434 interprets DU in reverse direction for
435 RTL clusters. E.g., if we don't reverse
436 the direction, the Hebrew point HOLAM is
437 drawn above the right edge of the base
438 consonant, instead of above the left edge. */
439 ASET (vec, 0, make_number (-offsets[j].du
440 + adj_offset));
441 /* Update the adjustment value for the width
442 advance of the glyph we just emitted. */
443 adj_offset -= 2 * advances[j];
444 }
445 else
446 ASET (vec, 0, make_number (offsets[j].du + adj_offset));
410 ASET (vec, 1, make_number (offsets[j].dv)); 447 ASET (vec, 1, make_number (offsets[j].dv));
411 /* Based on what ftfont.c does... */ 448 /* Based on what ftfont.c does... */
412 ASET (vec, 2, make_number (advances[j])); 449 ASET (vec, 2, make_number (advances[j]));
413 LGLYPH_SET_ADJUSTMENT (lglyph, vec); 450 LGLYPH_SET_ADJUSTMENT (lglyph, vec);
414 } 451 }
415 else 452 else
416 LGLYPH_SET_ADJUSTMENT (lglyph, Qnil); 453 {
454 LGLYPH_SET_ADJUSTMENT (lglyph, Qnil);
455 /* Update the adjustment value to compensate for
456 the width of the base character. */
457 if (items[i].a.fRTL)
458 adj_offset -= advances[j];
459 }
417 } 460 }
418 } 461 }
419 } 462 }
diff --git a/src/window.c b/src/window.c
index 7874105df1e..4d92566b243 100644
--- a/src/window.c
+++ b/src/window.c
@@ -19,6 +19,9 @@ You should have received a copy of the GNU General Public License
19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 19along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22
23#define WINDOW_INLINE EXTERN_INLINE
24
22#include <stdio.h> 25#include <stdio.h>
23#include <setjmp.h> 26#include <setjmp.h>
24 27
@@ -130,6 +133,118 @@ static int window_scroll_pixel_based_preserve_y;
130static EMACS_INT window_scroll_preserve_hpos; 133static EMACS_INT window_scroll_preserve_hpos;
131static EMACS_INT window_scroll_preserve_vpos; 134static EMACS_INT window_scroll_preserve_vpos;
132 135
136/* These setters are used only in this file, so they can be private. */
137static inline void
138wset_combination_limit (struct window *w, Lisp_Object val)
139{
140 w->combination_limit = val;
141}
142static inline void
143wset_dedicated (struct window *w, Lisp_Object val)
144{
145 w->dedicated = val;
146}
147static inline void
148wset_display_table (struct window *w, Lisp_Object val)
149{
150 w->display_table = val;
151}
152static inline void
153wset_hchild (struct window *w, Lisp_Object val)
154{
155 w->hchild = val;
156}
157static inline void
158wset_left_fringe_width (struct window *w, Lisp_Object val)
159{
160 w->left_fringe_width = val;
161}
162static inline void
163wset_left_margin_cols (struct window *w, Lisp_Object val)
164{
165 w->left_margin_cols = val;
166}
167static inline void
168wset_new_normal (struct window *w, Lisp_Object val)
169{
170 w->new_normal = val;
171}
172static inline void
173wset_new_total (struct window *w, Lisp_Object val)
174{
175 w->new_total = val;
176}
177static inline void
178wset_next_buffers (struct window *w, Lisp_Object val)
179{
180 w->next_buffers = val;
181}
182static inline void
183wset_normal_cols (struct window *w, Lisp_Object val)
184{
185 w->normal_cols = val;
186}
187static inline void
188wset_normal_lines (struct window *w, Lisp_Object val)
189{
190 w->normal_lines = val;
191}
192static inline void
193wset_parent (struct window *w, Lisp_Object val)
194{
195 w->parent = val;
196}
197static inline void
198wset_pointm (struct window *w, Lisp_Object val)
199{
200 w->pointm = val;
201}
202static inline void
203wset_prev_buffers (struct window *w, Lisp_Object val)
204{
205 w->prev_buffers = val;
206}
207static inline void
208wset_right_fringe_width (struct window *w, Lisp_Object val)
209{
210 w->right_fringe_width = val;
211}
212static inline void
213wset_right_margin_cols (struct window *w, Lisp_Object val)
214{
215 w->right_margin_cols = val;
216}
217static inline void
218wset_scroll_bar_width (struct window *w, Lisp_Object val)
219{
220 w->scroll_bar_width = val;
221}
222static inline void
223wset_start (struct window *w, Lisp_Object val)
224{
225 w->start = val;
226}
227static inline void
228wset_temslot (struct window *w, Lisp_Object val)
229{
230 w->temslot = val;
231}
232static inline void
233wset_vchild (struct window *w, Lisp_Object val)
234{
235 w->vchild = val;
236}
237static inline void
238wset_vertical_scroll_bar_type (struct window *w, Lisp_Object val)
239{
240 w->vertical_scroll_bar_type = val;
241}
242static inline void
243wset_window_parameters (struct window *w, Lisp_Object val)
244{
245 w->window_parameters = val;
246}
247
133struct window * 248struct window *
134decode_live_window (register Lisp_Object window) 249decode_live_window (register Lisp_Object window)
135{ 250{
@@ -322,7 +437,10 @@ Return WINDOW. */)
322 if (EQ (frame, selected_frame)) 437 if (EQ (frame, selected_frame))
323 return Fselect_window (window, norecord); 438 return Fselect_window (window, norecord);
324 else 439 else
325 return FSET (XFRAME (frame), selected_window, window); 440 {
441 fset_selected_window (XFRAME (frame), window);
442 return window;
443 }
326} 444}
327 445
328DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, 446DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0,
@@ -359,13 +477,16 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
359 record_buffer (w->buffer); 477 record_buffer (w->buffer);
360 } 478 }
361 479
480 /* Make the selected window's buffer current. */
481 Fset_buffer (w->buffer);
482
362 if (EQ (window, selected_window) && !inhibit_point_swap) 483 if (EQ (window, selected_window) && !inhibit_point_swap)
363 return window; 484 return window;
364 485
365 sf = SELECTED_FRAME (); 486 sf = SELECTED_FRAME ();
366 if (XFRAME (WINDOW_FRAME (w)) != sf) 487 if (XFRAME (WINDOW_FRAME (w)) != sf)
367 { 488 {
368 FSET (XFRAME (WINDOW_FRAME (w)), selected_window, window); 489 fset_selected_window (XFRAME (WINDOW_FRAME (w)), window);
369 /* Use this rather than Fhandle_switch_frame 490 /* Use this rather than Fhandle_switch_frame
370 so that FRAME_FOCUS_FRAME is moved appropriately as we 491 so that FRAME_FOCUS_FRAME is moved appropriately as we
371 move around in the state where a minibuffer in a separate 492 move around in the state where a minibuffer in a separate
@@ -376,11 +497,11 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
376 return window; 497 return window;
377 } 498 }
378 else 499 else
379 FSET (sf, selected_window, window); 500 fset_selected_window (sf, window);
380 501
381 /* Store the current buffer's actual point into the 502 /* Store the old selected window's buffer's point in pointm of the old
382 old selected window. It belongs to that window, 503 selected window. It belongs to that window, and when the window is
383 and when the window is not selected, must be in the window. */ 504 not selected, must be in the window. */
384 if (!inhibit_point_swap) 505 if (!inhibit_point_swap)
385 { 506 {
386 ow = XWINDOW (selected_window); 507 ow = XWINDOW (selected_window);
@@ -391,10 +512,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
391 } 512 }
392 513
393 selected_window = window; 514 selected_window = window;
394 515 bset_last_selected_window (XBUFFER (w->buffer), window);
395 Fset_buffer (w->buffer);
396
397 BSET (XBUFFER (w->buffer), last_selected_window, window);
398 516
399 /* Go to the point recorded in the window. 517 /* Go to the point recorded in the window.
400 This is important when the buffer is in more 518 This is important when the buffer is in more
@@ -511,7 +629,8 @@ never \(re-)combined with WINDOW's siblings. Other values are reserved
511for future use. */) 629for future use. */)
512 (Lisp_Object window, Lisp_Object limit) 630 (Lisp_Object window, Lisp_Object limit)
513{ 631{
514 return WSET (decode_valid_window (window), combination_limit, limit); 632 wset_combination_limit (decode_valid_window (window), limit);
633 return limit;
515} 634}
516 635
517DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, 636DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0,
@@ -750,7 +869,8 @@ with two arguments: WINDOW, and the end trigger value. Afterwards the
750end-trigger value is reset to nil. */) 869end-trigger value is reset to nil. */)
751 (register Lisp_Object window, Lisp_Object value) 870 (register Lisp_Object window, Lisp_Object value)
752{ 871{
753 return WSET (decode_live_window (window), redisplay_end_trigger, value); 872 wset_redisplay_end_trigger (decode_live_window (window), value);
873 return value;
754} 874}
755 875
756DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, 876DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0,
@@ -1287,22 +1407,21 @@ DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,
1287 doc: /* Return current value of point in WINDOW. 1407 doc: /* Return current value of point in WINDOW.
1288WINDOW must be a live window and defaults to the selected one. 1408WINDOW must be a live window and defaults to the selected one.
1289 1409
1290For a nonselected window, this is the value point would have 1410For a nonselected window, this is the value point would have if that
1291if that window were selected. 1411window were selected.
1292 1412
1293Note that, when WINDOW is the selected window and its buffer 1413Note that, when WINDOW is selected, the value returned is the same as
1294is also currently selected, the value returned is the same as (point). 1414that returned by `point' for WINDOW's buffer. It would be more strictly
1295It would be more strictly correct to return the `top-level' value 1415correct to return the `top-level' value of `point', outside of any
1296of point, outside of any save-excursion forms. 1416`save-excursion' forms. But that is hard to define. */)
1297But that is hard to define. */)
1298 (Lisp_Object window) 1417 (Lisp_Object window)
1299{ 1418{
1300 register struct window *w = decode_live_window (window); 1419 register struct window *w = decode_live_window (window);
1301 1420
1302 if (w == XWINDOW (selected_window) 1421 if (w == XWINDOW (selected_window))
1303 && current_buffer == XBUFFER (w->buffer)) 1422 return make_number (BUF_PT (XBUFFER (w->buffer)));
1304 return Fpoint (); 1423 else
1305 return Fmarker_position (w->pointm); 1424 return Fmarker_position (w->pointm);
1306} 1425}
1307 1426
1308DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, 1427DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
@@ -1412,16 +1531,27 @@ Return POS. */)
1412 register struct window *w = decode_live_window (window); 1531 register struct window *w = decode_live_window (window);
1413 1532
1414 CHECK_NUMBER_COERCE_MARKER (pos); 1533 CHECK_NUMBER_COERCE_MARKER (pos);
1415 if (w == XWINDOW (selected_window)
1416 && XBUFFER (w->buffer) == current_buffer)
1417 Fgoto_char (pos);
1418 else
1419 set_marker_restricted (w->pointm, pos, w->buffer);
1420 1534
1421 /* We have to make sure that redisplay updates the window to show 1535 if (w == XWINDOW (selected_window))
1422 the new value of point. */ 1536 {
1423 if (!EQ (window, selected_window)) 1537 if (XBUFFER (w->buffer) == current_buffer)
1424 ++windows_or_buffers_changed; 1538 Fgoto_char (pos);
1539 else
1540 {
1541 struct buffer *old_buffer = current_buffer;
1542
1543 set_buffer_internal (XBUFFER (w->buffer));
1544 Fgoto_char (pos);
1545 set_buffer_internal (old_buffer);
1546 }
1547 }
1548 else
1549 {
1550 set_marker_restricted (w->pointm, pos, w->buffer);
1551 /* We have to make sure that redisplay updates the window to show
1552 the new value of point. */
1553 ++windows_or_buffers_changed;
1554 }
1425 1555
1426 return pos; 1556 return pos;
1427} 1557}
@@ -1671,7 +1801,8 @@ buffer. If and when `set-window-buffer' displays another buffer in a
1671window, it also makes sure that the window is no more dedicated. */) 1801window, it also makes sure that the window is no more dedicated. */)
1672 (Lisp_Object window, Lisp_Object flag) 1802 (Lisp_Object window, Lisp_Object flag)
1673{ 1803{
1674 return WSET (decode_live_window (window), dedicated, flag); 1804 wset_dedicated (decode_live_window (window), flag);
1805 return flag;
1675} 1806}
1676 1807
1677DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, 1808DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers,
@@ -1697,7 +1828,8 @@ where BUFFER is a buffer, WINDOW-START is the start position of the
1697window for that buffer, and POS is a window-specific point value. */) 1828window for that buffer, and POS is a window-specific point value. */)
1698 (Lisp_Object window, Lisp_Object prev_buffers) 1829 (Lisp_Object window, Lisp_Object prev_buffers)
1699{ 1830{
1700 return WSET (decode_live_window (window), prev_buffers, prev_buffers); 1831 wset_prev_buffers (decode_live_window (window), prev_buffers);
1832 return prev_buffers;
1701} 1833}
1702 1834
1703DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, 1835DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers,
@@ -1716,7 +1848,8 @@ WINDOW must be a live window and defaults to the selected one.
1716NEXT-BUFFERS should be a list of buffers. */) 1848NEXT-BUFFERS should be a list of buffers. */)
1717 (Lisp_Object window, Lisp_Object next_buffers) 1849 (Lisp_Object window, Lisp_Object next_buffers)
1718{ 1850{
1719 return WSET (decode_live_window (window), next_buffers, next_buffers); 1851 wset_next_buffers (decode_live_window (window), next_buffers);
1852 return next_buffers;
1720} 1853}
1721 1854
1722DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, 1855DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters,
@@ -1753,8 +1886,8 @@ Return VALUE. */)
1753 1886
1754 old_alist_elt = Fassq (parameter, w->window_parameters); 1887 old_alist_elt = Fassq (parameter, w->window_parameters);
1755 if (NILP (old_alist_elt)) 1888 if (NILP (old_alist_elt))
1756 WSET (w, window_parameters, 1889 wset_window_parameters
1757 Fcons (Fcons (parameter, value), w->window_parameters)); 1890 (w, Fcons (Fcons (parameter, value), w->window_parameters));
1758 else 1891 else
1759 Fsetcdr (old_alist_elt, value); 1892 Fsetcdr (old_alist_elt, value);
1760 return value; 1893 return value;
@@ -1799,7 +1932,8 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa
1799WINDOW must be a live window and defaults to the selected one. */) 1932WINDOW must be a live window and defaults to the selected one. */)
1800 (register Lisp_Object window, Lisp_Object table) 1933 (register Lisp_Object window, Lisp_Object table)
1801{ 1934{
1802 return WSET (decode_live_window (window), display_table, table); 1935 wset_display_table (decode_live_window (window), table);
1936 return table;
1803} 1937}
1804 1938
1805/* Record info on buffer window W is displaying 1939/* Record info on buffer window W is displaying
@@ -1848,7 +1982,7 @@ unshow_buffer (register struct window *w)
1848 1982
1849 if (WINDOWP (BVAR (b, last_selected_window)) 1983 if (WINDOWP (BVAR (b, last_selected_window))
1850 && w == XWINDOW (BVAR (b, last_selected_window))) 1984 && w == XWINDOW (BVAR (b, last_selected_window)))
1851 BSET (b, last_selected_window, Qnil); 1985 bset_last_selected_window (b, Qnil);
1852} 1986}
1853 1987
1854/* Put NEW into the window structure in place of OLD. SETFLAG zero 1988/* Put NEW into the window structure in place of OLD. SETFLAG zero
@@ -1863,18 +1997,18 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1863 /* If OLD is its frame's root window, then NEW is the new 1997 /* If OLD is its frame's root window, then NEW is the new
1864 root window for that frame. */ 1998 root window for that frame. */
1865 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) 1999 if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame))))
1866 FSET (XFRAME (o->frame), root_window, new); 2000 fset_root_window (XFRAME (o->frame), new);
1867 2001
1868 if (setflag) 2002 if (setflag)
1869 { 2003 {
1870 WSET (n, left_col, o->left_col); 2004 wset_left_col (n, o->left_col);
1871 WSET (n, top_line, o->top_line); 2005 wset_top_line (n, o->top_line);
1872 WSET (n, total_cols, o->total_cols); 2006 wset_total_cols (n, o->total_cols);
1873 WSET (n, total_lines, o->total_lines); 2007 wset_total_lines (n, o->total_lines);
1874 WSET (n, normal_cols, o->normal_cols); 2008 wset_normal_cols (n, o->normal_cols);
1875 WSET (o, normal_cols, make_float (1.0)); 2009 wset_normal_cols (o, make_float (1.0));
1876 WSET (n, normal_lines, o->normal_lines); 2010 wset_normal_lines (n, o->normal_lines);
1877 WSET (o, normal_lines, make_float (1.0)); 2011 wset_normal_lines (o, make_float (1.0));
1878 n->desired_matrix = n->current_matrix = 0; 2012 n->desired_matrix = n->current_matrix = 0;
1879 n->vscroll = 0; 2013 n->vscroll = 0;
1880 memset (&n->cursor, 0, sizeof (n->cursor)); 2014 memset (&n->cursor, 0, sizeof (n->cursor));
@@ -1884,30 +2018,30 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
1884 n->phys_cursor_width = -1; 2018 n->phys_cursor_width = -1;
1885 n->must_be_updated_p = 0; 2019 n->must_be_updated_p = 0;
1886 n->pseudo_window_p = 0; 2020 n->pseudo_window_p = 0;
1887 WSET (n, window_end_vpos, make_number (0)); 2021 wset_window_end_vpos (n, make_number (0));
1888 WSET (n, window_end_pos, make_number (0)); 2022 wset_window_end_pos (n, make_number (0));
1889 WSET (n, window_end_valid, Qnil); 2023 wset_window_end_valid (n, Qnil);
1890 n->frozen_window_start_p = 0; 2024 n->frozen_window_start_p = 0;
1891 } 2025 }
1892 2026
1893 tem = o->next; 2027 tem = o->next;
1894 WSET (n, next, tem); 2028 wset_next (n, tem);
1895 if (!NILP (tem)) 2029 if (!NILP (tem))
1896 WSET (XWINDOW (tem), prev, new); 2030 wset_prev (XWINDOW (tem), new);
1897 2031
1898 tem = o->prev; 2032 tem = o->prev;
1899 WSET (n, prev, tem); 2033 wset_prev (n, tem);
1900 if (!NILP (tem)) 2034 if (!NILP (tem))
1901 WSET (XWINDOW (tem), next, new); 2035 wset_next (XWINDOW (tem), new);
1902 2036
1903 tem = o->parent; 2037 tem = o->parent;
1904 WSET (n, parent, tem); 2038 wset_parent (n, tem);
1905 if (!NILP (tem)) 2039 if (!NILP (tem))
1906 { 2040 {
1907 if (EQ (XWINDOW (tem)->vchild, old)) 2041 if (EQ (XWINDOW (tem)->vchild, old))
1908 WSET (XWINDOW (tem), vchild, new); 2042 wset_vchild (XWINDOW (tem), new);
1909 if (EQ (XWINDOW (tem)->hchild, old)) 2043 if (EQ (XWINDOW (tem)->hchild, old))
1910 WSET (XWINDOW (tem), hchild, new); 2044 wset_hchild (XWINDOW (tem), new);
1911 } 2045 }
1912} 2046}
1913 2047
@@ -1940,34 +2074,34 @@ recombine_windows (Lisp_Object window)
1940 assign new normal sizes. */ 2074 assign new normal sizes. */
1941 if (NILP (w->prev)) 2075 if (NILP (w->prev))
1942 if (horflag) 2076 if (horflag)
1943 WSET (p, hchild, child); 2077 wset_hchild (p, child);
1944 else 2078 else
1945 WSET (p, vchild, child); 2079 wset_vchild (p, child);
1946 else 2080 else
1947 { 2081 {
1948 WSET (c, prev, w->prev); 2082 wset_prev (c, w->prev);
1949 WSET (XWINDOW (w->prev), next, child); 2083 wset_next (XWINDOW (w->prev), child);
1950 } 2084 }
1951 2085
1952 while (c) 2086 while (c)
1953 { 2087 {
1954 WSET (c, parent, parent); 2088 wset_parent (c, parent);
1955 2089
1956 if (horflag) 2090 if (horflag)
1957 WSET (c, normal_cols, 2091 wset_normal_cols (c,
1958 make_float (XFLOATINT (c->total_cols) 2092 make_float (XFLOATINT (c->total_cols)
1959 / XFLOATINT (p->total_cols))); 2093 / XFLOATINT (p->total_cols)));
1960 else 2094 else
1961 WSET (c, normal_lines, 2095 wset_normal_lines (c,
1962 make_float (XFLOATINT (c->total_lines) 2096 make_float (XFLOATINT (c->total_lines)
1963 / XFLOATINT (p->total_lines))); 2097 / XFLOATINT (p->total_lines)));
1964 2098
1965 if (NILP (c->next)) 2099 if (NILP (c->next))
1966 { 2100 {
1967 if (!NILP (w->next)) 2101 if (!NILP (w->next))
1968 { 2102 {
1969 WSET (c, next, w->next); 2103 wset_next (c, w->next);
1970 WSET (XWINDOW (c->next), prev, child); 2104 wset_prev (XWINDOW (c->next), child);
1971 } 2105 }
1972 2106
1973 c = 0; 2107 c = 0;
@@ -1980,8 +2114,8 @@ recombine_windows (Lisp_Object window)
1980 } 2114 }
1981 2115
1982 /* WINDOW can be deleted now. */ 2116 /* WINDOW can be deleted now. */
1983 WSET (w, vchild, Qnil); 2117 wset_vchild (w, Qnil);
1984 WSET (w, hchild, Qnil); 2118 wset_hchild (w, Qnil);
1985 } 2119 }
1986 } 2120 }
1987} 2121}
@@ -2146,7 +2280,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2146 2280
2147 /* ALL_FRAMES nil doesn't specify which frames to include. */ 2281 /* ALL_FRAMES nil doesn't specify which frames to include. */
2148 if (NILP (*all_frames)) 2282 if (NILP (*all_frames))
2149 *all_frames 2283 *all_frames
2150 = (!EQ (*minibuf, Qlambda) 2284 = (!EQ (*minibuf, Qlambda)
2151 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) 2285 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame))
2152 : Qnil); 2286 : Qnil);
@@ -2502,7 +2636,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2502 if (EQ (w->buffer, obj)) 2636 if (EQ (w->buffer, obj))
2503 { 2637 {
2504 /* Undedicate WINDOW. */ 2638 /* Undedicate WINDOW. */
2505 WSET (w, dedicated, Qnil); 2639 wset_dedicated (w, Qnil);
2506 /* Make WINDOW show the buffer returned by 2640 /* Make WINDOW show the buffer returned by
2507 other_buffer_safely, don't run any hooks. */ 2641 other_buffer_safely, don't run any hooks. */
2508 set_window_buffer 2642 set_window_buffer
@@ -2659,7 +2793,7 @@ window-start value is reasonable when this function is called. */)
2659 if (EQ (selected_frame, w->frame)) 2793 if (EQ (selected_frame, w->frame))
2660 Fselect_window (window, Qnil); 2794 Fselect_window (window, Qnil);
2661 else 2795 else
2662 FSET (f, selected_window, window); 2796 fset_selected_window (f, window);
2663 } 2797 }
2664 } 2798 }
2665 else 2799 else
@@ -2689,7 +2823,7 @@ window-start value is reasonable when this function is called. */)
2689 if (EQ (selected_frame, w->frame)) 2823 if (EQ (selected_frame, w->frame))
2690 Fselect_window (swindow, Qnil); 2824 Fselect_window (swindow, Qnil);
2691 else 2825 else
2692 FSET (f, selected_window, swindow); 2826 fset_selected_window (f, swindow);
2693 } 2827 }
2694 } 2828 }
2695 2829
@@ -2724,7 +2858,7 @@ window-start value is reasonable when this function is called. */)
2724 /* Resize child windows vertically. */ 2858 /* Resize child windows vertically. */
2725 XSETINT (delta, XINT (r->total_lines) 2859 XSETINT (delta, XINT (r->total_lines)
2726 - XINT (w->total_lines)); 2860 - XINT (w->total_lines));
2727 WSET (w, top_line, r->top_line); 2861 wset_top_line (w, r->top_line);
2728 resize_root_window (window, delta, Qnil, Qnil); 2862 resize_root_window (window, delta, Qnil, Qnil);
2729 if (window_resize_check (w, 0)) 2863 if (window_resize_check (w, 0))
2730 window_resize_apply (w, 0); 2864 window_resize_apply (w, 0);
@@ -2740,10 +2874,10 @@ window-start value is reasonable when this function is called. */)
2740 /* Resize child windows horizontally. */ 2874 /* Resize child windows horizontally. */
2741 if (!resize_failed) 2875 if (!resize_failed)
2742 { 2876 {
2743 WSET (w, left_col, r->left_col); 2877 wset_left_col (w, r->left_col);
2744 XSETINT (delta, XINT (r->total_cols) 2878 XSETINT (delta,
2745 - XINT (w->total_cols)); 2879 XINT (r->total_cols) - XINT (w->total_cols));
2746 WSET (w, left_col, r->left_col); 2880 wset_left_col (w, r->left_col);
2747 resize_root_window (window, delta, Qt, Qnil); 2881 resize_root_window (window, delta, Qt, Qnil);
2748 if (window_resize_check (w, 1)) 2882 if (window_resize_check (w, 1))
2749 window_resize_apply (w, 1); 2883 window_resize_apply (w, 1);
@@ -2771,32 +2905,32 @@ window-start value is reasonable when this function is called. */)
2771 { 2905 {
2772 sibling = w->prev; 2906 sibling = w->prev;
2773 s = XWINDOW (sibling); 2907 s = XWINDOW (sibling);
2774 WSET (s, next, w->next); 2908 wset_next (s, w->next);
2775 if (!NILP (s->next)) 2909 if (!NILP (s->next))
2776 WSET (XWINDOW (s->next), prev, sibling); 2910 wset_prev (XWINDOW (s->next), sibling);
2777 } 2911 }
2778 else 2912 else
2779 /* Get SIBLING below (on the right of) WINDOW. */ 2913 /* Get SIBLING below (on the right of) WINDOW. */
2780 { 2914 {
2781 sibling = w->next; 2915 sibling = w->next;
2782 s = XWINDOW (sibling); 2916 s = XWINDOW (sibling);
2783 WSET (s, prev, Qnil); 2917 wset_prev (s, Qnil);
2784 if (!NILP (XWINDOW (w->parent)->vchild)) 2918 if (!NILP (XWINDOW (w->parent)->vchild))
2785 WSET (XWINDOW (w->parent), vchild, sibling); 2919 wset_vchild (XWINDOW (w->parent), sibling);
2786 else 2920 else
2787 WSET (XWINDOW (w->parent), hchild, sibling); 2921 wset_hchild (XWINDOW (w->parent), sibling);
2788 } 2922 }
2789 2923
2790 /* Delete ROOT and all child windows of ROOT. */ 2924 /* Delete ROOT and all child windows of ROOT. */
2791 if (!NILP (r->vchild)) 2925 if (!NILP (r->vchild))
2792 { 2926 {
2793 delete_all_child_windows (r->vchild); 2927 delete_all_child_windows (r->vchild);
2794 WSET (r, vchild, Qnil); 2928 wset_vchild (r, Qnil);
2795 } 2929 }
2796 else if (!NILP (r->hchild)) 2930 else if (!NILP (r->hchild))
2797 { 2931 {
2798 delete_all_child_windows (r->hchild); 2932 delete_all_child_windows (r->hchild);
2799 WSET (r, hchild, Qnil); 2933 wset_hchild (r, Qnil);
2800 } 2934 }
2801 2935
2802 replace_window (root, window, 1); 2936 replace_window (root, window, 1);
@@ -2823,7 +2957,7 @@ window-start value is reasonable when this function is called. */)
2823 pos = *vmotion (startpos, -top, w); 2957 pos = *vmotion (startpos, -top, w);
2824 2958
2825 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); 2959 set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
2826 WSET (w, window_end_valid, Qnil); 2960 wset_window_end_valid (w, Qnil);
2827 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE 2961 w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
2828 || FETCH_BYTE (pos.bytepos - 1) == '\n'); 2962 || FETCH_BYTE (pos.bytepos - 1) == '\n');
2829 /* We need to do this, so that the window-scroll-functions 2963 /* We need to do this, so that the window-scroll-functions
@@ -2914,14 +3048,14 @@ adjust_window_margins (struct window *w)
2914 { 3048 {
2915 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 3049 if (WINDOW_LEFT_MARGIN_COLS (w) > 0)
2916 { 3050 {
2917 WSET (w, left_margin_cols, make_number (margin_cols / 2)); 3051 wset_left_margin_cols (w, make_number (margin_cols / 2));
2918 WSET (w, right_margin_cols, make_number (margin_cols / 2)); 3052 wset_right_margin_cols (w, make_number (margin_cols / 2));
2919 } 3053 }
2920 else 3054 else
2921 WSET (w, right_margin_cols, make_number (margin_cols)); 3055 wset_right_margin_cols (w, make_number (margin_cols));
2922 } 3056 }
2923 else 3057 else
2924 WSET (w, left_margin_cols, make_number (margin_cols)); 3058 wset_left_margin_cols (w, make_number (margin_cols));
2925 return 1; 3059 return 1;
2926} 3060}
2927 3061
@@ -3021,23 +3155,23 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3021 ptrdiff_t count = SPECPDL_INDEX (); 3155 ptrdiff_t count = SPECPDL_INDEX ();
3022 int samebuf = EQ (buffer, w->buffer); 3156 int samebuf = EQ (buffer, w->buffer);
3023 3157
3024 WSET (w, buffer, buffer); 3158 wset_buffer (w, buffer);
3025 3159
3026 if (EQ (window, selected_window)) 3160 if (EQ (window, selected_window))
3027 BSET (b, last_selected_window, window); 3161 bset_last_selected_window (b, window);
3028 3162
3029 /* Let redisplay errors through. */ 3163 /* Let redisplay errors through. */
3030 b->display_error_modiff = 0; 3164 b->display_error_modiff = 0;
3031 3165
3032 /* Update time stamps of buffer display. */ 3166 /* Update time stamps of buffer display. */
3033 if (INTEGERP (BVAR (b, display_count))) 3167 if (INTEGERP (BVAR (b, display_count)))
3034 BSET (b, display_count, make_number (XINT (BVAR (b, display_count)) + 1)); 3168 bset_display_count (b, make_number (XINT (BVAR (b, display_count)) + 1));
3035 BSET (b, display_time, Fcurrent_time ()); 3169 bset_display_time (b, Fcurrent_time ());
3036 3170
3037 WSET (w, window_end_pos, make_number (0)); 3171 wset_window_end_pos (w, make_number (0));
3038 WSET (w, window_end_vpos, make_number (0)); 3172 wset_window_end_vpos (w, make_number (0));
3039 memset (&w->last_cursor, 0, sizeof w->last_cursor); 3173 memset (&w->last_cursor, 0, sizeof w->last_cursor);
3040 WSET (w, window_end_valid, Qnil); 3174 wset_window_end_valid (w, Qnil);
3041 if (!(keep_margins_p && samebuf)) 3175 if (!(keep_margins_p && samebuf))
3042 { /* If we're not actually changing the buffer, don't reset hscroll and 3176 { /* If we're not actually changing the buffer, don't reset hscroll and
3043 vscroll. This case happens for example when called from 3177 vscroll. This case happens for example when called from
@@ -3082,8 +3216,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3082 Lisp_Object save_left = w->left_margin_cols; 3216 Lisp_Object save_left = w->left_margin_cols;
3083 Lisp_Object save_right = w->right_margin_cols; 3217 Lisp_Object save_right = w->right_margin_cols;
3084 3218
3085 WSET (w, left_margin_cols, Qnil); 3219 wset_left_margin_cols (w, Qnil);
3086 WSET (w, right_margin_cols, Qnil); 3220 wset_right_margin_cols (w, Qnil);
3087 3221
3088 Fset_window_fringes (window, 3222 Fset_window_fringes (window,
3089 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), 3223 BVAR (b, left_fringe_width), BVAR (b, right_fringe_width),
@@ -3093,8 +3227,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
3093 BVAR (b, scroll_bar_width), 3227 BVAR (b, scroll_bar_width),
3094 BVAR (b, vertical_scroll_bar_type), Qnil); 3228 BVAR (b, vertical_scroll_bar_type), Qnil);
3095 3229
3096 WSET (w, left_margin_cols, save_left); 3230 wset_left_margin_cols (w, save_left);
3097 WSET (w, right_margin_cols, save_right); 3231 wset_right_margin_cols (w, save_right);
3098 3232
3099 Fset_window_margins (window, 3233 Fset_window_margins (window,
3100 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); 3234 BVAR (b, left_margin_cols), BVAR (b, right_margin_cols));
@@ -3153,7 +3287,7 @@ This function runs `window-scroll-functions' before running
3153 else 3287 else
3154 /* WINDOW is weakly dedicated to its buffer, reset 3288 /* WINDOW is weakly dedicated to its buffer, reset
3155 dedication. */ 3289 dedication. */
3156 WSET (w, dedicated, Qnil); 3290 wset_dedicated (w, Qnil);
3157 3291
3158 call1 (Qrecord_window_buffer, window); 3292 call1 (Qrecord_window_buffer, window);
3159 } 3293 }
@@ -3223,7 +3357,7 @@ temp_output_buffer_show (register Lisp_Object buf)
3223 register Lisp_Object window; 3357 register Lisp_Object window;
3224 register struct window *w; 3358 register struct window *w;
3225 3359
3226 BSET (XBUFFER (buf), directory, BVAR (current_buffer, directory)); 3360 bset_directory (XBUFFER (buf), BVAR (current_buffer, directory));
3227 3361
3228 Fset_buffer (buf); 3362 Fset_buffer (buf);
3229 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF; 3363 BUF_SAVE_MODIFF (XBUFFER (buf)) = MODIFF;
@@ -3299,17 +3433,17 @@ make_parent_window (Lisp_Object window, int horflag)
3299 3433
3300 replace_window (window, parent, 1); 3434 replace_window (window, parent, 1);
3301 3435
3302 WSET (o, next, Qnil); 3436 wset_next (o, Qnil);
3303 WSET (o, prev, Qnil); 3437 wset_prev (o, Qnil);
3304 WSET (o, parent, parent); 3438 wset_parent (o, parent);
3305 3439
3306 WSET (p, hchild, horflag ? window : Qnil); 3440 wset_hchild (p, horflag ? window : Qnil);
3307 WSET (p, vchild, horflag ? Qnil : window); 3441 wset_vchild (p, horflag ? Qnil : window);
3308 WSET (p, start, Qnil); 3442 wset_start (p, Qnil);
3309 WSET (p, pointm, Qnil); 3443 wset_pointm (p, Qnil);
3310 WSET (p, buffer, Qnil); 3444 wset_buffer (p, Qnil);
3311 WSET (p, combination_limit, Qnil); 3445 wset_combination_limit (p, Qnil);
3312 WSET (p, window_parameters, Qnil); 3446 wset_window_parameters (p, Qnil);
3313} 3447}
3314 3448
3315/* Make new window from scratch. */ 3449/* Make new window from scratch. */
@@ -3322,19 +3456,19 @@ make_window (void)
3322 w = allocate_window (); 3456 w = allocate_window ();
3323 /* Initialize Lisp data. Note that allocate_window initializes all 3457 /* Initialize Lisp data. Note that allocate_window initializes all
3324 Lisp data to nil, so do it only for slots which should not be nil. */ 3458 Lisp data to nil, so do it only for slots which should not be nil. */
3325 WSET (w, left_col, make_number (0)); 3459 wset_left_col (w, make_number (0));
3326 WSET (w, top_line, make_number (0)); 3460 wset_top_line (w, make_number (0));
3327 WSET (w, total_lines, make_number (0)); 3461 wset_total_lines (w, make_number (0));
3328 WSET (w, total_cols, make_number (0)); 3462 wset_total_cols (w, make_number (0));
3329 WSET (w, normal_lines, make_float (1.0)); 3463 wset_normal_lines (w, make_float (1.0));
3330 WSET (w, normal_cols, make_float (1.0)); 3464 wset_normal_cols (w, make_float (1.0));
3331 WSET (w, new_total, make_number (0)); 3465 wset_new_total (w, make_number (0));
3332 WSET (w, new_normal, make_number (0)); 3466 wset_new_normal (w, make_number (0));
3333 WSET (w, start, Fmake_marker ()); 3467 wset_start (w, Fmake_marker ());
3334 WSET (w, pointm, Fmake_marker ()); 3468 wset_pointm (w, Fmake_marker ());
3335 WSET (w, vertical_scroll_bar_type, Qt); 3469 wset_vertical_scroll_bar_type (w, Qt);
3336 WSET (w, window_end_pos, make_number (0)); 3470 wset_window_end_pos (w, make_number (0));
3337 WSET (w, window_end_vpos, make_number (0)); 3471 wset_window_end_vpos (w, make_number (0));
3338 3472
3339 /* Initialize non-Lisp data. Note that allocate_window zeroes out all 3473 /* Initialize non-Lisp data. Note that allocate_window zeroes out all
3340 non-Lisp data, so do it only for slots which should not be zero. */ 3474 non-Lisp data, so do it only for slots which should not be zero. */
@@ -3365,9 +3499,9 @@ Note: This function does not operate on any child windows of WINDOW. */)
3365 3499
3366 CHECK_NUMBER (size); 3500 CHECK_NUMBER (size);
3367 if (NILP (add)) 3501 if (NILP (add))
3368 WSET (w, new_total, size); 3502 wset_new_total (w, size);
3369 else 3503 else
3370 WSET (w, new_total, make_number (XINT (w->new_total) + XINT (size))); 3504 wset_new_total (w, make_number (XINT (w->new_total) + XINT (size)));
3371 3505
3372 return w->new_total; 3506 return w->new_total;
3373} 3507}
@@ -3380,7 +3514,8 @@ Return SIZE.
3380Note: This function does not operate on any child windows of WINDOW. */) 3514Note: This function does not operate on any child windows of WINDOW. */)
3381 (Lisp_Object window, Lisp_Object size) 3515 (Lisp_Object window, Lisp_Object size)
3382{ 3516{
3383 return WSET (decode_valid_window (window), new_normal, size); 3517 wset_new_normal (decode_valid_window (window), size);
3518 return size;
3384} 3519}
3385 3520
3386/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is 3521/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is
@@ -3481,17 +3616,17 @@ window_resize_apply (struct window *w, int horflag)
3481 parent window has been set *before*. */ 3616 parent window has been set *before*. */
3482 if (horflag) 3617 if (horflag)
3483 { 3618 {
3484 WSET (w, total_cols, w->new_total); 3619 wset_total_cols (w, w->new_total);
3485 if (NUMBERP (w->new_normal)) 3620 if (NUMBERP (w->new_normal))
3486 WSET (w, normal_cols, w->new_normal); 3621 wset_normal_cols (w, w->new_normal);
3487 3622
3488 pos = XINT (w->left_col); 3623 pos = XINT (w->left_col);
3489 } 3624 }
3490 else 3625 else
3491 { 3626 {
3492 WSET (w, total_lines, w->new_total); 3627 wset_total_lines (w, w->new_total);
3493 if (NUMBERP (w->new_normal)) 3628 if (NUMBERP (w->new_normal))
3494 WSET (w, normal_lines, w->new_normal); 3629 wset_normal_lines (w, w->new_normal);
3495 3630
3496 pos = XINT (w->top_line); 3631 pos = XINT (w->top_line);
3497 } 3632 }
@@ -3503,9 +3638,9 @@ window_resize_apply (struct window *w, int horflag)
3503 while (c) 3638 while (c)
3504 { 3639 {
3505 if (horflag) 3640 if (horflag)
3506 WSET (c, left_col, make_number (pos)); 3641 wset_left_col (c, make_number (pos));
3507 else 3642 else
3508 WSET (c, top_line, make_number (pos)); 3643 wset_top_line (c, make_number (pos));
3509 window_resize_apply (c, horflag); 3644 window_resize_apply (c, horflag);
3510 if (!horflag) 3645 if (!horflag)
3511 pos = pos + XINT (c->total_lines); 3646 pos = pos + XINT (c->total_lines);
@@ -3519,9 +3654,9 @@ window_resize_apply (struct window *w, int horflag)
3519 while (c) 3654 while (c)
3520 { 3655 {
3521 if (horflag) 3656 if (horflag)
3522 WSET (c, left_col, make_number (pos)); 3657 wset_left_col (c, make_number (pos));
3523 else 3658 else
3524 WSET (c, top_line, make_number (pos)); 3659 wset_top_line (c, make_number (pos));
3525 window_resize_apply (c, horflag); 3660 window_resize_apply (c, horflag);
3526 if (horflag) 3661 if (horflag)
3527 pos = pos + XINT (c->total_cols); 3662 pos = pos + XINT (c->total_cols);
@@ -3602,17 +3737,17 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3602 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 3737 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
3603 ? 1 : 0))); 3738 ? 1 : 0)));
3604 3739
3605 WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); 3740 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f)));
3606 if (NILP (r->vchild) && NILP (r->hchild)) 3741 if (NILP (r->vchild) && NILP (r->hchild))
3607 /* For a leaf root window just set the size. */ 3742 /* For a leaf root window just set the size. */
3608 if (horflag) 3743 if (horflag)
3609 WSET (r, total_cols, make_number (new_size)); 3744 wset_total_cols (r, make_number (new_size));
3610 else 3745 else
3611 WSET (r, total_lines, make_number (new_size)); 3746 wset_total_lines (r, make_number (new_size));
3612 else 3747 else
3613 { 3748 {
3614 /* old_size is the old size of the frame's root window. */ 3749 /* old_size is the old size of the frame's root window. */
3615 int old_size = XFASTINT (horflag ? r->total_cols 3750 int old_size = XFASTINT (horflag ? r->total_cols
3616 : r->total_lines); 3751 : r->total_lines);
3617 Lisp_Object delta; 3752 Lisp_Object delta;
3618 3753
@@ -3643,9 +3778,9 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3643 root = f->selected_window; 3778 root = f->selected_window;
3644 Fdelete_other_windows_internal (root, Qnil); 3779 Fdelete_other_windows_internal (root, Qnil);
3645 if (horflag) 3780 if (horflag)
3646 WSET (XWINDOW (root), total_cols, make_number (new_size)); 3781 wset_total_cols (XWINDOW (root), make_number (new_size));
3647 else 3782 else
3648 WSET (XWINDOW (root), total_lines, make_number (new_size)); 3783 wset_total_lines (XWINDOW (root), make_number (new_size));
3649 } 3784 }
3650 } 3785 }
3651 } 3786 }
@@ -3655,13 +3790,13 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3655 { 3790 {
3656 m = XWINDOW (mini); 3791 m = XWINDOW (mini);
3657 if (horflag) 3792 if (horflag)
3658 WSET (m, total_cols, make_number (size)); 3793 wset_total_cols (m, make_number (size));
3659 else 3794 else
3660 { 3795 {
3661 /* Are we sure we always want 1 line here? */ 3796 /* Are we sure we always want 1 line here? */
3662 WSET (m, total_lines, make_number (1)); 3797 wset_total_lines (m, make_number (1));
3663 WSET (m, top_line, 3798 wset_top_line
3664 make_number (XINT (r->top_line) + XINT (r->total_lines))); 3799 (m, make_number (XINT (r->top_line) + XINT (r->total_lines)));
3665 } 3800 }
3666 } 3801 }
3667} 3802}
@@ -3742,15 +3877,14 @@ set correctly. See the code of `split-window' for how this is done. */)
3742 { 3877 {
3743 p = XWINDOW (o->parent); 3878 p = XWINDOW (o->parent);
3744 /* Temporarily pretend we split the parent window. */ 3879 /* Temporarily pretend we split the parent window. */
3745 WSET (p, new_total, 3880 wset_new_total
3746 make_number (XINT (horflag ? p->total_cols : p->total_lines) 3881 (p, make_number (XINT (horflag ? p->total_cols : p->total_lines)
3747 - XINT (total_size))); 3882 - XINT (total_size)));
3748 if (!window_resize_check (p, horflag)) 3883 if (!window_resize_check (p, horflag))
3749 error ("Window sizes don't fit"); 3884 error ("Window sizes don't fit");
3750 else 3885 else
3751 /* Undo the temporary pretension. */ 3886 /* Undo the temporary pretension. */
3752 WSET (p, new_total, 3887 wset_new_total (p, horflag ? p->total_cols : p->total_lines);
3753 horflag ? p->total_cols : p->total_lines);
3754 } 3888 }
3755 else 3889 else
3756 { 3890 {
@@ -3774,10 +3908,10 @@ set correctly. See the code of `split-window' for how this is done. */)
3774 p = XWINDOW (o->parent); 3908 p = XWINDOW (o->parent);
3775 /* Store value of `window-combination-limit' in new parent's 3909 /* Store value of `window-combination-limit' in new parent's
3776 combination_limit slot. */ 3910 combination_limit slot. */
3777 WSET (p, combination_limit, Vwindow_combination_limit); 3911 wset_combination_limit (p, Vwindow_combination_limit);
3778 /* These get applied below. */ 3912 /* These get applied below. */
3779 WSET (p, new_total, horflag ? o->total_cols : o->total_lines); 3913 wset_new_total (p, horflag ? o->total_cols : o->total_lines);
3780 WSET (p, new_normal, new_normal); 3914 wset_new_normal (p, new_normal);
3781 } 3915 }
3782 else 3916 else
3783 p = XWINDOW (o->parent); 3917 p = XWINDOW (o->parent);
@@ -3786,62 +3920,62 @@ set correctly. See the code of `split-window' for how this is done. */)
3786 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3920 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3787 new = make_window (); 3921 new = make_window ();
3788 n = XWINDOW (new); 3922 n = XWINDOW (new);
3789 WSET (n, frame, frame); 3923 wset_frame (n, frame);
3790 WSET (n, parent, o->parent); 3924 wset_parent (n, o->parent);
3791 WSET (n, vchild, Qnil); 3925 wset_vchild (n, Qnil);
3792 WSET (n, hchild, Qnil); 3926 wset_hchild (n, Qnil);
3793 3927
3794 if (EQ (side, Qabove) || EQ (side, Qleft)) 3928 if (EQ (side, Qabove) || EQ (side, Qleft))
3795 { 3929 {
3796 WSET (n, prev, o->prev); 3930 wset_prev (n, o->prev);
3797 if (NILP (n->prev)) 3931 if (NILP (n->prev))
3798 if (horflag) 3932 if (horflag)
3799 WSET (p, hchild, new); 3933 wset_hchild (p, new);
3800 else 3934 else
3801 WSET (p, vchild, new); 3935 wset_vchild (p, new);
3802 else 3936 else
3803 WSET (XWINDOW (n->prev), next, new); 3937 wset_next (XWINDOW (n->prev), new);
3804 WSET (n, next, old); 3938 wset_next (n, old);
3805 WSET (o, prev, new); 3939 wset_prev (o, new);
3806 } 3940 }
3807 else 3941 else
3808 { 3942 {
3809 WSET (n, next, o->next); 3943 wset_next (n, o->next);
3810 if (!NILP (n->next)) 3944 if (!NILP (n->next))
3811 WSET (XWINDOW (n->next), prev, new); 3945 wset_prev (XWINDOW (n->next), new);
3812 WSET (n, prev, old); 3946 wset_prev (n, old);
3813 WSET (o, next, new); 3947 wset_next (o, new);
3814 } 3948 }
3815 3949
3816 WSET (n, buffer, Qt); 3950 wset_buffer (n, Qt);
3817 WSET (n, window_end_valid, Qnil); 3951 wset_window_end_valid (n, Qnil);
3818 memset (&n->last_cursor, 0, sizeof n->last_cursor); 3952 memset (&n->last_cursor, 0, sizeof n->last_cursor);
3819 3953
3820 /* Get special geometry settings from reference window. */ 3954 /* Get special geometry settings from reference window. */
3821 WSET (n, left_margin_cols, r->left_margin_cols); 3955 wset_left_margin_cols (n, r->left_margin_cols);
3822 WSET (n, right_margin_cols, r->right_margin_cols); 3956 wset_right_margin_cols (n, r->right_margin_cols);
3823 WSET (n, left_fringe_width, r->left_fringe_width); 3957 wset_left_fringe_width (n, r->left_fringe_width);
3824 WSET (n, right_fringe_width, r->right_fringe_width); 3958 wset_right_fringe_width (n, r->right_fringe_width);
3825 n->fringes_outside_margins = r->fringes_outside_margins; 3959 n->fringes_outside_margins = r->fringes_outside_margins;
3826 WSET (n, scroll_bar_width, r->scroll_bar_width); 3960 wset_scroll_bar_width (n, r->scroll_bar_width);
3827 WSET (n, vertical_scroll_bar_type, r->vertical_scroll_bar_type); 3961 wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
3828 3962
3829 /* Directly assign orthogonal coordinates and sizes. */ 3963 /* Directly assign orthogonal coordinates and sizes. */
3830 if (horflag) 3964 if (horflag)
3831 { 3965 {
3832 WSET (n, top_line, o->top_line); 3966 wset_top_line (n, o->top_line);
3833 WSET (n, total_lines, o->total_lines); 3967 wset_total_lines (n, o->total_lines);
3834 } 3968 }
3835 else 3969 else
3836 { 3970 {
3837 WSET (n, left_col, o->left_col); 3971 wset_left_col (n, o->left_col);
3838 WSET (n, total_cols, o->total_cols); 3972 wset_total_cols (n, o->total_cols);
3839 } 3973 }
3840 3974
3841 /* Iso-coordinates and sizes are assigned by window_resize_apply, 3975 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3842 get them ready here. */ 3976 get them ready here. */
3843 WSET (n, new_total, total_size); 3977 wset_new_total (n, total_size);
3844 WSET (n, new_normal, normal_size); 3978 wset_new_normal (n, normal_size);
3845 3979
3846 BLOCK_INPUT; 3980 BLOCK_INPUT;
3847 window_resize_apply (p, horflag); 3981 window_resize_apply (p, horflag);
@@ -3907,20 +4041,20 @@ Signal an error when WINDOW is the only window on its frame. */)
3907 before_sibling = 1; 4041 before_sibling = 1;
3908 sibling = w->next; 4042 sibling = w->next;
3909 s = XWINDOW (sibling); 4043 s = XWINDOW (sibling);
3910 WSET (s, prev, Qnil); 4044 wset_prev (s, Qnil);
3911 if (horflag) 4045 if (horflag)
3912 WSET (p, hchild, sibling); 4046 wset_hchild (p, sibling);
3913 else 4047 else
3914 WSET (p, vchild, sibling); 4048 wset_vchild (p, sibling);
3915 } 4049 }
3916 else 4050 else
3917 /* Get SIBLING above (on the left of) WINDOW. */ 4051 /* Get SIBLING above (on the left of) WINDOW. */
3918 { 4052 {
3919 sibling = w->prev; 4053 sibling = w->prev;
3920 s = XWINDOW (sibling); 4054 s = XWINDOW (sibling);
3921 WSET (s, next, w->next); 4055 wset_next (s, w->next);
3922 if (!NILP (s->next)) 4056 if (!NILP (s->next))
3923 WSET (XWINDOW (s->next), prev, sibling); 4057 wset_prev (XWINDOW (s->next), sibling);
3924 } 4058 }
3925 4059
3926 if (window_resize_check (r, horflag) 4060 if (window_resize_check (r, horflag)
@@ -3947,25 +4081,25 @@ Signal an error when WINDOW is the only window on its frame. */)
3947 Vwindow_list = Qnil; 4081 Vwindow_list = Qnil;
3948 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4082 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3949 4083
3950 WSET (w, next, Qnil); /* Don't delete w->next too. */ 4084 wset_next (w, Qnil); /* Don't delete w->next too. */
3951 free_window_matrices (w); 4085 free_window_matrices (w);
3952 4086
3953 if (!NILP (w->vchild)) 4087 if (!NILP (w->vchild))
3954 { 4088 {
3955 delete_all_child_windows (w->vchild); 4089 delete_all_child_windows (w->vchild);
3956 WSET (w, vchild, Qnil); 4090 wset_vchild (w, Qnil);
3957 } 4091 }
3958 else if (!NILP (w->hchild)) 4092 else if (!NILP (w->hchild))
3959 { 4093 {
3960 delete_all_child_windows (w->hchild); 4094 delete_all_child_windows (w->hchild);
3961 WSET (w, hchild, Qnil); 4095 wset_hchild (w, Qnil);
3962 } 4096 }
3963 else if (!NILP (w->buffer)) 4097 else if (!NILP (w->buffer))
3964 { 4098 {
3965 unshow_buffer (w); 4099 unshow_buffer (w);
3966 unchain_marker (XMARKER (w->pointm)); 4100 unchain_marker (XMARKER (w->pointm));
3967 unchain_marker (XMARKER (w->start)); 4101 unchain_marker (XMARKER (w->start));
3968 WSET (w, buffer, Qnil); 4102 wset_buffer (w, Qnil);
3969 } 4103 }
3970 4104
3971 if (NILP (s->prev) && NILP (s->next)) 4105 if (NILP (s->prev) && NILP (s->next))
@@ -3976,11 +4110,11 @@ Signal an error when WINDOW is the only window on its frame. */)
3976 replace_window (parent, sibling, 0); 4110 replace_window (parent, sibling, 0);
3977 /* Have SIBLING inherit the following three slot values from 4111 /* Have SIBLING inherit the following three slot values from
3978 PARENT (the combination_limit slot is not inherited). */ 4112 PARENT (the combination_limit slot is not inherited). */
3979 WSET (s, normal_cols, p->normal_cols); 4113 wset_normal_cols (s, p->normal_cols);
3980 WSET (s, normal_lines, p->normal_lines); 4114 wset_normal_lines (s, p->normal_lines);
3981 /* Mark PARENT as deleted. */ 4115 /* Mark PARENT as deleted. */
3982 WSET (p, vchild, Qnil); 4116 wset_vchild (p, Qnil);
3983 WSET (p, hchild, Qnil); 4117 wset_hchild (p, Qnil);
3984 /* Try to merge SIBLING into its new parent. */ 4118 /* Try to merge SIBLING into its new parent. */
3985 recombine_windows (sibling); 4119 recombine_windows (sibling);
3986 } 4120 }
@@ -4000,7 +4134,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4000 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) 4134 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
4001 Fselect_window (new_selected_window, Qt); 4135 Fselect_window (new_selected_window, Qt);
4002 else 4136 else
4003 FSET (f, selected_window, new_selected_window); 4137 fset_selected_window (f, new_selected_window);
4004 4138
4005 UNBLOCK_INPUT; 4139 UNBLOCK_INPUT;
4006 4140
@@ -4014,7 +4148,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4014 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window)) 4148 if (EQ (FRAME_SELECTED_WINDOW (f), selected_window))
4015 Fselect_window (new_selected_window, Qnil); 4149 Fselect_window (new_selected_window, Qnil);
4016 else 4150 else
4017 FSET (f, selected_window, new_selected_window); 4151 fset_selected_window (f, new_selected_window);
4018 } 4152 }
4019 else 4153 else
4020 UNBLOCK_INPUT; 4154 UNBLOCK_INPUT;
@@ -4027,17 +4161,17 @@ Signal an error when WINDOW is the only window on its frame. */)
4027 { 4161 {
4028 if (before_sibling) 4162 if (before_sibling)
4029 { 4163 {
4030 WSET (s, prev, window); 4164 wset_prev (s, window);
4031 if (horflag) 4165 if (horflag)
4032 WSET (p, hchild, window); 4166 wset_hchild (p, window);
4033 else 4167 else
4034 WSET (p, vchild, window); 4168 wset_vchild (p, window);
4035 } 4169 }
4036 else 4170 else
4037 { 4171 {
4038 WSET (s, next, window); 4172 wset_next (s, window);
4039 if (!NILP (w->next)) 4173 if (!NILP (w->next))
4040 WSET (XWINDOW (w->next), prev, window); 4174 wset_prev (XWINDOW (w->next), window);
4041 } 4175 }
4042 error ("Deletion failed"); 4176 error ("Deletion failed");
4043 } 4177 }
@@ -4071,10 +4205,10 @@ grow_mini_window (struct window *w, int delta)
4071 window_resize_apply (r, 0); 4205 window_resize_apply (r, 0);
4072 4206
4073 /* Grow the mini-window. */ 4207 /* Grow the mini-window. */
4074 WSET (w, top_line, 4208 wset_top_line
4075 make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); 4209 (w, make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines)));
4076 WSET (w, total_lines, 4210 wset_total_lines
4077 make_number (XFASTINT (w->total_lines) - XINT (value))); 4211 (w, make_number (XFASTINT (w->total_lines) - XINT (value)));
4078 w->last_modified = 0; 4212 w->last_modified = 0;
4079 w->last_overlay_modified = 0; 4213 w->last_overlay_modified = 0;
4080 4214
@@ -4108,9 +4242,9 @@ shrink_mini_window (struct window *w)
4108 window_resize_apply (r, 0); 4242 window_resize_apply (r, 0);
4109 4243
4110 /* Shrink the mini-window. */ 4244 /* Shrink the mini-window. */
4111 WSET (w, top_line, 4245 wset_top_line (w, make_number (XFASTINT (r->top_line)
4112 make_number (XFASTINT (r->top_line) + XFASTINT (r->total_lines))); 4246 + XFASTINT (r->total_lines)));
4113 WSET (w, total_lines, make_number (1)); 4247 wset_total_lines (w, make_number (1));
4114 4248
4115 w->last_modified = 0; 4249 w->last_modified = 0;
4116 w->last_overlay_modified = 0; 4250 w->last_overlay_modified = 0;
@@ -4151,9 +4285,9 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4151 BLOCK_INPUT; 4285 BLOCK_INPUT;
4152 window_resize_apply (r, 0); 4286 window_resize_apply (r, 0);
4153 4287
4154 WSET (w, total_lines, w->new_total); 4288 wset_total_lines (w, w->new_total);
4155 WSET (w, top_line, 4289 wset_top_line (w, make_number (XINT (r->top_line)
4156 make_number (XINT (r->top_line) + XINT (r->total_lines))); 4290 + XINT (r->total_lines)));
4157 4291
4158 windows_or_buffers_changed++; 4292 windows_or_buffers_changed++;
4159 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4293 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
@@ -5221,7 +5355,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5221 5355
5222 /* Set the new window start. */ 5356 /* Set the new window start. */
5223 set_marker_both (w->start, w->buffer, charpos, bytepos); 5357 set_marker_both (w->start, w->buffer, charpos, bytepos);
5224 WSET (w, window_end_valid, Qnil); 5358 wset_window_end_valid (w, Qnil);
5225 5359
5226 w->optional_new_start = 1; 5360 w->optional_new_start = 1;
5227 5361
@@ -5539,34 +5673,34 @@ the return value is nil. Otherwise the value is t. */)
5539 p = SAVED_WINDOW_N (saved_windows, k); 5673 p = SAVED_WINDOW_N (saved_windows, k);
5540 window = p->window; 5674 window = p->window;
5541 w = XWINDOW (window); 5675 w = XWINDOW (window);
5542 WSET (w, next, Qnil); 5676 wset_next (w, Qnil);
5543 5677
5544 if (!NILP (p->parent)) 5678 if (!NILP (p->parent))
5545 WSET (w, parent, SAVED_WINDOW_N 5679 wset_parent
5546 (saved_windows, XFASTINT (p->parent))->window); 5680 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window);
5547 else 5681 else
5548 WSET (w, parent, Qnil); 5682 wset_parent (w, Qnil);
5549 5683
5550 if (!NILP (p->prev)) 5684 if (!NILP (p->prev))
5551 { 5685 {
5552 WSET (w, prev, SAVED_WINDOW_N 5686 wset_prev
5553 (saved_windows, XFASTINT (p->prev))->window); 5687 (w, SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window);
5554 WSET (XWINDOW (w->prev), next, p->window); 5688 wset_next (XWINDOW (w->prev), p->window);
5555 } 5689 }
5556 else 5690 else
5557 { 5691 {
5558 WSET (w, prev, Qnil); 5692 wset_prev (w, Qnil);
5559 if (!NILP (w->parent)) 5693 if (!NILP (w->parent))
5560 { 5694 {
5561 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) 5695 if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols))
5562 { 5696 {
5563 WSET (XWINDOW (w->parent), vchild, p->window); 5697 wset_vchild (XWINDOW (w->parent), p->window);
5564 WSET (XWINDOW (w->parent), hchild, Qnil); 5698 wset_hchild (XWINDOW (w->parent), Qnil);
5565 } 5699 }
5566 else 5700 else
5567 { 5701 {
5568 WSET (XWINDOW (w->parent), hchild, p->window); 5702 wset_hchild (XWINDOW (w->parent), p->window);
5569 WSET (XWINDOW (w->parent), vchild, Qnil); 5703 wset_vchild (XWINDOW (w->parent), Qnil);
5570 } 5704 }
5571 } 5705 }
5572 } 5706 }
@@ -5574,25 +5708,25 @@ the return value is nil. Otherwise the value is t. */)
5574 /* If we squirreled away the buffer in the window's height, 5708 /* If we squirreled away the buffer in the window's height,
5575 restore it now. */ 5709 restore it now. */
5576 if (BUFFERP (w->total_lines)) 5710 if (BUFFERP (w->total_lines))
5577 WSET (w, buffer, w->total_lines); 5711 wset_buffer (w, w->total_lines);
5578 WSET (w, left_col, p->left_col); 5712 wset_left_col (w, p->left_col);
5579 WSET (w, top_line, p->top_line); 5713 wset_top_line (w, p->top_line);
5580 WSET (w, total_cols, p->total_cols); 5714 wset_total_cols (w, p->total_cols);
5581 WSET (w, total_lines, p->total_lines); 5715 wset_total_lines (w, p->total_lines);
5582 WSET (w, normal_cols, p->normal_cols); 5716 wset_normal_cols (w, p->normal_cols);
5583 WSET (w, normal_lines, p->normal_lines); 5717 wset_normal_lines (w, p->normal_lines);
5584 w->hscroll = XFASTINT (p->hscroll); 5718 w->hscroll = XFASTINT (p->hscroll);
5585 w->min_hscroll = XFASTINT (p->min_hscroll); 5719 w->min_hscroll = XFASTINT (p->min_hscroll);
5586 WSET (w, display_table, p->display_table); 5720 wset_display_table (w, p->display_table);
5587 WSET (w, left_margin_cols, p->left_margin_cols); 5721 wset_left_margin_cols (w, p->left_margin_cols);
5588 WSET (w, right_margin_cols, p->right_margin_cols); 5722 wset_right_margin_cols (w, p->right_margin_cols);
5589 WSET (w, left_fringe_width, p->left_fringe_width); 5723 wset_left_fringe_width (w, p->left_fringe_width);
5590 WSET (w, right_fringe_width, p->right_fringe_width); 5724 wset_right_fringe_width (w, p->right_fringe_width);
5591 w->fringes_outside_margins = !NILP (p->fringes_outside_margins); 5725 w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
5592 WSET (w, scroll_bar_width, p->scroll_bar_width); 5726 wset_scroll_bar_width (w, p->scroll_bar_width);
5593 WSET (w, vertical_scroll_bar_type, p->vertical_scroll_bar_type); 5727 wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
5594 WSET (w, dedicated, p->dedicated); 5728 wset_dedicated (w, p->dedicated);
5595 WSET (w, combination_limit, p->combination_limit); 5729 wset_combination_limit (w, p->combination_limit);
5596 /* Restore any window parameters that have been saved. 5730 /* Restore any window parameters that have been saved.
5597 Parameters that have not been saved are left alone. */ 5731 Parameters that have not been saved are left alone. */
5598 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) 5732 for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem))
@@ -5621,24 +5755,24 @@ the return value is nil. Otherwise the value is t. */)
5621 /* Reinstall the saved buffer and pointers into it. */ 5755 /* Reinstall the saved buffer and pointers into it. */
5622 if (NILP (p->buffer)) 5756 if (NILP (p->buffer))
5623 /* An internal window. */ 5757 /* An internal window. */
5624 WSET (w, buffer, p->buffer); 5758 wset_buffer (w, p->buffer);
5625 else if (!NILP (BVAR (XBUFFER (p->buffer), name))) 5759 else if (!NILP (BVAR (XBUFFER (p->buffer), name)))
5626 /* If saved buffer is alive, install it. */ 5760 /* If saved buffer is alive, install it. */
5627 { 5761 {
5628 WSET (w, buffer, p->buffer); 5762 wset_buffer (w, p->buffer);
5629 w->start_at_line_beg = !NILP (p->start_at_line_beg); 5763 w->start_at_line_beg = !NILP (p->start_at_line_beg);
5630 set_marker_restricted (w->start, p->start, w->buffer); 5764 set_marker_restricted (w->start, p->start, w->buffer);
5631 set_marker_restricted (w->pointm, p->pointm, 5765 set_marker_restricted (w->pointm, p->pointm,
5632 w->buffer); 5766 w->buffer);
5633 Fset_marker (BVAR (XBUFFER (w->buffer), mark), 5767 Fset_marker (BVAR (XBUFFER (w->buffer), mark),
5634 p->mark, w->buffer); 5768 p->mark, w->buffer);
5635 5769
5636 /* As documented in Fcurrent_window_configuration, don't 5770 /* As documented in Fcurrent_window_configuration, don't
5637 restore the location of point in the buffer which was 5771 restore the location of point in the buffer which was
5638 current when the window configuration was recorded. */ 5772 current when the window configuration was recorded. */
5639 if (!EQ (p->buffer, new_current_buffer) 5773 if (!EQ (p->buffer, new_current_buffer)
5640 && XBUFFER (p->buffer) == current_buffer) 5774 && XBUFFER (p->buffer) == current_buffer)
5641 Fgoto_char (w->pointm); 5775 Fgoto_char (w->pointm);
5642 } 5776 }
5643 else if (!NILP (w->buffer) 5777 else if (!NILP (w->buffer)
5644 && !NILP (BVAR (XBUFFER (w->buffer), name))) 5778 && !NILP (BVAR (XBUFFER (w->buffer), name)))
@@ -5650,7 +5784,7 @@ the return value is nil. Otherwise the value is t. */)
5650 set_marker_restricted (w->start, make_number (0), 5784 set_marker_restricted (w->start, make_number (0),
5651 w->buffer); 5785 w->buffer);
5652 if (XMARKER (w->pointm)->buffer == 0) 5786 if (XMARKER (w->pointm)->buffer == 0)
5653 set_marker_restricted_both 5787 set_marker_restricted_both
5654 (w->pointm, w->buffer, 5788 (w->pointm, w->buffer,
5655 BUF_PT (XBUFFER (w->buffer)), 5789 BUF_PT (XBUFFER (w->buffer)),
5656 BUF_PT_BYTE (XBUFFER (w->buffer))); 5790 BUF_PT_BYTE (XBUFFER (w->buffer)));
@@ -5659,7 +5793,8 @@ the return value is nil. Otherwise the value is t. */)
5659 else if (STRINGP (auto_buffer_name = 5793 else if (STRINGP (auto_buffer_name =
5660 Fwindow_parameter (window, Qauto_buffer_name)) 5794 Fwindow_parameter (window, Qauto_buffer_name))
5661 && SCHARS (auto_buffer_name) != 0 5795 && SCHARS (auto_buffer_name) != 0
5662 && !NILP (WSET (w, buffer, Fget_buffer_create (auto_buffer_name)))) 5796 && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)),
5797 !NILP (w->buffer)))
5663 { 5798 {
5664 set_marker_restricted (w->start, 5799 set_marker_restricted (w->start,
5665 make_number (0), w->buffer); 5800 make_number (0), w->buffer);
@@ -5674,7 +5809,7 @@ the return value is nil. Otherwise the value is t. */)
5674 avoid showing an unimportant buffer and, if necessary, to 5809 avoid showing an unimportant buffer and, if necessary, to
5675 recreate *scratch* in the course (part of Juanma's bs-show 5810 recreate *scratch* in the course (part of Juanma's bs-show
5676 scenario from March 2011). */ 5811 scenario from March 2011). */
5677 WSET (w, buffer, other_buffer_safely (Fcurrent_buffer ())); 5812 wset_buffer (w, other_buffer_safely (Fcurrent_buffer ()));
5678 /* This will set the markers to beginning of visible 5813 /* This will set the markers to beginning of visible
5679 range. */ 5814 range. */
5680 set_marker_restricted (w->start, 5815 set_marker_restricted (w->start,
@@ -5686,11 +5821,11 @@ the return value is nil. Otherwise the value is t. */)
5686 /* Record this window as dead. */ 5821 /* Record this window as dead. */
5687 dead_windows = Fcons (window, dead_windows); 5822 dead_windows = Fcons (window, dead_windows);
5688 /* Make sure window is no more dedicated. */ 5823 /* Make sure window is no more dedicated. */
5689 WSET (w, dedicated, Qnil); 5824 wset_dedicated (w, Qnil);
5690 } 5825 }
5691 } 5826 }
5692 5827
5693 FSET (f, root_window, data->root_window); 5828 fset_root_window (f, data->root_window);
5694 /* Arrange *not* to restore point in the buffer that was 5829 /* Arrange *not* to restore point in the buffer that was
5695 current when the window configuration was saved. */ 5830 current when the window configuration was saved. */
5696 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) 5831 if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
@@ -5786,24 +5921,25 @@ delete_all_child_windows (Lisp_Object window)
5786 /* Delete WINDOW's siblings (we traverse postorderly). */ 5921 /* Delete WINDOW's siblings (we traverse postorderly). */
5787 delete_all_child_windows (w->next); 5922 delete_all_child_windows (w->next);
5788 5923
5789 WSET (w, total_lines, w->buffer); /* See Fset_window_configuration for excuse. */ 5924 /* See Fset_window_configuration for excuse. */
5925 wset_total_lines (w, w->buffer);
5790 5926
5791 if (!NILP (w->vchild)) 5927 if (!NILP (w->vchild))
5792 { 5928 {
5793 delete_all_child_windows (w->vchild); 5929 delete_all_child_windows (w->vchild);
5794 WSET (w, vchild, Qnil); 5930 wset_vchild (w, Qnil);
5795 } 5931 }
5796 else if (!NILP (w->hchild)) 5932 else if (!NILP (w->hchild))
5797 { 5933 {
5798 delete_all_child_windows (w->hchild); 5934 delete_all_child_windows (w->hchild);
5799 WSET (w, hchild, Qnil); 5935 wset_hchild (w, Qnil);
5800 } 5936 }
5801 else if (!NILP (w->buffer)) 5937 else if (!NILP (w->buffer))
5802 { 5938 {
5803 unshow_buffer (w); 5939 unshow_buffer (w);
5804 unchain_marker (XMARKER (w->pointm)); 5940 unchain_marker (XMARKER (w->pointm));
5805 unchain_marker (XMARKER (w->start)); 5941 unchain_marker (XMARKER (w->start));
5806 WSET (w, buffer, Qnil); 5942 wset_buffer (w, Qnil);
5807 } 5943 }
5808 5944
5809 Vwindow_list = Qnil; 5945 Vwindow_list = Qnil;
@@ -5895,7 +6031,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5895 p = SAVED_WINDOW_N (vector, i); 6031 p = SAVED_WINDOW_N (vector, i);
5896 w = XWINDOW (window); 6032 w = XWINDOW (window);
5897 6033
5898 WSET (w, temslot, make_number (i)); i++; 6034 wset_temslot (w, make_number (i)); i++;
5899 p->window = window; 6035 p->window = window;
5900 p->buffer = w->buffer; 6036 p->buffer = w->buffer;
5901 p->left_col = w->left_col; 6037 p->left_col = w->left_col;
@@ -6098,8 +6234,8 @@ means no margin. */)
6098 if (!EQ (w->left_margin_cols, left_width) 6234 if (!EQ (w->left_margin_cols, left_width)
6099 || !EQ (w->right_margin_cols, right_width)) 6235 || !EQ (w->right_margin_cols, right_width))
6100 { 6236 {
6101 WSET (w, left_margin_cols, left_width); 6237 wset_left_margin_cols (w, left_width);
6102 WSET (w, right_margin_cols, right_width); 6238 wset_right_margin_cols (w, right_width);
6103 6239
6104 adjust_window_margins (w); 6240 adjust_window_margins (w);
6105 6241
@@ -6160,14 +6296,14 @@ display marginal areas and the text area. */)
6160 || !EQ (w->right_fringe_width, right_width) 6296 || !EQ (w->right_fringe_width, right_width)
6161 || w->fringes_outside_margins != outside)) 6297 || w->fringes_outside_margins != outside))
6162 { 6298 {
6163 WSET (w, left_fringe_width, left_width); 6299 wset_left_fringe_width (w, left_width);
6164 WSET (w, right_fringe_width, right_width); 6300 wset_right_fringe_width (w, right_width);
6165 w->fringes_outside_margins = outside; 6301 w->fringes_outside_margins = outside;
6166 6302
6167 adjust_window_margins (w); 6303 adjust_window_margins (w);
6168 6304
6169 clear_glyph_matrix (w->current_matrix); 6305 clear_glyph_matrix (w->current_matrix);
6170 WSET (w, window_end_valid, Qnil); 6306 wset_window_end_valid (w, Qnil);
6171 6307
6172 ++windows_or_buffers_changed; 6308 ++windows_or_buffers_changed;
6173 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6309 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
@@ -6232,13 +6368,13 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */)
6232 if (!EQ (w->scroll_bar_width, width) 6368 if (!EQ (w->scroll_bar_width, width)
6233 || !EQ (w->vertical_scroll_bar_type, vertical_type)) 6369 || !EQ (w->vertical_scroll_bar_type, vertical_type))
6234 { 6370 {
6235 WSET (w, scroll_bar_width, width); 6371 wset_scroll_bar_width (w, width);
6236 WSET (w, vertical_scroll_bar_type, vertical_type); 6372 wset_vertical_scroll_bar_type (w, vertical_type);
6237 6373
6238 adjust_window_margins (w); 6374 adjust_window_margins (w);
6239 6375
6240 clear_glyph_matrix (w->current_matrix); 6376 clear_glyph_matrix (w->current_matrix);
6241 WSET (w, window_end_valid, Qnil); 6377 wset_window_end_valid (w, Qnil);
6242 6378
6243 ++windows_or_buffers_changed; 6379 ++windows_or_buffers_changed;
6244 adjust_glyphs (XFRAME (WINDOW_FRAME (w))); 6380 adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
diff --git a/src/window.h b/src/window.h
index 77b31dafd8b..28b9678b667 100644
--- a/src/window.h
+++ b/src/window.h
@@ -22,6 +22,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include "dispextern.h" 23#include "dispextern.h"
24 24
25INLINE_HEADER_BEGIN
26#ifndef WINDOW_INLINE
27# define WINDOW_INLINE INLINE
28#endif
29
25extern Lisp_Object Qleft, Qright; 30extern Lisp_Object Qleft, Qright;
26 31
27/* Windows are allocated as if they were vectors, but then the 32/* Windows are allocated as if they were vectors, but then the
@@ -86,10 +91,6 @@ struct cursor_pos
86 int hpos, vpos; 91 int hpos, vpos;
87}; 92};
88 93
89/* Most code should use this macro to set Lisp fields in struct window. */
90
91#define WSET(w, field, value) ((w)->field = (value))
92
93struct window 94struct window
94 { 95 {
95 /* This is for Lisp; the terminal code does not refer to it. */ 96 /* This is for Lisp; the terminal code does not refer to it. */
@@ -348,6 +349,75 @@ struct window
348 ptrdiff_t window_end_bytepos; 349 ptrdiff_t window_end_bytepos;
349}; 350};
350 351
352/* Most code should use these functions to set Lisp fields in struct
353 window. */
354WINDOW_INLINE void
355wset_buffer (struct window *w, Lisp_Object val)
356{
357 w->buffer = val;
358}
359WINDOW_INLINE void
360wset_frame (struct window *w, Lisp_Object val)
361{
362 w->frame = val;
363}
364WINDOW_INLINE void
365wset_left_col (struct window *w, Lisp_Object val)
366{
367 w->left_col = val;
368}
369WINDOW_INLINE void
370wset_next (struct window *w, Lisp_Object val)
371{
372 w->next = val;
373}
374WINDOW_INLINE void
375wset_prev (struct window *w, Lisp_Object val)
376{
377 w->prev = val;
378}
379WINDOW_INLINE void
380wset_redisplay_end_trigger (struct window *w, Lisp_Object val)
381{
382 w->redisplay_end_trigger = val;
383}
384WINDOW_INLINE void
385wset_top_line (struct window *w, Lisp_Object val)
386{
387 w->top_line = val;
388}
389WINDOW_INLINE void
390wset_total_cols (struct window *w, Lisp_Object val)
391{
392 w->total_cols = val;
393}
394WINDOW_INLINE void
395wset_total_lines (struct window *w, Lisp_Object val)
396{
397 w->total_lines = val;
398}
399WINDOW_INLINE void
400wset_vertical_scroll_bar (struct window *w, Lisp_Object val)
401{
402 w->vertical_scroll_bar = val;
403}
404WINDOW_INLINE void
405wset_window_end_pos (struct window *w, Lisp_Object val)
406{
407 w->window_end_pos = val;
408}
409WINDOW_INLINE void
410wset_window_end_valid (struct window *w, Lisp_Object val)
411{
412 w->window_end_valid = val;
413}
414WINDOW_INLINE void
415wset_window_end_vpos (struct window *w, Lisp_Object val)
416{
417 w->window_end_vpos = val;
418}
419
420
351/* 1 if W is a minibuffer window. */ 421/* 1 if W is a minibuffer window. */
352 422
353#define MINI_WINDOW_P(W) ((W)->mini) 423#define MINI_WINDOW_P(W) ((W)->mini)
@@ -916,4 +986,6 @@ extern void init_window (void);
916extern void syms_of_window (void); 986extern void syms_of_window (void);
917extern void keys_of_window (void); 987extern void keys_of_window (void);
918 988
989INLINE_HEADER_END
990
919#endif /* not WINDOW_H_INCLUDED */ 991#endif /* not WINDOW_H_INCLUDED */
diff --git a/src/xdisp.c b/src/xdisp.c
index 4cd95606041..f5edb4b16f8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -365,6 +365,28 @@ Lisp_Object Qcenter;
365static Lisp_Object Qmargin, Qpointer; 365static Lisp_Object Qmargin, Qpointer;
366static Lisp_Object Qline_height; 366static Lisp_Object Qline_height;
367 367
368/* These setters are used only in this file, so they can be private. */
369static inline void
370wset_base_line_number (struct window *w, Lisp_Object val)
371{
372 w->base_line_number = val;
373}
374static inline void
375wset_base_line_pos (struct window *w, Lisp_Object val)
376{
377 w->base_line_pos = val;
378}
379static inline void
380wset_column_number_displayed (struct window *w, Lisp_Object val)
381{
382 w->column_number_displayed = val;
383}
384static inline void
385wset_region_showing (struct window *w, Lisp_Object val)
386{
387 w->region_showing = val;
388}
389
368#ifdef HAVE_WINDOW_SYSTEM 390#ifdef HAVE_WINDOW_SYSTEM
369 391
370/* Test if overflow newline into fringe. Called with iterator IT 392/* Test if overflow newline into fringe. Called with iterator IT
@@ -4047,38 +4069,54 @@ static enum prop_handled
4047handle_invisible_prop (struct it *it) 4069handle_invisible_prop (struct it *it)
4048{ 4070{
4049 enum prop_handled handled = HANDLED_NORMALLY; 4071 enum prop_handled handled = HANDLED_NORMALLY;
4072 int invis_p;
4073 Lisp_Object prop;
4050 4074
4051 if (STRINGP (it->string)) 4075 if (STRINGP (it->string))
4052 { 4076 {
4053 Lisp_Object prop, end_charpos, limit, charpos; 4077 Lisp_Object end_charpos, limit, charpos;
4054 4078
4055 /* Get the value of the invisible text property at the 4079 /* Get the value of the invisible text property at the
4056 current position. Value will be nil if there is no such 4080 current position. Value will be nil if there is no such
4057 property. */ 4081 property. */
4058 charpos = make_number (IT_STRING_CHARPOS (*it)); 4082 charpos = make_number (IT_STRING_CHARPOS (*it));
4059 prop = Fget_text_property (charpos, Qinvisible, it->string); 4083 prop = Fget_text_property (charpos, Qinvisible, it->string);
4084 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4060 4085
4061 if (!NILP (prop) 4086 if (invis_p && IT_STRING_CHARPOS (*it) < it->end_charpos)
4062 && IT_STRING_CHARPOS (*it) < it->end_charpos)
4063 { 4087 {
4064 ptrdiff_t endpos; 4088 /* Record whether we have to display an ellipsis for the
4089 invisible text. */
4090 int display_ellipsis_p = (invis_p == 2);
4091 ptrdiff_t len, endpos;
4065 4092
4066 handled = HANDLED_RECOMPUTE_PROPS; 4093 handled = HANDLED_RECOMPUTE_PROPS;
4067 4094
4068 /* Get the position at which the next change of the 4095 /* Get the position at which the next visible text can be
4069 invisible text property can be found in IT->string. 4096 found in IT->string, if any. */
4070 Value will be nil if the property value is the same for 4097 endpos = len = SCHARS (it->string);
4071 all the rest of IT->string. */ 4098 XSETINT (limit, len);
4072 XSETINT (limit, SCHARS (it->string)); 4099 do
4073 end_charpos = Fnext_single_property_change (charpos, Qinvisible, 4100 {
4074 it->string, limit); 4101 end_charpos = Fnext_single_property_change (charpos, Qinvisible,
4075 4102 it->string, limit);
4076 /* Text at current position is invisible. The next 4103 if (INTEGERP (end_charpos))
4077 change in the property is at position end_charpos. 4104 {
4078 Move IT's current position to that position. */ 4105 endpos = XFASTINT (end_charpos);
4079 if (INTEGERP (end_charpos) 4106 prop = Fget_text_property (end_charpos, Qinvisible, it->string);
4080 && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) 4107 invis_p = TEXT_PROP_MEANS_INVISIBLE (prop);
4108 if (invis_p == 2)
4109 display_ellipsis_p = 1;
4110 }
4111 }
4112 while (invis_p && endpos < len);
4113
4114 if (display_ellipsis_p)
4115 it->ellipsis_p = 1;
4116
4117 if (endpos < len)
4081 { 4118 {
4119 /* Text at END_CHARPOS is visible. Move IT there. */
4082 struct text_pos old; 4120 struct text_pos old;
4083 ptrdiff_t oldpos; 4121 ptrdiff_t oldpos;
4084 4122
@@ -4114,7 +4152,8 @@ handle_invisible_prop (struct it *it)
4114 /* The rest of the string is invisible. If this is an 4152 /* The rest of the string is invisible. If this is an
4115 overlay string, proceed with the next overlay string 4153 overlay string, proceed with the next overlay string
4116 or whatever comes and return a character from there. */ 4154 or whatever comes and return a character from there. */
4117 if (it->current.overlay_string_index >= 0) 4155 if (it->current.overlay_string_index >= 0
4156 && !display_ellipsis_p)
4118 { 4157 {
4119 next_overlay_string (it); 4158 next_overlay_string (it);
4120 /* Don't check for overlay strings when we just 4159 /* Don't check for overlay strings when we just
@@ -4131,9 +4170,8 @@ handle_invisible_prop (struct it *it)
4131 } 4170 }
4132 else 4171 else
4133 { 4172 {
4134 int invis_p;
4135 ptrdiff_t newpos, next_stop, start_charpos, tem; 4173 ptrdiff_t newpos, next_stop, start_charpos, tem;
4136 Lisp_Object pos, prop, overlay; 4174 Lisp_Object pos, overlay;
4137 4175
4138 /* First of all, is there invisible text at this position? */ 4176 /* First of all, is there invisible text at this position? */
4139 tem = start_charpos = IT_CHARPOS (*it); 4177 tem = start_charpos = IT_CHARPOS (*it);
@@ -6010,7 +6048,7 @@ back_to_previous_visible_line_start (struct it *it)
6010 { 6048 {
6011 Lisp_Object prop; 6049 Lisp_Object prop;
6012 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1), 6050 prop = Fget_char_property (make_number (IT_CHARPOS (*it) - 1),
6013 Qinvisible, it->window); 6051 Qinvisible, it->window);
6014 if (TEXT_PROP_MEANS_INVISIBLE (prop)) 6052 if (TEXT_PROP_MEANS_INVISIBLE (prop))
6015 continue; 6053 continue;
6016 } 6054 }
@@ -7981,7 +8019,7 @@ run_redisplay_end_trigger_hook (struct it *it)
7981 8019
7982 /* Since we are *trying* to run these functions, don't try to run 8020 /* Since we are *trying* to run these functions, don't try to run
7983 them again, even if they get an error. */ 8021 them again, even if they get an error. */
7984 WSET (it->w, redisplay_end_trigger, Qnil); 8022 wset_redisplay_end_trigger (it->w, Qnil);
7985 Frun_hook_with_args (3, args); 8023 Frun_hook_with_args (3, args);
7986 8024
7987 /* Notice if it changed the face of the character we are on. */ 8025 /* Notice if it changed the face of the character we are on. */
@@ -9318,7 +9356,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
9318 old_deactivate_mark = Vdeactivate_mark; 9356 old_deactivate_mark = Vdeactivate_mark;
9319 oldbuf = current_buffer; 9357 oldbuf = current_buffer;
9320 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name)); 9358 Fset_buffer (Fget_buffer_create (Vmessages_buffer_name));
9321 BSET (current_buffer, undo_list, Qt); 9359 bset_undo_list (current_buffer, Qt);
9322 9360
9323 oldpoint = message_dolog_marker1; 9361 oldpoint = message_dolog_marker1;
9324 set_marker_restricted (oldpoint, make_number (PT), Qnil); 9362 set_marker_restricted (oldpoint, make_number (PT), Qnil);
@@ -9880,7 +9918,7 @@ ensure_echo_area_buffers (void)
9880 old_buffer = echo_buffer[i]; 9918 old_buffer = echo_buffer[i];
9881 echo_buffer[i] = Fget_buffer_create 9919 echo_buffer[i] = Fget_buffer_create
9882 (make_formatted_string (name, " *Echo Area %d*", i)); 9920 (make_formatted_string (name, " *Echo Area %d*", i));
9883 BSET (XBUFFER (echo_buffer[i]), truncate_lines, Qnil); 9921 bset_truncate_lines (XBUFFER (echo_buffer[i]), Qnil);
9884 /* to force word wrap in echo area - 9922 /* to force word wrap in echo area -
9885 it was decided to postpone this*/ 9923 it was decided to postpone this*/
9886 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */ 9924 /* XBUFFER (echo_buffer[i])->word_wrap = Qt; */
@@ -9969,12 +10007,12 @@ with_echo_area_buffer (struct window *w, int which,
9969 set_buffer_internal_1 (XBUFFER (buffer)); 10007 set_buffer_internal_1 (XBUFFER (buffer));
9970 if (w) 10008 if (w)
9971 { 10009 {
9972 WSET (w, buffer, buffer); 10010 wset_buffer (w, buffer);
9973 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); 10011 set_marker_both (w->pointm, buffer, BEG, BEG_BYTE);
9974 } 10012 }
9975 10013
9976 BSET (current_buffer, undo_list, Qt); 10014 bset_undo_list (current_buffer, Qt);
9977 BSET (current_buffer, read_only, Qnil); 10015 bset_read_only (current_buffer, Qnil);
9978 specbind (Qinhibit_read_only, Qt); 10016 specbind (Qinhibit_read_only, Qt);
9979 specbind (Qinhibit_modification_hooks, Qt); 10017 specbind (Qinhibit_modification_hooks, Qt);
9980 10018
@@ -10054,7 +10092,7 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
10054 charpos = AREF (vector, 5); 10092 charpos = AREF (vector, 5);
10055 bytepos = AREF (vector, 6); 10093 bytepos = AREF (vector, 6);
10056 10094
10057 WSET (w, buffer, buffer); 10095 wset_buffer (w, buffer);
10058 set_marker_both (w->pointm, buffer, 10096 set_marker_both (w->pointm, buffer,
10059 XFASTINT (charpos), XFASTINT (bytepos)); 10097 XFASTINT (charpos), XFASTINT (bytepos));
10060 } 10098 }
@@ -10087,7 +10125,7 @@ setup_echo_area_for_printing (int multibyte_p)
10087 10125
10088 /* Switch to that buffer and clear it. */ 10126 /* Switch to that buffer and clear it. */
10089 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10127 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10090 BSET (current_buffer, truncate_lines, Qnil); 10128 bset_truncate_lines (current_buffer, Qnil);
10091 10129
10092 if (Z > BEG) 10130 if (Z > BEG)
10093 { 10131 {
@@ -10130,7 +10168,7 @@ setup_echo_area_for_printing (int multibyte_p)
10130 { 10168 {
10131 /* Someone switched buffers between print requests. */ 10169 /* Someone switched buffers between print requests. */
10132 set_buffer_internal (XBUFFER (echo_area_buffer[0])); 10170 set_buffer_internal (XBUFFER (echo_area_buffer[0]));
10133 BSET (current_buffer, truncate_lines, Qnil); 10171 bset_truncate_lines (current_buffer, Qnil);
10134 } 10172 }
10135 } 10173 }
10136} 10174}
@@ -10442,11 +10480,10 @@ current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
10442 empty. This is a relatively infrequent operation, so it's not 10480 empty. This is a relatively infrequent operation, so it's not
10443 worth optimizing. */ 10481 worth optimizing. */
10444 10482
10445int 10483bool
10446push_message (void) 10484push_message (void)
10447{ 10485{
10448 Lisp_Object msg; 10486 Lisp_Object msg = current_message ();
10449 msg = current_message ();
10450 Vmessage_stack = Fcons (msg, Vmessage_stack); 10487 Vmessage_stack = Fcons (msg, Vmessage_stack);
10451 return STRINGP (msg); 10488 return STRINGP (msg);
10452} 10489}
@@ -10582,9 +10619,9 @@ set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multiby
10582 != !NILP (BVAR (current_buffer, enable_multibyte_characters))) 10619 != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
10583 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil); 10620 Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
10584 10621
10585 BSET (current_buffer, truncate_lines, message_truncate_lines ? Qt : Qnil); 10622 bset_truncate_lines (current_buffer, message_truncate_lines ? Qt : Qnil);
10586 if (!NILP (BVAR (current_buffer, bidi_display_reordering))) 10623 if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
10587 BSET (current_buffer, bidi_paragraph_direction, Qleft_to_right); 10624 bset_bidi_paragraph_direction (current_buffer, Qleft_to_right);
10588 10625
10589 /* Insert new message at BEG. */ 10626 /* Insert new message at BEG. */
10590 TEMP_SET_PT_BOTH (BEG, BEG_BYTE); 10627 TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
@@ -11274,7 +11311,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
11274 } 11311 }
11275 11312
11276 XSETFRAME (Vmenu_updating_frame, f); 11313 XSETFRAME (Vmenu_updating_frame, f);
11277 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 11314 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
11278 11315
11279 /* Redisplay the menu bar in case we changed it. */ 11316 /* Redisplay the menu bar in case we changed it. */
11280#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \ 11317#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
@@ -11487,7 +11524,7 @@ update_tool_bar (struct frame *f, int save_match_data)
11487 may access f->tool_bar_items. Make sure we update both 11524 may access f->tool_bar_items. Make sure we update both
11488 variables within BLOCK_INPUT so no such event interrupts. */ 11525 variables within BLOCK_INPUT so no such event interrupts. */
11489 BLOCK_INPUT; 11526 BLOCK_INPUT;
11490 FSET (f, tool_bar_items, new_tool_bar); 11527 fset_tool_bar_items (f, new_tool_bar);
11491 f->n_tool_bar_items = new_n_tool_bar; 11528 f->n_tool_bar_items = new_n_tool_bar;
11492 w->update_mode_line = 1; 11529 w->update_mode_line = 1;
11493 UNBLOCK_INPUT; 11530 UNBLOCK_INPUT;
@@ -11529,8 +11566,8 @@ build_desired_tool_bar_string (struct frame *f)
11529 11566
11530 /* Reuse f->desired_tool_bar_string, if possible. */ 11567 /* Reuse f->desired_tool_bar_string, if possible. */
11531 if (size < size_needed || NILP (f->desired_tool_bar_string)) 11568 if (size < size_needed || NILP (f->desired_tool_bar_string))
11532 FSET (f, desired_tool_bar_string, 11569 fset_desired_tool_bar_string
11533 Fmake_string (make_number (size_needed), make_number (' '))); 11570 (f, Fmake_string (make_number (size_needed), make_number (' ')));
11534 else 11571 else
11535 { 11572 {
11536 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); 11573 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
@@ -13266,12 +13303,12 @@ redisplay_internal (void)
13266 if ((it.glyph_row - 1)->displays_text_p) 13303 if ((it.glyph_row - 1)->displays_text_p)
13267 { 13304 {
13268 if (XFASTINT (w->window_end_vpos) < this_line_vpos) 13305 if (XFASTINT (w->window_end_vpos) < this_line_vpos)
13269 WSET (w, window_end_vpos, make_number (this_line_vpos)); 13306 wset_window_end_vpos (w, make_number (this_line_vpos));
13270 } 13307 }
13271 else if (XFASTINT (w->window_end_vpos) == this_line_vpos 13308 else if (XFASTINT (w->window_end_vpos) == this_line_vpos
13272 && this_line_vpos > 0) 13309 && this_line_vpos > 0)
13273 WSET (w, window_end_vpos, make_number (this_line_vpos - 1)); 13310 wset_window_end_vpos (w, make_number (this_line_vpos - 1));
13274 WSET (w, window_end_valid, Qnil); 13311 wset_window_end_valid (w, Qnil);
13275 13312
13276 /* Update hint: No need to try to scroll in update_window. */ 13313 /* Update hint: No need to try to scroll in update_window. */
13277 w->desired_matrix->no_scrolling_p = 1; 13314 w->desired_matrix->no_scrolling_p = 1;
@@ -13737,7 +13774,7 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
13737 13774
13738 if (accurate_p) 13775 if (accurate_p)
13739 { 13776 {
13740 WSET (w, window_end_valid, w->buffer); 13777 wset_window_end_valid (w, w->buffer);
13741 w->update_mode_line = 0; 13778 w->update_mode_line = 0;
13742 } 13779 }
13743} 13780}
@@ -14845,7 +14882,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
14845 if (!just_this_one_p 14882 if (!just_this_one_p
14846 || current_buffer->clip_changed 14883 || current_buffer->clip_changed
14847 || BEG_UNCHANGED < CHARPOS (startp)) 14884 || BEG_UNCHANGED < CHARPOS (startp))
14848 WSET (w, base_line_number, Qnil); 14885 wset_base_line_number (w, Qnil);
14849 14886
14850 /* If cursor ends up on a partially visible line, 14887 /* If cursor ends up on a partially visible line,
14851 treat that as being off the bottom of the screen. */ 14888 treat that as being off the bottom of the screen. */
@@ -15470,7 +15507,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15470 if (XMARKER (w->start)->buffer == current_buffer) 15507 if (XMARKER (w->start)->buffer == current_buffer)
15471 compute_window_start_on_continuation_line (w); 15508 compute_window_start_on_continuation_line (w);
15472 15509
15473 WSET (w, window_end_valid, Qnil); 15510 wset_window_end_valid (w, Qnil);
15474 } 15511 }
15475 15512
15476 /* Some sanity checks. */ 15513 /* Some sanity checks. */
@@ -15581,11 +15618,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15581 15618
15582 w->force_start = 0; 15619 w->force_start = 0;
15583 w->vscroll = 0; 15620 w->vscroll = 0;
15584 WSET (w, window_end_valid, Qnil); 15621 wset_window_end_valid (w, Qnil);
15585 15622
15586 /* Forget any recorded base line for line number display. */ 15623 /* Forget any recorded base line for line number display. */
15587 if (!buffer_unchanged_p) 15624 if (!buffer_unchanged_p)
15588 WSET (w, base_line_number, Qnil); 15625 wset_base_line_number (w, Qnil);
15589 15626
15590 /* Redisplay the mode line. Select the buffer properly for that. 15627 /* Redisplay the mode line. Select the buffer properly for that.
15591 Also, run the hook window-scroll-functions 15628 Also, run the hook window-scroll-functions
@@ -15799,7 +15836,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15799 || current_buffer->clip_changed 15836 || current_buffer->clip_changed
15800 || BEG_UNCHANGED < CHARPOS (startp)) 15837 || BEG_UNCHANGED < CHARPOS (startp))
15801 /* Forget any recorded base line for line number display. */ 15838 /* Forget any recorded base line for line number display. */
15802 WSET (w, base_line_number, Qnil); 15839 wset_base_line_number (w, Qnil);
15803 15840
15804 if (!cursor_row_fully_visible_p (w, 1, 0)) 15841 if (!cursor_row_fully_visible_p (w, 1, 0))
15805 { 15842 {
@@ -15870,7 +15907,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
15870 15907
15871 /* Forget any previously recorded base line for line number display. */ 15908 /* Forget any previously recorded base line for line number display. */
15872 if (!buffer_unchanged_p) 15909 if (!buffer_unchanged_p)
15873 WSET (w, base_line_number, Qnil); 15910 wset_base_line_number (w, Qnil);
15874 15911
15875 /* Determine the window start relative to point. */ 15912 /* Determine the window start relative to point. */
15876 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); 15913 init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID);
@@ -16128,8 +16165,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16128 if (!line_number_displayed 16165 if (!line_number_displayed
16129 && !BUFFERP (w->base_line_pos)) 16166 && !BUFFERP (w->base_line_pos))
16130 { 16167 {
16131 WSET (w, base_line_pos, Qnil); 16168 wset_base_line_pos (w, Qnil);
16132 WSET (w, base_line_number, Qnil); 16169 wset_base_line_number (w, Qnil);
16133 } 16170 }
16134 16171
16135 finish_menu_bars: 16172 finish_menu_bars:
@@ -16306,10 +16343,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16306 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); 16343 eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
16307 w->window_end_bytepos 16344 w->window_end_bytepos
16308 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16345 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16309 WSET (w, window_end_pos, 16346 wset_window_end_pos
16310 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16347 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16311 WSET (w, window_end_vpos, 16348 wset_window_end_vpos
16312 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16349 (w, make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)));
16313 eassert 16350 eassert
16314 (MATRIX_ROW (w->desired_matrix, 16351 (MATRIX_ROW (w->desired_matrix,
16315 XFASTINT (w->window_end_vpos))->displays_text_p); 16352 XFASTINT (w->window_end_vpos))->displays_text_p);
@@ -16317,12 +16354,12 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
16317 else 16354 else
16318 { 16355 {
16319 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16356 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16320 WSET (w, window_end_pos, make_number (Z - ZV)); 16357 wset_window_end_pos (w, make_number (Z - ZV));
16321 WSET (w, window_end_vpos, make_number (0)); 16358 wset_window_end_vpos (w, make_number (0));
16322 } 16359 }
16323 16360
16324 /* But that is not valid info until redisplay finishes. */ 16361 /* But that is not valid info until redisplay finishes. */
16325 WSET (w, window_end_valid, Qnil); 16362 wset_window_end_valid (w, Qnil);
16326 return 1; 16363 return 1;
16327} 16364}
16328 16365
@@ -16546,28 +16583,31 @@ try_window_reusing_current_matrix (struct window *w)
16546 { 16583 {
16547 w->window_end_bytepos 16584 w->window_end_bytepos
16548 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); 16585 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row);
16549 WSET (w, window_end_pos, 16586 wset_window_end_pos
16550 make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row))); 16587 (w, make_number (Z
16551 WSET (w, window_end_vpos, 16588 - MATRIX_ROW_END_CHARPOS (last_reused_text_row)));
16552 make_number (MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix))); 16589 wset_window_end_vpos
16590 (w, make_number (MATRIX_ROW_VPOS (last_reused_text_row,
16591 w->current_matrix)));
16553 } 16592 }
16554 else if (last_text_row) 16593 else if (last_text_row)
16555 { 16594 {
16556 w->window_end_bytepos 16595 w->window_end_bytepos
16557 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16596 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16558 WSET (w, window_end_pos, 16597 wset_window_end_pos
16559 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16598 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16560 WSET (w, window_end_vpos, 16599 wset_window_end_vpos
16561 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16600 (w, make_number (MATRIX_ROW_VPOS (last_text_row,
16601 w->desired_matrix)));
16562 } 16602 }
16563 else 16603 else
16564 { 16604 {
16565 /* This window must be completely empty. */ 16605 /* This window must be completely empty. */
16566 w->window_end_bytepos = Z_BYTE - ZV_BYTE; 16606 w->window_end_bytepos = Z_BYTE - ZV_BYTE;
16567 WSET (w, window_end_pos, make_number (Z - ZV)); 16607 wset_window_end_pos (w, make_number (Z - ZV));
16568 WSET (w, window_end_vpos, make_number (0)); 16608 wset_window_end_vpos (w, make_number (0));
16569 } 16609 }
16570 WSET (w, window_end_valid, Qnil); 16610 wset_window_end_valid (w, Qnil);
16571 16611
16572 /* Update hint: don't try scrolling again in update_window. */ 16612 /* Update hint: don't try scrolling again in update_window. */
16573 w->desired_matrix->no_scrolling_p = 1; 16613 w->desired_matrix->no_scrolling_p = 1;
@@ -16748,18 +16788,19 @@ try_window_reusing_current_matrix (struct window *w)
16748 { 16788 {
16749 w->window_end_bytepos 16789 w->window_end_bytepos
16750 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 16790 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
16751 WSET (w, window_end_pos, 16791 wset_window_end_pos
16752 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 16792 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
16753 WSET (w, window_end_vpos, 16793 wset_window_end_vpos
16754 make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); 16794 (w, make_number (MATRIX_ROW_VPOS (last_text_row,
16795 w->desired_matrix)));
16755 } 16796 }
16756 else 16797 else
16757 { 16798 {
16758 WSET (w, window_end_vpos, 16799 wset_window_end_vpos
16759 make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled)); 16800 (w, make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled));
16760 } 16801 }
16761 16802
16762 WSET (w, window_end_valid, Qnil); 16803 wset_window_end_valid (w, Qnil);
16763 w->desired_matrix->no_scrolling_p = 1; 16804 w->desired_matrix->no_scrolling_p = 1;
16764 16805
16765#ifdef GLYPH_DEBUG 16806#ifdef GLYPH_DEBUG
@@ -17331,8 +17372,8 @@ try_window_id (struct window *w)
17331 { 17372 {
17332 /* We have to compute the window end anew since text 17373 /* We have to compute the window end anew since text
17333 could have been added/removed after it. */ 17374 could have been added/removed after it. */
17334 WSET (w, window_end_pos, 17375 wset_window_end_pos
17335 make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17376 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17336 w->window_end_bytepos 17377 w->window_end_bytepos
17337 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17378 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17338 17379
@@ -17766,21 +17807,22 @@ try_window_id (struct window *w)
17766 first_unchanged_at_end_row); 17807 first_unchanged_at_end_row);
17767 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); 17808 eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
17768 17809
17769 WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17810 wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17770 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17811 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17771 WSET (w, window_end_vpos, 17812 wset_window_end_vpos
17772 make_number (MATRIX_ROW_VPOS (row, w->current_matrix))); 17813 (w, make_number (MATRIX_ROW_VPOS (row, w->current_matrix)));
17773 eassert (w->window_end_bytepos >= 0); 17814 eassert (w->window_end_bytepos >= 0);
17774 IF_DEBUG (debug_method_add (w, "A")); 17815 IF_DEBUG (debug_method_add (w, "A"));
17775 } 17816 }
17776 else if (last_text_row_at_end) 17817 else if (last_text_row_at_end)
17777 { 17818 {
17778 WSET (w, window_end_pos, 17819 wset_window_end_pos
17779 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end))); 17820 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)));
17780 w->window_end_bytepos 17821 w->window_end_bytepos
17781 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); 17822 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
17782 WSET (w, window_end_vpos, 17823 wset_window_end_vpos
17783 make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix))); 17824 (w, make_number (MATRIX_ROW_VPOS (last_text_row_at_end,
17825 desired_matrix)));
17784 eassert (w->window_end_bytepos >= 0); 17826 eassert (w->window_end_bytepos >= 0);
17785 IF_DEBUG (debug_method_add (w, "B")); 17827 IF_DEBUG (debug_method_add (w, "B"));
17786 } 17828 }
@@ -17789,12 +17831,12 @@ try_window_id (struct window *w)
17789 /* We have displayed either to the end of the window or at the 17831 /* We have displayed either to the end of the window or at the
17790 end of the window, i.e. the last row with text is to be found 17832 end of the window, i.e. the last row with text is to be found
17791 in the desired matrix. */ 17833 in the desired matrix. */
17792 WSET (w, window_end_pos, 17834 wset_window_end_pos
17793 make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row))); 17835 (w, make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)));
17794 w->window_end_bytepos 17836 w->window_end_bytepos
17795 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); 17837 = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
17796 WSET (w, window_end_vpos, 17838 wset_window_end_vpos
17797 make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix))); 17839 (w, make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)));
17798 eassert (w->window_end_bytepos >= 0); 17840 eassert (w->window_end_bytepos >= 0);
17799 } 17841 }
17800 else if (first_unchanged_at_end_row == NULL 17842 else if (first_unchanged_at_end_row == NULL
@@ -17822,8 +17864,8 @@ try_window_id (struct window *w)
17822 } 17864 }
17823 17865
17824 eassert (row != NULL); 17866 eassert (row != NULL);
17825 WSET (w, window_end_vpos, make_number (vpos + 1)); 17867 wset_window_end_vpos (w, make_number (vpos + 1));
17826 WSET (w, window_end_pos, make_number (Z - MATRIX_ROW_END_CHARPOS (row))); 17868 wset_window_end_pos (w, make_number (Z - MATRIX_ROW_END_CHARPOS (row)));
17827 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); 17869 w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
17828 eassert (w->window_end_bytepos >= 0); 17870 eassert (w->window_end_bytepos >= 0);
17829 IF_DEBUG (debug_method_add (w, "C")); 17871 IF_DEBUG (debug_method_add (w, "C"));
@@ -17835,7 +17877,7 @@ try_window_id (struct window *w)
17835 debug_end_vpos = XFASTINT (w->window_end_vpos)); 17877 debug_end_vpos = XFASTINT (w->window_end_vpos));
17836 17878
17837 /* Record that display has not been completed. */ 17879 /* Record that display has not been completed. */
17838 WSET (w, window_end_valid, Qnil); 17880 wset_window_end_valid (w, Qnil);
17839 w->desired_matrix->no_scrolling_p = 1; 17881 w->desired_matrix->no_scrolling_p = 1;
17840 return 3; 17882 return 3;
17841 17883
@@ -19248,7 +19290,7 @@ display_line (struct it *it)
19248 } 19290 }
19249 19291
19250 /* Is IT->w showing the region? */ 19292 /* Is IT->w showing the region? */
19251 WSET (it->w, region_showing, it->region_beg_charpos > 0 ? Qt : Qnil); 19293 wset_region_showing (it->w, it->region_beg_charpos > 0 ? Qt : Qnil);
19252 19294
19253 /* Clear the result glyph row and enable it. */ 19295 /* Clear the result glyph row and enable it. */
19254 prepare_desired_row (row); 19296 prepare_desired_row (row);
@@ -20252,7 +20294,7 @@ display_mode_lines (struct window *w)
20252 20294
20253 /* These will be set while the mode line specs are processed. */ 20295 /* These will be set while the mode line specs are processed. */
20254 line_number_displayed = 0; 20296 line_number_displayed = 0;
20255 WSET (w, column_number_displayed, Qnil); 20297 wset_column_number_displayed (w, Qnil);
20256 20298
20257 if (WINDOW_WANTS_MODELINE_P (w)) 20299 if (WINDOW_WANTS_MODELINE_P (w))
20258 { 20300 {
@@ -21388,7 +21430,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21388 else 21430 else
21389 { 21431 {
21390 ptrdiff_t col = current_column (); 21432 ptrdiff_t col = current_column ();
21391 WSET (w, column_number_displayed, make_number (col)); 21433 wset_column_number_displayed (w, make_number (col));
21392 pint2str (decode_mode_spec_buf, field_width, col); 21434 pint2str (decode_mode_spec_buf, field_width, col);
21393 return decode_mode_spec_buf; 21435 return decode_mode_spec_buf;
21394 } 21436 }
@@ -21451,14 +21493,14 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21451 goto no_value; 21493 goto no_value;
21452 /* But do forget it, if the window shows a different buffer now. */ 21494 /* But do forget it, if the window shows a different buffer now. */
21453 else if (BUFFERP (w->base_line_pos)) 21495 else if (BUFFERP (w->base_line_pos))
21454 WSET (w, base_line_pos, Qnil); 21496 wset_base_line_pos (w, Qnil);
21455 21497
21456 /* If the buffer is very big, don't waste time. */ 21498 /* If the buffer is very big, don't waste time. */
21457 if (INTEGERP (Vline_number_display_limit) 21499 if (INTEGERP (Vline_number_display_limit)
21458 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) 21500 && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit))
21459 { 21501 {
21460 WSET (w, base_line_pos, Qnil); 21502 wset_base_line_pos (w, Qnil);
21461 WSET (w, base_line_number, Qnil); 21503 wset_base_line_number (w, Qnil);
21462 goto no_value; 21504 goto no_value;
21463 } 21505 }
21464 21506
@@ -21490,8 +21532,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21490 go back past it. */ 21532 go back past it. */
21491 if (startpos == BUF_BEGV (b)) 21533 if (startpos == BUF_BEGV (b))
21492 { 21534 {
21493 WSET (w, base_line_number, make_number (topline)); 21535 wset_base_line_number (w, make_number (topline));
21494 WSET (w, base_line_pos, make_number (BUF_BEGV (b))); 21536 wset_base_line_pos (w, make_number (BUF_BEGV (b)));
21495 } 21537 }
21496 else if (nlines < height + 25 || nlines > height * 3 + 50 21538 else if (nlines < height + 25 || nlines > height * 3 + 50
21497 || linepos == BUF_BEGV (b)) 21539 || linepos == BUF_BEGV (b))
@@ -21517,13 +21559,13 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21517 give up on line numbers for this window. */ 21559 give up on line numbers for this window. */
21518 if (position == limit_byte && limit == startpos - distance) 21560 if (position == limit_byte && limit == startpos - distance)
21519 { 21561 {
21520 WSET (w, base_line_pos, w->buffer); 21562 wset_base_line_pos (w, w->buffer);
21521 WSET (w, base_line_number, Qnil); 21563 wset_base_line_number (w, Qnil);
21522 goto no_value; 21564 goto no_value;
21523 } 21565 }
21524 21566
21525 WSET (w, base_line_number, make_number (topline - nlines)); 21567 wset_base_line_number (w, make_number (topline - nlines));
21526 WSET (w, base_line_pos, make_number (BYTE_TO_CHAR (position))); 21568 wset_base_line_pos (w, make_number (BYTE_TO_CHAR (position)));
21527 } 21569 }
21528 21570
21529 /* Now count lines from the start pos to point. */ 21571 /* Now count lines from the start pos to point. */
@@ -29288,12 +29330,13 @@ init_xdisp (void)
29288 29330
29289 echo_area_window = minibuf_window; 29331 echo_area_window = minibuf_window;
29290 29332
29291 WSET (r, top_line, make_number (FRAME_TOP_MARGIN (f))); 29333 wset_top_line (r, make_number (FRAME_TOP_MARGIN (f)));
29292 WSET (r, total_lines, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f))); 29334 wset_total_lines
29293 WSET (r, total_cols, make_number (FRAME_COLS (f))); 29335 (r, make_number (FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)));
29294 WSET (m, top_line, make_number (FRAME_LINES (f) - 1)); 29336 wset_total_cols (r, make_number (FRAME_COLS (f)));
29295 WSET (m, total_lines, make_number (1)); 29337 wset_top_line (m, make_number (FRAME_LINES (f) - 1));
29296 WSET (m, total_cols, make_number (FRAME_COLS (f))); 29338 wset_total_lines (m, make_number (1));
29339 wset_total_cols (m, make_number (FRAME_COLS (f)));
29297 29340
29298 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; 29341 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
29299 scratch_glyph_row.glyphs[TEXT_AREA + 1] 29342 scratch_glyph_row.glyphs[TEXT_AREA + 1]
diff --git a/src/xfaces.c b/src/xfaces.c
index 8c6542ee725..820d764d0a8 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -2695,7 +2695,7 @@ Value is a vector of face attributes. */)
2695 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 2695 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
2696 Qunspecified); 2696 Qunspecified);
2697 ASET (lface, 0, Qface); 2697 ASET (lface, 0, Qface);
2698 FSET (f, face_alist, Fcons (Fcons (face, lface), f->face_alist)); 2698 fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist));
2699 } 2699 }
2700 else 2700 else
2701 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2701 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
@@ -2781,8 +2781,7 @@ The value is TO. */)
2781 copy = Finternal_make_lisp_face (to, new_frame); 2781 copy = Finternal_make_lisp_face (to, new_frame);
2782 } 2782 }
2783 2783
2784 memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents, 2784 vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE);
2785 LFACE_VECTOR_SIZE * word_size);
2786 2785
2787 /* Changing a named face means that all realized faces depending on 2786 /* Changing a named face means that all realized faces depending on
2788 that face are invalid. Since we cannot tell which realized faces 2787 that face are invalid. Since we cannot tell which realized faces
@@ -3831,9 +3830,9 @@ Default face attributes override any local face attributes. */)
3831 gvec = XVECTOR (global_lface)->contents; 3830 gvec = XVECTOR (global_lface)->contents;
3832 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 3831 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
3833 if (IGNORE_DEFFACE_P (gvec[i])) 3832 if (IGNORE_DEFFACE_P (gvec[i]))
3834 lvec[i] = Qunspecified; 3833 ASET (local_lface, i, Qunspecified);
3835 else if (! UNSPECIFIEDP (gvec[i])) 3834 else if (! UNSPECIFIEDP (gvec[i]))
3836 lvec[i] = gvec[i]; 3835 ASET (local_lface, i, AREF (global_lface, i));
3837 3836
3838 /* If the default face was changed, update the face cache and the 3837 /* If the default face was changed, update the face cache and the
3839 `font' frame parameter. */ 3838 `font' frame parameter. */
@@ -3850,7 +3849,7 @@ Default face attributes override any local face attributes. */)
3850 the previously-cached vector. */ 3849 the previously-cached vector. */
3851 memcpy (attrs, oldface->lface, sizeof attrs); 3850 memcpy (attrs, oldface->lface, sizeof attrs);
3852 merge_face_vectors (f, lvec, attrs, 0); 3851 merge_face_vectors (f, lvec, attrs, 0);
3853 memcpy (lvec, attrs, sizeof attrs); 3852 vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE);
3854 newface = realize_face (c, lvec, DEFAULT_FACE_ID); 3853 newface = realize_face (c, lvec, DEFAULT_FACE_ID);
3855 3854
3856 if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) 3855 if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX])
diff --git a/src/xfns.c b/src/xfns.c
index a9d22e7d3c6..90b54d12345 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -658,7 +658,7 @@ x_set_tool_bar_position (struct frame *f,
658 658
659#ifdef USE_GTK 659#ifdef USE_GTK
660 if (xg_change_toolbar_position (f, new_value)) 660 if (xg_change_toolbar_position (f, new_value))
661 FSET (f, tool_bar_position, new_value); 661 fset_tool_bar_position (f, new_value);
662#endif 662#endif
663} 663}
664 664
@@ -1145,7 +1145,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1145 else if (!NILP (arg) || NILP (oldval)) 1145 else if (!NILP (arg) || NILP (oldval))
1146 return; 1146 return;
1147 1147
1148 FSET (f, icon_name, arg); 1148 fset_icon_name (f, arg);
1149 1149
1150 if (f->output_data.x->icon_bitmap != 0) 1150 if (f->output_data.x->icon_bitmap != 0)
1151 return; 1151 return;
@@ -1636,7 +1636,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1636 if (! NILP (Fstring_equal (name, f->name))) 1636 if (! NILP (Fstring_equal (name, f->name)))
1637 return; 1637 return;
1638 1638
1639 FSET (f, name, name); 1639 fset_name (f, name);
1640 1640
1641 /* For setting the frame title, the title parameter should override 1641 /* For setting the frame title, the title parameter should override
1642 the name parameter. */ 1642 the name parameter. */
@@ -1676,7 +1676,7 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1676 1676
1677 update_mode_lines = 1; 1677 update_mode_lines = 1;
1678 1678
1679 FSET (f, title, name); 1679 fset_title (f, name);
1680 1680
1681 if (NILP (name)) 1681 if (NILP (name))
1682 name = f->name; 1682 name = f->name;
@@ -2565,7 +2565,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2565 2565
2566 f->explicit_name = 0; 2566 f->explicit_name = 0;
2567 name = f->name; 2567 name = f->name;
2568 FSET (f, name, Qnil); 2568 fset_name (f, Qnil);
2569 x_set_name (f, name, explicit); 2569 x_set_name (f, name, explicit);
2570 } 2570 }
2571 2571
@@ -2708,7 +2708,7 @@ x_window (struct frame *f)
2708 2708
2709 f->explicit_name = 0; 2709 f->explicit_name = 0;
2710 name = f->name; 2710 name = f->name;
2711 FSET (f, name, Qnil); 2711 fset_name (f, Qnil);
2712 x_set_name (f, name, explicit); 2712 x_set_name (f, name, explicit);
2713 } 2713 }
2714 2714
@@ -3128,11 +3128,11 @@ This function is an internal primitive--use `make-frame' instead. */)
3128 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 3128 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
3129#endif /* USE_TOOLKIT_SCROLL_BARS */ 3129#endif /* USE_TOOLKIT_SCROLL_BARS */
3130 3130
3131 FSET (f, icon_name, 3131 fset_icon_name (f,
3132 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 3132 x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
3133 RES_TYPE_STRING)); 3133 RES_TYPE_STRING));
3134 if (! STRINGP (f->icon_name)) 3134 if (! STRINGP (f->icon_name))
3135 FSET (f, icon_name, Qnil); 3135 fset_icon_name (f, Qnil);
3136 3136
3137 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 3137 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
3138 3138
@@ -3189,12 +3189,12 @@ This function is an internal primitive--use `make-frame' instead. */)
3189 be set. */ 3189 be set. */
3190 if (EQ (name, Qunbound) || NILP (name)) 3190 if (EQ (name, Qunbound) || NILP (name))
3191 { 3191 {
3192 FSET (f, name, build_string (dpyinfo->x_id_name)); 3192 fset_name (f, build_string (dpyinfo->x_id_name));
3193 f->explicit_name = 0; 3193 f->explicit_name = 0;
3194 } 3194 }
3195 else 3195 else
3196 { 3196 {
3197 FSET (f, name, name); 3197 fset_name (f, name);
3198 f->explicit_name = 1; 3198 f->explicit_name = 1;
3199 /* use the frame's title when getting resources for this frame. */ 3199 /* use the frame's title when getting resources for this frame. */
3200 specbind (Qx_resource_name, name); 3200 specbind (Qx_resource_name, name);
@@ -3455,13 +3455,13 @@ This function is an internal primitive--use `make-frame' instead. */)
3455 if (FRAME_HAS_MINIBUF_P (f) 3455 if (FRAME_HAS_MINIBUF_P (f)
3456 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame)) 3456 && (!FRAMEP (KVAR (kb, Vdefault_minibuffer_frame))
3457 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame))))) 3457 || !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
3458 KSET (kb, Vdefault_minibuffer_frame, frame); 3458 kset_default_minibuffer_frame (kb, frame);
3459 3459
3460 /* All remaining specified parameters, which have not been "used" 3460 /* All remaining specified parameters, which have not been "used"
3461 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3461 by x_get_arg and friends, now go in the misc. alist of the frame. */
3462 for (tem = parms; CONSP (tem); tem = XCDR (tem)) 3462 for (tem = parms; CONSP (tem); tem = XCDR (tem))
3463 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 3463 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
3464 FSET (f, param_alist, Fcons (XCAR (tem), f->param_alist)); 3464 fset_param_alist (f, Fcons (XCAR (tem), f->param_alist));
3465 3465
3466 UNGCPRO; 3466 UNGCPRO;
3467 3467
@@ -4590,7 +4590,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4590 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0); 4590 set_window_buffer (FRAME_ROOT_WINDOW (f), buffer, 0, 0);
4591 old_buffer = current_buffer; 4591 old_buffer = current_buffer;
4592 set_buffer_internal_1 (XBUFFER (buffer)); 4592 set_buffer_internal_1 (XBUFFER (buffer));
4593 BSET (current_buffer, truncate_lines, Qnil); 4593 bset_truncate_lines (current_buffer, Qnil);
4594 specbind (Qinhibit_read_only, Qt); 4594 specbind (Qinhibit_read_only, Qt);
4595 specbind (Qinhibit_modification_hooks, Qt); 4595 specbind (Qinhibit_modification_hooks, Qt);
4596 Ferase_buffer (); 4596 Ferase_buffer ();
@@ -4616,7 +4616,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4616 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 4616 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
4617 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 4617 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
4618#endif /* USE_TOOLKIT_SCROLL_BARS */ 4618#endif /* USE_TOOLKIT_SCROLL_BARS */
4619 FSET (f, icon_name, Qnil); 4619 fset_icon_name (f, Qnil);
4620 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 4620 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
4621 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; 4621 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
4622 f->output_data.x->explicit_parent = 0; 4622 f->output_data.x->explicit_parent = 0;
@@ -4658,12 +4658,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4658 be set. */ 4658 be set. */
4659 if (EQ (name, Qunbound) || NILP (name)) 4659 if (EQ (name, Qunbound) || NILP (name))
4660 { 4660 {
4661 FSET (f, name, build_string (dpyinfo->x_id_name)); 4661 fset_name (f, build_string (dpyinfo->x_id_name));
4662 f->explicit_name = 0; 4662 f->explicit_name = 0;
4663 } 4663 }
4664 else 4664 else
4665 { 4665 {
4666 FSET (f, name, name); 4666 fset_name (f, name);
4667 f->explicit_name = 1; 4667 f->explicit_name = 1;
4668 /* use the frame's title when getting resources for this frame. */ 4668 /* use the frame's title when getting resources for this frame. */
4669 specbind (Qx_resource_name, name); 4669 specbind (Qx_resource_name, name);
@@ -5064,20 +5064,20 @@ Text larger than the specified size is clipped. */)
5064 5064
5065 /* Set up the frame's root window. */ 5065 /* Set up the frame's root window. */
5066 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 5066 w = XWINDOW (FRAME_ROOT_WINDOW (f));
5067 WSET (w, left_col, make_number (0)); 5067 wset_left_col (w, make_number (0));
5068 WSET (w, top_line, make_number (0)); 5068 wset_top_line (w, make_number (0));
5069 5069
5070 if (CONSP (Vx_max_tooltip_size) 5070 if (CONSP (Vx_max_tooltip_size)
5071 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) 5071 && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
5072 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) 5072 && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
5073 { 5073 {
5074 WSET (w, total_cols, XCAR (Vx_max_tooltip_size)); 5074 wset_total_cols (w, XCAR (Vx_max_tooltip_size));
5075 WSET (w, total_lines, XCDR (Vx_max_tooltip_size)); 5075 wset_total_lines (w, XCDR (Vx_max_tooltip_size));
5076 } 5076 }
5077 else 5077 else
5078 { 5078 {
5079 WSET (w, total_cols, make_number (80)); 5079 wset_total_cols (w, make_number (80));
5080 WSET (w, total_lines, make_number (40)); 5080 wset_total_lines (w, make_number (40));
5081 } 5081 }
5082 5082
5083 FRAME_TOTAL_COLS (f) = XINT (w->total_cols); 5083 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
@@ -5087,7 +5087,7 @@ Text larger than the specified size is clipped. */)
5087 /* Display the tooltip text in a temporary buffer. */ 5087 /* Display the tooltip text in a temporary buffer. */
5088 old_buffer = current_buffer; 5088 old_buffer = current_buffer;
5089 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); 5089 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
5090 BSET (current_buffer, truncate_lines, Qnil); 5090 bset_truncate_lines (current_buffer, Qnil);
5091 clear_glyph_matrix (w->desired_matrix); 5091 clear_glyph_matrix (w->desired_matrix);
5092 clear_glyph_matrix (w->current_matrix); 5092 clear_glyph_matrix (w->current_matrix);
5093 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 5093 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -5147,7 +5147,7 @@ Text larger than the specified size is clipped. */)
5147 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, 5147 /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
5148 not in pixels. */ 5148 not in pixels. */
5149 width /= WINDOW_FRAME_COLUMN_WIDTH (w); 5149 width /= WINDOW_FRAME_COLUMN_WIDTH (w);
5150 WSET (w, total_cols, make_number (width)); 5150 wset_total_cols (w, make_number (width));
5151 FRAME_TOTAL_COLS (f) = width; 5151 FRAME_TOTAL_COLS (f) = width;
5152 adjust_glyphs (f); 5152 adjust_glyphs (f);
5153 clear_glyph_matrix (w->desired_matrix); 5153 clear_glyph_matrix (w->desired_matrix);
diff --git a/src/xfont.c b/src/xfont.c
index 072bce7bb0a..cbb24622ae9 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -390,7 +390,7 @@ xfont_list_pattern (Display *display, const char *pattern,
390 Lisp_Object scripts = Qnil; 390 Lisp_Object scripts = Qnil;
391 391
392 for (i = 0; i < ASIZE (xfont_scratch_props); i++) 392 for (i = 0; i < ASIZE (xfont_scratch_props); i++)
393 props[i] = Qnil; 393 ASET (xfont_scratch_props, i, Qnil);
394 for (i = 0; i < num_fonts; i++) 394 for (i = 0; i < num_fonts; i++)
395 indices[i] = names[i]; 395 indices[i] = names[i];
396 qsort (indices, num_fonts, sizeof (char *), compare_font_names); 396 qsort (indices, num_fonts, sizeof (char *), compare_font_names);
@@ -467,9 +467,9 @@ xfont_list_pattern (Display *display, const char *pattern,
467 word_size * 7) 467 word_size * 7)
468 || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7])) 468 || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7]))
469 { 469 {
470 memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX), 470 vcopy (xfont_scratch_props, 0,
471 word_size * 7); 471 aref_addr (entity, FONT_FOUNDRY_INDEX), 7);
472 props[7] = AREF (entity, FONT_SPACING_INDEX); 472 ASET (xfont_scratch_props, 7, AREF (entity, FONT_SPACING_INDEX));
473 scripts = xfont_supported_scripts (display, indices[i], 473 scripts = xfont_supported_scripts (display, indices[i],
474 xfont_scratch_props, encoding); 474 xfont_scratch_props, encoding);
475 } 475 }
diff --git a/src/xmenu.c b/src/xmenu.c
index ab790094f85..54a7849218a 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1008,7 +1008,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1008 if (! NILP (Vlucid_menu_bar_dirty_flag)) 1008 if (! NILP (Vlucid_menu_bar_dirty_flag))
1009 call0 (Qrecompute_lucid_menubar); 1009 call0 (Qrecompute_lucid_menubar);
1010 safe_run_hooks (Qmenu_bar_update_hook); 1010 safe_run_hooks (Qmenu_bar_update_hook);
1011 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 1011 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
1012 1012
1013 items = FRAME_MENU_BAR_ITEMS (f); 1013 items = FRAME_MENU_BAR_ITEMS (f);
1014 1014
@@ -1100,7 +1100,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1100 } 1100 }
1101 1101
1102 /* The menu items are different, so store them in the frame. */ 1102 /* The menu items are different, so store them in the frame. */
1103 FSET (f, menu_bar_vector, menu_items); 1103 fset_menu_bar_vector (f, menu_items);
1104 f->menu_bar_items_used = menu_items_used; 1104 f->menu_bar_items_used = menu_items_used;
1105 1105
1106 /* This undoes save_menu_items. */ 1106 /* This undoes save_menu_items. */
@@ -1283,7 +1283,7 @@ initialize_frame_menubar (FRAME_PTR f)
1283{ 1283{
1284 /* This function is called before the first chance to redisplay 1284 /* This function is called before the first chance to redisplay
1285 the frame. It has to be, so the frame will have the right size. */ 1285 the frame. It has to be, so the frame will have the right size. */
1286 FSET (f, menu_bar_items, menu_bar_items (FRAME_MENU_BAR_ITEMS (f))); 1286 fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
1287 set_frame_menubar (f, 1, 1); 1287 set_frame_menubar (f, 1, 1);
1288} 1288}
1289 1289
diff --git a/src/xselect.c b/src/xselect.c
index 664b5f92a15..463bd6e37b0 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -353,8 +353,9 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
353 INTEGER_TO_CONS (timestamp), frame); 353 INTEGER_TO_CONS (timestamp), frame);
354 prev_value = LOCAL_SELECTION (selection_name, dpyinfo); 354 prev_value = LOCAL_SELECTION (selection_name, dpyinfo);
355 355
356 TSET (dpyinfo->terminal, Vselection_alist, 356 tset_selection_alist
357 Fcons (selection_data, dpyinfo->terminal->Vselection_alist)); 357 (dpyinfo->terminal,
358 Fcons (selection_data, dpyinfo->terminal->Vselection_alist));
358 359
359 /* If we already owned the selection, remove the old selection 360 /* If we already owned the selection, remove the old selection
360 data. Don't use Fdelq as that may QUIT. */ 361 data. Don't use Fdelq as that may QUIT. */
@@ -989,7 +990,7 @@ x_handle_selection_clear (struct input_event *event)
989 break; 990 break;
990 } 991 }
991 } 992 }
992 TSET (dpyinfo->terminal, Vselection_alist, Vselection_alist); 993 tset_selection_alist (dpyinfo->terminal, Vselection_alist);
993 994
994 /* Run the `x-lost-selection-functions' abnormal hook. */ 995 /* Run the `x-lost-selection-functions' abnormal hook. */
995 { 996 {
@@ -1039,7 +1040,7 @@ x_clear_frame_selections (FRAME_PTR f)
1039 args[1] = Fcar (Fcar (t->Vselection_alist)); 1040 args[1] = Fcar (Fcar (t->Vselection_alist));
1040 Frun_hook_with_args (2, args); 1041 Frun_hook_with_args (2, args);
1041 1042
1042 TSET (t, Vselection_alist, XCDR (t->Vselection_alist)); 1043 tset_selection_alist (t, XCDR (t->Vselection_alist));
1043 } 1044 }
1044 1045
1045 /* Delete elements after the beginning of Vselection_alist. */ 1046 /* Delete elements after the beginning of Vselection_alist. */
diff --git a/src/xterm.c b/src/xterm.c
index b1a73d07998..118c8767c23 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3584,7 +3584,7 @@ x_frame_rehighlight (struct x_display_info *dpyinfo)
3584 : dpyinfo->x_focus_frame); 3584 : dpyinfo->x_focus_frame);
3585 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) 3585 if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame))
3586 { 3586 {
3587 FSET (dpyinfo->x_focus_frame, focus_frame, Qnil); 3587 fset_focus_frame (dpyinfo->x_focus_frame, Qnil);
3588 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame; 3588 dpyinfo->x_highlight_frame = dpyinfo->x_focus_frame;
3589 } 3589 }
3590 } 3590 }
@@ -5018,7 +5018,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
5018 bar->next = FRAME_SCROLL_BARS (f); 5018 bar->next = FRAME_SCROLL_BARS (f);
5019 bar->prev = Qnil; 5019 bar->prev = Qnil;
5020 XSETVECTOR (barobj, bar); 5020 XSETVECTOR (barobj, bar);
5021 FSET (f, scroll_bars, barobj); 5021 fset_scroll_bars (f, barobj);
5022 if (!NILP (bar->next)) 5022 if (!NILP (bar->next))
5023 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 5023 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
5024 5024
@@ -5181,7 +5181,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5181#endif 5181#endif
5182 5182
5183 /* Dissociate this scroll bar from its window. */ 5183 /* Dissociate this scroll bar from its window. */
5184 WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); 5184 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
5185 5185
5186 UNBLOCK_INPUT; 5186 UNBLOCK_INPUT;
5187} 5187}
@@ -5395,7 +5395,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5395#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5395#endif /* not USE_TOOLKIT_SCROLL_BARS */
5396 5396
5397 XSETVECTOR (barobj, bar); 5397 XSETVECTOR (barobj, bar);
5398 WSET (w, vertical_scroll_bar, barobj); 5398 wset_vertical_scroll_bar (w, barobj);
5399} 5399}
5400 5400
5401 5401
@@ -5419,12 +5419,12 @@ XTcondemn_scroll_bars (FRAME_PTR frame)
5419 { 5419 {
5420 Lisp_Object bar; 5420 Lisp_Object bar;
5421 bar = FRAME_SCROLL_BARS (frame); 5421 bar = FRAME_SCROLL_BARS (frame);
5422 FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); 5422 fset_scroll_bars (frame, XSCROLL_BAR (bar)->next);
5423 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); 5423 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
5424 XSCROLL_BAR (bar)->prev = Qnil; 5424 XSCROLL_BAR (bar)->prev = Qnil;
5425 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) 5425 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
5426 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; 5426 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar;
5427 FSET (frame, condemned_scroll_bars, bar); 5427 fset_condemned_scroll_bars (frame, bar);
5428 } 5428 }
5429} 5429}
5430 5430
@@ -5456,7 +5456,7 @@ XTredeem_scroll_bar (struct window *window)
5456 return; 5456 return;
5457 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), 5457 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
5458 window->vertical_scroll_bar)) 5458 window->vertical_scroll_bar))
5459 FSET (f, condemned_scroll_bars, bar->next); 5459 fset_condemned_scroll_bars (f, bar->next);
5460 else 5460 else
5461 /* If its prev pointer is nil, it must be at the front of 5461 /* If its prev pointer is nil, it must be at the front of
5462 one or the other! */ 5462 one or the other! */
@@ -5471,7 +5471,7 @@ XTredeem_scroll_bar (struct window *window)
5471 bar->next = FRAME_SCROLL_BARS (f); 5471 bar->next = FRAME_SCROLL_BARS (f);
5472 bar->prev = Qnil; 5472 bar->prev = Qnil;
5473 XSETVECTOR (barobj, bar); 5473 XSETVECTOR (barobj, bar);
5474 FSET (f, scroll_bars, barobj); 5474 fset_scroll_bars (f, barobj);
5475 if (! NILP (bar->next)) 5475 if (! NILP (bar->next))
5476 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 5476 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
5477} 5477}
@@ -5488,7 +5488,7 @@ XTjudge_scroll_bars (FRAME_PTR f)
5488 5488
5489 /* Clear out the condemned list now so we won't try to process any 5489 /* Clear out the condemned list now so we won't try to process any
5490 more events on the hapless scroll bars. */ 5490 more events on the hapless scroll bars. */
5491 FSET (f, condemned_scroll_bars, Qnil); 5491 fset_condemned_scroll_bars (f, Qnil);
5492 5492
5493 for (; ! NILP (bar); bar = next) 5493 for (; ! NILP (bar); bar = next)
5494 { 5494 {
@@ -7834,7 +7834,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7834 { 7834 {
7835 /* Set this to t so that delete_frame won't get confused 7835 /* Set this to t so that delete_frame won't get confused
7836 trying to find a replacement. */ 7836 trying to find a replacement. */
7837 KSET (FRAME_KBOARD (XFRAME (frame)), Vdefault_minibuffer_frame, Qt); 7837 kset_default_minibuffer_frame (FRAME_KBOARD (XFRAME (frame)), Qt);
7838 delete_frame (frame, Qnoelisp); 7838 delete_frame (frame, Qnoelisp);
7839 } 7839 }
7840 7840
@@ -10114,7 +10114,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10114 { 10114 {
10115 terminal->kboard = xmalloc (sizeof *terminal->kboard); 10115 terminal->kboard = xmalloc (sizeof *terminal->kboard);
10116 init_kboard (terminal->kboard); 10116 init_kboard (terminal->kboard);
10117 KSET (terminal->kboard, Vwindow_system, Qx); 10117 kset_window_system (terminal->kboard, Qx);
10118 10118
10119 /* Add the keyboard to the list before running Lisp code (via 10119 /* Add the keyboard to the list before running Lisp code (via
10120 Qvendor_specific_keysyms below), since these are not traced 10120 Qvendor_specific_keysyms below), since these are not traced
@@ -10136,9 +10136,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10136 /* Temporarily hide the partially initialized terminal. */ 10136 /* Temporarily hide the partially initialized terminal. */
10137 terminal_list = terminal->next_terminal; 10137 terminal_list = terminal->next_terminal;
10138 UNBLOCK_INPUT; 10138 UNBLOCK_INPUT;
10139 KSET (terminal->kboard, Vsystem_key_alist, 10139 kset_system_key_alist
10140 call1 (Qvendor_specific_keysyms, 10140 (terminal->kboard,
10141 vendor ? build_string (vendor) : empty_unibyte_string)); 10141 call1 (Qvendor_specific_keysyms,
10142 vendor ? build_string (vendor) : empty_unibyte_string));
10142 BLOCK_INPUT; 10143 BLOCK_INPUT;
10143 terminal->next_terminal = terminal_list; 10144 terminal->next_terminal = terminal_list;
10144 terminal_list = terminal; 10145 terminal_list = terminal;