aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2011-03-21 12:42:16 -0400
committerStefan Monnier2011-03-21 12:42:16 -0400
commitcafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch)
tree7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src
parenta08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff)
parent4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff)
downloademacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz
emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit4
-rw-r--r--src/ChangeLog.trunk797
-rw-r--r--src/alloc.c90
-rw-r--r--src/bidi.c3
-rw-r--r--src/buffer.c283
-rw-r--r--src/buffer.h72
-rw-r--r--src/bytecode.c16
-rw-r--r--src/callint.c28
-rw-r--r--src/casefiddle.c31
-rw-r--r--src/casetab.c6
-rw-r--r--src/category.c4
-rw-r--r--src/ccl.c57
-rw-r--r--src/character.c2
-rw-r--r--src/character.h57
-rw-r--r--src/charset.c29
-rw-r--r--src/charset.h7
-rw-r--r--src/chartab.c45
-rw-r--r--src/cm.c9
-rw-r--r--src/cm.h33
-rw-r--r--src/cmds.c6
-rw-r--r--src/coding.c348
-rw-r--r--src/config.in1388
-rw-r--r--src/data.c40
-rw-r--r--src/dbusbind.c49
-rw-r--r--src/deps.mk28
-rw-r--r--src/dired.c52
-rw-r--r--src/dispextern.h8
-rw-r--r--src/doc.c36
-rw-r--r--src/editfns.c209
-rw-r--r--src/emacs.c51
-rw-r--r--src/eval.c63
-rw-r--r--src/fileio.c109
-rw-r--r--src/filelock.c10
-rw-r--r--src/floatfns.c17
-rw-r--r--src/fns.c25
-rw-r--r--src/font.c84
-rw-r--r--src/fontset.c17
-rw-r--r--src/fringe.c20
-rw-r--r--src/gtkutil.c338
-rw-r--r--src/image.c64
-rw-r--r--src/indent.c34
-rw-r--r--src/insdel.c24
-rw-r--r--src/intervals.c16
-rw-r--r--src/keyboard.c244
-rw-r--r--src/keyboard.h11
-rw-r--r--src/keymap.c76
-rw-r--r--src/lisp.h309
-rw-r--r--src/lread.c67
-rw-r--r--src/makefile.w32-in44
-rw-r--r--src/marker.c12
-rw-r--r--src/minibuf.c77
-rw-r--r--src/msdos.c7
-rw-r--r--src/msdos.h2
-rw-r--r--src/nsterm.m18
-rw-r--r--src/print.c26
-rw-r--r--src/process.c19
-rw-r--r--src/regex.c255
-rw-r--r--src/s/aix4-2.h2
-rw-r--r--src/s/cygwin.h3
-rw-r--r--src/s/darwin.h3
-rw-r--r--src/s/gnu-linux.h2
-rw-r--r--src/s/irix6-5.h3
-rw-r--r--src/scroll.c13
-rw-r--r--src/search.c29
-rw-r--r--src/syntax.c19
-rw-r--r--src/sysdep.c37
-rw-r--r--src/systime.h5
-rw-r--r--src/systty.h3
-rw-r--r--src/term.c78
-rw-r--r--src/termcap.c18
-rw-r--r--src/termchar.h93
-rw-r--r--src/termhooks.h3
-rw-r--r--src/terminal.c5
-rw-r--r--src/tparam.c16
-rw-r--r--src/tparam.h31
-rw-r--r--src/unexaix.c9
-rw-r--r--src/unexcoff.c8
-rw-r--r--src/unexcw.c9
-rw-r--r--src/unexec.h1
-rw-r--r--src/unexelf.c28
-rw-r--r--src/unexhp9k800.c6
-rw-r--r--src/unexmacosx.c8
-rw-r--r--src/unexsol.c7
-rw-r--r--src/unexw32.c6
-rw-r--r--src/w32.c5
-rw-r--r--src/w32console.c9
-rw-r--r--src/w32fns.c48
-rw-r--r--src/w32font.c3
-rw-r--r--src/w32inevt.c9
-rw-r--r--src/w32menu.c8
-rw-r--r--src/w32proc.c8
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32term.c14
-rw-r--r--src/w32term.h6
-rw-r--r--src/w32uniscribe.c4
-rw-r--r--src/w32xfns.c2
-rw-r--r--src/window.c53
-rw-r--r--src/window.h1
-rw-r--r--src/xdisp.c65
-rw-r--r--src/xfaces.c90
-rw-r--r--src/xfns.c52
-rw-r--r--src/xgselect.c17
-rw-r--r--src/xmenu.c24
-rw-r--r--src/xrdb.c10
-rw-r--r--src/xselect.c34
-rw-r--r--src/xsmfns.c6
-rw-r--r--src/xterm.c222
-rw-r--r--src/xterm.h14
108 files changed, 3187 insertions, 3740 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 3072dc956b9..2cf5663df91 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -392,7 +392,7 @@ define pwinx
392 printf "Window %d ", $int 392 printf "Window %d ", $int
393 xgetptr $w->buffer 393 xgetptr $w->buffer
394 set $tem = (struct buffer *) $ptr 394 set $tem = (struct buffer *) $ptr
395 xgetptr $tem->name 395 xgetptr $tem->name_
396 printf "%s", ((struct Lisp_String *) $ptr)->data 396 printf "%s", ((struct Lisp_String *) $ptr)->data
397 printf "\n" 397 printf "\n"
398 xgetptr $w->start 398 xgetptr $w->start
@@ -938,7 +938,7 @@ end
938define xbuffer 938define xbuffer
939 xgetptr $ 939 xgetptr $
940 print (struct buffer *) $ptr 940 print (struct buffer *) $ptr
941 xgetptr $->name 941 xgetptr $->name_
942 output ((struct Lisp_String *) $ptr)->data 942 output ((struct Lisp_String *) $ptr)->data
943 echo \n 943 echo \n
944end 944end
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index a96edcdfdca..6fa2d821565 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,3 +1,796 @@
12011-03-20 Glenn Morris <rgm@gnu.org>
2
3 * config.in: Remove file.
4
52011-03-20 Juanma Barranquero <lekktu@gmail.com>
6
7 * minibuf.c (Vcompleting_read_function): Don't declare, global variables
8 are now in src/globals.h.
9 (syms_of_minibuf): Remove spurious & from previous change.
10
112011-03-20 Leo <sdl.web@gmail.com>
12
13 * minibuf.c (completing-read-function): New variable.
14 (completing-read-default): Rename from completing-read.
15 (completing-read): Call completing-read-function.
16
172011-03-19 Juanma Barranquero <lekktu@gmail.com>
18
19 * xfaces.c (Fx_load_color_file):
20 Read color file from absolute filename (bug#8250).
21
222011-03-19 Juanma Barranquero <lekktu@gmail.com>
23
24 * makefile.w32-in: Update dependencies.
25
262011-03-17 Eli Zaretskii <eliz@gnu.org>
27
28 * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h.
29
302011-03-17 Paul Eggert <eggert@cs.ucla.edu>
31
32 Fix more problems found by GCC 4.5.2's static checks.
33
34 * process.c (make_serial_process_unwind, send_process_trap):
35 (sigchld_handler): Now static.
36
37 * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars.
38 That way, the code declares only the vars that it needs.
39 * s/aix4-2.h (PTY_ITERATION): Declare iteration vars.
40 * s/cygwin.h (PTY_ITERATION): Likewise.
41 * s/darwin.h (PTY_ITERATION): Likewise.
42 * s/gnu-linux.h (PTY_ITERATION): Likewise.
43
44 * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
45 * process.c (allocate_pty): Don't declare stb unless it's needed.
46
47 * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else".
48 (CONSTANTLIM): Remove; unused.
49 (METER_CODE, Bscan_buffer, Bread_char, Bset_mark):
50 Define only if needed.
51
52 * unexelf.c (unexec): Name an expression,
53 to avoid gcc -Wbad-function-cast warning.
54 Use a different way to cause a compilation error if anyone uses
55 n rather than nn, a way that does not involve shadowing.
56 (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused.
57
58 * deps.mk (unexalpha.o): Remove; unused.
59
60 New file unexec.h, the (simple) interface for unexec (Bug#8267).
61 * unexec.h: New file.
62 * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o):
63 (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o):
64 Depend on unexec.h.
65 * emacs.c [!defined CANNOT_DUMP]: Include unexec.h.
66 * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c:
67 * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h.
68 Change as necessary to match prototype in unexec.h.
69
70 * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid
71 shadowing.
72 (back_comment, skip_chars): Mark vars as initialized.
73
74 * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS):
75 Rename locals to avoid shadowing.
76
77 * lread.c (read1): Rewrite so as not to use empty "else".
78 (Fload, readevalloop, read1): Rename locals to avoid shadowing.
79
80 * print.c (Fredirect_debugging_output): Fix pointer signedess.
81
82 * lisp.h (debug_output_compilation_hack): Add decl here, to avoid
83 warning when compiling print.c.
84
85 * font.c (font_unparse_fcname): Abort in an "impossible" situation
86 instead of using an uninitialized var.
87 (font_sort_entities): Mark var as initialized.
88
89 * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing.
90
91 * font.c (font_unparse_xlfd): Don't mix pointers to variables with
92 pointers to constants.
93 (font_parse_fcname): Remove unused vars.
94 (font_delete_unmatched): Now static.
95 (font_get_spec): Remove; unused.
96 (font_style_to_value, font_prop_validate_style, font_unparse_fcname):
97 (font_update_drivers, Ffont_get_glyphs, font_add_log):
98 Rename or move locals to avoid shadowing.
99
100 * fns.c (require_nesting_list, require_unwind): Now static.
101 (Ffillarray): Rename locals to avoid shadowing.
102
103 * floatfns.c (domain_error2): Define only if needed.
104 (Ffrexp, Fldexp): Rename locals to avoid shadowing.
105
106 * alloc.c (mark_backtrace): Move decl from here ...
107 * lisp.h: ... to here, so that it can be checked.
108
109 * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static.
110 (Fdefvar): Rewrite so as not to use empty "else".
111 (lisp_indirect_variable): Name an expression,
112 to avoid gcc -Wbad-function-cast warning.
113 (Fdefvar): Rename locals to avoid shadowing.
114
115 * callint.c (quotify_arg, quotify_args): Now static.
116 (Fcall_interactively): Rename locals to avoid shadowing.
117 Use const pointer when appropriate.
118
119 * lisp.h (get_system_name, get_operating_system_release):
120 Move decls here, to check interfaces.
121 * process.c (get_operating_system_release): Move decl to lisp.h.
122 * xrdb.c (get_system_name): Likewise.
123 * editfns.c (init_editfns, Fuser_login_name, Fuser_uid):
124 (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts,
125 some of which prompt warnings from gcc -Wbad-function-cast.
126 (Fformat_time_string, Fencode_time, Finsert_char):
127 (Ftranslate_region_internal, Fformat):
128 Rename or remove local vars to avoid shadowing.
129 (Ftranslate_region_internal): Mark var as initialized.
130
131 * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to
132 avoid shadowing.
133
134 * lisp.h (eassert): Check that the argument compiles, even if
135 ENABLE_CHECKING is not defined.
136
137 * data.c (Findirect_variable): Name an expression, to avoid
138 gcc -Wbad-function-cast warning.
139 (default_value, arithcompare, arith_driver, arith_error): Now static.
140 (store_symval_forwarding): Rename local to avoid shadowing.
141 (Fmake_variable_buffer_local, Fmake_local_variable): Mark
142 variables as initialized.
143 (do_blv_forwarding, do_symval_forwarding): Remove; unused.
144
145 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
146 (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect):
147 Rename locals to avoid shadowing.
148 (mark_stack): Move local variables into the #ifdef region where
149 they're used.
150 (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if
151 ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not
152 needed otherwise.
153 (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS.
154 (GC_STRING_CHARS): Remove; not used.
155 (Fmemory_limit): Cast sbrk's returned value to char *.
156
157 * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this
158 avoids undefined behavior in theory.
159
160 * regex.c (IF_LINT): Add defn, for benefit of ../lib-src.
161
162 Use functions, not macros, for up- and down-casing (Bug#8254).
163 * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
164 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed
165 to use the following functions instead of these macros.
166 (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not
167 EMACS_INT, since callers assume the returned value fits in int.
168 (upcase1): Likewise, for UPCASE_TABLE.
169 (uppercasep, lowercasep, upcase): New static inline functions.
170 * editfns.c (Fchar_equal): Remove no-longer-needed workaround for
171 the race-condition problem in the old DOWNCASE.
172
173 * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT):
174 Rename locals to avoid shadowing.
175 (regex_compile, re_match_2_internal): Move locals to avoid shadowing.
176 (regex_compile, re_search_2, re_match_2_internal):
177 Remove unused local vars.
178 (FREE_VAR): Rewrite so as not to use empty "else",
179 which gcc can warn about.
180 (regex_compile, re_match_2_internal): Mark locals as initialized.
181 (RETALLOC_IF): Define only if needed.
182 (WORDCHAR_P): Likewise. This one is never needed, but is used
183 only in a comment talking about a compiler bug, so put inside
184 the #if 0 of that comment.
185 (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK):
186 (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING):
187 Remove; unused.
188
189 * search.c (boyer_moore): Rename locals to avoid shadowing.
190 * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE):
191 (PREV_CHAR_BOUNDARY): Likewise.
192
193 * search.c (simple_search): Remove unused var.
194
195 * dired.c (compile_pattern): Move decl from here ...
196 * lisp.h: ... to here, so that it can be checked.
197 (struct re_registers): New forward decl.
198
199 * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing.
200
201 * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width.
202 All uses changed.
203 (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion):
204 Rename locals to avoid shadowing.
205 (Fvertical_motion): Mark locals as initialized.
206
207 * casefiddle.c (casify_object, casify_region): Now static.
208 (casify_region): Mark local as initialized.
209
210 * cmds.c (internal_self_insert): Rename local to avoid shadowing.
211
212 * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
213 New macros, so that the caller can use some names other than
214 gcpro1, gcpro2, etc.
215 (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
216 of the new macros.
217 (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
218 argument, for consistency with GCPRO2_VAR, etc: it is now the
219 prefix of the variable, not the variable itself. All uses
220 changed.
221 * dired.c (directory_files_internal, file_name_completion):
222 Rename locals to avoid shadowing.
223
224 Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
225 An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
226 dired.c's scmp function, had undefined behavior.
227 * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
228 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
229 * buffer.h: ... to here, because these macros use current_buffer,
230 and the new implementation with inline functions needs to have
231 current_buffer in scope now, rather than later when the macros
232 are used.
233 (downcase, upcase1): New static inline functions.
234 (DOWNCASE, UPCASE1): Reimplement using these functions.
235 This avoids undefined behavior in expressions like
236 DOWNCASE (x) == DOWNCASE (y), which previously suffered
237 from race conditions in accessing the global variables
238 case_temp1 and case_temp2.
239 * casetab.c (case_temp1, case_temp2): Remove; no longer needed.
240 * lisp.h (case_temp1, case_temp2): Remove their decls.
241 * character.h (ASCII_CHAR_P): Move from here ...
242 * lisp.h: ... to here, so that the inline functions mentioned
243 above can use them.
244
245 * dired.c (directory_files_internal_unwind): Now static.
246
247 * fileio.c (file_name_as_directory, directory_file_name):
248 (barf_or_query_if_file_exists, auto_save_error, auto_save_1):
249 Now static.
250 (file_name_as_directory): Use const pointers when appropriate.
251 (Fexpand_file_name): Likewise. In particular, newdir might
252 point at constant storage, so make it a const pointer.
253 (Fmake_directory_internal, Fread_file_name): Remove unused vars.
254 (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer
255 signedness issues.
256 (Fset_file_times, Finsert_file_contents, auto_save_error):
257 Rename locals to avoid shadowing.
258
259 * minibuf.c (choose_minibuf_frame_1): Now static.
260 (Ftry_completion, Fall_completions): Rename or remove locals
261 to avoid shadowing.
262
263 * marker.c (bytepos_to_charpos): Remove; unused.
264
265 * lisp.h (verify_bytepos, count_markers): New decls,
266 so that gcc does not warn that these functions aren't declared.
267
268 * insdel.c (check_markers, make_gap_larger, make_gap_smaller):
269 (reset_var_on_error, Fcombine_after_change_execute_1): Now static.
270 (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic.
271 (copy_text): Remove unused local var.
272
273 * filelock.c (within_one_second): Now static.
274 (lock_file_1): Rename local to avoid shadowing.
275
276 * buffer.c (fix_overlays_before): Mark locals as initialized.
277 (fix_start_end_in_overlays): Likewise. This function should be
278 simplified by using pointers-to-pointers, but that's a different
279 matter.
280 (switch_to_buffer_1): Now static.
281 (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte):
282 (report_overlay_modification): Rename locals to avoid shadowing.
283
284 * sysdep.c (system_process_attributes): Rename vars to avoid shadowing.
285 Fix pointer signedness issue.
286 (sys_subshell): Mark local as volatile if checking for lint,
287 to suppress a gcc -Wclobbered warning that does not seem to be right.
288 (MAXPATHLEN): Define only if needed.
289
290 * process.c (serial_open, serial_configure): Move decls from here ...
291 * systty.h: ... to here, so that they can be checked.
292
293 * fns.c (get_random, seed_random): Move extern decls from here ...
294 * lisp.h: ... to here, so that they can be checked.
295
296 * sysdep.c (reset_io): Now static.
297 (wait_for_termination_signal): Remove; unused.
298
299 * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal):
300 (copy_keymap_item, append_key, push_text_char_description):
301 Now static.
302 (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily.
303 (DENSE_TABLE_SIZE): Remove; unused.
304 (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
305 (describe_map_tree):
306 Rename locals to avoid shadowing.
307
308 * keyboard.c: Declare functions static if they are not used elsewhere.
309 (echo_char, echo_dash, cmd_error, top_level_2):
310 (poll_for_input, handle_async_input): Now static.
311 (read_char, kbd_buffer_get_event, make_lispy_position):
312 (make_lispy_event, make_lispy_movement, apply_modifiers):
313 (decode_keyboard_code, tty_read_avail_input, menu_bar_items):
314 (parse_tool_bar_item, read_key_sequence, Fread_key_sequence):
315 (Fread_key_sequence_vector): Rename locals to avoid shadowing.
316 (read_key_sequence, read_char): Mark locals as initialized.
317 (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN.
318
319 * keyboard.h (make_ctrl_char): New decl.
320 (mark_kboards): Move decl here ...
321 * alloc.c (mark_kboards): ... from here.
322
323 * lisp.h (force_auto_save_soon): New decl.
324
325 * emacs.c (init_cmdargs): Rename local to avoid shadowing.
326 (DEFINE_DUMMY_FUNCTION): New macro.
327 (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main):
328 Use it.
329 (main): Add casts to avoid warnings
330 if GCC considers string literals to be constants.
331
332 * lisp.h (fatal_error_signal): Add decl, since it's exported.
333
334 * dbusbind.c: Pointer signedness fixes.
335 (xd_signature, xd_append_arg, xd_initialize):
336 (Fdbus_call_method, Fdbus_call_method_asynchronously):
337 (Fdbus_method_return_internal, Fdbus_method_error_internal):
338 (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service):
339 (Fdbus_register_signal): Use SSDATA when the context wants char *.
340
341 * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning
342 if GCC considers string literals to be constants.
343 (Fdbus_register_service, Fdbus_register_method): Remove unused vars.
344
3452011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
346
347 * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro.
348 (print_preprocess, print_object): New macro to fix last change.
349
350 * print.c (print_preprocess): Don't forget font objects.
351
3522011-03-16 Juanma Barranquero <lekktu@gmail.com>
353
354 * emacs.c (USAGE3): Doc fixes.
355
3562011-03-15 Andreas Schwab <schwab@linux-m68k.org>
357
358 * coding.c (detect_coding_iso_2022): Reorganize code to clarify
359 structure.
360
3612011-03-14 Juanma Barranquero <lekktu@gmail.com>
362
363 * lisp.h (VWindow_system, Qfile_name_history):
364 * keyboard.h (lispy_function_keys) [WINDOWSNT]:
365 * w32term.h (w32_system_caret_hwnd, w32_system_caret_height)
366 (w32_system_caret_x, w32_system_caret_y): Declare extern.
367
368 * w32select.c: Don't #include "keyboard.h".
369 (run_protected): Add extern declaration for waiting_for_input.
370
371 * w32.c (Qlocal, noninteractive1, inhibit_window_system):
372 * w32console.c (detect_input_pending, read_input_pending)
373 (encode_terminal_code):
374 * w32fns.c (quit_char, lispy_function_keys, Qtooltip)
375 (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x)
376 (w32_system_caret_y, Qfile_name_history):
377 * w32font.c (w32font_driver, QCantialias, QCotf, QClang):
378 * w32inevt.c (reinvoke_input_signal, lispy_function_keys):
379 * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map)
380 (Qoverriding_terminal_local_map, Qmenu_bar_update_hook):
381 * w32proc.c (Qlocal, report_file_error):
382 * w32term.c (Vwindow_system, updating_frame):
383 * w32uniscribe.c (initialized, uniscribe_font_driver):
384 Remove unneeded extern declarations.
385
3862011-03-14 Chong Yidong <cyd@stupidchicken.com>
387
388 * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions.
389
3902011-03-13 Chong Yidong <cyd@stupidchicken.com>
391
392 * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT)
393 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219).
394 These macros can no longer be used for assignment.
395
396 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Assign
397 struct members directly, instead of using BUF_BEGV etc.
398 (record_buffer_markers, fetch_buffer_markers): New functions for
399 recording and fetching special buffer markers.
400 (set_buffer_internal_1, set_buffer_temp): Use them.
401
402 * lread.c (unreadchar): Use SET_BUF_PT_BOTH.
403
404 * insdel.c (adjust_point): Use SET_BUF_PT_BOTH.
405
406 * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH.
407 (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH.
408
409 * xdisp.c (hscroll_window_tree):
410 (reconsider_clip_changes): Use PT instead of BUF_PT.
411
4122011-03-13 Eli Zaretskii <eliz@gnu.org>
413
414 * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on
415 $(EMACS_ROOT)/lib/intprops.h.
416
4172011-03-13 Paul Eggert <eggert@cs.ucla.edu>
418
419 Fix more problems found by GCC 4.5.2's static checks.
420
421 * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char *
422 to unsigned char * to avoid compiler diagnostic.
423 (xg_free_frame_widgets): Make it clear that a local variable is
424 needed only if USE_GTK_TOOLTIP.
425 (gdk_window_get_screen): Make it clear that this macro is needed
426 only if USE_GTK_TOOLTIP.
427 (int_gtk_range_get_value): New function, which avoids a diagnostic
428 from gcc -Wbad-function-cast.
429 (xg_set_toolkit_scroll_bar_thumb): Use it.
430 (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid
431 diagnostic from gcc -Wbad-function-cast.
432 (get_utf8_string, xg_get_file_with_chooser):
433 Rename locals to avoid shadowing.
434 (create_dialog): Move locals to avoid shadowing.
435
436 * xgselect.c (xg_select): Remove unused var.
437
438 * image.c (four_corners_best): Mark locals as initialized.
439 (gif_load): Initialize transparent_p to zero (Bug#8238).
440 Mark another local as initialized.
441 (my_png_error, my_error_exit): Mark with NO_RETURN.
442
443 * image.c (clear_image_cache): Now static.
444 (DIM, HAVE_STDLIB_H_1): Remove unused macros.
445 (xpm_load): Redo to avoid "discards qualifiers" gcc warning.
446 (x_edge_detection): Remove unnecessary cast that
447 gcc -Wbad-function-cast diagnoses.
448 (gif_load): Fix pointer signedness.
449 (clear_image_cache, xbm_read_bitmap_data, x_detect_edges):
450 (jpeg_load, gif_load): Rename locals to avoid shadowing.
451
4522011-03-11 Paul Eggert <eggert@cs.ucla.edu>
453
454 Improve quality of tests for time stamp overflow.
455 For example, without this patch (encode-time 0 0 0 1 1
456 1152921504606846976) returns the obviously-bogus value (-948597
457 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly
458 reports time overflow. See
459 <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>.
460 * deps.mk (editfns.o): Depend on ../lib/intprops.h.
461 * editfns.c: Include limits.h and intprops.h.
462 (TIME_T_MIN, TIME_T_MAX): New macros.
463 (time_overflow): Move earlier, to before first use.
464 (hi_time, lo_time): New functions, for an accurate test for
465 out-of-range times.
466 (Fcurrent_time, Fget_internal_run_time, make_time): Use them.
467 (Fget_internal_run_time): Don't assume time_t fits in int.
468 (make_time): Use list2 instead of Fcons twice.
469 (Fdecode_time): More accurate test for out-of-range times.
470 (check_tm_member): New function.
471 (Fencode_time): Use it, to test for out-of-range times.
472 (lisp_time_argument): Don't rely on undefined left-shift and
473 right-shift behavior when checking for time stamp overflow.
474
475 * editfns.c (time_overflow): New function, refactoring common code.
476 (Fformat_time_string, Fdecode_time, Fencode_time):
477 (Fcurrent_time_string): Use it.
478
479 Move 'make_time' to be next to its inverse 'lisp_time_argument'.
480 * dired.c (make_time): Move to ...
481 * editfns.c (make_time): ... here.
482 * systime.h: Note the move.
483
4842011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
485
486 * fringe.c (update_window_fringes): Remove unused variables.
487
488 * unexmacosx.c (copy_data_segment): Also copy __got section.
489 (Bug#8223)
490
4912011-03-12 Eli Zaretskii <eliz@gnu.org>
492
493 * termcap.c [MSDOS]: Include "msdos.h".
494 (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent):
495 Constify `char *' arguments and their references according to
496 prototypes in tparam.h.
497
498 * deps.mk (termcap.o): Depend on tparam.h and msdos.h.
499
500 * msdos.c (XMenuAddPane): 3rd argument is `const char *' now.
501 Adapt all references accordingly.
502
503 * msdos.h (XMenuAddPane): 3rd argument is `const char *' now.
504
5052011-03-11 Tom Tromey <tromey@redhat.com>
506
507 * buffer.c (syms_of_buffer): Remove obsolete comment.
508
5092011-03-11 Eli Zaretskii <eliz@gnu.org>
510
511 * termhooks.h (encode_terminal_code): Declare prototype.
512
513 * msdos.c (encode_terminal_code): Don't declare prototype.
514
515 * term.c (encode_terminal_code): Now external again, used by
516 w32console.c and msdos.c.
517
518 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend
519 on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
520
5212011-03-11 Paul Eggert <eggert@cs.ucla.edu>
522
523 Fix some minor problems found by GCC 4.5.2's static checks.
524
525 * fringe.c (update_window_fringes): Mark locals as initialized
526 (Bug#8227).
527 (destroy_fringe_bitmap, init_fringe_bitmap): Now static.
528
529 * alloc.c (mark_fringe_data): Move decl from here ...
530 * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here,
531 to check its interface.
532 (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM.
533
534 * fontset.c (free_realized_fontset): Now static.
535 (Fset_fontset_font): Rename local to avoid shadowing.
536 (fontset_font): Mark local as initialized.
537 (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused.
538
539 * xrdb.c: Include "xterm.h", to check x_load_resources's interface.
540
541 * xselect.c (x_disown_buffer_selections): Remove; not used.
542 (TRACE3) [!defined TRACE_SELECTION]: Remove; not used.
543 (x_own_selection, Fx_disown_selection_internal): Rename locals
544 to avoid shadowing.
545 (x_handle_dnd_message): Remove local to avoid shadowing.
546
547 * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros,
548 so that the caller can use some name other than gcpro1.
549 (GCPRO1, UNGCPRO): Reimplement in terms of the new macros.
550 * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
551 (Fx_backspace_delete_keys_p):
552 Use them to avoid shadowing, and rename vars to avoid shadowing.
553 (x_decode_color, x_set_name, x_window): Now static.
554 (Fx_create_frame): Add braces to silence GCC warning.
555 (Fx_file_dialog, Fx_select_font): Fix pointer signedness.
556 (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame):
557 Remove unused locals.
558 (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
559 (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing.
560 Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR
561 macros.
562
563 * xterm.h (x_mouse_leave): New decl.
564
565 * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame):
566 Remove unused functions.
567 (x_shift_glyphs_for_insert, XTflash, XTring_bell):
568 (x_calc_absolute_position): Now static.
569 (XTread_socket): Don't define label "out" unless it's used.
570 Don't declare local "event" unless it's used.
571 (x_iconify_frame, x_free_frame_resources): Don't declare locals
572 unless they are used.
573 (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
574 (x_fatal_error_signal): Remove; not used.
575 (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
576 (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
577 (x_error_catcher, x_connection_closed, x_error_handler):
578 (x_error_quitter, xembed_send_message, x_iconify_frame):
579 (my_log_handler): Rename locals to avoid shadowing.
580 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
581 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
582
583 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename
584 or move locals to avoid shadowing.
585 (tty_defined_color, merge_face_heights): Now static.
586 (free_realized_faces_for_fontset): Remove; not used.
587 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
588 does not deduce is never used uninitialized.
589 (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used.
590 (LFACEP): Define only if XASSERTS, as it's not needed otherwise.
591
592 * terminal.c (store_terminal_param): Now static.
593
594 * xmenu.c (menu_highlight_callback): Now static.
595 (set_frame_menubar): Remove unused local.
596 (xmenu_show): Rename parameter to avoid shadowing.
597 (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const"
598 since they might point to immutable storage.
599 (next_menubar_widget_id): Declare only if USE_X_TOOLKIT,
600 since it's unused otherwise.
601
602 * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff.
603 Add a FIXME, since the code still doesn't look right. (Bug#8215)
604 (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
605 avoids a gcc -Wuninitialized diagnostic.
606 (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs):
607 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
608 does not deduce are never used uninitialized.
609
610 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
611
612 * xdisp.c (redisplay_window): Rename local to avoid shadowing.
613 * window.c (window_loop, size_window):
614 (run_window_configuration_change_hook, enlarge_window): Likewise.
615
616 * window.c (display_buffer): Now static.
617 (size_window): Mark variables that gcc -Wuninitialized
618 does not deduce are never used uninitialized.
619 * window.h (check_all_windows): New decl, to forestall
620 gcc -Wmissing-prototypes diagnostic.
621 * dispextern.h (bidi_dump_cached_states): Likewise.
622
623 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
624 shadowing.
625 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
626 Include <limits.h>.
627 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
628 and to avoid gcc -Wuninitialized warning.
629 (load_charset_map): Mark variables that gcc -Wuninitialized
630 does not deduce are never used uninitialized.
631 (load_charset): Abort instead of using uninitialized var (Bug#8229).
632
633 * coding.c (coding_set_source, coding_set_destination):
634 Use "else { /* comment */ }" rather than "else /* comment */;"
635 for clarity, and to avoid gcc -Wempty-body warning.
636 (Fdefine_coding_system_internal): Don't redeclare 'i' inside
637 a block, when the outer 'i' will do.
638 (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
639 (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
640 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
641 (decode_coding_raw_text, decode_coding_charset, get_translation_table):
642 (Fdecode_sjis_char, Fdefine_coding_system_internal):
643 Rename locals to avoid shadowing.
644 * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
645 * coding.c (emacs_mule_char, encode_invocation_designation):
646 Now static, since they're not used elsewhere.
647 (decode_coding_iso_2022): Add "default: abort ();" as a safety check.
648 (decode_coding_object, encode_coding_object, detect_coding_system):
649 (decode_coding_emacs_mule): Mark variables that gcc
650 -Wuninitialized does not deduce are never used uninitialized.
651 (detect_coding_iso_2022): Initialize a local variable that might
652 be used uninitialized. Leave a FIXME because it's not clear that
653 this initialization is needed. (Bug#8211)
654 (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT):
655 (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P):
656 (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER):
657 (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R):
658 Remove unused macros.
659
660 * category.c (hash_get_category_set): Remove unused local var.
661 (copy_category_table): Now static, since it's not used elsewhere.
662 * character.c (string_count_byte8): Likewise.
663
664 * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string):
665 (Fregister_code_conversion_map): Rename locals to avoid shadowing.
666
667 * chartab.c (copy_sub_char_table): Now static, since it's not used
668 elsewhere.
669 (sub_char_table_ref_and_range, char_table_ref_and_range):
670 Rename locals to avoid shadowing.
671 (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros.
672
673 * bidi.c (bidi_check_type): Now static, since it's not used elsewhere.
674 (BIDI_BOB): Remove unused macro.
675
676 * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not
677 deduce are never used uninitialized.
678 * term.c (encode_terminal_code): Likewise.
679
680 * term.c (encode_terminal_code): Now static. Remove unused local.
681
682 * tparam.h: New file.
683 * term.c, tparam.h: Include it.
684 * deps.mk (term.o, tparam.o): Depend on tparam.h.
685 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
686 Move these decls to tparam.h, and make them agree with what
687 is actually in tparam.c. The previous trick of using incompatible
688 decls in different modules does not conform to the C standard.
689 All callers of tparam changed to use tparam's actual API.
690 * tparam.c (tparam1, tparam, tgoto):
691 Use const pointers where appropriate.
692
693 * cm.c (calccost, cmgoto): Use const pointers where appropriate.
694 * cm.h (struct cm): Likewise.
695 * dispextern.h (do_line_insertion_deletion_costs): Likewise.
696 * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise.
697 * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table):
698 (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph):
699 (turn_on_face, init_tty): Likewise.
700 * termchar.h (struct tty_display_info): Likewise.
701
702 * term.c (term_mouse_position): Rename local to avoid shadowing.
703
704 * alloc.c (mark_ttys): Move decl from here ...
705 * lisp.h (mark_ttys): ... to here, so that it's checked against defn.
706
7072011-03-11 Andreas Schwab <schwab@linux-m68k.org>
708
709 * .gdbinit (pwinx, xbuffer): Fix access to buffer name.
710
7112011-03-09 Juanma Barranquero <lekktu@gmail.com>
712
713 * search.c (compile_pattern_1): Remove argument regp, unused since
714 revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig.
715 (compile_pattern): Don't pass it.
716
7172011-03-08 Jan Djärv <jan.h.d@swipnet.se>
718
719 * xterm.h (DEFAULT_GDK_DISPLAY): New define.
720 (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines
721 for ! HAVE_GTK3.
722 (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID.
723
724 * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size.
725
726 * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define
727 gdk_window_get_screen, gdk_window_get_geometry,
728 gdk_x11_window_lookup_for_display and GDK_KEY_g.
729 (xg_set_screen): Use DEFAULT_GDK_DISPLAY.
730 (xg_get_pixbuf_from_pixmap): New function.
731 (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap
732 to Pixmap, take frame as parameter, remove GdkColormap parameter.
733 Call xg_get_pixbuf_from_pixmap instead of
734 gdk_pixbuf_get_from_drawable.
735 (xg_get_image_for_pixmap): Do not make GdkPixmaps, call
736 xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead.
737 (xg_check_special_colors): Use GtkStyleContext and its functions
738 for HAVE_GTK3.
739 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen.
740 (xg_prepare_tooltip, create_dialog, menubar_map_cb)
741 (xg_update_frame_menubar, xg_tool_bar_detach_callback)
742 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes): Call
743 gtk_widget_get_preferred_size.
744 (xg_frame_resized): gdk_window_get_geometry only takes 5
745 parameters.
746 (xg_win_to_widget, xg_event_is_for_menubar): Call
747 gdk_x11_window_lookup_for_display.
748 (xg_set_widget_bg): New function.
749 (delete_cb): New function.
750 (xg_create_frame_widgets): connect delete-event to delete_cb.
751 Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3
752 (xg_set_background_color): Call xg_set_widget_bg.
753 (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask.
754 (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3.
755 Only call gtk_range_set_update_policy if ! HAVE_GTK3.
756 (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback
757 if ! HAVE_GTK3.
758 (update_frame_tool_bar): Call gtk_widget_hide.
759 (xg_initialize): Use GDK_KEY_g.
760
761 * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id
762 if ! HAVE_GTK3
763 (x_session_initialize): Call gdk_x11_set_sm_client_id.
764
765 * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3.
766 (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS.
767 Load ~/emacs.d/gtkrc only for ! HAVE_GTK3.
768
7692011-03-08 Juanma Barranquero <lekktu@gmail.com>
770
771 * w32xfns.c (select_palette): Check success of RealizePalette against
772 GDI_ERROR, not zero.
773
7742011-03-07 Ben Key <bkey76@gmail.com>
775
776 * w32fns.c (FILE_NAME_COMBO_BOX, FILE_NAME_LIST): Define.
777 (file_dialog_callback): Fix locating the window handle of the File Name
778 text field. After disabling it, set focus on the list control.
779 (Fx_file_dialog): If only_dir_p is non-nil, set the text of the File
780 Name text field to "Current Directory" if it does not already have
781 another value. (Bug#8181)
782
7832011-03-07 Adrian Robert <Adrian.B.Robert@gmail.com>
784
785 * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width"
786 parameter for hbar cursors. Based on a patch by Ben Key
787 <bkey76@gmail.com>.
788
7892011-03-06 Chong Yidong <cyd@stupidchicken.com>
790
791 * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06
792 change.
793
12011-03-06 Paul Eggert <eggert@cs.ucla.edu> 7942011-03-06 Paul Eggert <eggert@cs.ucla.edu>
2 795
3 current_column: Now returns EMACS_INT, fixing some iftc 796 current_column: Now returns EMACS_INT, fixing some iftc
@@ -46,7 +839,7 @@
46 * xdisp.c (BUILD_GLYPHLESS_GLYPH_STRING): Omit unused local var. 839 * xdisp.c (BUILD_GLYPHLESS_GLYPH_STRING): Omit unused local var.
47 (produce_glyphless_glyph): Make a pointer "const" 840 (produce_glyphless_glyph): Make a pointer "const"
48 since it might point to immutable storage. 841 since it might point to immutable storage.
49 (update_window_cursor): Now static, since it's not used elsewhere. 842 (update_window_cursor): Now static, since it's not used elsewhere.
50 (SKIP_GLYPHS): Removed unused macro. 843 (SKIP_GLYPHS): Removed unused macro.
51 844
522011-03-06 Michael Shields <shields@msrl.com> (tiny change) 8452011-03-06 Michael Shields <shields@msrl.com> (tiny change)
@@ -132,7 +925,7 @@
132 as per recent filemodestring API change. Reported by Jonas Öster in 925 as per recent filemodestring API change. Reported by Jonas Öster in
133 <http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg01069.html>. 926 <http://lists.gnu.org/archive/html/emacs-devel/2011-02/msg01069.html>.
134 927
1352011-02-23 Ben Key <bkey76@gmail.com> (tiny change) 9282011-02-23 Ben Key <bkey76@gmail.com>
136 929
137 * nsterm.m (ns_draw_window_cursor): Obey the cursor_width argument 930 * nsterm.m (ns_draw_window_cursor): Obey the cursor_width argument
138 directly, for bar cursors. 931 directly, for bar cursors.
diff --git a/src/alloc.c b/src/alloc.c
index c7fd8747f74..0ca702fe0cd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -92,7 +92,8 @@ extern __malloc_size_t __malloc_extra_blocks;
92 92
93#endif /* not DOUG_LEA_MALLOC */ 93#endif /* not DOUG_LEA_MALLOC */
94 94
95#if ! defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) 95#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT
96#ifdef HAVE_GTK_AND_PTHREAD
96 97
97/* When GTK uses the file chooser dialog, different backends can be loaded 98/* When GTK uses the file chooser dialog, different backends can be loaded
98 dynamically. One such a backend is the Gnome VFS backend that gets loaded 99 dynamically. One such a backend is the Gnome VFS backend that gets loaded
@@ -130,12 +131,13 @@ static pthread_mutex_t alloc_mutex;
130 } \ 131 } \
131 while (0) 132 while (0)
132 133
133#else /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ 134#else /* ! defined HAVE_GTK_AND_PTHREAD */
134 135
135#define BLOCK_INPUT_ALLOC BLOCK_INPUT 136#define BLOCK_INPUT_ALLOC BLOCK_INPUT
136#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT 137#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT
137 138
138#endif /* SYSTEM_MALLOC || not HAVE_GTK_AND_PTHREAD */ 139#endif /* ! defined HAVE_GTK_AND_PTHREAD */
140#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */
139 141
140/* Value of _bytes_used, when spare_memory was freed. */ 142/* Value of _bytes_used, when spare_memory was freed. */
141 143
@@ -152,13 +154,11 @@ static __malloc_size_t bytes_used_when_full;
152#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG) 154#define VECTOR_UNMARK(V) ((V)->size &= ~ARRAY_MARK_FLAG)
153#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0) 155#define VECTOR_MARKED_P(V) (((V)->size & ARRAY_MARK_FLAG) != 0)
154 156
155/* Value is the number of bytes/chars of S, a pointer to a struct 157/* Value is the number of bytes of S, a pointer to a struct Lisp_String.
156 Lisp_String. This must be used instead of STRING_BYTES (S) or 158 Be careful during GC, because S->size contains the mark bit for
157 S->size during GC, because S->size contains the mark bit for
158 strings. */ 159 strings. */
159 160
160#define GC_STRING_BYTES(S) (STRING_BYTES (S)) 161#define GC_STRING_BYTES(S) (STRING_BYTES (S))
161#define GC_STRING_CHARS(S) ((S)->size & ~ARRAY_MARK_FLAG)
162 162
163/* Global variables. */ 163/* Global variables. */
164struct emacs_globals globals; 164struct emacs_globals globals;
@@ -270,17 +270,10 @@ Lisp_Object Qpost_gc_hook;
270 270
271static void mark_buffer (Lisp_Object); 271static void mark_buffer (Lisp_Object);
272static void mark_terminals (void); 272static void mark_terminals (void);
273extern void mark_kboards (void);
274extern void mark_ttys (void);
275extern void mark_backtrace (void);
276static void gc_sweep (void); 273static void gc_sweep (void);
277static void mark_glyph_matrix (struct glyph_matrix *); 274static void mark_glyph_matrix (struct glyph_matrix *);
278static void mark_face_cache (struct face_cache *); 275static void mark_face_cache (struct face_cache *);
279 276
280#ifdef HAVE_WINDOW_SYSTEM
281extern void mark_fringe_data (void);
282#endif /* HAVE_WINDOW_SYSTEM */
283
284static struct Lisp_String *allocate_string (void); 277static struct Lisp_String *allocate_string (void);
285static void compact_small_strings (void); 278static void compact_small_strings (void);
286static void free_large_strings (void); 279static void free_large_strings (void);
@@ -2659,17 +2652,17 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
2659 return val; 2652 return val;
2660} 2653}
2661 2654
2655#ifdef GC_CHECK_CONS_LIST
2662/* Get an error now if there's any junk in the cons free list. */ 2656/* Get an error now if there's any junk in the cons free list. */
2663void 2657void
2664check_cons_list (void) 2658check_cons_list (void)
2665{ 2659{
2666#ifdef GC_CHECK_CONS_LIST
2667 struct Lisp_Cons *tail = cons_free_list; 2660 struct Lisp_Cons *tail = cons_free_list;
2668 2661
2669 while (tail) 2662 while (tail)
2670 tail = tail->u.chain; 2663 tail = tail->u.chain;
2671#endif
2672} 2664}
2665#endif
2673 2666
2674/* Make a list of 1, 2, 3, 4 or 5 specified objects. */ 2667/* Make a list of 1, 2, 3, 4 or 5 specified objects. */
2675 2668
@@ -2909,15 +2902,15 @@ See also the function `vector'. */)
2909{ 2902{
2910 Lisp_Object vector; 2903 Lisp_Object vector;
2911 register EMACS_INT sizei; 2904 register EMACS_INT sizei;
2912 register EMACS_INT index; 2905 register EMACS_INT i;
2913 register struct Lisp_Vector *p; 2906 register struct Lisp_Vector *p;
2914 2907
2915 CHECK_NATNUM (length); 2908 CHECK_NATNUM (length);
2916 sizei = XFASTINT (length); 2909 sizei = XFASTINT (length);
2917 2910
2918 p = allocate_vector (sizei); 2911 p = allocate_vector (sizei);
2919 for (index = 0; index < sizei; index++) 2912 for (i = 0; i < sizei; i++)
2920 p->contents[index] = init; 2913 p->contents[i] = init;
2921 2914
2922 XSETVECTOR (vector, p); 2915 XSETVECTOR (vector, p);
2923 return vector; 2916 return vector;
@@ -2931,14 +2924,14 @@ usage: (vector &rest OBJECTS) */)
2931 (register int nargs, Lisp_Object *args) 2924 (register int nargs, Lisp_Object *args)
2932{ 2925{
2933 register Lisp_Object len, val; 2926 register Lisp_Object len, val;
2934 register int index; 2927 register int i;
2935 register struct Lisp_Vector *p; 2928 register struct Lisp_Vector *p;
2936 2929
2937 XSETFASTINT (len, nargs); 2930 XSETFASTINT (len, nargs);
2938 val = Fmake_vector (len, Qnil); 2931 val = Fmake_vector (len, Qnil);
2939 p = XVECTOR (val); 2932 p = XVECTOR (val);
2940 for (index = 0; index < nargs; index++) 2933 for (i = 0; i < nargs; i++)
2941 p->contents[index] = args[index]; 2934 p->contents[i] = args[i];
2942 return val; 2935 return val;
2943} 2936}
2944 2937
@@ -2962,7 +2955,7 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
2962 (register int nargs, Lisp_Object *args) 2955 (register int nargs, Lisp_Object *args)
2963{ 2956{
2964 register Lisp_Object len, val; 2957 register Lisp_Object len, val;
2965 register int index; 2958 register int i;
2966 register struct Lisp_Vector *p; 2959 register struct Lisp_Vector *p;
2967 2960
2968 XSETFASTINT (len, nargs); 2961 XSETFASTINT (len, nargs);
@@ -2980,11 +2973,11 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
2980 args[1] = Fstring_as_unibyte (args[1]); 2973 args[1] = Fstring_as_unibyte (args[1]);
2981 2974
2982 p = XVECTOR (val); 2975 p = XVECTOR (val);
2983 for (index = 0; index < nargs; index++) 2976 for (i = 0; i < nargs; i++)
2984 { 2977 {
2985 if (!NILP (Vpurify_flag)) 2978 if (!NILP (Vpurify_flag))
2986 args[index] = Fpurecopy (args[index]); 2979 args[i] = Fpurecopy (args[i]);
2987 p->contents[index] = args[index]; 2980 p->contents[i] = args[i];
2988 } 2981 }
2989 XSETPVECTYPE (p, PVEC_COMPILED); 2982 XSETPVECTYPE (p, PVEC_COMPILED);
2990 XSETCOMPILED (val, p); 2983 XSETCOMPILED (val, p);
@@ -4328,12 +4321,6 @@ static void
4328mark_stack (void) 4321mark_stack (void)
4329{ 4322{
4330 int i; 4323 int i;
4331 /* jmp_buf may not be aligned enough on darwin-ppc64 */
4332 union aligned_jmpbuf {
4333 Lisp_Object o;
4334 jmp_buf j;
4335 } j;
4336 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
4337 void *end; 4324 void *end;
4338 4325
4339#ifdef HAVE___BUILTIN_UNWIND_INIT 4326#ifdef HAVE___BUILTIN_UNWIND_INIT
@@ -4343,6 +4330,14 @@ mark_stack (void)
4343 __builtin_unwind_init (); 4330 __builtin_unwind_init ();
4344 end = &end; 4331 end = &end;
4345#else /* not HAVE___BUILTIN_UNWIND_INIT */ 4332#else /* not HAVE___BUILTIN_UNWIND_INIT */
4333#ifndef GC_SAVE_REGISTERS_ON_STACK
4334 /* jmp_buf may not be aligned enough on darwin-ppc64 */
4335 union aligned_jmpbuf {
4336 Lisp_Object o;
4337 jmp_buf j;
4338 } j;
4339 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
4340#endif
4346 /* This trick flushes the register windows so that all the state of 4341 /* This trick flushes the register windows so that all the state of
4347 the process is contained in the stack. */ 4342 the process is contained in the stack. */
4348 /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is 4343 /* Fixme: Code in the Boehm GC suggests flushing (with `flushrs') is
@@ -5079,18 +5074,18 @@ returns nil, because real GC can't be done. */)
5079 5074
5080 if (FLOATP (Vgc_cons_percentage)) 5075 if (FLOATP (Vgc_cons_percentage))
5081 { /* Set gc_cons_combined_threshold. */ 5076 { /* Set gc_cons_combined_threshold. */
5082 EMACS_INT total = 0; 5077 EMACS_INT tot = 0;
5083 5078
5084 total += total_conses * sizeof (struct Lisp_Cons); 5079 tot += total_conses * sizeof (struct Lisp_Cons);
5085 total += total_symbols * sizeof (struct Lisp_Symbol); 5080 tot += total_symbols * sizeof (struct Lisp_Symbol);
5086 total += total_markers * sizeof (union Lisp_Misc); 5081 tot += total_markers * sizeof (union Lisp_Misc);
5087 total += total_string_size; 5082 tot += total_string_size;
5088 total += total_vector_size * sizeof (Lisp_Object); 5083 tot += total_vector_size * sizeof (Lisp_Object);
5089 total += total_floats * sizeof (struct Lisp_Float); 5084 tot += total_floats * sizeof (struct Lisp_Float);
5090 total += total_intervals * sizeof (struct interval); 5085 tot += total_intervals * sizeof (struct interval);
5091 total += total_strings * sizeof (struct Lisp_String); 5086 tot += total_strings * sizeof (struct Lisp_String);
5092 5087
5093 gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage); 5088 gc_relative_threshold = tot * XFLOAT_DATA (Vgc_cons_percentage);
5094 } 5089 }
5095 else 5090 else
5096 gc_relative_threshold = 0; 5091 gc_relative_threshold = 0;
@@ -5139,9 +5134,9 @@ returns nil, because real GC can't be done. */)
5139 5134
5140 if (!NILP (Vpost_gc_hook)) 5135 if (!NILP (Vpost_gc_hook))
5141 { 5136 {
5142 int count = inhibit_garbage_collection (); 5137 int gc_count = inhibit_garbage_collection ();
5143 safe_run_hooks (Qpost_gc_hook); 5138 safe_run_hooks (Qpost_gc_hook);
5144 unbind_to (count, Qnil); 5139 unbind_to (gc_count, Qnil);
5145 } 5140 }
5146 5141
5147 /* Accumulate statistics. */ 5142 /* Accumulate statistics. */
@@ -5320,7 +5315,6 @@ mark_object (Lisp_Object arg)
5320 5315
5321#else /* not GC_CHECK_MARKED_OBJECTS */ 5316#else /* not GC_CHECK_MARKED_OBJECTS */
5322 5317
5323#define CHECK_ALLOCATED() (void) 0
5324#define CHECK_LIVE(LIVEP) (void) 0 5318#define CHECK_LIVE(LIVEP) (void) 0
5325#define CHECK_ALLOCATED_AND_LIVE(LIVEP) (void) 0 5319#define CHECK_ALLOCATED_AND_LIVE(LIVEP) (void) 0
5326 5320
@@ -6072,7 +6066,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */)
6072{ 6066{
6073 Lisp_Object end; 6067 Lisp_Object end;
6074 6068
6075 XSETINT (end, (EMACS_INT) sbrk (0) / 1024); 6069 XSETINT (end, (EMACS_INT) (char *) sbrk (0) / 1024);
6076 6070
6077 return end; 6071 return end;
6078} 6072}
diff --git a/src/bidi.c b/src/bidi.c
index eeacf65bd5c..3457e177436 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -72,7 +72,6 @@ static Lisp_Object bidi_type_table, bidi_mirror_table;
72#define RLO_CHAR 0x202E 72#define RLO_CHAR 0x202E
73 73
74#define BIDI_EOB -1 74#define BIDI_EOB -1
75#define BIDI_BOB -2 /* FIXME: Is this needed? */
76 75
77/* Local data structures. (Look in dispextern.h for the rest.) */ 76/* Local data structures. (Look in dispextern.h for the rest.) */
78 77
@@ -180,7 +179,7 @@ bidi_get_type (int ch, bidi_dir_t override)
180 } 179 }
181} 180}
182 181
183void 182static void
184bidi_check_type (bidi_type_t type) 183bidi_check_type (bidi_type_t type)
185{ 184{
186 if (type < UNKNOWN_BT || type > NEUTRAL_ON) 185 if (type < UNKNOWN_BT || type > NEUTRAL_ON)
diff --git a/src/buffer.c b/src/buffer.c
index 1b413ccb8b0..d301e7f14f9 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -330,15 +330,17 @@ even if it is dead. The return value is never nil. */)
330 if (! BUF_BEG_ADDR (b)) 330 if (! BUF_BEG_ADDR (b))
331 buffer_memory_full (); 331 buffer_memory_full ();
332 332
333 BUF_PT (b) = BEG; 333 b->pt = BEG;
334 b->begv = BEG;
335 b->zv = BEG;
336 b->pt_byte = BEG_BYTE;
337 b->begv_byte = BEG_BYTE;
338 b->zv_byte = BEG_BYTE;
339
334 BUF_GPT (b) = BEG; 340 BUF_GPT (b) = BEG;
335 BUF_BEGV (b) = BEG;
336 BUF_ZV (b) = BEG;
337 BUF_Z (b) = BEG;
338 BUF_PT_BYTE (b) = BEG_BYTE;
339 BUF_GPT_BYTE (b) = BEG_BYTE; 341 BUF_GPT_BYTE (b) = BEG_BYTE;
340 BUF_BEGV_BYTE (b) = BEG_BYTE; 342
341 BUF_ZV_BYTE (b) = BEG_BYTE; 343 BUF_Z (b) = BEG;
342 BUF_Z_BYTE (b) = BEG_BYTE; 344 BUF_Z_BYTE (b) = BEG_BYTE;
343 BUF_MODIFF (b) = 1; 345 BUF_MODIFF (b) = 1;
344 BUF_CHARS_MODIFF (b) = 1; 346 BUF_CHARS_MODIFF (b) = 1;
@@ -489,6 +491,53 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
489 BVAR (to, local_var_alist) = buffer_lisp_local_variables (from); 491 BVAR (to, local_var_alist) = buffer_lisp_local_variables (from);
490} 492}
491 493
494
495/* If buffer B has markers to record PT, BEGV and ZV when it is not
496 current, update these markers. */
497
498static void
499record_buffer_markers (struct buffer *b)
500{
501 if (! NILP (BVAR (b, pt_marker)))
502 {
503 Lisp_Object buffer;
504
505 eassert (!NILP (BVAR (b, begv_marker)));
506 eassert (!NILP (BVAR (b, zv_marker)));
507
508 XSETBUFFER (buffer, b);
509 set_marker_both (BVAR (b, pt_marker), buffer, b->pt, b->pt_byte);
510 set_marker_both (BVAR (b, begv_marker), buffer, b->begv, b->begv_byte);
511 set_marker_both (BVAR (b, zv_marker), buffer, b->zv, b->zv_byte);
512 }
513}
514
515
516/* If buffer B has markers to record PT, BEGV and ZV when it is not
517 current, fetch these values into B->begv etc. */
518
519static void
520fetch_buffer_markers (struct buffer *b)
521{
522 if (! NILP (BVAR (b, pt_marker)))
523 {
524 Lisp_Object m;
525
526 eassert (!NILP (BVAR (b, begv_marker)));
527 eassert (!NILP (BVAR (b, zv_marker)));
528
529 m = BVAR (b, pt_marker);
530 SET_BUF_PT_BOTH (b, marker_position (m), marker_byte_position (m));
531
532 m = BVAR (b, begv_marker);
533 SET_BUF_BEGV_BOTH (b, marker_position (m), marker_byte_position (m));
534
535 m = BVAR (b, zv_marker);
536 SET_BUF_ZV_BOTH (b, marker_position (m), marker_byte_position (m));
537 }
538}
539
540
492DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer, 541DEFUN ("make-indirect-buffer", Fmake_indirect_buffer, Smake_indirect_buffer,
493 2, 3, 542 2, 3,
494 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ", 543 "bMake indirect buffer (to buffer): \nBName of indirect buffer: ",
@@ -527,12 +576,12 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
527 /* Use the base buffer's text object. */ 576 /* Use the base buffer's text object. */
528 b->text = b->base_buffer->text; 577 b->text = b->base_buffer->text;
529 578
530 BUF_BEGV (b) = BUF_BEGV (b->base_buffer); 579 b->pt = b->base_buffer->pt;
531 BUF_ZV (b) = BUF_ZV (b->base_buffer); 580 b->begv = b->base_buffer->begv;
532 BUF_PT (b) = BUF_PT (b->base_buffer); 581 b->zv = b->base_buffer->zv;
533 BUF_BEGV_BYTE (b) = BUF_BEGV_BYTE (b->base_buffer); 582 b->pt_byte = b->base_buffer->pt_byte;
534 BUF_ZV_BYTE (b) = BUF_ZV_BYTE (b->base_buffer); 583 b->begv_byte = b->base_buffer->begv_byte;
535 BUF_PT_BYTE (b) = BUF_PT_BYTE (b->base_buffer); 584 b->zv_byte = b->base_buffer->zv_byte;
536 585
537 b->newline_cache = 0; 586 b->newline_cache = 0;
538 b->width_run_cache = 0; 587 b->width_run_cache = 0;
@@ -562,24 +611,23 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
562 /* Make sure the base buffer has markers for its narrowing. */ 611 /* Make sure the base buffer has markers for its narrowing. */
563 if (NILP (BVAR (b->base_buffer, pt_marker))) 612 if (NILP (BVAR (b->base_buffer, pt_marker)))
564 { 613 {
614 eassert (NILP (BVAR (b->base_buffer, begv_marker)));
615 eassert (NILP (BVAR (b->base_buffer, zv_marker)));
616
565 BVAR (b->base_buffer, pt_marker) = Fmake_marker (); 617 BVAR (b->base_buffer, pt_marker) = Fmake_marker ();
566 set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer, 618 set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer,
567 BUF_PT (b->base_buffer), 619 b->base_buffer->pt,
568 BUF_PT_BYTE (b->base_buffer)); 620 b->base_buffer->pt_byte);
569 } 621
570 if (NILP (BVAR (b->base_buffer, begv_marker)))
571 {
572 BVAR (b->base_buffer, begv_marker) = Fmake_marker (); 622 BVAR (b->base_buffer, begv_marker) = Fmake_marker ();
573 set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer, 623 set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer,
574 BUF_BEGV (b->base_buffer), 624 b->base_buffer->begv,
575 BUF_BEGV_BYTE (b->base_buffer)); 625 b->base_buffer->begv_byte);
576 } 626
577 if (NILP (BVAR (b->base_buffer, zv_marker)))
578 {
579 BVAR (b->base_buffer, zv_marker) = Fmake_marker (); 627 BVAR (b->base_buffer, zv_marker) = Fmake_marker ();
580 set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer, 628 set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer,
581 BUF_ZV (b->base_buffer), 629 b->base_buffer->zv,
582 BUF_ZV_BYTE (b->base_buffer)); 630 b->base_buffer->zv_byte);
583 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1; 631 XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
584 } 632 }
585 633
@@ -587,11 +635,11 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
587 { 635 {
588 /* Give the indirect buffer markers for its narrowing. */ 636 /* Give the indirect buffer markers for its narrowing. */
589 BVAR (b, pt_marker) = Fmake_marker (); 637 BVAR (b, pt_marker) = Fmake_marker ();
590 set_marker_both (BVAR (b, pt_marker), buf, BUF_PT (b), BUF_PT_BYTE (b)); 638 set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte);
591 BVAR (b, begv_marker) = Fmake_marker (); 639 BVAR (b, begv_marker) = Fmake_marker ();
592 set_marker_both (BVAR (b, begv_marker), buf, BUF_BEGV (b), BUF_BEGV_BYTE (b)); 640 set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte);
593 BVAR (b, zv_marker) = Fmake_marker (); 641 BVAR (b, zv_marker) = Fmake_marker ();
594 set_marker_both (BVAR (b, zv_marker), buf, BUF_ZV (b), BUF_ZV_BYTE (b)); 642 set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte);
595 XMARKER (BVAR (b, zv_marker))->insertion_type = 1; 643 XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
596 } 644 }
597 else 645 else
@@ -1416,9 +1464,9 @@ with SIGHUP. */)
1416 don't re-kill them. */ 1464 don't re-kill them. */
1417 if (other->base_buffer == b && !NILP (BVAR (other, name))) 1465 if (other->base_buffer == b && !NILP (BVAR (other, name)))
1418 { 1466 {
1419 Lisp_Object buffer; 1467 Lisp_Object buf;
1420 XSETBUFFER (buffer, other); 1468 XSETBUFFER (buf, other);
1421 Fkill_buffer (buffer); 1469 Fkill_buffer (buf);
1422 } 1470 }
1423 1471
1424 UNGCPRO; 1472 UNGCPRO;
@@ -1479,9 +1527,9 @@ with SIGHUP. */)
1479 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b) 1527 && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
1480 && NILP (Fsymbol_value (intern ("auto-save-visited-file-name")))) 1528 && NILP (Fsymbol_value (intern ("auto-save-visited-file-name"))))
1481 { 1529 {
1482 Lisp_Object tem; 1530 Lisp_Object delete;
1483 tem = Fsymbol_value (intern ("delete-auto-save-files")); 1531 delete = Fsymbol_value (intern ("delete-auto-save-files"));
1484 if (! NILP (tem)) 1532 if (! NILP (delete))
1485 internal_delete_file (BVAR (b, auto_save_file_name)); 1533 internal_delete_file (BVAR (b, auto_save_file_name));
1486 } 1534 }
1487 1535
@@ -1553,19 +1601,19 @@ with SIGHUP. */)
1553void 1601void
1554record_buffer (Lisp_Object buf) 1602record_buffer (Lisp_Object buf)
1555{ 1603{
1556 register Lisp_Object link, prev; 1604 register Lisp_Object list, prev;
1557 Lisp_Object frame; 1605 Lisp_Object frame;
1558 frame = selected_frame; 1606 frame = selected_frame;
1559 1607
1560 prev = Qnil; 1608 prev = Qnil;
1561 for (link = Vbuffer_alist; CONSP (link); link = XCDR (link)) 1609 for (list = Vbuffer_alist; CONSP (list); list = XCDR (list))
1562 { 1610 {
1563 if (EQ (XCDR (XCAR (link)), buf)) 1611 if (EQ (XCDR (XCAR (list)), buf))
1564 break; 1612 break;
1565 prev = link; 1613 prev = list;
1566 } 1614 }
1567 1615
1568 /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist); 1616 /* Effectively do Vbuffer_alist = Fdelq (list, Vbuffer_alist);
1569 we cannot use Fdelq itself here because it allows quitting. */ 1617 we cannot use Fdelq itself here because it allows quitting. */
1570 1618
1571 if (NILP (prev)) 1619 if (NILP (prev))
@@ -1573,40 +1621,40 @@ record_buffer (Lisp_Object buf)
1573 else 1621 else
1574 XSETCDR (prev, XCDR (XCDR (prev))); 1622 XSETCDR (prev, XCDR (XCDR (prev)));
1575 1623
1576 XSETCDR (link, Vbuffer_alist); 1624 XSETCDR (list, Vbuffer_alist);
1577 Vbuffer_alist = link; 1625 Vbuffer_alist = list;
1578 1626
1579 /* Effectively do a delq on buried_buffer_list. */ 1627 /* Effectively do a delq on buried_buffer_list. */
1580 1628
1581 prev = Qnil; 1629 prev = Qnil;
1582 for (link = XFRAME (frame)->buried_buffer_list; CONSP (link); 1630 for (list = XFRAME (frame)->buried_buffer_list; CONSP (list);
1583 link = XCDR (link)) 1631 list = XCDR (list))
1584 { 1632 {
1585 if (EQ (XCAR (link), buf)) 1633 if (EQ (XCAR (list), buf))
1586 { 1634 {
1587 if (NILP (prev)) 1635 if (NILP (prev))
1588 XFRAME (frame)->buried_buffer_list = XCDR (link); 1636 XFRAME (frame)->buried_buffer_list = XCDR (list);
1589 else 1637 else
1590 XSETCDR (prev, XCDR (XCDR (prev))); 1638 XSETCDR (prev, XCDR (XCDR (prev)));
1591 break; 1639 break;
1592 } 1640 }
1593 prev = link; 1641 prev = list;
1594 } 1642 }
1595 1643
1596 /* Now move this buffer to the front of frame_buffer_list also. */ 1644 /* Now move this buffer to the front of frame_buffer_list also. */
1597 1645
1598 prev = Qnil; 1646 prev = Qnil;
1599 for (link = frame_buffer_list (frame); CONSP (link); 1647 for (list = frame_buffer_list (frame); CONSP (list);
1600 link = XCDR (link)) 1648 list = XCDR (list))
1601 { 1649 {
1602 if (EQ (XCAR (link), buf)) 1650 if (EQ (XCAR (list), buf))
1603 break; 1651 break;
1604 prev = link; 1652 prev = list;
1605 } 1653 }
1606 1654
1607 /* Effectively do delq. */ 1655 /* Effectively do delq. */
1608 1656
1609 if (CONSP (link)) 1657 if (CONSP (list))
1610 { 1658 {
1611 if (NILP (prev)) 1659 if (NILP (prev))
1612 set_frame_buffer_list (frame, 1660 set_frame_buffer_list (frame,
@@ -1614,8 +1662,8 @@ record_buffer (Lisp_Object buf)
1614 else 1662 else
1615 XSETCDR (prev, XCDR (XCDR (prev))); 1663 XSETCDR (prev, XCDR (XCDR (prev)));
1616 1664
1617 XSETCDR (link, frame_buffer_list (frame)); 1665 XSETCDR (list, frame_buffer_list (frame));
1618 set_frame_buffer_list (frame, link); 1666 set_frame_buffer_list (frame, list);
1619 } 1667 }
1620 else 1668 else
1621 set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame))); 1669 set_frame_buffer_list (frame, Fcons (buf, frame_buffer_list (frame)));
@@ -1664,7 +1712,7 @@ the current buffer's major mode. */)
1664/* Switch to buffer BUFFER in the selected window. 1712/* Switch to buffer BUFFER in the selected window.
1665 If NORECORD is non-nil, don't call record_buffer. */ 1713 If NORECORD is non-nil, don't call record_buffer. */
1666 1714
1667Lisp_Object 1715static Lisp_Object
1668switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord) 1716switch_to_buffer_1 (Lisp_Object buffer_or_name, Lisp_Object norecord)
1669{ 1717{
1670 register Lisp_Object buffer; 1718 register Lisp_Object buffer;
@@ -1796,27 +1844,7 @@ set_buffer_internal_1 (register struct buffer *b)
1796 1844
1797 /* If the old current buffer has markers to record PT, BEGV and ZV 1845 /* If the old current buffer has markers to record PT, BEGV and ZV
1798 when it is not current, update them now. */ 1846 when it is not current, update them now. */
1799 if (! NILP (BVAR (old_buf, pt_marker))) 1847 record_buffer_markers (old_buf);
1800 {
1801 Lisp_Object obuf;
1802 XSETBUFFER (obuf, old_buf);
1803 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1804 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1805 }
1806 if (! NILP (BVAR (old_buf, begv_marker)))
1807 {
1808 Lisp_Object obuf;
1809 XSETBUFFER (obuf, old_buf);
1810 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1811 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1812 }
1813 if (! NILP (BVAR (old_buf, zv_marker)))
1814 {
1815 Lisp_Object obuf;
1816 XSETBUFFER (obuf, old_buf);
1817 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1818 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1819 }
1820 } 1848 }
1821 1849
1822 /* Get the undo list from the base buffer, so that it appears 1850 /* Get the undo list from the base buffer, so that it appears
@@ -1826,21 +1854,7 @@ set_buffer_internal_1 (register struct buffer *b)
1826 1854
1827 /* If the new current buffer has markers to record PT, BEGV and ZV 1855 /* If the new current buffer has markers to record PT, BEGV and ZV
1828 when it is not current, fetch them now. */ 1856 when it is not current, fetch them now. */
1829 if (! NILP (BVAR (b, pt_marker))) 1857 fetch_buffer_markers (b);
1830 {
1831 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1832 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1833 }
1834 if (! NILP (BVAR (b, begv_marker)))
1835 {
1836 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1837 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1838 }
1839 if (! NILP (BVAR (b, zv_marker)))
1840 {
1841 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1842 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1843 }
1844 1858
1845 /* Look down buffer's list of local Lisp variables 1859 /* Look down buffer's list of local Lisp variables
1846 to find and update any that forward into C variables. */ 1860 to find and update any that forward into C variables. */
@@ -1876,50 +1890,13 @@ set_buffer_temp (struct buffer *b)
1876 old_buf = current_buffer; 1890 old_buf = current_buffer;
1877 current_buffer = b; 1891 current_buffer = b;
1878 1892
1879 if (old_buf) 1893 /* If the old current buffer has markers to record PT, BEGV and ZV
1880 { 1894 when it is not current, update them now. */
1881 /* If the old current buffer has markers to record PT, BEGV and ZV 1895 record_buffer_markers (old_buf);
1882 when it is not current, update them now. */
1883 if (! NILP (BVAR (old_buf, pt_marker)))
1884 {
1885 Lisp_Object obuf;
1886 XSETBUFFER (obuf, old_buf);
1887 set_marker_both (BVAR (old_buf, pt_marker), obuf,
1888 BUF_PT (old_buf), BUF_PT_BYTE (old_buf));
1889 }
1890 if (! NILP (BVAR (old_buf, begv_marker)))
1891 {
1892 Lisp_Object obuf;
1893 XSETBUFFER (obuf, old_buf);
1894 set_marker_both (BVAR (old_buf, begv_marker), obuf,
1895 BUF_BEGV (old_buf), BUF_BEGV_BYTE (old_buf));
1896 }
1897 if (! NILP (BVAR (old_buf, zv_marker)))
1898 {
1899 Lisp_Object obuf;
1900 XSETBUFFER (obuf, old_buf);
1901 set_marker_both (BVAR (old_buf, zv_marker), obuf,
1902 BUF_ZV (old_buf), BUF_ZV_BYTE (old_buf));
1903 }
1904 }
1905 1896
1906 /* If the new current buffer has markers to record PT, BEGV and ZV 1897 /* If the new current buffer has markers to record PT, BEGV and ZV
1907 when it is not current, fetch them now. */ 1898 when it is not current, fetch them now. */
1908 if (! NILP (BVAR (b, pt_marker))) 1899 fetch_buffer_markers (b);
1909 {
1910 BUF_PT (b) = marker_position (BVAR (b, pt_marker));
1911 BUF_PT_BYTE (b) = marker_byte_position (BVAR (b, pt_marker));
1912 }
1913 if (! NILP (BVAR (b, begv_marker)))
1914 {
1915 BUF_BEGV (b) = marker_position (BVAR (b, begv_marker));
1916 BUF_BEGV_BYTE (b) = marker_byte_position (BVAR (b, begv_marker));
1917 }
1918 if (! NILP (BVAR (b, zv_marker)))
1919 {
1920 BUF_ZV (b) = marker_position (BVAR (b, zv_marker));
1921 BUF_ZV_BYTE (b) = marker_byte_position (BVAR (b, zv_marker));
1922 }
1923} 1900}
1924 1901
1925DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, 1902DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0,
@@ -2007,13 +1984,13 @@ its frame, iconify that frame. */)
2007 buffer is killed. */ 1984 buffer is killed. */
2008 if (!NILP (BVAR (XBUFFER (buffer), name))) 1985 if (!NILP (BVAR (XBUFFER (buffer), name)))
2009 { 1986 {
2010 Lisp_Object aelt, link; 1987 Lisp_Object aelt, list;
2011 1988
2012 aelt = Frassq (buffer, Vbuffer_alist); 1989 aelt = Frassq (buffer, Vbuffer_alist);
2013 link = Fmemq (aelt, Vbuffer_alist); 1990 list = Fmemq (aelt, Vbuffer_alist);
2014 Vbuffer_alist = Fdelq (aelt, Vbuffer_alist); 1991 Vbuffer_alist = Fdelq (aelt, Vbuffer_alist);
2015 XSETCDR (link, Qnil); 1992 XSETCDR (list, Qnil);
2016 Vbuffer_alist = nconc2 (Vbuffer_alist, link); 1993 Vbuffer_alist = nconc2 (Vbuffer_alist, list);
2017 1994
2018 XFRAME (selected_frame)->buffer_list 1995 XFRAME (selected_frame)->buffer_list
2019 = Fdelq (buffer, XFRAME (selected_frame)->buffer_list); 1996 = Fdelq (buffer, XFRAME (selected_frame)->buffer_list);
@@ -2358,12 +2335,12 @@ current buffer is cleared. */)
2358 && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE 2335 && GPT_BYTE > 1 && GPT_BYTE < Z_BYTE
2359 && ! CHAR_HEAD_P (*(GAP_END_ADDR))) 2336 && ! CHAR_HEAD_P (*(GAP_END_ADDR)))
2360 { 2337 {
2361 unsigned char *p = GPT_ADDR - 1; 2338 unsigned char *q = GPT_ADDR - 1;
2362 2339
2363 while (! CHAR_HEAD_P (*p) && p > BEG_ADDR) p--; 2340 while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--;
2364 if (LEADING_CODE_P (*p)) 2341 if (LEADING_CODE_P (*q))
2365 { 2342 {
2366 EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - p); 2343 EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q);
2367 2344
2368 move_gap_both (new_gpt, new_gpt); 2345 move_gap_both (new_gpt, new_gpt);
2369 } 2346 }
@@ -2447,14 +2424,14 @@ current buffer is cleared. */)
2447 ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; 2424 ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG;
2448 2425
2449 { 2426 {
2450 EMACS_INT pt_byte = advance_to_char_boundary (PT_BYTE); 2427 EMACS_INT byte = advance_to_char_boundary (PT_BYTE);
2451 EMACS_INT pt; 2428 EMACS_INT position;
2452 2429
2453 if (pt_byte > GPT_BYTE) 2430 if (byte > GPT_BYTE)
2454 pt = chars_in_text (GAP_END_ADDR, pt_byte - GPT_BYTE) + GPT; 2431 position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT;
2455 else 2432 else
2456 pt = chars_in_text (BEG_ADDR, pt_byte - BEG_BYTE) + BEG; 2433 position = chars_in_text (BEG_ADDR, byte - BEG_BYTE) + BEG;
2457 TEMP_SET_PT_BOTH (pt, pt_byte); 2434 TEMP_SET_PT_BOTH (position, byte);
2458 } 2435 }
2459 2436
2460 tail = markers = BUF_MARKERS (current_buffer); 2437 tail = markers = BUF_MARKERS (current_buffer);
@@ -3421,7 +3398,8 @@ void
3421fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) 3398fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
3422{ 3399{
3423 Lisp_Object overlay; 3400 Lisp_Object overlay;
3424 struct Lisp_Overlay *before_list, *after_list; 3401 struct Lisp_Overlay *before_list IF_LINT (= NULL);
3402 struct Lisp_Overlay *after_list IF_LINT (= NULL);
3425 /* These are either nil, indicating that before_list or after_list 3403 /* These are either nil, indicating that before_list or after_list
3426 should be assigned, or the cons cell the cdr of which should be 3404 should be assigned, or the cons cell the cdr of which should be
3427 assigned. */ 3405 assigned. */
@@ -3569,7 +3547,7 @@ fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos)
3569 /* If parent is nil, replace overlays_before; otherwise, parent->next. */ 3547 /* If parent is nil, replace overlays_before; otherwise, parent->next. */
3570 struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; 3548 struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
3571 Lisp_Object tem; 3549 Lisp_Object tem;
3572 EMACS_INT end; 3550 EMACS_INT end IF_LINT (= 0);
3573 3551
3574 /* After the insertion, the several overlays may be in incorrect 3552 /* After the insertion, the several overlays may be in incorrect
3575 order. The possibility is that, in the list `overlays_before', 3553 order. The possibility is that, in the list `overlays_before',
@@ -4345,10 +4323,10 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
4345 4323
4346 for (i = 0; i < size;) 4324 for (i = 0; i < size;)
4347 { 4325 {
4348 Lisp_Object prop, overlay; 4326 Lisp_Object prop_i, overlay_i;
4349 prop = copy[i++]; 4327 prop_i = copy[i++];
4350 overlay = copy[i++]; 4328 overlay_i = copy[i++];
4351 call_overlay_mod_hooks (prop, overlay, after, arg1, arg2, arg3); 4329 call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3);
4352 } 4330 }
4353 } 4331 }
4354 UNGCPRO; 4332 UNGCPRO;
@@ -5333,9 +5311,6 @@ syms_of_buffer (void)
5333 Fput (Qprotected_field, Qerror_message, 5311 Fput (Qprotected_field, Qerror_message,
5334 make_pure_c_string ("Attempt to modify a protected field")); 5312 make_pure_c_string ("Attempt to modify a protected field"));
5335 5313
5336 /* All these use DEFVAR_LISP_NOPRO because the slots in
5337 buffer_defaults will all be marked via Vbuffer_defaults. */
5338
5339 DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", 5314 DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format",
5340 mode_line_format, 5315 mode_line_format,
5341 doc: /* Default value of `mode-line-format' for buffers that don't override it. 5316 doc: /* Default value of `mode-line-format' for buffers that don't override it.
diff --git a/src/buffer.h b/src/buffer.h
index 65c7168d60a..d80875a0811 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -107,27 +107,46 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
107#define BUF_BEG(buf) (BEG) 107#define BUF_BEG(buf) (BEG)
108#define BUF_BEG_BYTE(buf) (BEG_BYTE) 108#define BUF_BEG_BYTE(buf) (BEG_BYTE)
109 109
110/* !!!FIXME: all the BUF_BEGV/BUF_ZV/BUF_PT macros are flawed: 110/* The BUF_BEGV[_BYTE], BUF_ZV[_BYTE], and BUF_PT[_BYTE] macros cannot
111 on indirect (or base) buffers, that value is only correct if that buffer 111 be used for assignment; use SET_BUF_* macros below for that. */
112 is the current_buffer, or if the buffer's text hasn't been modified (via
113 an indirect buffer) since it was last current. */
114 112
115/* Position of beginning of accessible range of buffer. */ 113/* Position of beginning of accessible range of buffer. */
116#define BUF_BEGV(buf) ((buf)->begv) 114#define BUF_BEGV(buf) \
117#define BUF_BEGV_BYTE(buf) ((buf)->begv_byte) 115 (buf == current_buffer ? BEGV \
116 : NILP (BVAR (buf, begv_marker)) ? buf->begv \
117 : marker_position (BVAR (buf, begv_marker)))
118
119#define BUF_BEGV_BYTE(buf) \
120 (buf == current_buffer ? BEGV_BYTE \
121 : NILP (BVAR (buf, begv_marker)) ? buf->begv_byte \
122 : marker_byte_position (BVAR (buf, begv_marker)))
118 123
119/* Position of point in buffer. */ 124/* Position of point in buffer. */
120#define BUF_PT(buf) ((buf)->pt) 125#define BUF_PT(buf) \
121#define BUF_PT_BYTE(buf) ((buf)->pt_byte) 126 (buf == current_buffer ? PT \
127 : NILP (BVAR (buf, pt_marker)) ? buf->pt \
128 : marker_position (BVAR (buf, pt_marker)))
129
130#define BUF_PT_BYTE(buf) \
131 (buf == current_buffer ? PT_BYTE \
132 : NILP (BVAR (buf, pt_marker)) ? buf->pt_byte \
133 : marker_byte_position (BVAR (buf, pt_marker)))
134
135/* Position of end of accessible range of buffer. */
136#define BUF_ZV(buf) \
137 (buf == current_buffer ? ZV \
138 : NILP (BVAR (buf, zv_marker)) ? buf->zv \
139 : marker_position (BVAR (buf, zv_marker)))
140
141#define BUF_ZV_BYTE(buf) \
142 (buf == current_buffer ? ZV_BYTE \
143 : NILP (BVAR (buf, zv_marker)) ? buf->zv_byte \
144 : marker_byte_position (BVAR (buf, zv_marker)))
122 145
123/* Position of gap in buffer. */ 146/* Position of gap in buffer. */
124#define BUF_GPT(buf) ((buf)->text->gpt) 147#define BUF_GPT(buf) ((buf)->text->gpt)
125#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte) 148#define BUF_GPT_BYTE(buf) ((buf)->text->gpt_byte)
126 149
127/* Position of end of accessible range of buffer. */
128#define BUF_ZV(buf) ((buf)->zv)
129#define BUF_ZV_BYTE(buf) ((buf)->zv_byte)
130
131/* Position of end of buffer. */ 150/* Position of end of buffer. */
132#define BUF_Z(buf) ((buf)->text->z) 151#define BUF_Z(buf) ((buf)->text->z)
133#define BUF_Z_BYTE(buf) ((buf)->text->z_byte) 152#define BUF_Z_BYTE(buf) ((buf)->text->z_byte)
@@ -235,8 +254,6 @@ extern void enlarge_buffer_text (struct buffer *, EMACS_INT);
235 254
236/* Macros for setting the BEGV, ZV or PT of a given buffer. 255/* Macros for setting the BEGV, ZV or PT of a given buffer.
237 256
238 SET_BUF_PT* seet to be redundant. Get rid of them?
239
240 The ..._BOTH macros take both a charpos and a bytepos, 257 The ..._BOTH macros take both a charpos and a bytepos,
241 which must correspond to each other. 258 which must correspond to each other.
242 259
@@ -1009,4 +1026,31 @@ extern int last_per_buffer_idx;
1009 1026
1010#define PER_BUFFER_VALUE(BUFFER, OFFSET) \ 1027#define PER_BUFFER_VALUE(BUFFER, OFFSET) \
1011 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER))) 1028 (*(Lisp_Object *)((OFFSET) + (char *) (BUFFER)))
1029
1030/* Downcase a character C, or make no change if that cannot be done. */
1031static inline int
1032downcase (int c)
1033{
1034 Lisp_Object downcase_table = BVAR (current_buffer, downcase_table);
1035 Lisp_Object down = CHAR_TABLE_REF (downcase_table, c);
1036 return NATNUMP (down) ? XFASTINT (down) : c;
1037}
1038
1039/* 1 if C is upper case. */
1040static inline int uppercasep (int c) { return downcase (c) != c; }
1041
1042/* Upcase a character C known to be not upper case. */
1043static inline int
1044upcase1 (int c)
1045{
1046 Lisp_Object upcase_table = BVAR (current_buffer, upcase_table);
1047 Lisp_Object up = CHAR_TABLE_REF (upcase_table, c);
1048 return NATNUMP (up) ? XFASTINT (up) : c;
1049}
1050
1051/* 1 if C is lower case. */
1052static inline int lowercasep (int c)
1053{ return !uppercasep (c) && upcase1 (c) != c; }
1012 1054
1055/* Upcase a character C, or make no change if that cannot be done. */
1056static inline int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); }
diff --git a/src/bytecode.c b/src/bytecode.c
index ba3c012bd1a..d887668dd39 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -76,11 +76,7 @@ Lisp_Object Qbyte_code_meter;
76 } \ 76 } \
77} 77}
78 78
79#else /* no BYTE_CODE_METER */ 79#endif /* BYTE_CODE_METER */
80
81#define METER_CODE(last_code, this_code)
82
83#endif /* no BYTE_CODE_METER */
84 80
85 81
86Lisp_Object Qbytecode; 82Lisp_Object Qbytecode;
@@ -148,7 +144,9 @@ extern Lisp_Object Qand_optional, Qand_rest;
148#define Bpreceding_char 0150 144#define Bpreceding_char 0150
149#define Bcurrent_column 0151 145#define Bcurrent_column 0151
150#define Bindent_to 0152 146#define Bindent_to 0152
147#ifdef BYTE_CODE_SAFE
151#define Bscan_buffer 0153 /* No longer generated as of v18 */ 148#define Bscan_buffer 0153 /* No longer generated as of v18 */
149#endif
152#define Beolp 0154 150#define Beolp 0154
153#define Beobp 0155 151#define Beobp 0155
154#define Bbolp 0156 152#define Bbolp 0156
@@ -156,8 +154,12 @@ extern Lisp_Object Qand_optional, Qand_rest;
156#define Bcurrent_buffer 0160 154#define Bcurrent_buffer 0160
157#define Bset_buffer 0161 155#define Bset_buffer 0161
158#define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */ 156#define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer. */
157#if 0
159#define Bread_char 0162 /* No longer generated as of v19 */ 158#define Bread_char 0162 /* No longer generated as of v19 */
159#endif
160#ifdef BYTE_CODE_SAFE
160#define Bset_mark 0163 /* this loser is no longer generated as of v18 */ 161#define Bset_mark 0163 /* this loser is no longer generated as of v18 */
162#endif
161#define Binteractive_p 0164 /* Obsolete. */ 163#define Binteractive_p 0164 /* Obsolete. */
162 164
163#define Bforward_char 0165 165#define Bforward_char 0165
@@ -234,7 +236,6 @@ extern Lisp_Object Qand_optional, Qand_rest;
234#define BdiscardN 0266 236#define BdiscardN 0266
235 237
236#define Bconstant 0300 238#define Bconstant 0300
237#define CONSTANTLIM 0100
238 239
239/* Whether to maintain a `top' and `bottom' field in the stack frame. */ 240/* Whether to maintain a `top' and `bottom' field in the stack frame. */
240#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK) 241#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
@@ -370,6 +371,7 @@ unmark_byte_stack (void)
370 We do this at every branch, to avoid loops that never GC. */ 371 We do this at every branch, to avoid loops that never GC. */
371 372
372#define MAYBE_GC() \ 373#define MAYBE_GC() \
374 do { \
373 if (consing_since_gc > gc_cons_threshold \ 375 if (consing_since_gc > gc_cons_threshold \
374 && consing_since_gc > gc_relative_threshold) \ 376 && consing_since_gc > gc_relative_threshold) \
375 { \ 377 { \
@@ -377,7 +379,7 @@ unmark_byte_stack (void)
377 Fgarbage_collect (); \ 379 Fgarbage_collect (); \
378 AFTER_POTENTIAL_GC (); \ 380 AFTER_POTENTIAL_GC (); \
379 } \ 381 } \
380 else 382 } while (0)
381 383
382/* Check for jumping out of range. */ 384/* Check for jumping out of range. */
383 385
diff --git a/src/callint.c b/src/callint.c
index a0efc4bbfe4..3c520742e27 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -118,7 +118,7 @@ usage: (interactive &optional ARGS) */)
118 118
119/* Quotify EXP: if EXP is constant, return it. 119/* Quotify EXP: if EXP is constant, return it.
120 If EXP is not constant, return (quote EXP). */ 120 If EXP is not constant, return (quote EXP). */
121Lisp_Object 121static Lisp_Object
122quotify_arg (register Lisp_Object exp) 122quotify_arg (register Lisp_Object exp)
123{ 123{
124 if (CONSP (exp) 124 if (CONSP (exp)
@@ -130,7 +130,7 @@ quotify_arg (register Lisp_Object exp)
130} 130}
131 131
132/* Modify EXP by quotifying each element (except the first). */ 132/* Modify EXP by quotifying each element (except the first). */
133Lisp_Object 133static Lisp_Object
134quotify_args (Lisp_Object exp) 134quotify_args (Lisp_Object exp)
135{ 135{
136 register Lisp_Object tail; 136 register Lisp_Object tail;
@@ -262,7 +262,7 @@ invoke it. If KEYS is omitted or nil, the return value of
262 262
263 Lisp_Object prefix_arg; 263 Lisp_Object prefix_arg;
264 char *string; 264 char *string;
265 char *tem; 265 const char *tem;
266 266
267 /* If varies[i] > 0, the i'th argument shouldn't just have its value 267 /* If varies[i] > 0, the i'th argument shouldn't just have its value
268 in this call quoted in the command history. It should be 268 in this call quoted in the command history. It should be
@@ -415,25 +415,25 @@ invoke it. If KEYS is omitted or nil, the return value of
415 string++; 415 string++;
416 else if (*string == '@') 416 else if (*string == '@')
417 { 417 {
418 Lisp_Object event, tem; 418 Lisp_Object event, w;
419 419
420 event = (next_event < key_count 420 event = (next_event < key_count
421 ? AREF (keys, next_event) 421 ? AREF (keys, next_event)
422 : Qnil); 422 : Qnil);
423 if (EVENT_HAS_PARAMETERS (event) 423 if (EVENT_HAS_PARAMETERS (event)
424 && (tem = XCDR (event), CONSP (tem)) 424 && (w = XCDR (event), CONSP (w))
425 && (tem = XCAR (tem), CONSP (tem)) 425 && (w = XCAR (w), CONSP (w))
426 && (tem = XCAR (tem), WINDOWP (tem))) 426 && (w = XCAR (w), WINDOWP (w)))
427 { 427 {
428 if (MINI_WINDOW_P (XWINDOW (tem)) 428 if (MINI_WINDOW_P (XWINDOW (w))
429 && ! (minibuf_level > 0 && EQ (tem, minibuf_window))) 429 && ! (minibuf_level > 0 && EQ (w, minibuf_window)))
430 error ("Attempt to select inactive minibuffer window"); 430 error ("Attempt to select inactive minibuffer window");
431 431
432 /* If the current buffer wants to clean up, let it. */ 432 /* If the current buffer wants to clean up, let it. */
433 if (!NILP (Vmouse_leave_buffer_hook)) 433 if (!NILP (Vmouse_leave_buffer_hook))
434 call1 (Vrun_hooks, Qmouse_leave_buffer_hook); 434 call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
435 435
436 Fselect_window (tem, Qnil); 436 Fselect_window (w, Qnil);
437 } 437 }
438 string++; 438 string++;
439 } 439 }
@@ -686,7 +686,7 @@ invoke it. If KEYS is omitted or nil, the return value of
686 int first = 1; 686 int first = 1;
687 do 687 do
688 { 688 {
689 Lisp_Object tem; 689 Lisp_Object str;
690 if (! first) 690 if (! first)
691 { 691 {
692 message ("Please enter a number."); 692 message ("Please enter a number.");
@@ -694,13 +694,13 @@ invoke it. If KEYS is omitted or nil, the return value of
694 } 694 }
695 first = 0; 695 first = 0;
696 696
697 tem = Fread_from_minibuffer (callint_message, 697 str = Fread_from_minibuffer (callint_message,
698 Qnil, Qnil, Qnil, Qnil, Qnil, 698 Qnil, Qnil, Qnil, Qnil, Qnil,
699 Qnil); 699 Qnil);
700 if (! STRINGP (tem) || SCHARS (tem) == 0) 700 if (! STRINGP (str) || SCHARS (str) == 0)
701 args[i] = Qnil; 701 args[i] = Qnil;
702 else 702 else
703 args[i] = Fread (tem); 703 args[i] = Fread (str);
704 } 704 }
705 while (! NUMBERP (args[i])); 705 while (! NUMBERP (args[i]));
706 } 706 }
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 26fa0db2d77..43ecd38dc7d 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -32,7 +32,7 @@ enum case_action {CASE_UP, CASE_DOWN, CASE_CAPITALIZE, CASE_CAPITALIZE_UP};
32 32
33Lisp_Object Qidentity; 33Lisp_Object Qidentity;
34 34
35Lisp_Object 35static Lisp_Object
36casify_object (enum case_action flag, Lisp_Object obj) 36casify_object (enum case_action flag, Lisp_Object obj)
37{ 37{
38 register int c, c1; 38 register int c, c1;
@@ -64,13 +64,13 @@ casify_object (enum case_action flag, Lisp_Object obj)
64 multibyte = 1; 64 multibyte = 1;
65 if (! multibyte) 65 if (! multibyte)
66 MAKE_CHAR_MULTIBYTE (c1); 66 MAKE_CHAR_MULTIBYTE (c1);
67 c = DOWNCASE (c1); 67 c = downcase (c1);
68 if (inword) 68 if (inword)
69 XSETFASTINT (obj, c | flags); 69 XSETFASTINT (obj, c | flags);
70 else if (c == (XFASTINT (obj) & ~flagbits)) 70 else if (c == (XFASTINT (obj) & ~flagbits))
71 { 71 {
72 if (! inword) 72 if (! inword)
73 c = UPCASE1 (c1); 73 c = upcase1 (c1);
74 if (! multibyte) 74 if (! multibyte)
75 MAKE_CHAR_UNIBYTE (c); 75 MAKE_CHAR_UNIBYTE (c);
76 XSETFASTINT (obj, c | flags); 76 XSETFASTINT (obj, c | flags);
@@ -92,10 +92,10 @@ casify_object (enum case_action flag, Lisp_Object obj)
92 MAKE_CHAR_MULTIBYTE (c); 92 MAKE_CHAR_MULTIBYTE (c);
93 c1 = c; 93 c1 = c;
94 if (inword && flag != CASE_CAPITALIZE_UP) 94 if (inword && flag != CASE_CAPITALIZE_UP)
95 c = DOWNCASE (c); 95 c = downcase (c);
96 else if (!UPPERCASEP (c) 96 else if (!uppercasep (c)
97 && (!inword || flag != CASE_CAPITALIZE_UP)) 97 && (!inword || flag != CASE_CAPITALIZE_UP))
98 c = UPCASE1 (c1); 98 c = upcase1 (c1);
99 if ((int) flag >= (int) CASE_CAPITALIZE) 99 if ((int) flag >= (int) CASE_CAPITALIZE)
100 inword = (SYNTAX (c) == Sword); 100 inword = (SYNTAX (c) == Sword);
101 if (c != c1) 101 if (c != c1)
@@ -133,10 +133,10 @@ casify_object (enum case_action flag, Lisp_Object obj)
133 } 133 }
134 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); 134 c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
135 if (inword && flag != CASE_CAPITALIZE_UP) 135 if (inword && flag != CASE_CAPITALIZE_UP)
136 c = DOWNCASE (c); 136 c = downcase (c);
137 else if (!UPPERCASEP (c) 137 else if (!uppercasep (c)
138 && (!inword || flag != CASE_CAPITALIZE_UP)) 138 && (!inword || flag != CASE_CAPITALIZE_UP))
139 c = UPCASE1 (c); 139 c = upcase1 (c);
140 if ((int) flag >= (int) CASE_CAPITALIZE) 140 if ((int) flag >= (int) CASE_CAPITALIZE)
141 inword = (SYNTAX (c) == Sword); 141 inword = (SYNTAX (c) == Sword);
142 o += CHAR_STRING (c, o); 142 o += CHAR_STRING (c, o);
@@ -193,7 +193,7 @@ The argument object is not altered--the value is a copy. */)
193/* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP. 193/* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP.
194 b and e specify range of buffer to operate on. */ 194 b and e specify range of buffer to operate on. */
195 195
196void 196static void
197casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) 197casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
198{ 198{
199 register int c; 199 register int c;
@@ -201,7 +201,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
201 register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 201 register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
202 EMACS_INT start, end; 202 EMACS_INT start, end;
203 EMACS_INT start_byte, end_byte; 203 EMACS_INT start_byte, end_byte;
204 EMACS_INT first = -1, last; /* Position of first and last changes. */ 204
205 /* Position of first and last changes. */
206 EMACS_INT first = -1, last IF_LINT (= 0);
207
205 EMACS_INT opoint = PT; 208 EMACS_INT opoint = PT;
206 EMACS_INT opoint_byte = PT_BYTE; 209 EMACS_INT opoint_byte = PT_BYTE;
207 210
@@ -240,10 +243,10 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
240 } 243 }
241 c2 = c; 244 c2 = c;
242 if (inword && flag != CASE_CAPITALIZE_UP) 245 if (inword && flag != CASE_CAPITALIZE_UP)
243 c = DOWNCASE (c); 246 c = downcase (c);
244 else if (!UPPERCASEP (c) 247 else if (!uppercasep (c)
245 && (!inword || flag != CASE_CAPITALIZE_UP)) 248 && (!inword || flag != CASE_CAPITALIZE_UP))
246 c = UPCASE1 (c); 249 c = upcase1 (c);
247 if ((int) flag >= (int) CASE_CAPITALIZE) 250 if ((int) flag >= (int) CASE_CAPITALIZE)
248 inword = ((SYNTAX (c) == Sword) 251 inword = ((SYNTAX (c) == Sword)
249 && (inword || !syntax_prefix_flag_p (c))); 252 && (inword || !syntax_prefix_flag_p (c)));
diff --git a/src/casetab.c b/src/casetab.c
index 5207e5315ae..56f6b065358 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -28,11 +28,6 @@ Lisp_Object Qcase_table_p, Qcase_table;
28Lisp_Object Vascii_downcase_table, Vascii_upcase_table; 28Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
29Lisp_Object Vascii_canon_table, Vascii_eqv_table; 29Lisp_Object Vascii_canon_table, Vascii_eqv_table;
30 30
31/* Used as a temporary in DOWNCASE and other macros in lisp.h. No
32 need to mark it, since it is used only very temporarily. */
33int case_temp1;
34Lisp_Object case_temp2;
35
36static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt); 31static void set_canon (Lisp_Object case_table, Lisp_Object range, Lisp_Object elt);
37static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt); 32static void set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
38static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt); 33static void shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt);
@@ -302,4 +297,3 @@ syms_of_casetab (void)
302 defsubr (&Sset_case_table); 297 defsubr (&Sset_case_table);
303 defsubr (&Sset_standard_case_table); 298 defsubr (&Sset_standard_case_table);
304} 299}
305
diff --git a/src/category.c b/src/category.c
index bcd73d3a487..cc7ff88474f 100644
--- a/src/category.c
+++ b/src/category.c
@@ -61,7 +61,6 @@ static Lisp_Object hash_get_category_set (Lisp_Object, Lisp_Object);
61static Lisp_Object 61static Lisp_Object
62hash_get_category_set (Lisp_Object table, Lisp_Object category_set) 62hash_get_category_set (Lisp_Object table, Lisp_Object category_set)
63{ 63{
64 Lisp_Object val;
65 struct Lisp_Hash_Table *h; 64 struct Lisp_Hash_Table *h;
66 int i; 65 int i;
67 unsigned hash; 66 unsigned hash;
@@ -228,7 +227,7 @@ copy_category_entry (Lisp_Object table, Lisp_Object c, Lisp_Object val)
228 the original and the copy. This function is called recursively by 227 the original and the copy. This function is called recursively by
229 binding TABLE to a sub char table. */ 228 binding TABLE to a sub char table. */
230 229
231Lisp_Object 230static Lisp_Object
232copy_category_table (Lisp_Object table) 231copy_category_table (Lisp_Object table)
233{ 232{
234 table = copy_char_table (table); 233 table = copy_char_table (table);
@@ -538,4 +537,3 @@ See the documentation of the variable `word-combining-categories'. */);
538 537
539 category_table_version = 0; 538 category_table_version = 0;
540} 539}
541
diff --git a/src/ccl.c b/src/ccl.c
index 411c041b22a..5428e94c69a 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -758,18 +758,18 @@ while(0)
758 buffer. */ 758 buffer. */
759#define CCL_WRITE_STRING(len) \ 759#define CCL_WRITE_STRING(len) \
760 do { \ 760 do { \
761 int i; \ 761 int ccli; \
762 if (!dst) \ 762 if (!dst) \
763 CCL_INVALID_CMD; \ 763 CCL_INVALID_CMD; \
764 else if (dst + len <= dst_end) \ 764 else if (dst + len <= dst_end) \
765 { \ 765 { \
766 if (XFASTINT (ccl_prog[ic]) & 0x1000000) \ 766 if (XFASTINT (ccl_prog[ic]) & 0x1000000) \
767 for (i = 0; i < len; i++) \ 767 for (ccli = 0; ccli < len; ccli++) \
768 *dst++ = XFASTINT (ccl_prog[ic + i]) & 0xFFFFFF; \ 768 *dst++ = XFASTINT (ccl_prog[ic + ccli]) & 0xFFFFFF; \
769 else \ 769 else \
770 for (i = 0; i < len; i++) \ 770 for (ccli = 0; ccli < len; ccli++) \
771 *dst++ = ((XFASTINT (ccl_prog[ic + (i / 3)])) \ 771 *dst++ = ((XFASTINT (ccl_prog[ic + (ccli / 3)])) \
772 >> ((2 - (i % 3)) * 8)) & 0xFF; \ 772 >> ((2 - (ccli % 3)) * 8)) & 0xFF; \
773 } \ 773 } \
774 else \ 774 else \
775 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \ 775 CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST); \
@@ -806,15 +806,15 @@ while(0)
806 806
807#define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \ 807#define CCL_ENCODE_CHAR(c, charset_list, id, encoded) \
808 do { \ 808 do { \
809 unsigned code; \ 809 unsigned ncode; \
810 \ 810 \
811 charset = char_charset ((c), (charset_list), &code); \ 811 charset = char_charset ((c), (charset_list), &ncode); \
812 if (! charset && ! NILP (charset_list)) \ 812 if (! charset && ! NILP (charset_list)) \
813 charset = char_charset ((c), Qnil, &code); \ 813 charset = char_charset ((c), Qnil, &ncode); \
814 if (charset) \ 814 if (charset) \
815 { \ 815 { \
816 (id) = CHARSET_ID (charset); \ 816 (id) = CHARSET_ID (charset); \
817 (encoded) = code; \ 817 (encoded) = ncode; \
818 } \ 818 } \
819 } while (0) 819 } while (0)
820 820
@@ -2092,22 +2092,22 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2092 { 2092 {
2093 const unsigned char *p = SDATA (str) + consumed_bytes; 2093 const unsigned char *p = SDATA (str) + consumed_bytes;
2094 const unsigned char *endp = SDATA (str) + str_bytes; 2094 const unsigned char *endp = SDATA (str) + str_bytes;
2095 int i = 0; 2095 int j = 0;
2096 int *src, src_size; 2096 int *src, src_size;
2097 2097
2098 if (endp - p == str_chars - consumed_chars) 2098 if (endp - p == str_chars - consumed_chars)
2099 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) 2099 while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
2100 source[i++] = *p++; 2100 source[j++] = *p++;
2101 else 2101 else
2102 while (i < CCL_EXECUTE_BUF_SIZE && p < endp) 2102 while (j < CCL_EXECUTE_BUF_SIZE && p < endp)
2103 source[i++] = STRING_CHAR_ADVANCE (p); 2103 source[j++] = STRING_CHAR_ADVANCE (p);
2104 consumed_chars += i; 2104 consumed_chars += j;
2105 consumed_bytes = p - SDATA (str); 2105 consumed_bytes = p - SDATA (str);
2106 2106
2107 if (consumed_bytes == str_bytes) 2107 if (consumed_bytes == str_bytes)
2108 ccl.last_block = NILP (contin); 2108 ccl.last_block = NILP (contin);
2109 src = source; 2109 src = source;
2110 src_size = i; 2110 src_size = j;
2111 while (1) 2111 while (1)
2112 { 2112 {
2113 ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE, 2113 ccl_driver (&ccl, src, destination, src_size, CCL_EXECUTE_BUF_SIZE,
@@ -2123,8 +2123,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2123 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); 2123 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
2124 outp = outbuf + offset; 2124 outp = outbuf + offset;
2125 } 2125 }
2126 for (i = 0; i < ccl.produced; i++) 2126 for (j = 0; j < ccl.produced; j++)
2127 CHAR_STRING_ADVANCE (destination[i], outp); 2127 CHAR_STRING_ADVANCE (destination[j], outp);
2128 } 2128 }
2129 else 2129 else
2130 { 2130 {
@@ -2135,8 +2135,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2135 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize); 2135 outbuf = (unsigned char *) xrealloc (outbuf, outbufsize);
2136 outp = outbuf + offset; 2136 outp = outbuf + offset;
2137 } 2137 }
2138 for (i = 0; i < ccl.produced; i++) 2138 for (j = 0; j < ccl.produced; j++)
2139 *outp++ = destination[i]; 2139 *outp++ = destination[j];
2140 } 2140 }
2141 src += ccl.consumed; 2141 src += ccl.consumed;
2142 src_size -= ccl.consumed; 2142 src_size -= ccl.consumed;
@@ -2253,7 +2253,7 @@ Return index number of the registered map. */)
2253{ 2253{
2254 int len = ASIZE (Vcode_conversion_map_vector); 2254 int len = ASIZE (Vcode_conversion_map_vector);
2255 int i; 2255 int i;
2256 Lisp_Object index; 2256 Lisp_Object idx;
2257 2257
2258 CHECK_SYMBOL (symbol); 2258 CHECK_SYMBOL (symbol);
2259 CHECK_VECTOR (map); 2259 CHECK_VECTOR (map);
@@ -2267,11 +2267,11 @@ Return index number of the registered map. */)
2267 2267
2268 if (EQ (symbol, XCAR (slot))) 2268 if (EQ (symbol, XCAR (slot)))
2269 { 2269 {
2270 index = make_number (i); 2270 idx = make_number (i);
2271 XSETCDR (slot, map); 2271 XSETCDR (slot, map);
2272 Fput (symbol, Qcode_conversion_map, map); 2272 Fput (symbol, Qcode_conversion_map, map);
2273 Fput (symbol, Qcode_conversion_map_id, index); 2273 Fput (symbol, Qcode_conversion_map_id, idx);
2274 return index; 2274 return idx;
2275 } 2275 }
2276 } 2276 }
2277 2277
@@ -2279,11 +2279,11 @@ Return index number of the registered map. */)
2279 Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, 2279 Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector,
2280 len * 2, Qnil); 2280 len * 2, Qnil);
2281 2281
2282 index = make_number (i); 2282 idx = make_number (i);
2283 Fput (symbol, Qcode_conversion_map, map); 2283 Fput (symbol, Qcode_conversion_map, map);
2284 Fput (symbol, Qcode_conversion_map_id, index); 2284 Fput (symbol, Qcode_conversion_map_id, idx);
2285 ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map)); 2285 ASET (Vcode_conversion_map_vector, i, Fcons (symbol, map));
2286 return index; 2286 return idx;
2287} 2287}
2288 2288
2289 2289
@@ -2341,4 +2341,3 @@ used by CCL. */);
2341 defsubr (&Sregister_ccl_program); 2341 defsubr (&Sregister_ccl_program);
2342 defsubr (&Sregister_code_conversion_map); 2342 defsubr (&Sregister_code_conversion_map);
2343} 2343}
2344
diff --git a/src/character.c b/src/character.c
index 6f3312fec29..fdaf22f04f8 100644
--- a/src/character.c
+++ b/src/character.c
@@ -786,7 +786,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i
786} 786}
787 787
788 788
789EMACS_INT 789static EMACS_INT
790string_count_byte8 (Lisp_Object string) 790string_count_byte8 (Lisp_Object string)
791{ 791{
792 int multibyte = STRING_MULTIBYTE (string); 792 int multibyte = STRING_MULTIBYTE (string);
diff --git a/src/character.h b/src/character.h
index fb29ced66b7..4c468e14d2c 100644
--- a/src/character.h
+++ b/src/character.h
@@ -128,9 +128,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
128 XSETCDR ((x), tmp); \ 128 XSETCDR ((x), tmp); \
129 } while (0) 129 } while (0)
130 130
131/* Nonzero iff C is an ASCII character. */
132#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80)
133
134/* Nonzero iff C is a character of code less than 0x100. */ 131/* Nonzero iff C is a character of code less than 0x100. */
135#define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100) 132#define SINGLE_BYTE_CHAR_P(c) ((unsigned) (c) < 0x100)
136 133
@@ -281,11 +278,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
281 do { \ 278 do { \
282 if ((p) > (limit)) \ 279 if ((p) > (limit)) \
283 { \ 280 { \
284 const unsigned char *p0 = (p); \ 281 const unsigned char *pcb = (p); \
285 do { \ 282 do { \
286 p0--; \ 283 pcb--; \
287 } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \ 284 } while (pcb >= limit && ! CHAR_HEAD_P (*pcb)); \
288 (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \ 285 (p) = (BYTES_BY_CHAR_HEAD (*pcb) == (p) - pcb) ? pcb : (p) - 1; \
289 } \ 286 } \
290 } while (0) 287 } while (0)
291 288
@@ -356,11 +353,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
356 CHARIDX++; \ 353 CHARIDX++; \
357 if (STRING_MULTIBYTE (STRING)) \ 354 if (STRING_MULTIBYTE (STRING)) \
358 { \ 355 { \
359 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ 356 unsigned char *string_ptr = &SDATA (STRING)[BYTEIDX]; \
360 int len; \ 357 int string_len; \
361 \ 358 \
362 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ 359 OUTPUT = STRING_CHAR_AND_LENGTH (string_ptr, string_len); \
363 BYTEIDX += len; \ 360 BYTEIDX += string_len; \
364 } \ 361 } \
365 else \ 362 else \
366 { \ 363 { \
@@ -380,10 +377,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
380 if (STRING_MULTIBYTE (STRING)) \ 377 if (STRING_MULTIBYTE (STRING)) \
381 { \ 378 { \
382 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ 379 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \
383 int len; \ 380 int ptrlen; \
384 \ 381 \
385 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ 382 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, ptrlen); \
386 BYTEIDX += len; \ 383 BYTEIDX += ptrlen; \
387 } \ 384 } \
388 else \ 385 else \
389 { \ 386 { \
@@ -400,11 +397,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
400#define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \ 397#define FETCH_STRING_CHAR_ADVANCE_NO_CHECK(OUTPUT, STRING, CHARIDX, BYTEIDX) \
401 do \ 398 do \
402 { \ 399 { \
403 unsigned char *ptr = &SDATA (STRING)[BYTEIDX]; \ 400 unsigned char *fetch_ptr = &SDATA (STRING)[BYTEIDX]; \
404 int len; \ 401 int fetch_len; \
405 \ 402 \
406 OUTPUT = STRING_CHAR_AND_LENGTH (ptr, len); \ 403 OUTPUT = STRING_CHAR_AND_LENGTH (fetch_ptr, fetch_len); \
407 BYTEIDX += len; \ 404 BYTEIDX += fetch_len; \
408 CHARIDX++; \ 405 CHARIDX++; \
409 } \ 406 } \
410 while (0) 407 while (0)
@@ -420,10 +417,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
420 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \ 417 if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) \
421 { \ 418 { \
422 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \ 419 unsigned char *ptr = BYTE_POS_ADDR (BYTEIDX); \
423 int len; \ 420 int string_len; \
424 \ 421 \
425 OUTPUT= STRING_CHAR_AND_LENGTH (ptr, len); \ 422 OUTPUT= STRING_CHAR_AND_LENGTH (ptr, string_len); \
426 BYTEIDX += len; \ 423 BYTEIDX += string_len; \
427 } \ 424 } \
428 else \ 425 else \
429 { \ 426 { \
@@ -454,8 +451,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
454 451
455#define INC_POS(pos_byte) \ 452#define INC_POS(pos_byte) \
456 do { \ 453 do { \
457 unsigned char *p = BYTE_POS_ADDR (pos_byte); \ 454 unsigned char *ptr = BYTE_POS_ADDR (pos_byte); \
458 pos_byte += BYTES_BY_CHAR_HEAD (*p); \ 455 pos_byte += BYTES_BY_CHAR_HEAD (*ptr); \
459 } while (0) 456 } while (0)
460 457
461 458
@@ -464,16 +461,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
464 461
465#define DEC_POS(pos_byte) \ 462#define DEC_POS(pos_byte) \
466 do { \ 463 do { \
467 unsigned char *p; \ 464 unsigned char *ptr; \
468 \ 465 \
469 pos_byte--; \ 466 pos_byte--; \
470 if (pos_byte < GPT_BYTE) \ 467 if (pos_byte < GPT_BYTE) \
471 p = BEG_ADDR + pos_byte - BEG_BYTE; \ 468 ptr = BEG_ADDR + pos_byte - BEG_BYTE; \
472 else \ 469 else \
473 p = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE;\ 470 ptr = BEG_ADDR + GAP_SIZE + pos_byte - BEG_BYTE; \
474 while (!CHAR_HEAD_P (*p)) \ 471 while (!CHAR_HEAD_P (*ptr)) \
475 { \ 472 { \
476 p--; \ 473 ptr--; \
477 pos_byte--; \ 474 pos_byte--; \
478 } \ 475 } \
479 } while (0) 476 } while (0)
@@ -513,8 +510,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
513 510
514#define BUF_INC_POS(buf, pos_byte) \ 511#define BUF_INC_POS(buf, pos_byte) \
515 do { \ 512 do { \
516 unsigned char *p = BUF_BYTE_ADDRESS (buf, pos_byte); \ 513 unsigned char *bbp = BUF_BYTE_ADDRESS (buf, pos_byte); \
517 pos_byte += BYTES_BY_CHAR_HEAD (*p); \ 514 pos_byte += BYTES_BY_CHAR_HEAD (*bbp); \
518 } while (0) 515 } while (0)
519 516
520 517
diff --git a/src/charset.c b/src/charset.c
index 3624e740acb..d82b29ae44b 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <stdio.h> 29#include <stdio.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <ctype.h> 31#include <ctype.h>
32#include <limits.h>
32#include <sys/types.h> 33#include <sys/types.h>
33#include <setjmp.h> 34#include <setjmp.h>
34#include "lisp.h" 35#include "lisp.h"
@@ -250,7 +251,7 @@ struct charset_map_entries
250static void 251static void
251load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) 252load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag)
252{ 253{
253 Lisp_Object vec, table; 254 Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
254 unsigned max_code = CHARSET_MAX_CODE (charset); 255 unsigned max_code = CHARSET_MAX_CODE (charset);
255 int ascii_compatible_p = charset->ascii_compatible_p; 256 int ascii_compatible_p = charset->ascii_compatible_p;
256 int min_char, max_char, nonascii_min_char; 257 int min_char, max_char, nonascii_min_char;
@@ -629,8 +630,12 @@ load_charset (struct charset *charset, int control_flag)
629 630
630 if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) 631 if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP)
631 map = CHARSET_MAP (charset); 632 map = CHARSET_MAP (charset);
632 else if (CHARSET_UNIFIED_P (charset)) 633 else
633 map = CHARSET_UNIFY_MAP (charset); 634 {
635 if (! CHARSET_UNIFIED_P (charset))
636 abort ();
637 map = CHARSET_UNIFY_MAP (charset);
638 }
634 if (STRINGP (map)) 639 if (STRINGP (map))
635 load_charset_map_from_file (charset, map, control_flag); 640 load_charset_map_from_file (charset, map, control_flag);
636 else 641 else
@@ -668,9 +673,9 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object
668 673
669 while (1) 674 while (1)
670 { 675 {
671 int index = GET_TEMP_CHARSET_WORK_ENCODER (c); 676 int idx = GET_TEMP_CHARSET_WORK_ENCODER (c);
672 677
673 if (index >= from_idx && index <= to_idx) 678 if (idx >= from_idx && idx <= to_idx)
674 { 679 {
675 if (NILP (XCAR (range))) 680 if (NILP (XCAR (range)))
676 XSETCAR (range, make_number (c)); 681 XSETCAR (range, make_number (c));
@@ -2066,10 +2071,10 @@ that case, find the charset from what supported by that coding system. */)
2066 2071
2067 for (; CONSP (restriction); restriction = XCDR (restriction)) 2072 for (; CONSP (restriction); restriction = XCDR (restriction))
2068 { 2073 {
2069 struct charset *charset; 2074 struct charset *rcharset;
2070 2075
2071 CHECK_CHARSET_GET_CHARSET (XCAR (restriction), charset); 2076 CHECK_CHARSET_GET_CHARSET (XCAR (restriction), rcharset);
2072 if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)) 2077 if (ENCODE_CHAR (rcharset, c) != CHARSET_INVALID_CODE (rcharset))
2073 return XCAR (restriction); 2078 return XCAR (restriction);
2074 } 2079 }
2075 return Qnil; 2080 return Qnil;
@@ -2250,7 +2255,7 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2250 int n = XFASTINT (len), i, j, done; 2255 int n = XFASTINT (len), i, j, done;
2251 Lisp_Object tail, elt, attrs; 2256 Lisp_Object tail, elt, attrs;
2252 struct charset_sort_data *sort_data; 2257 struct charset_sort_data *sort_data;
2253 int id, min_id, max_id; 2258 int id, min_id = INT_MAX, max_id = INT_MIN;
2254 USE_SAFE_ALLOCA; 2259 USE_SAFE_ALLOCA;
2255 2260
2256 if (n == 0) 2261 if (n == 0)
@@ -2262,11 +2267,9 @@ See also `charset-priority-list' and `set-charset-priority'. */)
2262 CHECK_CHARSET_GET_ATTR (elt, attrs); 2267 CHECK_CHARSET_GET_ATTR (elt, attrs);
2263 sort_data[i].charset = elt; 2268 sort_data[i].charset = elt;
2264 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); 2269 sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs));
2265 if (i == 0) 2270 if (id < min_id)
2266 min_id = max_id = id;
2267 else if (id < min_id)
2268 min_id = id; 2271 min_id = id;
2269 else if (id > max_id) 2272 if (id > max_id)
2270 max_id = id; 2273 max_id = id;
2271 } 2274 }
2272 for (done = 0, tail = Vcharset_ordered_list, i = 0; 2275 for (done = 0, tail = Vcharset_ordered_list, i = 0;
diff --git a/src/charset.h b/src/charset.h
index 1fc552a5bd3..8c87ffe6c3d 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -358,9 +358,9 @@ extern int emacs_mule_charset[256];
358 358
359#define CHECK_CHARSET_GET_CHARSET(x, charset) \ 359#define CHECK_CHARSET_GET_CHARSET(x, charset) \
360 do { \ 360 do { \
361 int id; \ 361 int csid; \
362 CHECK_CHARSET_GET_ID (x, id); \ 362 CHECK_CHARSET_GET_ID (x, csid); \
363 charset = CHARSET_FROM_ID (id); \ 363 charset = CHARSET_FROM_ID (csid); \
364 } while (0) 364 } while (0)
365 365
366 366
@@ -541,4 +541,3 @@ extern void map_charset_chars (void (*) (Lisp_Object, Lisp_Object),
541 struct charset *, unsigned, unsigned); 541 struct charset *, unsigned, unsigned);
542 542
543#endif /* EMACS_CHARSET_H */ 543#endif /* EMACS_CHARSET_H */
544
diff --git a/src/chartab.c b/src/chartab.c
index cd8aa784eb4..85aa5932ac3 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -118,7 +118,7 @@ char_table_ascii (Lisp_Object table)
118 return XSUB_CHAR_TABLE (sub)->contents[0]; 118 return XSUB_CHAR_TABLE (sub)->contents[0];
119} 119}
120 120
121Lisp_Object 121static Lisp_Object
122copy_sub_char_table (Lisp_Object table) 122copy_sub_char_table (Lisp_Object table)
123{ 123{
124 Lisp_Object copy; 124 Lisp_Object copy;
@@ -216,16 +216,16 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
216 int depth = XINT (tbl->depth); 216 int depth = XINT (tbl->depth);
217 int min_char = XINT (tbl->min_char); 217 int min_char = XINT (tbl->min_char);
218 int max_char = min_char + chartab_chars[depth - 1] - 1; 218 int max_char = min_char + chartab_chars[depth - 1] - 1;
219 int index = CHARTAB_IDX (c, depth, min_char), idx; 219 int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx;
220 Lisp_Object val; 220 Lisp_Object val;
221 221
222 val = tbl->contents[index]; 222 val = tbl->contents[chartab_idx];
223 if (SUB_CHAR_TABLE_P (val)) 223 if (SUB_CHAR_TABLE_P (val))
224 val = sub_char_table_ref_and_range (val, c, from, to, defalt); 224 val = sub_char_table_ref_and_range (val, c, from, to, defalt);
225 else if (NILP (val)) 225 else if (NILP (val))
226 val = defalt; 226 val = defalt;
227 227
228 idx = index; 228 idx = chartab_idx;
229 while (idx > 0 && *from < min_char + idx * chartab_chars[depth]) 229 while (idx > 0 && *from < min_char + idx * chartab_chars[depth])
230 { 230 {
231 Lisp_Object this_val; 231 Lisp_Object this_val;
@@ -244,13 +244,13 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, Lisp
244 break; 244 break;
245 } 245 }
246 } 246 }
247 while ((c = min_char + (index + 1) * chartab_chars[depth]) <= max_char 247 while ((c = min_char + (chartab_idx + 1) * chartab_chars[depth]) <= max_char
248 && *to >= c) 248 && *to >= c)
249 { 249 {
250 Lisp_Object this_val; 250 Lisp_Object this_val;
251 251
252 index++; 252 chartab_idx++;
253 this_val = tbl->contents[index]; 253 this_val = tbl->contents[chartab_idx];
254 if (SUB_CHAR_TABLE_P (this_val)) 254 if (SUB_CHAR_TABLE_P (this_val))
255 this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt); 255 this_val = sub_char_table_ref_and_range (this_val, c, from, to, defalt);
256 else if (NILP (this_val)) 256 else if (NILP (this_val))
@@ -275,10 +275,10 @@ Lisp_Object
275char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to) 275char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
276{ 276{
277 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table); 277 struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
278 int index = CHARTAB_IDX (c, 0, 0), idx; 278 int chartab_idx = CHARTAB_IDX (c, 0, 0), idx;
279 Lisp_Object val; 279 Lisp_Object val;
280 280
281 val = tbl->contents[index]; 281 val = tbl->contents[chartab_idx];
282 if (*from < 0) 282 if (*from < 0)
283 *from = 0; 283 *from = 0;
284 if (*to < 0) 284 if (*to < 0)
@@ -288,7 +288,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
288 else if (NILP (val)) 288 else if (NILP (val))
289 val = tbl->defalt; 289 val = tbl->defalt;
290 290
291 idx = index; 291 idx = chartab_idx;
292 while (*from < idx * chartab_chars[0]) 292 while (*from < idx * chartab_chars[0])
293 { 293 {
294 Lisp_Object this_val; 294 Lisp_Object this_val;
@@ -308,13 +308,13 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
308 break; 308 break;
309 } 309 }
310 } 310 }
311 while (*to >= (index + 1) * chartab_chars[0]) 311 while (*to >= (chartab_idx + 1) * chartab_chars[0])
312 { 312 {
313 Lisp_Object this_val; 313 Lisp_Object this_val;
314 314
315 index++; 315 chartab_idx++;
316 c = index * chartab_chars[0]; 316 c = chartab_idx * chartab_chars[0];
317 this_val = tbl->contents[index]; 317 this_val = tbl->contents[chartab_idx];
318 if (SUB_CHAR_TABLE_P (this_val)) 318 if (SUB_CHAR_TABLE_P (this_val))
319 this_val = sub_char_table_ref_and_range (this_val, c, from, to, 319 this_val = sub_char_table_ref_and_range (this_val, c, from, to,
320 tbl->defalt); 320 tbl->defalt);
@@ -331,20 +331,6 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
331} 331}
332 332
333 333
334#define ASET_RANGE(ARRAY, FROM, TO, LIMIT, VAL) \
335 do { \
336 int limit = (TO) < (LIMIT) ? (TO) : (LIMIT); \
337 for (; (FROM) < limit; (FROM)++) (ARRAY)->contents[(FROM)] = (VAL); \
338 } while (0)
339
340#define GET_SUB_CHAR_TABLE(TABLE, SUBTABLE, IDX, DEPTH, MIN_CHAR) \
341 do { \
342 (SUBTABLE) = (TABLE)->contents[(IDX)]; \
343 if (!SUB_CHAR_TABLE_P (SUBTABLE)) \
344 (SUBTABLE) = make_sub_char_table ((DEPTH), (MIN_CHAR), (SUBTABLE)); \
345 } while (0)
346
347
348static void 334static void
349sub_char_table_set (Lisp_Object table, int c, Lisp_Object val) 335sub_char_table_set (Lisp_Object table, int c, Lisp_Object val)
350{ 336{
@@ -951,7 +937,7 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
951 map_charset_chars. */ 937 map_charset_chars. */
952 938
953void 939void
954map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), 940map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object),
955 Lisp_Object function, Lisp_Object table, Lisp_Object arg, 941 Lisp_Object function, Lisp_Object table, Lisp_Object arg,
956 struct charset *charset, 942 struct charset *charset,
957 unsigned from, unsigned to) 943 unsigned from, unsigned to)
@@ -1012,4 +998,3 @@ syms_of_chartab (void)
1012 defsubr (&Soptimize_char_table); 998 defsubr (&Soptimize_char_table);
1013 defsubr (&Smap_char_table); 999 defsubr (&Smap_char_table);
1014} 1000}
1015
diff --git a/src/cm.c b/src/cm.c
index d4aedad6db4..108ee5720f3 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -199,7 +199,7 @@ calccost (struct tty_display_info *tty,
199 tabx, 199 tabx,
200 tab2x, 200 tab2x,
201 tabcost; 201 tabcost;
202 register char *p; 202 register const char *p;
203 203
204 /* If have just wrapped on a terminal with xn, 204 /* If have just wrapped on a terminal with xn,
205 don't believe the cursor position: give up here 205 don't believe the cursor position: give up here
@@ -330,9 +330,9 @@ cmgoto (struct tty_display_info *tty, int row, int col)
330 llcost, 330 llcost,
331 relcost, 331 relcost,
332 directcost; 332 directcost;
333 int use; 333 int use IF_LINT (= 0);
334 char *p, 334 char *p;
335 *dcm; 335 const char *dcm;
336 336
337 /* First the degenerate case */ 337 /* First the degenerate case */
338 if (row == curY (tty) && col == curX (tty)) /* already there */ 338 if (row == curY (tty) && col == curX (tty)) /* already there */
@@ -460,4 +460,3 @@ Wcm_init (struct tty_display_info *tty)
460 return - 2; 460 return - 2;
461 return 0; 461 return 0;
462} 462}
463
diff --git a/src/cm.h b/src/cm.h
index 7b4bedd4e88..5d430598f0c 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -35,25 +35,25 @@ struct cm
35 int cm_curX; /* Current column */ 35 int cm_curX; /* Current column */
36 36
37 /* Capabilities from termcap */ 37 /* Capabilities from termcap */
38 char *cm_up; /* up (up) */ 38 const char *cm_up; /* up (up) */
39 char *cm_down; /* down (do) */ 39 const char *cm_down; /* down (do) */
40 char *cm_left; /* left (le) */ 40 const char *cm_left; /* left (le) */
41 char *cm_right; /* right (nd) */ 41 const char *cm_right; /* right (nd) */
42 char *cm_home; /* home (ho) */ 42 const char *cm_home; /* home (ho) */
43 char *cm_cr; /* carriage return (cr) */ 43 const char *cm_cr; /* carriage return (cr) */
44 char *cm_ll; /* last line (ll) */ 44 const char *cm_ll; /* last line (ll) */
45 char *cm_tab; /* tab (ta) */ 45 const char *cm_tab; /* tab (ta) */
46 char *cm_backtab; /* backtab (bt) */ 46 const char *cm_backtab; /* backtab (bt) */
47 char *cm_abs; /* absolute (cm) */ 47 char *cm_abs; /* absolute (cm) */
48 char *cm_habs; /* horizontal absolute (ch) */ 48 const char *cm_habs; /* horizontal absolute (ch) */
49 char *cm_vabs; /* vertical absolute (cv) */ 49 const char *cm_vabs; /* vertical absolute (cv) */
50#if 0 50#if 0
51 char *cm_ds; /* "don't send" string (ds) */ 51 const char *cm_ds; /* "don't send" string (ds) */
52#endif 52#endif
53 char *cm_multiup; /* multiple up (UP) */ 53 const char *cm_multiup; /* multiple up (UP) */
54 char *cm_multidown; /* multiple down (DO) */ 54 const char *cm_multidown; /* multiple down (DO) */
55 char *cm_multileft; /* multiple left (LE) */ 55 const char *cm_multileft; /* multiple left (LE) */
56 char *cm_multiright; /* multiple right (RI) */ 56 const char *cm_multiright; /* multiple right (RI) */
57 int cm_cols; /* number of cols on screen (co) */ 57 int cm_cols; /* number of cols on screen (co) */
58 int cm_rows; /* number of rows on screen (li) */ 58 int cm_rows; /* number of rows on screen (li) */
59 int cm_tabwidth; /* tab width (it) */ 59 int cm_tabwidth; /* tab width (it) */
@@ -168,4 +168,3 @@ extern void cmcostinit (struct tty_display_info *);
168extern void cmgoto (struct tty_display_info *, int, int); 168extern void cmgoto (struct tty_display_info *, int, int);
169extern void Wcm_clear (struct tty_display_info *); 169extern void Wcm_clear (struct tty_display_info *);
170extern int Wcm_init (struct tty_display_info *); 170extern int Wcm_init (struct tty_display_info *);
171
diff --git a/src/cmds.c b/src/cmds.c
index 5e6884c0807..fa1ac5028ae 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -485,18 +485,18 @@ internal_self_insert (int c, EMACS_INT n)
485 : (c == ' ' || c == '\n')) 485 : (c == ' ' || c == '\n'))
486 && !NILP (BVAR (current_buffer, auto_fill_function))) 486 && !NILP (BVAR (current_buffer, auto_fill_function)))
487 { 487 {
488 Lisp_Object tem; 488 Lisp_Object auto_fill_result;
489 489
490 if (c == '\n') 490 if (c == '\n')
491 /* After inserting a newline, move to previous line and fill 491 /* After inserting a newline, move to previous line and fill
492 that. Must have the newline in place already so filling and 492 that. Must have the newline in place already so filling and
493 justification, if any, know where the end is going to be. */ 493 justification, if any, know where the end is going to be. */
494 SET_PT_BOTH (PT - 1, PT_BYTE - 1); 494 SET_PT_BOTH (PT - 1, PT_BYTE - 1);
495 tem = call0 (BVAR (current_buffer, auto_fill_function)); 495 auto_fill_result = call0 (BVAR (current_buffer, auto_fill_function));
496 /* Test PT < ZV in case the auto-fill-function is strange. */ 496 /* Test PT < ZV in case the auto-fill-function is strange. */
497 if (c == '\n' && PT < ZV) 497 if (c == '\n' && PT < ZV)
498 SET_PT_BOTH (PT + 1, PT_BYTE + 1); 498 SET_PT_BOTH (PT + 1, PT_BYTE + 1);
499 if (!NILP (tem)) 499 if (!NILP (auto_fill_result))
500 hairy = 2; 500 hairy = 2;
501 } 501 }
502 502
diff --git a/src/coding.c b/src/coding.c
index f6310369ad3..0c2836c19f6 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -395,8 +395,6 @@ Lisp_Object Vbig5_coding_system;
395 395
396/* Control characters of ISO2022. */ 396/* Control characters of ISO2022. */
397 /* code */ /* function */ 397 /* code */ /* function */
398#define ISO_CODE_LF 0x0A /* line-feed */
399#define ISO_CODE_CR 0x0D /* carriage-return */
400#define ISO_CODE_SO 0x0E /* shift-out */ 398#define ISO_CODE_SO 0x0E /* shift-out */
401#define ISO_CODE_SI 0x0F /* shift-in */ 399#define ISO_CODE_SI 0x0F /* shift-in */
402#define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */ 400#define ISO_CODE_SS2_7 0x19 /* single-shift-2 for 7-bit code */
@@ -479,7 +477,7 @@ enum iso_code_class_type
479 477
480#define CODING_ISO_FLAG_COMPOSITION 0x2000 478#define CODING_ISO_FLAG_COMPOSITION 0x2000
481 479
482#define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 480/* #define CODING_ISO_FLAG_EUC_TW_SHIFT 0x4000 */
483 481
484#define CODING_ISO_FLAG_USE_ROMAN 0x8000 482#define CODING_ISO_FLAG_USE_ROMAN 0x8000
485 483
@@ -721,25 +719,6 @@ static struct coding_system coding_categories[coding_category_max];
721 } while (0) 719 } while (0)
722 720
723 721
724#define ONE_MORE_BYTE_NO_CHECK(c) \
725 do { \
726 c = *src++; \
727 if (multibytep && (c & 0x80)) \
728 { \
729 if ((c & 0xFE) == 0xC0) \
730 c = ((c & 1) << 6) | *src++; \
731 else \
732 { \
733 src--; \
734 c = - string_char (src, &src, NULL); \
735 record_conversion_result \
736 (coding, CODING_RESULT_INVALID_SRC); \
737 } \
738 } \
739 consumed_chars++; \
740 } while (0)
741
742
743/* Store a byte C in the place pointed by DST and increment DST to the 722/* Store a byte C in the place pointed by DST and increment DST to the
744 next free point, and increment PRODUCED_CHARS. The caller should 723 next free point, and increment PRODUCED_CHARS. The caller should
745 assure that C is 0..127, and declare and set the variable `dst' 724 assure that C is 0..127, and declare and set the variable `dst'
@@ -1051,9 +1030,10 @@ coding_set_source (struct coding_system *coding)
1051 coding->source = SDATA (coding->src_object) + coding->src_pos_byte; 1030 coding->source = SDATA (coding->src_object) + coding->src_pos_byte;
1052 } 1031 }
1053 else 1032 else
1054 /* Otherwise, the source is C string and is never relocated 1033 {
1055 automatically. Thus we don't have to update anything. */ 1034 /* Otherwise, the source is C string and is never relocated
1056 ; 1035 automatically. Thus we don't have to update anything. */
1036 }
1057} 1037}
1058 1038
1059static void 1039static void
@@ -1079,9 +1059,10 @@ coding_set_destination (struct coding_system *coding)
1079 } 1059 }
1080 } 1060 }
1081 else 1061 else
1082 /* Otherwise, the destination is C string and is never relocated 1062 {
1083 automatically. Thus we don't have to update anything. */ 1063 /* Otherwise, the destination is C string and is never relocated
1084 ; 1064 automatically. Thus we don't have to update anything. */
1065 }
1085} 1066}
1086 1067
1087 1068
@@ -1217,7 +1198,6 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1217#define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0) 1198#define UTF_8_4_OCTET_LEADING_P(c) (((c) & 0xF8) == 0xF0)
1218#define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8) 1199#define UTF_8_5_OCTET_LEADING_P(c) (((c) & 0xFC) == 0xF8)
1219 1200
1220#define UTF_BOM 0xFEFF
1221#define UTF_8_BOM_1 0xEF 1201#define UTF_8_BOM_1 0xEF
1222#define UTF_8_BOM_2 0xBB 1202#define UTF_8_BOM_2 0xBB
1223#define UTF_8_BOM_3 0xBF 1203#define UTF_8_BOM_3 0xBF
@@ -1318,7 +1298,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1318 int multibytep = coding->src_multibyte; 1298 int multibytep = coding->src_multibyte;
1319 enum utf_bom_type bom = CODING_UTF_8_BOM (coding); 1299 enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
1320 Lisp_Object attr, charset_list; 1300 Lisp_Object attr, charset_list;
1321 int eol_crlf = 1301 int eol_dos =
1322 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 1302 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
1323 int byte_after_cr = -1; 1303 int byte_after_cr = -1;
1324 1304
@@ -1379,7 +1359,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1379 } 1359 }
1380 else if (UTF_8_1_OCTET_P (c1)) 1360 else if (UTF_8_1_OCTET_P (c1))
1381 { 1361 {
1382 if (eol_crlf && c1 == '\r') 1362 if (eol_dos && c1 == '\r')
1383 ONE_MORE_BYTE (byte_after_cr); 1363 ONE_MORE_BYTE (byte_after_cr);
1384 c = c1; 1364 c = c1;
1385 } 1365 }
@@ -1533,11 +1513,6 @@ encode_coding_utf_8 (struct coding_system *coding)
1533#define UTF_16_LOW_SURROGATE_P(val) \ 1513#define UTF_16_LOW_SURROGATE_P(val) \
1534 (((val) & 0xFC00) == 0xDC00) 1514 (((val) & 0xFC00) == 0xDC00)
1535 1515
1536#define UTF_16_INVALID_P(val) \
1537 (((val) == 0xFFFE) \
1538 || ((val) == 0xFFFF) \
1539 || UTF_16_LOW_SURROGATE_P (val))
1540
1541 1516
1542static int 1517static int
1543detect_coding_utf_16 (struct coding_system *coding, 1518detect_coding_utf_16 (struct coding_system *coding,
@@ -1637,7 +1612,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1637 enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); 1612 enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
1638 int surrogate = CODING_UTF_16_SURROGATE (coding); 1613 int surrogate = CODING_UTF_16_SURROGATE (coding);
1639 Lisp_Object attr, charset_list; 1614 Lisp_Object attr, charset_list;
1640 int eol_crlf = 1615 int eol_dos =
1641 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 1616 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
1642 int byte_after_cr1 = -1, byte_after_cr2 = -1; 1617 int byte_after_cr1 = -1, byte_after_cr2 = -1;
1643 1618
@@ -1734,7 +1709,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1734 CODING_UTF_16_SURROGATE (coding) = surrogate = c; 1709 CODING_UTF_16_SURROGATE (coding) = surrogate = c;
1735 else 1710 else
1736 { 1711 {
1737 if (eol_crlf && c == '\r') 1712 if (eol_dos && c == '\r')
1738 { 1713 {
1739 ONE_MORE_BYTE (byte_after_cr1); 1714 ONE_MORE_BYTE (byte_after_cr1);
1740 ONE_MORE_BYTE (byte_after_cr2); 1715 ONE_MORE_BYTE (byte_after_cr2);
@@ -1918,17 +1893,17 @@ detect_coding_emacs_mule (struct coding_system *coding,
1918 it because analyzing it is too heavy for detecting. But, 1893 it because analyzing it is too heavy for detecting. But,
1919 at least, we check that the composite character 1894 at least, we check that the composite character
1920 constitutes of more than 4 bytes. */ 1895 constitutes of more than 4 bytes. */
1921 const unsigned char *src_base; 1896 const unsigned char *src_start;
1922 1897
1923 repeat: 1898 repeat:
1924 src_base = src; 1899 src_start = src;
1925 do 1900 do
1926 { 1901 {
1927 ONE_MORE_BYTE (c); 1902 ONE_MORE_BYTE (c);
1928 } 1903 }
1929 while (c >= 0xA0); 1904 while (c >= 0xA0);
1930 1905
1931 if (src - src_base <= 4) 1906 if (src - src_start <= 4)
1932 break; 1907 break;
1933 found = CATEGORY_MASK_EMACS_MULE; 1908 found = CATEGORY_MASK_EMACS_MULE;
1934 if (c == 0x80) 1909 if (c == 0x80)
@@ -1980,7 +1955,7 @@ detect_coding_emacs_mule (struct coding_system *coding,
1980 the decoded character or rule. If an invalid byte is found, return 1955 the decoded character or rule. If an invalid byte is found, return
1981 -1. If SRC is too short, return -2. */ 1956 -1. If SRC is too short, return -2. */
1982 1957
1983int 1958static int
1984emacs_mule_char (struct coding_system *coding, const unsigned char *src, 1959emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1985 int *nbytes, int *nchars, int *id, 1960 int *nbytes, int *nchars, int *id,
1986 struct composition_status *cmp_status) 1961 struct composition_status *cmp_status)
@@ -1988,7 +1963,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1988 const unsigned char *src_end = coding->source + coding->src_bytes; 1963 const unsigned char *src_end = coding->source + coding->src_bytes;
1989 const unsigned char *src_base = src; 1964 const unsigned char *src_base = src;
1990 int multibytep = coding->src_multibyte; 1965 int multibytep = coding->src_multibyte;
1991 int charset_id; 1966 int charset_ID;
1992 unsigned code; 1967 unsigned code;
1993 int c; 1968 int c;
1994 int consumed_chars = 0; 1969 int consumed_chars = 0;
@@ -1998,7 +1973,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
1998 if (c < 0) 1973 if (c < 0)
1999 { 1974 {
2000 c = -c; 1975 c = -c;
2001 charset_id = emacs_mule_charset[0]; 1976 charset_ID = emacs_mule_charset[0];
2002 } 1977 }
2003 else 1978 else
2004 { 1979 {
@@ -2034,7 +2009,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2034 switch (emacs_mule_bytes[c]) 2009 switch (emacs_mule_bytes[c])
2035 { 2010 {
2036 case 2: 2011 case 2:
2037 if ((charset_id = emacs_mule_charset[c]) < 0) 2012 if ((charset_ID = emacs_mule_charset[c]) < 0)
2038 goto invalid_code; 2013 goto invalid_code;
2039 ONE_MORE_BYTE (c); 2014 ONE_MORE_BYTE (c);
2040 if (c < 0xA0) 2015 if (c < 0xA0)
@@ -2047,7 +2022,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2047 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) 2022 || c == EMACS_MULE_LEADING_CODE_PRIVATE_12)
2048 { 2023 {
2049 ONE_MORE_BYTE (c); 2024 ONE_MORE_BYTE (c);
2050 if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) 2025 if (c < 0xA0 || (charset_ID = emacs_mule_charset[c]) < 0)
2051 goto invalid_code; 2026 goto invalid_code;
2052 ONE_MORE_BYTE (c); 2027 ONE_MORE_BYTE (c);
2053 if (c < 0xA0) 2028 if (c < 0xA0)
@@ -2056,7 +2031,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2056 } 2031 }
2057 else 2032 else
2058 { 2033 {
2059 if ((charset_id = emacs_mule_charset[c]) < 0) 2034 if ((charset_ID = emacs_mule_charset[c]) < 0)
2060 goto invalid_code; 2035 goto invalid_code;
2061 ONE_MORE_BYTE (c); 2036 ONE_MORE_BYTE (c);
2062 if (c < 0xA0) 2037 if (c < 0xA0)
@@ -2071,7 +2046,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2071 2046
2072 case 4: 2047 case 4:
2073 ONE_MORE_BYTE (c); 2048 ONE_MORE_BYTE (c);
2074 if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) 2049 if (c < 0 || (charset_ID = emacs_mule_charset[c]) < 0)
2075 goto invalid_code; 2050 goto invalid_code;
2076 ONE_MORE_BYTE (c); 2051 ONE_MORE_BYTE (c);
2077 if (c < 0xA0) 2052 if (c < 0xA0)
@@ -2085,21 +2060,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2085 2060
2086 case 1: 2061 case 1:
2087 code = c; 2062 code = c;
2088 charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; 2063 charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit;
2089 break; 2064 break;
2090 2065
2091 default: 2066 default:
2092 abort (); 2067 abort ();
2093 } 2068 }
2094 CODING_DECODE_CHAR (coding, src, src_base, src_end, 2069 CODING_DECODE_CHAR (coding, src, src_base, src_end,
2095 CHARSET_FROM_ID (charset_id), code, c); 2070 CHARSET_FROM_ID (charset_ID), code, c);
2096 if (c < 0) 2071 if (c < 0)
2097 goto invalid_code; 2072 goto invalid_code;
2098 } 2073 }
2099 *nbytes = src - src_base; 2074 *nbytes = src - src_base;
2100 *nchars = consumed_chars; 2075 *nchars = consumed_chars;
2101 if (id) 2076 if (id)
2102 *id = charset_id; 2077 *id = charset_ID;
2103 return (mseq_found ? -c : c); 2078 return (mseq_found ? -c : c);
2104 2079
2105 no_more_source: 2080 no_more_source:
@@ -2372,7 +2347,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2372 int char_offset = coding->produced_char; 2347 int char_offset = coding->produced_char;
2373 int last_offset = char_offset; 2348 int last_offset = char_offset;
2374 int last_id = charset_ascii; 2349 int last_id = charset_ascii;
2375 int eol_crlf = 2350 int eol_dos =
2376 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 2351 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
2377 int byte_after_cr = -1; 2352 int byte_after_cr = -1;
2378 struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; 2353 struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status;
@@ -2390,7 +2365,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2390 2365
2391 while (1) 2366 while (1)
2392 { 2367 {
2393 int c, id; 2368 int c, id IF_LINT (= 0);
2394 2369
2395 src_base = src; 2370 src_base = src;
2396 consumed_chars_base = consumed_chars; 2371 consumed_chars_base = consumed_chars;
@@ -2422,7 +2397,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2422 2397
2423 if (c < 0x80) 2398 if (c < 0x80)
2424 { 2399 {
2425 if (eol_crlf && c == '\r') 2400 if (eol_dos && c == '\r')
2426 ONE_MORE_BYTE (byte_after_cr); 2401 ONE_MORE_BYTE (byte_after_cr);
2427 id = charset_ascii; 2402 id = charset_ascii;
2428 if (cmp_status->state != COMPOSING_NO) 2403 if (cmp_status->state != COMPOSING_NO)
@@ -2435,7 +2410,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2435 } 2410 }
2436 else 2411 else
2437 { 2412 {
2438 int nchars, nbytes; 2413 int nchars IF_LINT (= 0), nbytes IF_LINT (= 0);
2439 /* emacs_mule_char can load a charset map from a file, which 2414 /* emacs_mule_char can load a charset map from a file, which
2440 allocates a large structure and might cause buffer text 2415 allocates a large structure and might cause buffer text
2441 to be relocated as result. Thus, we need to remember the 2416 to be relocated as result. Thus, we need to remember the
@@ -2903,10 +2878,6 @@ enum iso_code_class_type iso_code_class[256];
2903 ((id) <= (coding)->max_charset_id \ 2878 ((id) <= (coding)->max_charset_id \
2904 && (coding)->safe_charsets[id] != 255) 2879 && (coding)->safe_charsets[id] != 255)
2905 2880
2906
2907#define SHIFT_OUT_OK(category) \
2908 (CODING_ISO_INITIAL (&coding_categories[category], 1) >= 0)
2909
2910static void 2881static void
2911setup_iso_safe_charsets (Lisp_Object attrs) 2882setup_iso_safe_charsets (Lisp_Object attrs)
2912{ 2883{
@@ -3023,40 +2994,11 @@ detect_coding_iso_2022 (struct coding_system *coding,
3023 break; 2994 break;
3024 single_shifting = 0; 2995 single_shifting = 0;
3025 ONE_MORE_BYTE (c); 2996 ONE_MORE_BYTE (c);
3026 if (c >= '(' && c <= '/') 2997 if (c == 'N' || c == 'O')
3027 {
3028 /* Designation sequence for a charset of dimension 1. */
3029 ONE_MORE_BYTE (c1);
3030 if (c1 < ' ' || c1 >= 0x80
3031 || (id = iso_charset_table[0][c >= ','][c1]) < 0)
3032 /* Invalid designation sequence. Just ignore. */
3033 break;
3034 }
3035 else if (c == '$')
3036 {
3037 /* Designation sequence for a charset of dimension 2. */
3038 ONE_MORE_BYTE (c);
3039 if (c >= '@' && c <= 'B')
3040 /* Designation for JISX0208.1978, GB2312, or JISX0208. */
3041 id = iso_charset_table[1][0][c];
3042 else if (c >= '(' && c <= '/')
3043 {
3044 ONE_MORE_BYTE (c1);
3045 if (c1 < ' ' || c1 >= 0x80
3046 || (id = iso_charset_table[1][c >= ','][c1]) < 0)
3047 /* Invalid designation sequence. Just ignore. */
3048 break;
3049 }
3050 else
3051 /* Invalid designation sequence. Just ignore it. */
3052 break;
3053 }
3054 else if (c == 'N' || c == 'O')
3055 { 2998 {
3056 /* ESC <Fe> for SS2 or SS3. */ 2999 /* ESC <Fe> for SS2 or SS3. */
3057 single_shifting = 1; 3000 single_shifting = 1;
3058 rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_8BIT; 3001 rejected |= CATEGORY_MASK_ISO_7BIT | CATEGORY_MASK_ISO_8BIT;
3059 break;
3060 } 3002 }
3061 else if (c == '1') 3003 else if (c == '1')
3062 { 3004 {
@@ -3072,36 +3014,66 @@ detect_coding_iso_2022 (struct coding_system *coding,
3072 { 3014 {
3073 /* ESC <Fp> for start/end composition. */ 3015 /* ESC <Fp> for start/end composition. */
3074 composition_count = 0; 3016 composition_count = 0;
3075 break;
3076 } 3017 }
3077 else 3018 else
3078 { 3019 {
3079 /* Invalid escape sequence. Just ignore it. */ 3020 if (c >= '(' && c <= '/')
3080 break; 3021 {
3081 } 3022 /* Designation sequence for a charset of dimension 1. */
3023 ONE_MORE_BYTE (c1);
3024 if (c1 < ' ' || c1 >= 0x80
3025 || (id = iso_charset_table[0][c >= ','][c1]) < 0)
3026 /* Invalid designation sequence. Just ignore. */
3027 break;
3028 }
3029 else if (c == '$')
3030 {
3031 /* Designation sequence for a charset of dimension 2. */
3032 ONE_MORE_BYTE (c);
3033 if (c >= '@' && c <= 'B')
3034 /* Designation for JISX0208.1978, GB2312, or JISX0208. */
3035 id = iso_charset_table[1][0][c];
3036 else if (c >= '(' && c <= '/')
3037 {
3038 ONE_MORE_BYTE (c1);
3039 if (c1 < ' ' || c1 >= 0x80
3040 || (id = iso_charset_table[1][c >= ','][c1]) < 0)
3041 /* Invalid designation sequence. Just ignore. */
3042 break;
3043 }
3044 else
3045 /* Invalid designation sequence. Just ignore it. */
3046 break;
3047 }
3048 else
3049 {
3050 /* Invalid escape sequence. Just ignore it. */
3051 break;
3052 }
3082 3053
3083 /* We found a valid designation sequence for CHARSET. */ 3054 /* We found a valid designation sequence for CHARSET. */
3084 rejected |= CATEGORY_MASK_ISO_8BIT; 3055 rejected |= CATEGORY_MASK_ISO_8BIT;
3085 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7], 3056 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7],
3086 id)) 3057 id))
3087 found |= CATEGORY_MASK_ISO_7; 3058 found |= CATEGORY_MASK_ISO_7;
3088 else 3059 else
3089 rejected |= CATEGORY_MASK_ISO_7; 3060 rejected |= CATEGORY_MASK_ISO_7;
3090 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight], 3061 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_tight],
3091 id)) 3062 id))
3092 found |= CATEGORY_MASK_ISO_7_TIGHT; 3063 found |= CATEGORY_MASK_ISO_7_TIGHT;
3093 else 3064 else
3094 rejected |= CATEGORY_MASK_ISO_7_TIGHT; 3065 rejected |= CATEGORY_MASK_ISO_7_TIGHT;
3095 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else], 3066 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_7_else],
3096 id)) 3067 id))
3097 found |= CATEGORY_MASK_ISO_7_ELSE; 3068 found |= CATEGORY_MASK_ISO_7_ELSE;
3098 else 3069 else
3099 rejected |= CATEGORY_MASK_ISO_7_ELSE; 3070 rejected |= CATEGORY_MASK_ISO_7_ELSE;
3100 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else], 3071 if (SAFE_CHARSET_P (&coding_categories[coding_category_iso_8_else],
3101 id)) 3072 id))
3102 found |= CATEGORY_MASK_ISO_8_ELSE; 3073 found |= CATEGORY_MASK_ISO_8_ELSE;
3103 else 3074 else
3104 rejected |= CATEGORY_MASK_ISO_8_ELSE; 3075 rejected |= CATEGORY_MASK_ISO_8_ELSE;
3076 }
3105 break; 3077 break;
3106 3078
3107 case ISO_CODE_SO: 3079 case ISO_CODE_SO:
@@ -3129,13 +3101,32 @@ detect_coding_iso_2022 (struct coding_system *coding,
3129 rejected |= CATEGORY_MASK_ISO_7BIT; 3101 rejected |= CATEGORY_MASK_ISO_7BIT;
3130 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) 3102 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
3131 & CODING_ISO_FLAG_SINGLE_SHIFT) 3103 & CODING_ISO_FLAG_SINGLE_SHIFT)
3132 found |= CATEGORY_MASK_ISO_8_1, single_shifting = 1; 3104 {
3105 found |= CATEGORY_MASK_ISO_8_1;
3106 single_shifting = 1;
3107 }
3133 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) 3108 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2])
3134 & CODING_ISO_FLAG_SINGLE_SHIFT) 3109 & CODING_ISO_FLAG_SINGLE_SHIFT)
3135 found |= CATEGORY_MASK_ISO_8_2, single_shifting = 1; 3110 {
3111 found |= CATEGORY_MASK_ISO_8_2;
3112 single_shifting = 1;
3113 }
3136 if (single_shifting) 3114 if (single_shifting)
3137 break; 3115 break;
3138 goto check_extra_latin; 3116 check_extra_latin:
3117 if (! VECTORP (Vlatin_extra_code_table)
3118 || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))
3119 {
3120 rejected = CATEGORY_MASK_ISO;
3121 break;
3122 }
3123 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
3124 & CODING_ISO_FLAG_LATIN_EXTRA)
3125 found |= CATEGORY_MASK_ISO_8_1;
3126 else
3127 rejected |= CATEGORY_MASK_ISO_8_1;
3128 rejected |= CATEGORY_MASK_ISO_8_2;
3129 break;
3139 3130
3140 default: 3131 default:
3141 if (c < 0) 3132 if (c < 0)
@@ -3158,7 +3149,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
3158 if (! single_shifting 3149 if (! single_shifting
3159 && ! (rejected & CATEGORY_MASK_ISO_8_2)) 3150 && ! (rejected & CATEGORY_MASK_ISO_8_2))
3160 { 3151 {
3161 int i = 1; 3152 int len = 1;
3162 while (src < src_end) 3153 while (src < src_end)
3163 { 3154 {
3164 src_base = src; 3155 src_base = src;
@@ -3168,38 +3159,24 @@ detect_coding_iso_2022 (struct coding_system *coding,
3168 src = src_base; 3159 src = src_base;
3169 break; 3160 break;
3170 } 3161 }
3171 i++; 3162 len++;
3172 } 3163 }
3173 3164
3174 if (i & 1 && src < src_end) 3165 if (len & 1 && src < src_end)
3175 { 3166 {
3176 rejected |= CATEGORY_MASK_ISO_8_2; 3167 rejected |= CATEGORY_MASK_ISO_8_2;
3177 if (composition_count >= 0) 3168 if (composition_count >= 0)
3178 composition_count += i; 3169 composition_count += len;
3179 } 3170 }
3180 else 3171 else
3181 { 3172 {
3182 found |= CATEGORY_MASK_ISO_8_2; 3173 found |= CATEGORY_MASK_ISO_8_2;
3183 if (composition_count >= 0) 3174 if (composition_count >= 0)
3184 composition_count += i / 2; 3175 composition_count += len / 2;
3185 } 3176 }
3186 } 3177 }
3187 break; 3178 break;
3188 } 3179 }
3189 check_extra_latin:
3190 single_shifting = 0;
3191 if (! VECTORP (Vlatin_extra_code_table)
3192 || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))
3193 {
3194 rejected = CATEGORY_MASK_ISO;
3195 break;
3196 }
3197 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
3198 & CODING_ISO_FLAG_LATIN_EXTRA)
3199 found |= CATEGORY_MASK_ISO_8_1;
3200 else
3201 rejected |= CATEGORY_MASK_ISO_8_1;
3202 rejected |= CATEGORY_MASK_ISO_8_2;
3203 } 3180 }
3204 } 3181 }
3205 detect_info->rejected |= CATEGORY_MASK_ISO; 3182 detect_info->rejected |= CATEGORY_MASK_ISO;
@@ -3309,10 +3286,10 @@ detect_coding_iso_2022 (struct coding_system *coding,
3309 } \ 3286 } \
3310 else /* new format (after ver.21) */ \ 3287 else /* new format (after ver.21) */ \
3311 { \ 3288 { \
3312 int c; \ 3289 int b; \
3313 \ 3290 \
3314 ONE_MORE_BYTE (c); \ 3291 ONE_MORE_BYTE (b); \
3315 rule = COMPOSITION_ENCODE_RULE (rule - 81, c - 32); \ 3292 rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \
3316 if (rule >= 0) \ 3293 if (rule >= 0) \
3317 rule += 0x100; /* to destinguish it from the old format */ \ 3294 rule += 0x100; /* to destinguish it from the old format */ \
3318 nbytes = 2; \ 3295 nbytes = 2; \
@@ -3504,7 +3481,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3504 int char_offset = coding->produced_char; 3481 int char_offset = coding->produced_char;
3505 int last_offset = char_offset; 3482 int last_offset = char_offset;
3506 int last_id = charset_ascii; 3483 int last_id = charset_ascii;
3507 int eol_crlf = 3484 int eol_dos =
3508 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 3485 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
3509 int byte_after_cr = -1; 3486 int byte_after_cr = -1;
3510 int i; 3487 int i;
@@ -3624,7 +3601,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3624 break; 3601 break;
3625 3602
3626 case ISO_control_0: 3603 case ISO_control_0:
3627 if (eol_crlf && c1 == '\r') 3604 if (eol_dos && c1 == '\r')
3628 ONE_MORE_BYTE (byte_after_cr); 3605 ONE_MORE_BYTE (byte_after_cr);
3629 MAYBE_FINISH_COMPOSITION (); 3606 MAYBE_FINISH_COMPOSITION ();
3630 charset = CHARSET_FROM_ID (charset_ascii); 3607 charset = CHARSET_FROM_ID (charset_ascii);
@@ -3897,6 +3874,10 @@ decode_coding_iso_2022 (struct coding_system *coding)
3897 } 3874 }
3898 continue; 3875 continue;
3899 } 3876 }
3877 break;
3878
3879 default:
3880 abort ();
3900 } 3881 }
3901 3882
3902 if (cmp_status->state == COMPOSING_NO 3883 if (cmp_status->state == COMPOSING_NO
@@ -4029,7 +4010,6 @@ decode_coding_iso_2022 (struct coding_system *coding)
4029 const char *intermediate_char_94 = "()*+"; \ 4010 const char *intermediate_char_94 = "()*+"; \
4030 const char *intermediate_char_96 = ",-./"; \ 4011 const char *intermediate_char_96 = ",-./"; \
4031 int revision = -1; \ 4012 int revision = -1; \
4032 int c; \
4033 \ 4013 \
4034 if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ 4014 if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \
4035 revision = CHARSET_ISO_REVISION (charset); \ 4015 revision = CHARSET_ISO_REVISION (charset); \
@@ -4042,11 +4022,12 @@ decode_coding_iso_2022 (struct coding_system *coding)
4042 EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ 4022 EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \
4043 if (CHARSET_DIMENSION (charset) == 1) \ 4023 if (CHARSET_DIMENSION (charset) == 1) \
4044 { \ 4024 { \
4025 int b; \
4045 if (! CHARSET_ISO_CHARS_96 (charset)) \ 4026 if (! CHARSET_ISO_CHARS_96 (charset)) \
4046 c = intermediate_char_94[reg]; \ 4027 b = intermediate_char_94[reg]; \
4047 else \ 4028 else \
4048 c = intermediate_char_96[reg]; \ 4029 b = intermediate_char_96[reg]; \
4049 EMIT_ONE_ASCII_BYTE (c); \ 4030 EMIT_ONE_ASCII_BYTE (b); \
4050 } \ 4031 } \
4051 else \ 4032 else \
4052 { \ 4033 { \
@@ -4226,7 +4207,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
4226 to use CHARSET. The element `spec.iso_2022' of *CODING is updated. 4207 to use CHARSET. The element `spec.iso_2022' of *CODING is updated.
4227 Return new DST. */ 4208 Return new DST. */
4228 4209
4229unsigned char * 4210static unsigned char *
4230encode_invocation_designation (struct charset *charset, 4211encode_invocation_designation (struct charset *charset,
4231 struct coding_system *coding, 4212 struct coding_system *coding,
4232 unsigned char *dst, int *p_nchars) 4213 unsigned char *dst, int *p_nchars)
@@ -4289,30 +4270,6 @@ encode_invocation_designation (struct charset *charset,
4289 return dst; 4270 return dst;
4290} 4271}
4291 4272
4292/* The following three macros produce codes for indicating direction
4293 of text. */
4294#define ENCODE_CONTROL_SEQUENCE_INTRODUCER \
4295 do { \
4296 if (CODING_ISO_FLAGS (coding) == CODING_ISO_FLAG_SEVEN_BITS) \
4297 EMIT_TWO_ASCII_BYTES (ISO_CODE_ESC, '['); \
4298 else \
4299 EMIT_ONE_BYTE (ISO_CODE_CSI); \
4300 } while (0)
4301
4302
4303#define ENCODE_DIRECTION_R2L() \
4304 do { \
4305 ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \
4306 EMIT_TWO_ASCII_BYTES ('2', ']'); \
4307 } while (0)
4308
4309
4310#define ENCODE_DIRECTION_L2R() \
4311 do { \
4312 ENCODE_CONTROL_SEQUENCE_INTRODUCER (dst); \
4313 EMIT_TWO_ASCII_BYTES ('0', ']'); \
4314 } while (0)
4315
4316 4273
4317/* Produce codes for designation and invocation to reset the graphic 4274/* Produce codes for designation and invocation to reset the graphic
4318 planes and registers to initial state. */ 4275 planes and registers to initial state. */
@@ -4707,7 +4664,7 @@ decode_coding_sjis (struct coding_system *coding)
4707 int char_offset = coding->produced_char; 4664 int char_offset = coding->produced_char;
4708 int last_offset = char_offset; 4665 int last_offset = char_offset;
4709 int last_id = charset_ascii; 4666 int last_id = charset_ascii;
4710 int eol_crlf = 4667 int eol_dos =
4711 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 4668 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
4712 int byte_after_cr = -1; 4669 int byte_after_cr = -1;
4713 4670
@@ -4742,7 +4699,7 @@ decode_coding_sjis (struct coding_system *coding)
4742 goto invalid_code; 4699 goto invalid_code;
4743 if (c < 0x80) 4700 if (c < 0x80)
4744 { 4701 {
4745 if (eol_crlf && c == '\r') 4702 if (eol_dos && c == '\r')
4746 ONE_MORE_BYTE (byte_after_cr); 4703 ONE_MORE_BYTE (byte_after_cr);
4747 charset = charset_roman; 4704 charset = charset_roman;
4748 } 4705 }
@@ -4824,7 +4781,7 @@ decode_coding_big5 (struct coding_system *coding)
4824 int char_offset = coding->produced_char; 4781 int char_offset = coding->produced_char;
4825 int last_offset = char_offset; 4782 int last_offset = char_offset;
4826 int last_id = charset_ascii; 4783 int last_id = charset_ascii;
4827 int eol_crlf = 4784 int eol_dos =
4828 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 4785 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
4829 int byte_after_cr = -1; 4786 int byte_after_cr = -1;
4830 4787
@@ -4857,7 +4814,7 @@ decode_coding_big5 (struct coding_system *coding)
4857 goto invalid_code; 4814 goto invalid_code;
4858 if (c < 0x80) 4815 if (c < 0x80)
4859 { 4816 {
4860 if (eol_crlf && c == '\r') 4817 if (eol_dos && c == '\r')
4861 ONE_MORE_BYTE (byte_after_cr); 4818 ONE_MORE_BYTE (byte_after_cr);
4862 charset = charset_roman; 4819 charset = charset_roman;
4863 } 4820 }
@@ -5261,13 +5218,13 @@ encode_coding_ccl (struct coding_system *coding)
5261static void 5218static void
5262decode_coding_raw_text (struct coding_system *coding) 5219decode_coding_raw_text (struct coding_system *coding)
5263{ 5220{
5264 int eol_crlf = 5221 int eol_dos =
5265 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 5222 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
5266 5223
5267 coding->chars_at_source = 1; 5224 coding->chars_at_source = 1;
5268 coding->consumed_char = coding->src_chars; 5225 coding->consumed_char = coding->src_chars;
5269 coding->consumed = coding->src_bytes; 5226 coding->consumed = coding->src_bytes;
5270 if (eol_crlf && coding->source[coding->src_bytes - 1] == '\r') 5227 if (eol_dos && coding->source[coding->src_bytes - 1] == '\r')
5271 { 5228 {
5272 coding->consumed_char--; 5229 coding->consumed_char--;
5273 coding->consumed--; 5230 coding->consumed--;
@@ -5480,7 +5437,7 @@ decode_coding_charset (struct coding_system *coding)
5480 int char_offset = coding->produced_char; 5437 int char_offset = coding->produced_char;
5481 int last_offset = char_offset; 5438 int last_offset = char_offset;
5482 int last_id = charset_ascii; 5439 int last_id = charset_ascii;
5483 int eol_crlf = 5440 int eol_dos =
5484 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); 5441 !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
5485 int byte_after_cr = -1; 5442 int byte_after_cr = -1;
5486 5443
@@ -5514,7 +5471,7 @@ decode_coding_charset (struct coding_system *coding)
5514 else 5471 else
5515 { 5472 {
5516 ONE_MORE_BYTE (c); 5473 ONE_MORE_BYTE (c);
5517 if (eol_crlf && c == '\r') 5474 if (eol_dos && c == '\r')
5518 ONE_MORE_BYTE (byte_after_cr); 5475 ONE_MORE_BYTE (byte_after_cr);
5519 } 5476 }
5520 if (c < 0) 5477 if (c < 0)
@@ -6607,15 +6564,15 @@ get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
6607 } 6564 }
6608 else if (CONSP (translation_table)) 6565 else if (CONSP (translation_table))
6609 { 6566 {
6610 Lisp_Object tail, val; 6567 Lisp_Object tail;
6611 6568
6612 for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) 6569 for (tail = translation_table; CONSP (tail); tail = XCDR (tail))
6613 if (CHAR_TABLE_P (XCAR (tail)) 6570 if (CHAR_TABLE_P (XCAR (tail))
6614 && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) 6571 && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1)
6615 { 6572 {
6616 val = XCHAR_TABLE (XCAR (tail))->extras[1]; 6573 Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1];
6617 if (NATNUMP (val) && *max_lookup < XFASTINT (val)) 6574 if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval))
6618 *max_lookup = XFASTINT (val); 6575 *max_lookup = XFASTINT (tailval);
6619 } 6576 }
6620 } 6577 }
6621 } 6578 }
@@ -7652,12 +7609,12 @@ decode_coding_object (struct coding_system *coding,
7652 Lisp_Object dst_object) 7609 Lisp_Object dst_object)
7653{ 7610{
7654 int count = SPECPDL_INDEX (); 7611 int count = SPECPDL_INDEX ();
7655 unsigned char *destination; 7612 unsigned char *destination IF_LINT (= NULL);
7656 EMACS_INT dst_bytes; 7613 EMACS_INT dst_bytes IF_LINT (= 0);
7657 EMACS_INT chars = to - from; 7614 EMACS_INT chars = to - from;
7658 EMACS_INT bytes = to_byte - from_byte; 7615 EMACS_INT bytes = to_byte - from_byte;
7659 Lisp_Object attrs; 7616 Lisp_Object attrs;
7660 int saved_pt = -1, saved_pt_byte; 7617 int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
7661 int need_marker_adjustment = 0; 7618 int need_marker_adjustment = 0;
7662 Lisp_Object old_deactivate_mark; 7619 Lisp_Object old_deactivate_mark;
7663 7620
@@ -7845,7 +7802,7 @@ encode_coding_object (struct coding_system *coding,
7845 EMACS_INT chars = to - from; 7802 EMACS_INT chars = to - from;
7846 EMACS_INT bytes = to_byte - from_byte; 7803 EMACS_INT bytes = to_byte - from_byte;
7847 Lisp_Object attrs; 7804 Lisp_Object attrs;
7848 int saved_pt = -1, saved_pt_byte; 7805 int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
7849 int need_marker_adjustment = 0; 7806 int need_marker_adjustment = 0;
7850 int kill_src_buffer = 0; 7807 int kill_src_buffer = 0;
7851 Lisp_Object old_deactivate_mark; 7808 Lisp_Object old_deactivate_mark;
@@ -8178,8 +8135,8 @@ detect_coding_system (const unsigned char *src,
8178 base_category = XINT (CODING_ATTR_CATEGORY (attrs)); 8135 base_category = XINT (CODING_ATTR_CATEGORY (attrs));
8179 if (base_category == coding_category_undecided) 8136 if (base_category == coding_category_undecided)
8180 { 8137 {
8181 enum coding_category category; 8138 enum coding_category category IF_LINT (= 0);
8182 struct coding_system *this; 8139 struct coding_system *this IF_LINT (= NULL);
8183 int c, i; 8140 int c, i;
8184 8141
8185 /* Skip all ASCII bytes except for a few ISO2022 controls. */ 8142 /* Skip all ASCII bytes except for a few ISO2022 controls. */
@@ -9112,10 +9069,10 @@ Return the corresponding character. */)
9112 } 9069 }
9113 else 9070 else
9114 { 9071 {
9115 int s1 = c >> 8, s2 = c & 0xFF; 9072 int c1 = c >> 8, c2 = c & 0xFF;
9116 9073
9117 if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF 9074 if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF
9118 || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) 9075 || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC)
9119 error ("Invalid code: %d", code); 9076 error ("Invalid code: %d", code);
9120 SJIS_TO_JIS (c); 9077 SJIS_TO_JIS (c);
9121 charset = charset_kanji; 9078 charset = charset_kanji;
@@ -9798,7 +9755,6 @@ usage: (define-coding-system-internal ...) */)
9798 else if (EQ (coding_type, Qiso_2022)) 9755 else if (EQ (coding_type, Qiso_2022))
9799 { 9756 {
9800 Lisp_Object initial, reg_usage, request, flags; 9757 Lisp_Object initial, reg_usage, request, flags;
9801 int i;
9802 9758
9803 if (nargs < coding_arg_iso2022_max) 9759 if (nargs < coding_arg_iso2022_max)
9804 goto short_args; 9760 goto short_args;
@@ -9830,12 +9786,12 @@ usage: (define-coding-system-internal ...) */)
9830 for (tail = request; ! NILP (tail); tail = Fcdr (tail)) 9786 for (tail = request; ! NILP (tail); tail = Fcdr (tail))
9831 { 9787 {
9832 int id; 9788 int id;
9833 Lisp_Object tmp; 9789 Lisp_Object tmp1;
9834 9790
9835 val = Fcar (tail); 9791 val = Fcar (tail);
9836 CHECK_CONS (val); 9792 CHECK_CONS (val);
9837 tmp = XCAR (val); 9793 tmp1 = XCAR (val);
9838 CHECK_CHARSET_GET_ID (tmp, id); 9794 CHECK_CHARSET_GET_ID (tmp1, id);
9839 CHECK_NATNUM_CDR (val); 9795 CHECK_NATNUM_CDR (val);
9840 if (XINT (XCDR (val)) >= 4) 9796 if (XINT (XCDR (val)) >= 4)
9841 error ("Invalid graphic register number: %d", XINT (XCDR (val))); 9797 error ("Invalid graphic register number: %d", XINT (XCDR (val)));
diff --git a/src/config.in b/src/config.in
deleted file mode 100644
index 7f33727c0b1..00000000000
--- a/src/config.in
+++ /dev/null
@@ -1,1388 +0,0 @@
1/* src/config.in. Generated from configure.in by autoheader. */
2
3/* GNU Emacs site configuration template file.
4
5Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2011
6 Free Software Foundation, Inc.
7
8This file is part of GNU Emacs.
9
10GNU Emacs is free software: you can redistribute it and/or modify
11it under the terms of the GNU General Public License as published by
12the Free Software Foundation, either version 3 of the License, or
13(at your option) any later version.
14
15GNU Emacs is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22
23
24/* No code in Emacs #includes config.h twice, but some bits of code
25 intended to work with other packages as well (like gmalloc.c)
26 think they can include it as many times as they like. */
27#ifndef EMACS_CONFIG_H
28#define EMACS_CONFIG_H
29
30
31/* Define if building universal (internal helper macro) */
32#undef AC_APPLE_UNIVERSAL_BUILD
33
34/* Define to the number of bits in type 'ptrdiff_t'. */
35#undef BITSIZEOF_PTRDIFF_T
36
37/* Define to the number of bits in type 'sig_atomic_t'. */
38#undef BITSIZEOF_SIG_ATOMIC_T
39
40/* Define to the number of bits in type 'size_t'. */
41#undef BITSIZEOF_SIZE_T
42
43/* Define to the number of bits in type 'wchar_t'. */
44#undef BITSIZEOF_WCHAR_T
45
46/* Define to the number of bits in type 'wint_t'. */
47#undef BITSIZEOF_WINT_T
48
49/* Define if Emacs cannot be dumped on your system. */
50#undef CANNOT_DUMP
51
52/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
53 systems. This function is required for `alloca.c' support on those systems.
54 */
55#undef CRAY_STACKSEG_END
56
57/* Define to 1 if using `alloca.c'. */
58#undef C_ALLOCA
59
60/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
61#undef DGUX
62
63/* Define to 1 if you are using the GNU C Library. */
64#undef DOUG_LEA_MALLOC
65
66/* Define to the canonical Emacs configuration name. */
67#undef EMACS_CONFIGURATION
68
69/* Define to the options passed to configure. */
70#undef EMACS_CONFIG_OPTIONS
71
72/* Enable expensive run-time checking of data types? */
73#undef ENABLE_CHECKING
74
75/* Define this to check for errors in cons list. */
76#undef GC_CHECK_CONS_LIST
77
78/* Define this temporarily to hunt a bug. If defined, the size of strings is
79 redundantly recorded in sdata structures so that it can be compared to the
80 sizes recorded in Lisp strings. */
81#undef GC_CHECK_STRING_BYTES
82
83/* Define this to check the string free list. */
84#undef GC_CHECK_STRING_FREE_LIST
85
86/* Define this to check for short string overrun. */
87#undef GC_CHECK_STRING_OVERRUN
88
89/* Define to 1 if the `getpgrp' function requires zero arguments. */
90#undef GETPGRP_VOID
91
92/* Define to 1 if gettimeofday accepts only one argument. */
93#undef GETTIMEOFDAY_ONE_ARGUMENT
94
95/* Define to 1 if you want to use the GNU memory allocator. */
96#undef GNU_MALLOC
97
98/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
99#undef HAVE_AIX_SMT_EXP
100
101/* Define to 1 if you have the `alarm' function. */
102#undef HAVE_ALARM
103
104/* Define to 1 if you have `alloca', as a function or macro. */
105#undef HAVE_ALLOCA
106
107/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
108 */
109#undef HAVE_ALLOCA_H
110
111/* Define to 1 if ALSA is available. */
112#undef HAVE_ALSA
113
114/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */
115#undef HAVE_ATTRIBUTE_ALIGNED
116
117/* Define to 1 if strtold conforms to C99. */
118#undef HAVE_C99_STRTOLD
119
120/* Define to 1 if you have the `cbrt' function. */
121#undef HAVE_CBRT
122
123/* Define to 1 if you have the `cfmakeraw' function. */
124#undef HAVE_CFMAKERAW
125
126/* Define to 1 if you have the `cfsetspeed' function. */
127#undef HAVE_CFSETSPEED
128
129/* Define to 1 if you have the `closedir' function. */
130#undef HAVE_CLOSEDIR
131
132/* Define to 1 if you have the <coff.h> header file. */
133#undef HAVE_COFF_H
134
135/* Define to 1 if you have the <com_err.h> header file. */
136#undef HAVE_COM_ERR_H
137
138/* Define to 1 if you have the `copysign' function. */
139#undef HAVE_COPYSIGN
140
141/* Define to 1 if using D-Bus. */
142#undef HAVE_DBUS
143
144/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */
145#undef HAVE_DBUS_WATCH_GET_UNIX_FD
146
147/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
148 */
149#undef HAVE_DECL_GETENV
150
151/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you
152 don't. */
153#undef HAVE_DECL_LOCALTIME_R
154
155/* Define to 1 if you have the declaration of `strmode', and to 0 if you
156 don't. */
157#undef HAVE_DECL_STRMODE
158
159/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
160 don't. */
161#undef HAVE_DECL_SYS_SIGLIST
162
163/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
164 */
165#undef HAVE_DECL_TZNAME
166
167/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you
168 don't. */
169#undef HAVE_DECL___SYS_SIGLIST
170
171/* Define to 1 if you have the <des.h> header file. */
172#undef HAVE_DES_H
173
174/* Define to 1 if dynamic ptys are supported. */
175#undef HAVE_DEV_PTMX
176
177/* Define to 1 if you have the `difftime' function. */
178#undef HAVE_DIFFTIME
179
180/* Define to 1 if you have the <dirent.h> header file. */
181#undef HAVE_DIRENT_H
182
183/* Define to 1 if you have the `dup2' function. */
184#undef HAVE_DUP2
185
186/* Define to 1 if you have the `euidaccess' function. */
187#undef HAVE_EUIDACCESS
188
189/* Define to 1 if you have the <fcntl.h> header file. */
190#undef HAVE_FCNTL_H
191
192/* Define to 1 if you have the `fmod' function. */
193#undef HAVE_FMOD
194
195/* Define to 1 if you have the `fork' function. */
196#undef HAVE_FORK
197
198/* Define to 1 if you have the `fpathconf' function. */
199#undef HAVE_FPATHCONF
200
201/* Define to 1 if using the freetype and fontconfig libraries. */
202#undef HAVE_FREETYPE
203
204/* Define to 1 if you have the `frexp' function. */
205#undef HAVE_FREXP
206
207/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
208#undef HAVE_FSEEKO
209
210/* Define to 1 if you have the `fsync' function. */
211#undef HAVE_FSYNC
212
213/* Define to 1 if you have the `ftime' function. */
214#undef HAVE_FTIME
215
216/* Define to 1 if you have the `gai_strerror' function. */
217#undef HAVE_GAI_STRERROR
218
219/* Define to 1 if using GConf. */
220#undef HAVE_GCONF
221
222/* Define to 1 if you have the `getaddrinfo' function. */
223#undef HAVE_GETADDRINFO
224
225/* Define to 1 if you have the `getcwd' function. */
226#undef HAVE_GETCWD
227
228/* Define to 1 if you have the `getdelim' function. */
229#undef HAVE_GETDELIM
230
231/* Define to 1 if you have the `getdomainname' function. */
232#undef HAVE_GETDOMAINNAME
233
234/* Define to 1 if you have the `gethostname' function. */
235#undef HAVE_GETHOSTNAME
236
237/* Define to 1 if you have the `getline' function. */
238#undef HAVE_GETLINE
239
240/* Define to 1 if you have the <getopt.h> header file. */
241#undef HAVE_GETOPT_H
242
243/* Define to 1 if you have the `getopt_long_only' function. */
244#undef HAVE_GETOPT_LONG_ONLY
245
246/* Define to 1 if you have the `getpagesize' function. */
247#undef HAVE_GETPAGESIZE
248
249/* Define to 1 if you have the `getpeername' function. */
250#undef HAVE_GETPEERNAME
251
252/* Define to 1 if you have the `getpt' function. */
253#undef HAVE_GETPT
254
255/* Define to 1 if you have the `getrlimit' function. */
256#undef HAVE_GETRLIMIT
257
258/* Define to 1 if you have the `getrusage' function. */
259#undef HAVE_GETRUSAGE
260
261/* Define to 1 if you have the `getsockname' function. */
262#undef HAVE_GETSOCKNAME
263
264/* Define to 1 if you have the `getsockopt' function. */
265#undef HAVE_GETSOCKOPT
266
267/* Define to 1 if you have the `gettimeofday' function. */
268#undef HAVE_GETTIMEOFDAY
269
270/* Define to 1 if you have the `getwd' function. */
271#undef HAVE_GETWD
272
273/* Define to 1 if you have the `get_current_dir_name' function. */
274#undef HAVE_GET_CURRENT_DIR_NAME
275
276/* Define to 1 if you have a gif (or ungif) library. */
277#undef HAVE_GIF
278
279/* Define if using GnuTLS. */
280#undef HAVE_GNUTLS
281
282/* Define to 1 if you have the gpm library (-lgpm). */
283#undef HAVE_GPM
284
285/* Define to 1 if you have the `grantpt' function. */
286#undef HAVE_GRANTPT
287
288/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */
289#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
290
291/* Define to 1 if you have GTK and pthread (-lpthread). */
292#undef HAVE_GTK_AND_PTHREAD
293
294/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */
295#undef HAVE_GTK_DIALOG_GET_ACTION_AREA
296
297/* Define to 1 if you have the `gtk_file_selection_new' function. */
298#undef HAVE_GTK_FILE_SELECTION_NEW
299
300/* Define to 1 if you have the `gtk_main' function. */
301#undef HAVE_GTK_MAIN
302
303/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */
304#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
305
306/* Define to 1 if you have the `gtk_widget_get_mapped' function. */
307#undef HAVE_GTK_WIDGET_GET_MAPPED
308
309/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */
310#undef HAVE_GTK_WIDGET_GET_SENSITIVE
311
312/* Define to 1 if you have the `gtk_widget_get_window' function. */
313#undef HAVE_GTK_WIDGET_GET_WINDOW
314
315/* Define to 1 if you have the `gtk_widget_set_has_window' function. */
316#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW
317
318/* Define to 1 if you have the `g_type_init' function. */
319#undef HAVE_G_TYPE_INIT
320
321/* Define to 1 if netdb.h declares h_errno. */
322#undef HAVE_H_ERRNO
323
324/* Define to 1 if using imagemagick. */
325#undef HAVE_IMAGEMAGICK
326
327/* Define to 1 if you have inet sockets. */
328#undef HAVE_INET_SOCKETS
329
330/* Define to 1 if you have the <inttypes.h> header file. */
331#undef HAVE_INTTYPES_H
332
333/* Define to 1 if you have the `isnan' function. */
334#undef HAVE_ISNAN
335
336/* Define to 1 if you have the jpeg library (-ljpeg). */
337#undef HAVE_JPEG
338
339/* Define to 1 if you have the <kerberosIV/des.h> header file. */
340#undef HAVE_KERBEROSIV_DES_H
341
342/* Define to 1 if you have the <kerberosIV/krb.h> header file. */
343#undef HAVE_KERBEROSIV_KRB_H
344
345/* Define to 1 if you have the <kerberos/des.h> header file. */
346#undef HAVE_KERBEROS_DES_H
347
348/* Define to 1 if you have the <kerberos/krb.h> header file. */
349#undef HAVE_KERBEROS_KRB_H
350
351/* Define to 1 if `e_text' is a member of `krb5_error'. */
352#undef HAVE_KRB5_ERROR_E_TEXT
353
354/* Define to 1 if `text' is a member of `krb5_error'. */
355#undef HAVE_KRB5_ERROR_TEXT
356
357/* Define to 1 if you have the <krb5.h> header file. */
358#undef HAVE_KRB5_H
359
360/* Define to 1 if you have the <krb.h> header file. */
361#undef HAVE_KRB_H
362
363/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
364#undef HAVE_LANGINFO_CODESET
365
366/* Define to 1 if you have the `com_err' library (-lcom_err). */
367#undef HAVE_LIBCOM_ERR
368
369/* Define to 1 if you have the `crypto' library (-lcrypto). */
370#undef HAVE_LIBCRYPTO
371
372/* Define to 1 if you have the `des' library (-ldes). */
373#undef HAVE_LIBDES
374
375/* Define to 1 if you have the `des425' library (-ldes425). */
376#undef HAVE_LIBDES425
377
378/* Define to 1 if you have the `dgc' library (-ldgc). */
379#undef HAVE_LIBDGC
380
381/* Define to 1 if you have the `dnet' library (-ldnet). */
382#undef HAVE_LIBDNET
383
384/* Define to 1 if you have the hesiod library (-lhesiod). */
385#undef HAVE_LIBHESIOD
386
387/* Define to 1 if you have the `intl' library (-lintl). */
388#undef HAVE_LIBINTL
389
390/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */
391#undef HAVE_LIBK5CRYPTO
392
393/* Define to 1 if you have the `krb' library (-lkrb). */
394#undef HAVE_LIBKRB
395
396/* Define to 1 if you have the `krb4' library (-lkrb4). */
397#undef HAVE_LIBKRB4
398
399/* Define to 1 if you have the `krb5' library (-lkrb5). */
400#undef HAVE_LIBKRB5
401
402/* Define to 1 if you have the `kstat' library (-lkstat). */
403#undef HAVE_LIBKSTAT
404
405/* Define to 1 if you have the `lockfile' library (-llockfile). */
406#undef HAVE_LIBLOCKFILE
407
408/* Define to 1 if you have the `m' library (-lm). */
409#undef HAVE_LIBM
410
411/* Define to 1 if you have the `mail' library (-lmail). */
412#undef HAVE_LIBMAIL
413
414/* Define to 1 if you have the `ncurses' library (-lncurses). */
415#undef HAVE_LIBNCURSES
416
417/* Define to 1 if using libotf. */
418#undef HAVE_LIBOTF
419
420/* Define to 1 if you have the `perfstat' library (-lperfstat). */
421#undef HAVE_LIBPERFSTAT
422
423/* Define to 1 if you have the <libpng/png.h> header file. */
424#undef HAVE_LIBPNG_PNG_H
425
426/* Define to 1 if you have the `pthreads' library (-lpthreads). */
427#undef HAVE_LIBPTHREADS
428
429/* Define to 1 if you have the resolv library (-lresolv). */
430#undef HAVE_LIBRESOLV
431
432/* Define to 1 if using SELinux. */
433#undef HAVE_LIBSELINUX
434
435/* Define to 1 if you have the `Xext' library (-lXext). */
436#undef HAVE_LIBXEXT
437
438/* Define to 1 if you have the libxml library (-lxml2). */
439#undef HAVE_LIBXML2
440
441/* Define to 1 if you have the `Xmu' library (-lXmu). */
442#undef HAVE_LIBXMU
443
444/* Define to 1 if you have the <limits.h> header file. */
445#undef HAVE_LIMITS_H
446
447/* Define to 1 if you have the <linux/version.h> header file. */
448#undef HAVE_LINUX_VERSION_H
449
450/* Define to 1 if you have the <locale.h> header file. */
451#undef HAVE_LOCALE_H
452
453/* Define to 1 if you have the `localtime_r' function. */
454#undef HAVE_LOCALTIME_R
455
456/* Define to 1 if you have the `logb' function. */
457#undef HAVE_LOGB
458
459/* Define to 1 if you support file names longer than 14 characters. */
460#undef HAVE_LONG_FILE_NAMES
461
462/* Define to 1 if the system has the type `long long int'. */
463#undef HAVE_LONG_LONG_INT
464
465/* Define to 1 if you have the `lrand48' function. */
466#undef HAVE_LRAND48
467
468/* Define to 1 if you have the `lstat' function. */
469#undef HAVE_LSTAT
470
471/* Define to 1 if using libm17n-flt. */
472#undef HAVE_M17N_FLT
473
474/* Define to 1 if you have the <machine/soundcard.h> header file. */
475#undef HAVE_MACHINE_SOUNDCARD_H
476
477/* Define to 1 if you have the <mach/mach.h> header file. */
478#undef HAVE_MACH_MACH_H
479
480/* Define to 1 if you have the `MagickExportImagePixels' function. */
481#undef HAVE_MAGICKEXPORTIMAGEPIXELS
482
483/* Define to 1 if you have the <maillock.h> header file. */
484#undef HAVE_MAILLOCK_H
485
486/* Define to 1 if you have the <malloc/malloc.h> header file. */
487#undef HAVE_MALLOC_MALLOC_H
488
489/* Define to 1 if you have the `mblen' function. */
490#undef HAVE_MBLEN
491
492/* Define to 1 if you have the `mbrlen' function. */
493#undef HAVE_MBRLEN
494
495/* Define to 1 if you have the `mbsinit' function. */
496#undef HAVE_MBSINIT
497
498/* Define to 1 if <wchar.h> declares mbstate_t. */
499#undef HAVE_MBSTATE_T
500
501/* Define to 1 if you have the `memcmp' function. */
502#undef HAVE_MEMCMP
503
504/* Define to 1 if you have the `memcpy' function. */
505#undef HAVE_MEMCPY
506
507/* Define to 1 if you have the `memmove' function. */
508#undef HAVE_MEMMOVE
509
510/* Define to 1 if you have the <memory.h> header file. */
511#undef HAVE_MEMORY_H
512
513/* Define to 1 if you have the `mempcpy' function. */
514#undef HAVE_MEMPCPY
515
516/* Define to 1 if you have the `memset' function. */
517#undef HAVE_MEMSET
518
519/* Define to 1 if you have mouse menus. (This is automatic if you use X, but
520 the option to specify it remains.) It is also defined with other window
521 systems that support xmenu.c. */
522#undef HAVE_MENUS
523
524/* Define to 1 if you have the `mkdir' function. */
525#undef HAVE_MKDIR
526
527/* Define to 1 if you have the `mkstemp' function. */
528#undef HAVE_MKSTEMP
529
530/* Define to 1 if you have a working `mmap' system call. */
531#undef HAVE_MMAP
532
533/* Define if you have mouse support. */
534#undef HAVE_MOUSE
535
536/* Define to 1 if you have the `mremap' function. */
537#undef HAVE_MREMAP
538
539/* Define to 1 if you have the <net/if.h> header file. */
540#undef HAVE_NET_IF_H
541
542/* Define to 1 if you have the <nlist.h> header file. */
543#undef HAVE_NLIST_H
544
545/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on
546 Mac OS X. */
547#undef HAVE_NS
548
549/* Define to 1 if libotf has OTF_get_variation_glyphs. */
550#undef HAVE_OTF_GET_VARIATION_GLYPHS
551
552/* Define to 1 if personality LINUX32 can be set. */
553#undef HAVE_PERSONALITY_LINUX32
554
555/* Define to 1 if you have the png library (-lpng). */
556#undef HAVE_PNG
557
558/* Define to 1 if you have the <png.h> header file. */
559#undef HAVE_PNG_H
560
561/* Define to 1 if you have the `posix_memalign' function. */
562#undef HAVE_POSIX_MEMALIGN
563
564/* Define to 1 if you have the `pstat_getdynamic' function. */
565#undef HAVE_PSTAT_GETDYNAMIC
566
567/* Define to 1 if you have the <pthread.h> header file. */
568#undef HAVE_PTHREAD_H
569
570/* Define to 1 if you have the <pty.h> header file. */
571#undef HAVE_PTY_H
572
573/* Define to 1 if you have the <pwd.h> header file. */
574#undef HAVE_PWD_H
575
576/* Define to 1 if you have the `random' function. */
577#undef HAVE_RANDOM
578
579/* Define to 1 if you have the `readlink' function. */
580#undef HAVE_READLINK
581
582/* Define to 1 if you have the `recvfrom' function. */
583#undef HAVE_RECVFROM
584
585/* Define to 1 if you have the `rename' function. */
586#undef HAVE_RENAME
587
588/* Define to 1 if res_init is available. */
589#undef HAVE_RES_INIT
590
591/* Define to 1 if you have the `rint' function. */
592#undef HAVE_RINT
593
594/* Define to 1 if you have the `rmdir' function. */
595#undef HAVE_RMDIR
596
597/* Define to 1 if using librsvg. */
598#undef HAVE_RSVG
599
600/* Define to 1 if you have the `select' function. */
601#undef HAVE_SELECT
602
603/* Define to 1 if you have the `sendto' function. */
604#undef HAVE_SENDTO
605
606/* Define to 1 if you have the `setitimer' function. */
607#undef HAVE_SETITIMER
608
609/* Define to 1 if you have the `setlocale' function. */
610#undef HAVE_SETLOCALE
611
612/* Define to 1 if you have the `setpgid' function. */
613#undef HAVE_SETPGID
614
615/* Define to 1 if you have the `setrlimit' function. */
616#undef HAVE_SETRLIMIT
617
618/* Define to 1 if you have the `setsid' function. */
619#undef HAVE_SETSID
620
621/* Define to 1 if you have the `setsockopt' function. */
622#undef HAVE_SETSOCKOPT
623
624/* Define to 1 if you have the `shutdown' function. */
625#undef HAVE_SHUTDOWN
626
627/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
628#undef HAVE_SIGNED_SIG_ATOMIC_T
629
630/* Define to 1 if 'wchar_t' is a signed integer type. */
631#undef HAVE_SIGNED_WCHAR_T
632
633/* Define to 1 if 'wint_t' is a signed integer type. */
634#undef HAVE_SIGNED_WINT_T
635
636/* Define to 1 if the system has the type `size_t'. */
637#undef HAVE_SIZE_T
638
639/* Define to 1 if you have sound support. */
640#undef HAVE_SOUND
641
642/* Define to 1 if you have the <soundcard.h> header file. */
643#undef HAVE_SOUNDCARD_H
644
645/* Define to 1 if `speed_t' is declared by <termios.h>. */
646#undef HAVE_SPEED_T
647
648/* Define to 1 if you have the <stdint.h> header file. */
649#undef HAVE_STDINT_H
650
651/* Define to 1 if you have the <stdio_ext.h> header file. */
652#undef HAVE_STDIO_EXT_H
653
654/* Define to 1 if you have the <stdlib.h> header file. */
655#undef HAVE_STDLIB_H
656
657/* Define to 1 if you have the `strchr' function. */
658#undef HAVE_STRCHR
659
660/* Define to 1 if you have the `strerror' function. */
661#undef HAVE_STRERROR
662
663/* Define to 1 if you have the <strings.h> header file. */
664#undef HAVE_STRINGS_H
665
666/* Define to 1 if you have the <string.h> header file. */
667#undef HAVE_STRING_H
668
669/* Define to 1 if you have the `strrchr' function. */
670#undef HAVE_STRRCHR
671
672/* Define to 1 if you have the `strsignal' function. */
673#undef HAVE_STRSIGNAL
674
675/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
676#undef HAVE_STRUCT_IFREQ_IFR_ADDR
677
678/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
679#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
680
681/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
682#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
683
684/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
685#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
686
687/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
688#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
689
690/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
691#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
692
693/* Define to 1 if `tm_zone' is a member of `struct tm'. */
694#undef HAVE_STRUCT_TM_TM_ZONE
695
696/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
697#undef HAVE_STRUCT_UTIMBUF
698
699/* Define if struct stat has an st_dm_mode member. */
700#undef HAVE_ST_DM_MODE
701
702/* Define to 1 if you have the `symlink' function. */
703#undef HAVE_SYMLINK
704
705/* Define to 1 if you have the `sync' function. */
706#undef HAVE_SYNC
707
708/* Define to 1 if you have the `sysinfo' function. */
709#undef HAVE_SYSINFO
710
711/* Define to 1 if you have the <sys/bitypes.h> header file. */
712#undef HAVE_SYS_BITYPES_H
713
714/* Define to 1 if you have the <sys/inttypes.h> header file. */
715#undef HAVE_SYS_INTTYPES_H
716
717/* Define to 1 if you have the <sys/loadavg.h> header file. */
718#undef HAVE_SYS_LOADAVG_H
719
720/* Define to 1 if you have the <sys/mman.h> header file. */
721#undef HAVE_SYS_MMAN_H
722
723/* Define to 1 if you have the <sys/param.h> header file. */
724#undef HAVE_SYS_PARAM_H
725
726/* Define to 1 if you have the <sys/resource.h> header file. */
727#undef HAVE_SYS_RESOURCE_H
728
729/* Define to 1 if you have the <sys/select.h> header file. */
730#undef HAVE_SYS_SELECT_H
731
732/* Define to 1 if you have the <sys/socket.h> header file. */
733#undef HAVE_SYS_SOCKET_H
734
735/* Define to 1 if you have the <sys/soundcard.h> header file. */
736#undef HAVE_SYS_SOUNDCARD_H
737
738/* Define to 1 if you have the <sys/stat.h> header file. */
739#undef HAVE_SYS_STAT_H
740
741/* Define to 1 if you have the <sys/systeminfo.h> header file. */
742#undef HAVE_SYS_SYSTEMINFO_H
743
744/* Define to 1 if you have the <sys/time.h> header file. */
745#undef HAVE_SYS_TIME_H
746
747/* Define to 1 if you have the <sys/types.h> header file. */
748#undef HAVE_SYS_TYPES_H
749
750/* Define to 1 if you have the <sys/un.h> header file. */
751#undef HAVE_SYS_UN_H
752
753/* Define to 1 if you have the <sys/utsname.h> header file. */
754#undef HAVE_SYS_UTSNAME_H
755
756/* Define to 1 if you have the <sys/vlimit.h> header file. */
757#undef HAVE_SYS_VLIMIT_H
758
759/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
760#undef HAVE_SYS_WAIT_H
761
762/* Define to 1 if you have the <sys/_mbstate_t.h> header file. */
763#undef HAVE_SYS__MBSTATE_T_H
764
765/* Define to 1 if you have the <term.h> header file. */
766#undef HAVE_TERM_H
767
768/* Define to 1 if you have the tiff library (-ltiff). */
769#undef HAVE_TIFF
770
771/* Define to 1 if `struct timeval' is declared by <sys/time.h>. */
772#undef HAVE_TIMEVAL
773
774/* Define if struct tm has the tm_gmtoff member. */
775#undef HAVE_TM_GMTOFF
776
777/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
778 `HAVE_STRUCT_TM_TM_ZONE' instead. */
779#undef HAVE_TM_ZONE
780
781/* Define to 1 if you have the `touchlock' function. */
782#undef HAVE_TOUCHLOCK
783
784/* Define to 1 if you don't have `tm_zone' but do have the external array
785 `tzname'. */
786#undef HAVE_TZNAME
787
788/* Define to 1 if you have the `tzset' function. */
789#undef HAVE_TZSET
790
791/* Define to 1 if you have the `ualarm' function. */
792#undef HAVE_UALARM
793
794/* Define to 1 if you have the <unistd.h> header file. */
795#undef HAVE_UNISTD_H
796
797/* Define to 1 if the system has the type `unsigned long long int'. */
798#undef HAVE_UNSIGNED_LONG_LONG_INT
799
800/* Define to 1 if you have the <util.h> header file. */
801#undef HAVE_UTIL_H
802
803/* Define to 1 if you have the `utimes' function. */
804#undef HAVE_UTIMES
805
806/* Define to 1 if you have the <utime.h> header file. */
807#undef HAVE_UTIME_H
808
809/* Define to 1 if you have the <utmp.h> header file. */
810#undef HAVE_UTMP_H
811
812/* Define to 1 if you have the `vfork' function. */
813#undef HAVE_VFORK
814
815/* Define to 1 if you have the <vfork.h> header file. */
816#undef HAVE_VFORK_H
817
818/* Define to 1 if you have the <wchar.h> header file. */
819#undef HAVE_WCHAR_H
820
821/* Define if you have the 'wchar_t' type. */
822#undef HAVE_WCHAR_T
823
824/* Define if you have a window system. */
825#undef HAVE_WINDOW_SYSTEM
826
827/* Define to 1 if `fork' works. */
828#undef HAVE_WORKING_FORK
829
830/* Define to 1 if `vfork' works. */
831#undef HAVE_WORKING_VFORK
832
833/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs
834 expects to use version 10. */
835#undef HAVE_X11
836
837/* Define to 1 if you have the X11R6 or newer version of Xlib. */
838#undef HAVE_X11R6
839
840/* Define if you have usable X11R6-style XIM support. */
841#undef HAVE_X11R6_XIM
842
843/* Define to 1 if you have the X11R6 or newer version of Xt. */
844#undef HAVE_X11XTR6
845
846/* Define to 1 if you have the Xaw3d library (-lXaw3d). */
847#undef HAVE_XAW3D
848
849/* Define to 1 if you have the Xft library. */
850#undef HAVE_XFT
851
852/* Define to 1 if XIM is available */
853#undef HAVE_XIM
854
855/* Define to 1 if you have the XkbGetKeyboard function. */
856#undef HAVE_XKBGETKEYBOARD
857
858/* Define to 1 if you have the Xpm libary (-lXpm). */
859#undef HAVE_XPM
860
861/* Define to 1 if you have the `XrmSetDatabase' function. */
862#undef HAVE_XRMSETDATABASE
863
864/* Define to 1 if you have the `XScreenNumberOfScreen' function. */
865#undef HAVE_XSCREENNUMBEROFSCREEN
866
867/* Define to 1 if you have the `XScreenResourceString' function. */
868#undef HAVE_XSCREENRESOURCESTRING
869
870/* Define to 1 if you have the `XSetWMProtocols' function. */
871#undef HAVE_XSETWMPROTOCOLS
872
873/* Define if you have usable i18n support. */
874#undef HAVE_X_I18N
875
876/* Define to 1 if you have the SM library (-lSM). */
877#undef HAVE_X_SM
878
879/* Define to 1 if you want to use the X window system. */
880#undef HAVE_X_WINDOWS
881
882/* Define to 1 if the system has the type `_Bool'. */
883#undef HAVE__BOOL
884
885/* Define to 1 if you have the `__builtin_unwind_init' function. */
886#undef HAVE___BUILTIN_UNWIND_INIT
887
888/* Define to 1 if you have the `__executable_start' function. */
889#undef HAVE___EXECUTABLE_START
890
891/* Define to 1 if you have the `__fpending' function. */
892#undef HAVE___FPENDING
893
894/* Define to support using a Hesiod database to find the POP server. */
895#undef HESIOD
896
897/* Define to support Kerberos-authenticated POP mail retrieval. */
898#undef KERBEROS
899
900/* Define to use Kerberos 5 instead of Kerberos 4. */
901#undef KERBEROS5
902
903/* Define to 1 if localtime caches TZ. */
904#undef LOCALTIME_CACHE
905
906/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
907 slash. */
908#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
909
910/* String giving fallback POP mail host. */
911#undef MAILHOST
912
913/* Define to unlink, rather than empty, mail spool after reading. */
914#undef MAIL_UNLINK_SPOOL
915
916/* Define if the mailer uses flock to interlock the mail spool. */
917#undef MAIL_USE_FLOCK
918
919/* Define if the mailer uses lockf to interlock the mail spool. */
920#undef MAIL_USE_LOCKF
921
922/* Define to support MMDF mailboxes in movemail. */
923#undef MAIL_USE_MMDF
924
925/* Define to support POP mail retrieval. */
926#undef MAIL_USE_POP
927
928/* Define to 1 if you don't have struct exception in math.h. */
929#undef NO_MATHERR
930
931/* Define to 1 if your C compiler doesn't accept -c and -o together. */
932#undef NO_MINUS_C_MINUS_O
933
934/* Define to 1 if `NSInteger' is defined. */
935#undef NS_HAVE_NSINTEGER
936
937/* Define to 1 if you are using NS windowing under MacOS X. */
938#undef NS_IMPL_COCOA
939
940/* Define to 1 if you are using NS windowing under GNUstep. */
941#undef NS_IMPL_GNUSTEP
942
943/* Define to 1 if the nlist n_name member is a pointer */
944#undef N_NAME_POINTER
945
946/* Define if the C compiler is the linker. */
947#undef ORDINARY_LINK
948
949/* Name of package */
950#undef PACKAGE
951
952/* Define to the address where bug reports for this package should be sent. */
953#undef PACKAGE_BUGREPORT
954
955/* Define to the full name of this package. */
956#undef PACKAGE_NAME
957
958/* Define to the full name and version of this package. */
959#undef PACKAGE_STRING
960
961/* Define to the one symbol short name of this package. */
962#undef PACKAGE_TARNAME
963
964/* Define to the home page for this package. */
965#undef PACKAGE_URL
966
967/* Define to the version of this package. */
968#undef PACKAGE_VERSION
969
970/* Define as `void' if your compiler accepts `void *'; otherwise define as
971 `char'. */
972#undef POINTER_TYPE
973
974/* Define to 1 if the C compiler supports function prototypes. */
975#undef PROTOTYPES
976
977/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
978 'ptrdiff_t'. */
979#undef PTRDIFF_T_SUFFIX
980
981/* Define to 1 if readlink fails to recognize a trailing slash. */
982#undef READLINK_TRAILING_SLASH_BUG
983
984/* Define REL_ALLOC if you want to use the relocating allocator for buffer
985 space. */
986#undef REL_ALLOC
987
988/* Define to 1 if stat needs help when passed a directory name with a trailing
989 slash */
990#undef REPLACE_FUNC_STAT_DIR
991
992/* Define to 1 if stat needs help when passed a file name with a trailing
993 slash */
994#undef REPLACE_FUNC_STAT_FILE
995
996/* Define as the return type of signal handlers (`int' or `void'). */
997#undef RETSIGTYPE
998
999/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1000 'sig_atomic_t'. */
1001#undef SIG_ATOMIC_T_SUFFIX
1002
1003/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1004 'size_t'. */
1005#undef SIZE_T_SUFFIX
1006
1007/* If using the C implementation of alloca, define if you know the
1008 direction of stack growth for your system; otherwise it will be
1009 automatically deduced at runtime.
1010 STACK_DIRECTION > 0 => grows toward higher addresses
1011 STACK_DIRECTION < 0 => grows toward lower addresses
1012 STACK_DIRECTION = 0 => direction of growth unknown */
1013#undef STACK_DIRECTION
1014
1015/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
1016#undef STAT_MACROS_BROKEN
1017
1018/* Define to 1 if you have the ANSI C header files. */
1019#undef STDC_HEADERS
1020
1021/* Define to 1 on System V Release 4. */
1022#undef SVR4
1023
1024/* Process async input synchronously. */
1025#undef SYNC_INPUT
1026
1027/* Define to use system malloc. */
1028#undef SYSTEM_MALLOC
1029
1030/* Define to 1 if you use terminfo instead of termcap. */
1031#undef TERMINFO
1032
1033/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
1034#undef TIME_WITH_SYS_TIME
1035
1036/* Define to 1 if your <sys/time.h> declares `struct tm'. */
1037#undef TM_IN_SYS_TIME
1038
1039/* Define to 1 for Encore UMAX. */
1040#undef UMAX
1041
1042/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of
1043 <sys/cpustats.h>. */
1044#undef UMAX4_3
1045
1046/* Define to 1 if using GTK. */
1047#undef USE_GTK
1048
1049/* Define this to use a lisp union for the Lisp_Object data type. */
1050#undef USE_LISP_UNION_TYPE
1051
1052/* Define to 1 if using the Lucid X toolkit. */
1053#undef USE_LUCID
1054
1055/* Define to use mmap to allocate buffer text. */
1056#undef USE_MMAP_FOR_BUFFERS
1057
1058/* Define to 1 if using the Motif X toolkit. */
1059#undef USE_MOTIF
1060
1061/* Define to 1 if we should use toolkit scroll bars. */
1062#undef USE_TOOLKIT_SCROLL_BARS
1063
1064/* Define to 1 if we should use XIM, if it is available. */
1065#undef USE_XIM
1066
1067/* Define to 1 if using an X toolkit. */
1068#undef USE_X_TOOLKIT
1069
1070/* Version number of package */
1071#undef VERSION
1072
1073/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1074 'wchar_t'. */
1075#undef WCHAR_T_SUFFIX
1076
1077/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
1078 'wint_t'. */
1079#undef WINT_T_SUFFIX
1080
1081/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
1082 significant byte first (like Motorola and SPARC, unlike Intel). */
1083#if defined AC_APPLE_UNIVERSAL_BUILD
1084# if defined __BIG_ENDIAN__
1085# define WORDS_BIGENDIAN 1
1086# endif
1087#else
1088# ifndef WORDS_BIGENDIAN
1089# undef WORDS_BIGENDIAN
1090# endif
1091#endif
1092
1093/* Define this to check for malloc buffer overrun. */
1094#undef XMALLOC_OVERRUN_CHECK
1095
1096/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either
1097 XPointer or XPointer*. */
1098#undef XRegisterIMInstantiateCallback_arg6
1099
1100/* Number of bits in a file offset, on hosts where this is settable. */
1101#undef _FILE_OFFSET_BITS
1102
1103/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
1104#undef _LARGEFILE_SOURCE
1105
1106/* Define for large files, on AIX-style hosts. */
1107#undef _LARGE_FILES
1108
1109/* Define to 1 if on MINIX. */
1110#undef _MINIX
1111
1112/* Define to 2 if the system does not provide POSIX.1 features except with
1113 this defined. */
1114#undef _POSIX_1_SOURCE
1115
1116/* Define to 1 if you need to in order for `stat' and other things to work. */
1117#undef _POSIX_SOURCE
1118
1119/* Define to 500 only on HP-UX. */
1120#undef _XOPEN_SOURCE
1121
1122/* Enable extensions on AIX 3, Interix. */
1123#ifndef _ALL_SOURCE
1124# undef _ALL_SOURCE
1125#endif
1126/* Enable GNU extensions on systems that have them. */
1127#ifndef _GNU_SOURCE
1128# undef _GNU_SOURCE
1129#endif
1130/* Enable threading extensions on Solaris. */
1131#ifndef _POSIX_PTHREAD_SEMANTICS
1132# undef _POSIX_PTHREAD_SEMANTICS
1133#endif
1134/* Enable extensions on HP NonStop. */
1135#ifndef _TANDEM_SOURCE
1136# undef _TANDEM_SOURCE
1137#endif
1138/* Enable general extensions on Solaris. */
1139#ifndef __EXTENSIONS__
1140# undef __EXTENSIONS__
1141#endif
1142
1143
1144/* Define to rpl_ if the getopt replacement functions and variables should be
1145 used. */
1146#undef __GETOPT_PREFIX
1147
1148/* Define like PROTOTYPES; this can be used by system headers. */
1149#undef __PROTOTYPES
1150
1151/* Define to compiler's equivalent of C99 restrict keyword in array
1152 declarations. Define as empty for no equivalent. */
1153#undef __restrict_arr
1154
1155/* Define to the used machine dependent file. */
1156#undef config_machfile
1157
1158/* Define to the used os dependent file. */
1159#undef config_opsysfile
1160
1161/* Define to empty if `const' does not conform to ANSI C. */
1162#undef const
1163
1164/* Define to `__inline__' or `__inline' if that's what the C compiler
1165 calls it, or to nothing if 'inline' is not supported under any name. */
1166#ifndef __cplusplus
1167#undef inline
1168#endif
1169
1170/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
1171 the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
1172 earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
1173 __APPLE__ && __MACH__ test for MacOS X.
1174 __APPLE_CC__ tests for the Apple compiler and its version.
1175 __STDC_VERSION__ tests for the C99 mode. */
1176#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
1177# define __GNUC_STDC_INLINE__ 1
1178#endif
1179
1180/* Define to a type if <wchar.h> does not define. */
1181#undef mbstate_t
1182
1183/* Define to the name of the strftime replacement function. */
1184#undef my_strftime
1185
1186/* Define to the type of st_nlink in struct stat, or a supertype. */
1187#undef nlink_t
1188
1189/* Define to `int' if <sys/types.h> does not define. */
1190#undef pid_t
1191
1192/* Define to the equivalent of the C99 'restrict' keyword, or to
1193 nothing if this is not supported. Do not define if restrict is
1194 supported directly. */
1195#undef restrict
1196/* Work around a bug in Sun C++: it does not support _Restrict or
1197 __restrict__, even though the corresponding Sun C compiler ends up with
1198 "#define restrict _Restrict" or "#define restrict __restrict__" in the
1199 previous line. Perhaps some future version of Sun C++ will work with
1200 restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
1201#if defined __SUNPRO_CC && !defined __RESTRICT
1202# define _Restrict
1203# define __restrict__
1204#endif
1205
1206/* Define to any substitute for sys_siglist. */
1207#undef sys_siglist
1208
1209/* Define as a marker that can be attached to declarations that might not
1210 be used. This helps to reduce warnings, such as from
1211 GCC -Wunused-parameter. */
1212#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
1213# define _GL_UNUSED __attribute__ ((__unused__))
1214#else
1215# define _GL_UNUSED
1216#endif
1217/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name
1218 is a misnomer outside of parameter lists. */
1219#define _UNUSED_PARAMETER_ _GL_UNUSED
1220
1221
1222/* Define as `fork' if `vfork' does not work. */
1223#undef vfork
1224
1225/* Define to empty if the keyword `volatile' does not work. Warning: valid
1226 code using `volatile' can become incorrect without. Disable with care. */
1227#undef volatile
1228
1229
1230/* Define AMPERSAND_FULL_NAME if you use the convention
1231 that & in the full name stands for the login id. */
1232/* Turned on June 1996 supposing nobody will mind it. */
1233#define AMPERSAND_FULL_NAME
1234
1235/* If using GNU, then support inline function declarations. */
1236/* Don't try to switch on inline handling as detected by AC_C_INLINE
1237 generally, because even if non-gcc compilers accept `inline', they
1238 may reject `extern inline'. */
1239#if defined (__GNUC__)
1240#define INLINE __inline__
1241#else
1242#define INLINE
1243#endif
1244
1245/* `subprocesses' should be defined if you want to
1246 have code for asynchronous subprocesses
1247 (as used in M-x compile and M-x shell).
1248 Only MSDOS does not support this (it overrides
1249 this in its config_opsysfile below). */
1250
1251#define subprocesses
1252
1253/* Include the os and machine dependent files. */
1254#include config_opsysfile
1255#ifdef config_machfile
1256# include config_machfile
1257#endif
1258
1259/* GNUstep needs a bit more pure memory. Of the existing knobs,
1260 SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.
1261 (There is probably a better place to do this, but right now the
1262 Cocoa side does this in s/darwin.h and we cannot parallel this
1263 exactly since GNUstep is multi-OS. */
1264#if defined HAVE_NS && defined NS_IMPL_GNUSTEP
1265# define SYSTEM_PURESIZE_EXTRA 30000
1266#endif
1267
1268/* SIGTYPE is the macro we actually use. */
1269#ifndef SIGTYPE
1270#define SIGTYPE RETSIGTYPE
1271#endif
1272
1273#ifdef emacs /* Don't do this for lib-src. */
1274/* Tell regex.c to use a type compatible with Emacs. */
1275#define RE_TRANSLATE_TYPE Lisp_Object
1276#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
1277#ifdef make_number
1278/* If make_number is a macro, use it. */
1279#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
1280#else
1281/* If make_number is a function, avoid it. */
1282#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
1283#endif
1284#endif
1285
1286/* These default definitions are good for almost all machines.
1287 The exceptions override them in m/MACHINE.h. */
1288
1289#ifndef BITS_PER_CHAR
1290#define BITS_PER_CHAR 8
1291#endif
1292
1293#ifndef BITS_PER_SHORT
1294#define BITS_PER_SHORT 16
1295#endif
1296
1297/* Note that lisp.h uses this in a preprocessor conditional, so it
1298 would not work to use sizeof. That being so, we do all of them
1299 without sizeof, for uniformity's sake. */
1300#ifndef BITS_PER_INT
1301#define BITS_PER_INT 32
1302#endif
1303
1304#ifndef BITS_PER_LONG
1305#ifdef _LP64
1306#define BITS_PER_LONG 64
1307#else
1308#define BITS_PER_LONG 32
1309#endif
1310#endif
1311
1312/* Define if the compiler supports function prototypes. It may do so but
1313 not define __STDC__ (e.g. DEC C by default) or may define it as zero. */
1314#undef PROTOTYPES
1315
1316#include <string.h>
1317#include <stdlib.h>
1318
1319#ifdef HAVE_ALLOCA_H
1320# include <alloca.h>
1321#elif defined __GNUC__
1322# define alloca __builtin_alloca
1323#elif defined _AIX
1324# define alloca __alloca
1325#else
1326# include <stddef.h>
1327# ifdef __cplusplus
1328extern "C"
1329# endif
1330void *alloca (size_t);
1331#endif
1332
1333#ifndef HAVE_SIZE_T
1334typedef unsigned size_t;
1335#endif
1336
1337#ifndef HAVE_STRCHR
1338#define strchr(a, b) index (a, b)
1339#endif
1340
1341#ifndef HAVE_STRRCHR
1342#define strrchr(a, b) rindex (a, b)
1343#endif
1344
1345#if defined __GNUC__ && (__GNUC__ > 2 \
1346 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
1347#define NO_RETURN __attribute__ ((__noreturn__))
1348#else
1349#define NO_RETURN /* nothing */
1350#endif
1351
1352#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
1353#define NO_INLINE __attribute__((noinline))
1354#else
1355#define NO_INLINE
1356#endif
1357
1358#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
1359#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
1360#else
1361#define EXTERNALLY_VISIBLE
1362#endif
1363
1364/* Some versions of GNU/Linux define noinline in their headers. */
1365#ifdef noinline
1366#undef noinline
1367#endif
1368
1369/* These won't be used automatically yet. We also need to know, at least,
1370 that the stack is continuous. */
1371#ifdef __GNUC__
1372# ifndef GC_SETJMP_WORKS
1373 /* GC_SETJMP_WORKS is nearly always appropriate for GCC. */
1374# define GC_SETJMP_WORKS 1
1375# endif
1376# ifndef GC_LISP_OBJECT_ALIGNMENT
1377# define GC_LISP_OBJECT_ALIGNMENT (__alignof__ (Lisp_Object))
1378# endif
1379#endif
1380
1381#endif /* EMACS_CONFIG_H */
1382
1383/*
1384Local Variables:
1385mode: c
1386End:
1387*/
1388
diff --git a/src/data.c b/src/data.c
index 6039743b1d5..e5c485f5322 100644
--- a/src/data.c
+++ b/src/data.c
@@ -807,7 +807,10 @@ variable chain of symbols. */)
807 (Lisp_Object object) 807 (Lisp_Object object)
808{ 808{
809 if (SYMBOLP (object)) 809 if (SYMBOLP (object))
810 XSETSYMBOL (object, indirect_variable (XSYMBOL (object))); 810 {
811 struct Lisp_Symbol *sym = indirect_variable (XSYMBOL (object));
812 XSETSYMBOL (object, sym);
813 }
811 return object; 814 return object;
812} 815}
813 816
@@ -817,9 +820,6 @@ variable chain of symbols. */)
817 This does not handle buffer-local variables; use 820 This does not handle buffer-local variables; use
818 swap_in_symval_forwarding for that. */ 821 swap_in_symval_forwarding for that. */
819 822
820#define do_blv_forwarding(blv) \
821 ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv))
822
823Lisp_Object 823Lisp_Object
824do_symval_forwarding (register union Lisp_Fwd *valcontents) 824do_symval_forwarding (register union Lisp_Fwd *valcontents)
825{ 825{
@@ -866,14 +866,6 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
866 BUF non-zero means set the value in buffer BUF instead of the 866 BUF non-zero means set the value in buffer BUF instead of the
867 current buffer. This only plays a role for per-buffer variables. */ 867 current buffer. This only plays a role for per-buffer variables. */
868 868
869#define store_blv_forwarding(blv, newval, buf) \
870 do { \
871 if ((blv)->forwarded) \
872 store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \
873 else \
874 SET_BLV_VALUE (blv, newval); \
875 } while (0)
876
877static void 869static void
878store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf) 870store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf)
879{ 871{
@@ -909,12 +901,12 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
909 901
910 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 902 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
911 { 903 {
912 Lisp_Object buf; 904 Lisp_Object lbuf;
913 struct buffer *b; 905 struct buffer *b;
914 906
915 buf = Fcdr (XCAR (tail)); 907 lbuf = Fcdr (XCAR (tail));
916 if (!BUFFERP (buf)) continue; 908 if (!BUFFERP (lbuf)) continue;
917 b = XBUFFER (buf); 909 b = XBUFFER (lbuf);
918 910
919 if (! PER_BUFFER_VALUE_P (b, idx)) 911 if (! PER_BUFFER_VALUE_P (b, idx))
920 PER_BUFFER_VALUE (b, offset) = newval; 912 PER_BUFFER_VALUE (b, offset) = newval;
@@ -1271,7 +1263,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1271/* Return the default value of SYMBOL, but don't check for voidness. 1263/* Return the default value of SYMBOL, but don't check for voidness.
1272 Return Qunbound if it is void. */ 1264 Return Qunbound if it is void. */
1273 1265
1274Lisp_Object 1266static Lisp_Object
1275default_value (Lisp_Object symbol) 1267default_value (Lisp_Object symbol)
1276{ 1268{
1277 struct Lisp_Symbol *sym; 1269 struct Lisp_Symbol *sym;
@@ -1505,8 +1497,8 @@ The function `default-value' gets the default value and `set-default' sets it.
1505{ 1497{
1506 struct Lisp_Symbol *sym; 1498 struct Lisp_Symbol *sym;
1507 struct Lisp_Buffer_Local_Value *blv = NULL; 1499 struct Lisp_Buffer_Local_Value *blv = NULL;
1508 union Lisp_Val_Fwd valcontents; 1500 union Lisp_Val_Fwd valcontents IF_LINT (= {0});
1509 int forwarded; 1501 int forwarded IF_LINT (= 0);
1510 1502
1511 CHECK_SYMBOL (variable); 1503 CHECK_SYMBOL (variable);
1512 sym = XSYMBOL (variable); 1504 sym = XSYMBOL (variable);
@@ -1581,8 +1573,8 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1581 (register Lisp_Object variable) 1573 (register Lisp_Object variable)
1582{ 1574{
1583 register Lisp_Object tem; 1575 register Lisp_Object tem;
1584 int forwarded; 1576 int forwarded IF_LINT (= 0);
1585 union Lisp_Val_Fwd valcontents; 1577 union Lisp_Val_Fwd valcontents IF_LINT (= {0});
1586 struct Lisp_Symbol *sym; 1578 struct Lisp_Symbol *sym;
1587 struct Lisp_Buffer_Local_Value *blv = NULL; 1579 struct Lisp_Buffer_Local_Value *blv = NULL;
1588 1580
@@ -2218,7 +2210,7 @@ bool-vector. IDX starts at 0. */)
2218 2210
2219enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal }; 2211enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal };
2220 2212
2221Lisp_Object 2213static Lisp_Object
2222arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) 2214arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
2223{ 2215{
2224 double f1 = 0, f2 = 0; 2216 double f1 = 0, f2 = 0;
@@ -2486,7 +2478,7 @@ enum arithop
2486 2478
2487static Lisp_Object float_arith_driver (double, int, enum arithop, 2479static Lisp_Object float_arith_driver (double, int, enum arithop,
2488 int, Lisp_Object *); 2480 int, Lisp_Object *);
2489Lisp_Object 2481static Lisp_Object
2490arith_driver (enum arithop code, int nargs, register Lisp_Object *args) 2482arith_driver (enum arithop code, int nargs, register Lisp_Object *args)
2491{ 2483{
2492 register Lisp_Object val; 2484 register Lisp_Object val;
@@ -3310,7 +3302,7 @@ syms_of_data (void)
3310 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; 3302 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
3311} 3303}
3312 3304
3313SIGTYPE 3305static SIGTYPE
3314arith_error (int signo) 3306arith_error (int signo)
3315{ 3307{
3316 sigsetmask (SIGEMPTYMASK); 3308 sigsetmask (SIGEMPTYMASK);
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 7e5104026cd..2c8de20a4d4 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -325,7 +325,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
325 if ((subtype == DBUS_TYPE_SIGNATURE) 325 if ((subtype == DBUS_TYPE_SIGNATURE)
326 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt))) 326 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt)))
327 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt)))) 327 && NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
328 strcpy (x, SDATA (CAR_SAFE (XD_NEXT_VALUE (elt)))); 328 strcpy (x, SSDATA (CAR_SAFE (XD_NEXT_VALUE (elt))));
329 329
330 while (!NILP (elt)) 330 while (!NILP (elt))
331 { 331 {
@@ -531,7 +531,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
531 but by not encoding it, we guarantee it's valid utf-8, even if 531 but by not encoding it, we guarantee it's valid utf-8, even if
532 it contains eight-bit-bytes. Of course, you can still send 532 it contains eight-bit-bytes. Of course, you can still send
533 manually-crafted junk by passing a unibyte string. */ 533 manually-crafted junk by passing a unibyte string. */
534 char *val = SDATA (object); 534 char *val = SSDATA (object);
535 XD_DEBUG_MESSAGE ("%c %s", dtype, val); 535 XD_DEBUG_MESSAGE ("%c %s", dtype, val);
536 if (!dbus_message_iter_append_basic (iter, dtype, &val)) 536 if (!dbus_message_iter_append_basic (iter, dtype, &val))
537 XD_SIGNAL2 (build_string ("Unable to append argument"), object); 537 XD_SIGNAL2 (build_string ("Unable to append argument"), object);
@@ -569,7 +569,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
569 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object))) 569 && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object)))
570 && NILP (CDR_SAFE (XD_NEXT_VALUE (object)))) 570 && NILP (CDR_SAFE (XD_NEXT_VALUE (object))))
571 { 571 {
572 strcpy (signature, SDATA (CAR_SAFE (XD_NEXT_VALUE (object)))); 572 strcpy (signature, SSDATA (CAR_SAFE (XD_NEXT_VALUE (object))));
573 object = CDR_SAFE (XD_NEXT_VALUE (object)); 573 object = CDR_SAFE (XD_NEXT_VALUE (object));
574 } 574 }
575 575
@@ -789,7 +789,7 @@ xd_initialize (Lisp_Object bus, int raise_error)
789 dbus_error_init (&derror); 789 dbus_error_init (&derror);
790 790
791 if (STRINGP (bus)) 791 if (STRINGP (bus))
792 connection = dbus_connection_open (SDATA (bus), &derror); 792 connection = dbus_connection_open (SSDATA (bus), &derror);
793 else 793 else
794 if (EQ (bus, QCdbus_system_bus)) 794 if (EQ (bus, QCdbus_system_bus))
795 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); 795 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
@@ -936,7 +936,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
936 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); 936 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses);
937 937
938 /* We do not want to abort. */ 938 /* We do not want to abort. */
939 putenv ("DBUS_FATAL_WARNINGS=0"); 939 putenv ((char *) "DBUS_FATAL_WARNINGS=0");
940 940
941 /* Return. */ 941 /* Return. */
942 return Qnil; 942 return Qnil;
@@ -1089,10 +1089,10 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
1089 connection = xd_initialize (bus, TRUE); 1089 connection = xd_initialize (bus, TRUE);
1090 1090
1091 /* Create the message. */ 1091 /* Create the message. */
1092 dmessage = dbus_message_new_method_call (SDATA (service), 1092 dmessage = dbus_message_new_method_call (SSDATA (service),
1093 SDATA (path), 1093 SSDATA (path),
1094 SDATA (interface), 1094 SSDATA (interface),
1095 SDATA (method)); 1095 SSDATA (method));
1096 UNGCPRO; 1096 UNGCPRO;
1097 if (dmessage == NULL) 1097 if (dmessage == NULL)
1098 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1098 XD_SIGNAL1 (build_string ("Unable to create a new message"));
@@ -1272,10 +1272,10 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1272 connection = xd_initialize (bus, TRUE); 1272 connection = xd_initialize (bus, TRUE);
1273 1273
1274 /* Create the message. */ 1274 /* Create the message. */
1275 dmessage = dbus_message_new_method_call (SDATA (service), 1275 dmessage = dbus_message_new_method_call (SSDATA (service),
1276 SDATA (path), 1276 SSDATA (path),
1277 SDATA (interface), 1277 SSDATA (interface),
1278 SDATA (method)); 1278 SSDATA (method));
1279 if (dmessage == NULL) 1279 if (dmessage == NULL)
1280 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1280 XD_SIGNAL1 (build_string ("Unable to create a new message"));
1281 1281
@@ -1386,7 +1386,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1386 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN); 1386 dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
1387 if ((dmessage == NULL) 1387 if ((dmessage == NULL)
1388 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) 1388 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial)))
1389 || (!dbus_message_set_destination (dmessage, SDATA (service)))) 1389 || (!dbus_message_set_destination (dmessage, SSDATA (service))))
1390 { 1390 {
1391 UNGCPRO; 1391 UNGCPRO;
1392 XD_SIGNAL1 (build_string ("Unable to create a return message")); 1392 XD_SIGNAL1 (build_string ("Unable to create a return message"));
@@ -1475,7 +1475,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1475 if ((dmessage == NULL) 1475 if ((dmessage == NULL)
1476 || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)) 1476 || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED))
1477 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial))) 1477 || (!dbus_message_set_reply_serial (dmessage, XUINT (serial)))
1478 || (!dbus_message_set_destination (dmessage, SDATA (service)))) 1478 || (!dbus_message_set_destination (dmessage, SSDATA (service))))
1479 { 1479 {
1480 UNGCPRO; 1480 UNGCPRO;
1481 XD_SIGNAL1 (build_string ("Unable to create a error message")); 1481 XD_SIGNAL1 (build_string ("Unable to create a error message"));
@@ -1591,9 +1591,9 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1591 connection = xd_initialize (bus, TRUE); 1591 connection = xd_initialize (bus, TRUE);
1592 1592
1593 /* Create the message. */ 1593 /* Create the message. */
1594 dmessage = dbus_message_new_signal (SDATA (path), 1594 dmessage = dbus_message_new_signal (SSDATA (path),
1595 SDATA (interface), 1595 SSDATA (interface),
1596 SDATA (signal)); 1596 SSDATA (signal));
1597 UNGCPRO; 1597 UNGCPRO;
1598 if (dmessage == NULL) 1598 if (dmessage == NULL)
1599 XD_SIGNAL1 (build_string ("Unable to create a new message")); 1599 XD_SIGNAL1 (build_string ("Unable to create a new message"));
@@ -1745,11 +1745,11 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
1745 /* key has the structure (UNAME SERVICE PATH HANDLER). */ 1745 /* key has the structure (UNAME SERVICE PATH HANDLER). */
1746 if (((uname == NULL) 1746 if (((uname == NULL)
1747 || (NILP (CAR_SAFE (key))) 1747 || (NILP (CAR_SAFE (key)))
1748 || (strcmp (uname, SDATA (CAR_SAFE (key))) == 0)) 1748 || (strcmp (uname, SSDATA (CAR_SAFE (key))) == 0))
1749 && ((path == NULL) 1749 && ((path == NULL)
1750 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1750 || (NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (key)))))
1751 || (strcmp (path, 1751 || (strcmp (path,
1752 SDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key))))) 1752 SSDATA (CAR_SAFE (CDR_SAFE (CDR_SAFE (key)))))
1753 == 0)) 1753 == 0))
1754 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key))))))) 1754 && (!NILP (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (key)))))))
1755 { 1755 {
@@ -1888,7 +1888,6 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1888 (int nargs, register Lisp_Object *args) 1888 (int nargs, register Lisp_Object *args)
1889{ 1889{
1890 Lisp_Object bus, service; 1890 Lisp_Object bus, service;
1891 struct gcpro gcpro1, gcpro2;
1892 DBusConnection *connection; 1891 DBusConnection *connection;
1893 unsigned int i; 1892 unsigned int i;
1894 unsigned int value; 1893 unsigned int value;
@@ -1921,7 +1920,7 @@ usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
1921 1920
1922 /* Request the known name from the bus. */ 1921 /* Request the known name from the bus. */
1923 dbus_error_init (&derror); 1922 dbus_error_init (&derror);
1924 result = dbus_bus_request_name (connection, SDATA (service), flags, 1923 result = dbus_bus_request_name (connection, SSDATA (service), flags,
1925 &derror); 1924 &derror);
1926 if (dbus_error_is_set (&derror)) 1925 if (dbus_error_is_set (&derror))
1927 XD_ERROR (derror); 1926 XD_ERROR (derror);
@@ -2019,8 +2018,8 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
2019 name of "org.freedesktop.DBus" is that string itself. */ 2018 name of "org.freedesktop.DBus" is that string itself. */
2020 if ((STRINGP (service)) 2019 if ((STRINGP (service))
2021 && (SBYTES (service) > 0) 2020 && (SBYTES (service) > 0)
2022 && (strcmp (SDATA (service), DBUS_SERVICE_DBUS) != 0) 2021 && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0)
2023 && (strncmp (SDATA (service), ":", 1) != 0)) 2022 && (strncmp (SSDATA (service), ":", 1) != 0))
2024 { 2023 {
2025 uname = call2 (intern ("dbus-get-name-owner"), bus, service); 2024 uname = call2 (intern ("dbus-get-name-owner"), bus, service);
2026 /* When there is no unique name, we mark it with an empty 2025 /* When there is no unique name, we mark it with an empty
@@ -2122,7 +2121,6 @@ discovering the still incomplete interface.*/)
2122 Lisp_Object dont_register_service) 2121 Lisp_Object dont_register_service)
2123{ 2122{
2124 Lisp_Object key, key1, value; 2123 Lisp_Object key, key1, value;
2125 DBusError derror;
2126 Lisp_Object args[2] = { bus, service }; 2124 Lisp_Object args[2] = { bus, service };
2127 2125
2128 /* Check parameters. */ 2126 /* Check parameters. */
@@ -2350,4 +2348,3 @@ be called when the D-Bus reply message arrives. */);
2350} 2348}
2351 2349
2352#endif /* HAVE_DBUS */ 2350#endif /* HAVE_DBUS */
2353
diff --git a/src/deps.mk b/src/deps.mk
index 77994bcaadb..35754dfa7de 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -87,12 +87,13 @@ dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
87 msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ 87 msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \
88 lisp.h $(config_h) 88 lisp.h $(config_h)
89editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ 89editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
90 coding.h frame.h blockinput.h atimer.h ../lib/unistd.h ../lib/strftime.h \ 90 coding.h frame.h blockinput.h atimer.h \
91 ../lib/intprops.h ../lib/strftime.h ../lib/unistd.h \
91 lisp.h globals.h $(config_h) 92 lisp.h globals.h $(config_h)
92emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ 93emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
93 termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ 94 termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \
94 globals.h ../lib/unistd.h window.h dispextern.h keyboard.h keymap.h \ 95 globals.h ../lib/unistd.h window.h dispextern.h keyboard.h keymap.h \
95 frame.h coding.h gnutls.h msdos.h 96 frame.h coding.h gnutls.h msdos.h unexec.h
96fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ 97fileio.o: fileio.c window.h buffer.h systime.h $(INTERVALS_H) character.h \
97 coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h \ 98 coding.h msdos.h blockinput.h atimer.h lisp.h $(config_h) frame.h \
98 commands.h globals.h ../lib/unistd.h 99 commands.h globals.h ../lib/unistd.h
@@ -190,24 +191,23 @@ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
190term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ 191term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \
191 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ 192 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
192 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ 193 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
193 systty.h syssignal.h $(INTERVALS_H) buffer.h ../lib/unistd.h 194 systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h
194termcap.o: termcap.c lisp.h $(config_h) 195termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h)
195terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ 196terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \
196 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ 197 keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \
197 msdos.h 198 msdos.h
198terminfo.o: terminfo.c lisp.h globals.h $(config_h) 199terminfo.o: terminfo.c lisp.h globals.h $(config_h)
199tparam.o: tparam.c lisp.h $(config_h) 200tparam.o: tparam.c tparam.h lisp.h $(config_h)
200undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \ 201undo.o: undo.c buffer.h commands.h window.h dispextern.h msdos.h \
201 lisp.h globals.h $(config_h) 202 lisp.h globals.h $(config_h)
202unexaix.o: unexaix.c lisp.h $(config_h) 203unexaix.o: unexaix.c lisp.h unexec.h $(config_h)
203unexalpha.o: unexalpha.c $(config_h) 204unexcw.o: unexcw.c lisp.h unexec.h $(config_h)
204unexcw.o: unexcw.c lisp.h $(config_h) 205unexcoff.o: unexcoff.c lisp.h unexec.h $(config_h)
205unexcoff.o: unexcoff.c lisp.h $(config_h) 206unexelf.o: unexelf.c unexec.h ../lib/unistd.h $(config_h)
206unexelf.o: unexelf.c ../lib/unistd.h $(config_h) 207unexhp9k800.o: unexhp9k800.c unexec.h $(config_h)
207unexhp9k800.o: unexhp9k800.c $(config_h) 208unexmacosx.o: unexmacosx.c unexec.h $(config_h)
208unexmacosx.o: unexmacosx.c $(config_h) 209unexsol.o: unexsol.c lisp.h unexec.h $(config_h)
209unexsol.o: unexsol.c lisp.h $(config_h) 210unexw32.o: unexw32.c unexec.h $(config_h)
210unexw32.o: unexw32.c $(config_h)
211w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \ 211w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
212 msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h) 212 msdos.h buffer.h charset.h coding.h composite.h lisp.h $(config_h)
213widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \ 213widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
diff --git a/src/dired.c b/src/dired.c
index 96063680d4d..176f14925b4 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -79,11 +79,6 @@ extern struct direct *readdir (DIR *);
79#include "regex.h" 79#include "regex.h"
80#include "blockinput.h" 80#include "blockinput.h"
81 81
82/* Returns a search buffer, with a fastmap allocated and ready to go. */
83extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
84 struct re_registers *,
85 Lisp_Object, int, int);
86
87Lisp_Object Qdirectory_files; 82Lisp_Object Qdirectory_files;
88Lisp_Object Qdirectory_files_and_attributes; 83Lisp_Object Qdirectory_files_and_attributes;
89Lisp_Object Qfile_name_completion; 84Lisp_Object Qfile_name_completion;
@@ -102,7 +97,7 @@ directory_files_internal_w32_unwind (Lisp_Object arg)
102} 97}
103#endif 98#endif
104 99
105Lisp_Object 100static Lisp_Object
106directory_files_internal_unwind (Lisp_Object dh) 101directory_files_internal_unwind (Lisp_Object dh)
107{ 102{
108 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; 103 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
@@ -233,11 +228,11 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
233 int len; 228 int len;
234 int wanted = 0; 229 int wanted = 0;
235 Lisp_Object name, finalname; 230 Lisp_Object name, finalname;
236 struct gcpro gcpro1, gcpro2; 231 struct gcpro inner_gcpro1, inner_gcpro2;
237 232
238 len = NAMLEN (dp); 233 len = NAMLEN (dp);
239 name = finalname = make_unibyte_string (dp->d_name, len); 234 name = finalname = make_unibyte_string (dp->d_name, len);
240 GCPRO2 (finalname, name); 235 GCPRO2_VAR (finalname, name, inner_gcpro);
241 236
242 /* Note: DECODE_FILE can GC; it should protect its argument, 237 /* Note: DECODE_FILE can GC; it should protect its argument,
243 though. */ 238 though. */
@@ -293,23 +288,23 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
293 /* Construct an expanded filename for the directory entry. 288 /* Construct an expanded filename for the directory entry.
294 Use the decoded names for input to Ffile_attributes. */ 289 Use the decoded names for input to Ffile_attributes. */
295 Lisp_Object decoded_fullname, fileattrs; 290 Lisp_Object decoded_fullname, fileattrs;
296 struct gcpro gcpro1, gcpro2; 291 struct gcpro innermost_gcpro1, innermost_gcpro2;
297 292
298 decoded_fullname = fileattrs = Qnil; 293 decoded_fullname = fileattrs = Qnil;
299 GCPRO2 (decoded_fullname, fileattrs); 294 GCPRO2_VAR (decoded_fullname, fileattrs, innermost_gcpro);
300 295
301 /* Both Fexpand_file_name and Ffile_attributes can GC. */ 296 /* Both Fexpand_file_name and Ffile_attributes can GC. */
302 decoded_fullname = Fexpand_file_name (name, directory); 297 decoded_fullname = Fexpand_file_name (name, directory);
303 fileattrs = Ffile_attributes (decoded_fullname, id_format); 298 fileattrs = Ffile_attributes (decoded_fullname, id_format);
304 299
305 list = Fcons (Fcons (finalname, fileattrs), list); 300 list = Fcons (Fcons (finalname, fileattrs), list);
306 UNGCPRO; 301 UNGCPRO_VAR (innermost_gcpro);
307 } 302 }
308 else 303 else
309 list = Fcons (finalname, list); 304 list = Fcons (finalname, list);
310 } 305 }
311 306
312 UNGCPRO; 307 UNGCPRO_VAR (inner_gcpro);
313 } 308 }
314 } 309 }
315 310
@@ -676,11 +671,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
676 if (!NILP (predicate)) 671 if (!NILP (predicate))
677 { 672 {
678 Lisp_Object val; 673 Lisp_Object val;
679 struct gcpro gcpro1; 674 struct gcpro inner_gcpro1;
680 675
681 GCPRO1 (name); 676 GCPRO1_VAR (name, inner_gcpro);
682 val = call1 (predicate, name); 677 val = call1 (predicate, name);
683 UNGCPRO; 678 UNGCPRO_VAR (inner_gcpro);
684 679
685 if (NILP (val)) 680 if (NILP (val))
686 continue; 681 continue;
@@ -702,16 +697,16 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
702 Lisp_Object zero = make_number (0); 697 Lisp_Object zero = make_number (0);
703 /* FIXME: This is a copy of the code in Ftry_completion. */ 698 /* FIXME: This is a copy of the code in Ftry_completion. */
704 int compare = min (bestmatchsize, SCHARS (name)); 699 int compare = min (bestmatchsize, SCHARS (name));
705 Lisp_Object tem 700 Lisp_Object cmp
706 = Fcompare_strings (bestmatch, zero, 701 = Fcompare_strings (bestmatch, zero,
707 make_number (compare), 702 make_number (compare),
708 name, zero, 703 name, zero,
709 make_number (compare), 704 make_number (compare),
710 completion_ignore_case ? Qt : Qnil); 705 completion_ignore_case ? Qt : Qnil);
711 int matchsize 706 int matchsize
712 = (EQ (tem, Qt) ? compare 707 = (EQ (cmp, Qt) ? compare
713 : XINT (tem) < 0 ? - XINT (tem) - 1 708 : XINT (cmp) < 0 ? - XINT (cmp) - 1
714 : XINT (tem) - 1); 709 : XINT (cmp) - 1);
715 710
716 if (completion_ignore_case) 711 if (completion_ignore_case)
717 { 712 {
@@ -735,18 +730,18 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
735 (((matchsize == SCHARS (name)) 730 (((matchsize == SCHARS (name))
736 == 731 ==
737 (matchsize + !!directoryp == SCHARS (bestmatch))) 732 (matchsize + !!directoryp == SCHARS (bestmatch)))
738 && (tem = Fcompare_strings (name, zero, 733 && (cmp = Fcompare_strings (name, zero,
739 make_number (SCHARS (file)), 734 make_number (SCHARS (file)),
740 file, zero, 735 file, zero,
741 Qnil, 736 Qnil,
742 Qnil), 737 Qnil),
743 EQ (Qt, tem)) 738 EQ (Qt, cmp))
744 && (tem = Fcompare_strings (bestmatch, zero, 739 && (cmp = Fcompare_strings (bestmatch, zero,
745 make_number (SCHARS (file)), 740 make_number (SCHARS (file)),
746 file, zero, 741 file, zero,
747 Qnil, 742 Qnil,
748 Qnil), 743 Qnil),
749 ! EQ (Qt, tem)))) 744 ! EQ (Qt, cmp))))
750 bestmatch = name; 745 bestmatch = name;
751 } 746 }
752 bestmatchsize = matchsize; 747 bestmatchsize = matchsize;
@@ -795,8 +790,8 @@ scmp (const char *s1, const char *s2, int len)
795 if (completion_ignore_case) 790 if (completion_ignore_case)
796 { 791 {
797 while (l 792 while (l
798 && (DOWNCASE ((unsigned char) *s1++) 793 && (downcase ((unsigned char) *s1++)
799 == DOWNCASE ((unsigned char) *s2++))) 794 == downcase ((unsigned char) *s2++)))
800 l--; 795 l--;
801 } 796 }
802 else 797 else
@@ -848,13 +843,6 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
848 return value; 843 return value;
849} 844}
850 845
851Lisp_Object
852make_time (time_t time)
853{
854 return Fcons (make_number (time >> 16),
855 Fcons (make_number (time & 0177777), Qnil));
856}
857
858static char * 846static char *
859stat_uname (struct stat *st) 847stat_uname (struct stat *st)
860{ 848{
diff --git a/src/dispextern.h b/src/dispextern.h
index 37ae7ee5fd5..9843dfd1fcd 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2944,6 +2944,7 @@ enum tool_bar_item_image
2944 2944
2945extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *); 2945extern void bidi_init_it (EMACS_INT, EMACS_INT, struct bidi_it *);
2946extern void bidi_move_to_visually_next (struct bidi_it *); 2946extern void bidi_move_to_visually_next (struct bidi_it *);
2947extern void bidi_dump_cached_states (void);
2947extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); 2948extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
2948extern int bidi_mirror_char (int); 2949extern int bidi_mirror_char (int);
2949 2950
@@ -3325,9 +3326,10 @@ extern struct terminal *init_tty (const char *, const char *, int);
3325 3326
3326extern int scrolling_max_lines_saved (int, int, int *, int *, int *); 3327extern int scrolling_max_lines_saved (int, int, int *, int *, int *);
3327extern int scroll_cost (struct frame *, int, int, int); 3328extern int scroll_cost (struct frame *, int, int, int);
3328extern void do_line_insertion_deletion_costs (struct frame *, char *, 3329extern void do_line_insertion_deletion_costs (struct frame *, const char *,
3329 char *, char *, char *, 3330 const char *, const char *,
3330 char *, char *, int); 3331 const char *, const char *,
3332 const char *, int);
3331void scrolling_1 (struct frame *, int, int, int, int *, int *, int *, 3333void scrolling_1 (struct frame *, int, int, int, int *, int *, int *,
3332 int *, int); 3334 int *, int);
3333 3335
diff --git a/src/doc.c b/src/doc.c
index b56464e7219..158b09790f7 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -323,17 +323,20 @@ string is passed through `substitute-command-keys'. */)
323{ 323{
324 Lisp_Object fun; 324 Lisp_Object fun;
325 Lisp_Object funcar; 325 Lisp_Object funcar;
326 Lisp_Object tem, doc; 326 Lisp_Object doc;
327 int try_reload = 1; 327 int try_reload = 1;
328 328
329 documentation: 329 documentation:
330 330
331 doc = Qnil; 331 doc = Qnil;
332 332
333 if (SYMBOLP (function) 333 if (SYMBOLP (function))
334 && (tem = Fget (function, Qfunction_documentation), 334 {
335 !NILP (tem))) 335 Lisp_Object tem = Fget (function, Qfunction_documentation);
336 return Fdocumentation_property (function, Qfunction_documentation, raw); 336 if (!NILP (tem))
337 return Fdocumentation_property (function, Qfunction_documentation,
338 raw);
339 }
337 340
338 fun = Findirect_function (function, Qnil); 341 fun = Findirect_function (function, Qnil);
339 if (SUBRP (fun)) 342 if (SUBRP (fun))
@@ -349,13 +352,16 @@ string is passed through `substitute-command-keys'. */)
349 { 352 {
350 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING) 353 if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING)
351 return Qnil; 354 return Qnil;
352 tem = AREF (fun, COMPILED_DOC_STRING);
353 if (STRINGP (tem))
354 doc = tem;
355 else if (NATNUMP (tem) || CONSP (tem))
356 doc = tem;
357 else 355 else
358 return Qnil; 356 {
357 Lisp_Object tem = AREF (fun, COMPILED_DOC_STRING);
358 if (STRINGP (tem))
359 doc = tem;
360 else if (NATNUMP (tem) || CONSP (tem))
361 doc = tem;
362 else
363 return Qnil;
364 }
359 } 365 }
360 else if (STRINGP (fun) || VECTORP (fun)) 366 else if (STRINGP (fun) || VECTORP (fun))
361 { 367 {
@@ -372,9 +378,8 @@ string is passed through `substitute-command-keys'. */)
372 || (EQ (funcar, Qclosure) && (fun = XCDR (fun), 1)) 378 || (EQ (funcar, Qclosure) && (fun = XCDR (fun), 1))
373 || EQ (funcar, Qautoload)) 379 || EQ (funcar, Qautoload))
374 { 380 {
375 Lisp_Object tem1; 381 Lisp_Object tem1 = Fcdr (Fcdr (fun));
376 tem1 = Fcdr (Fcdr (fun)); 382 Lisp_Object tem = Fcar (tem1);
377 tem = Fcar (tem1);
378 if (STRINGP (tem)) 383 if (STRINGP (tem))
379 doc = tem; 384 doc = tem;
380 /* Handle a doc reference--but these never come last 385 /* Handle a doc reference--but these never come last
@@ -542,7 +547,7 @@ the same file name is found in the `doc-directory'. */)
542 char buf[1024 + 1]; 547 char buf[1024 + 1];
543 register EMACS_INT filled; 548 register EMACS_INT filled;
544 register EMACS_INT pos; 549 register EMACS_INT pos;
545 register char *p, *end; 550 register char *p;
546 Lisp_Object sym; 551 Lisp_Object sym;
547 char *name; 552 char *name;
548 int skip_file = 0; 553 int skip_file = 0;
@@ -601,6 +606,7 @@ the same file name is found in the `doc-directory'. */)
601 pos = 0; 606 pos = 0;
602 while (1) 607 while (1)
603 { 608 {
609 register char *end;
604 if (filled < 512) 610 if (filled < 512)
605 filled += emacs_read (fd, &buf[filled], sizeof buf - 1 - filled); 611 filled += emacs_read (fd, &buf[filled], sizeof buf - 1 - filled);
606 if (!filled) 612 if (!filled)
diff --git a/src/editfns.c b/src/editfns.c
index 28690e7c76d..1f98ff040b3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -45,6 +45,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
45#endif 45#endif
46 46
47#include <ctype.h> 47#include <ctype.h>
48#include <limits.h>
49#include <intprops.h>
48#include <strftime.h> 50#include <strftime.h>
49 51
50#include "intervals.h" 52#include "intervals.h"
@@ -87,6 +89,7 @@ extern char **environ;
87extern Lisp_Object w32_get_internal_run_time (void); 89extern Lisp_Object w32_get_internal_run_time (void);
88#endif 90#endif
89 91
92static void time_overflow (void) NO_RETURN;
90static int tm_diff (struct tm *, struct tm *); 93static int tm_diff (struct tm *, struct tm *);
91static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, 94static void find_field (Lisp_Object, Lisp_Object, Lisp_Object,
92 EMACS_INT *, Lisp_Object, EMACS_INT *); 95 EMACS_INT *, Lisp_Object, EMACS_INT *);
@@ -119,7 +122,7 @@ Lisp_Object Qboundary;
119void 122void
120init_editfns (void) 123init_editfns (void)
121{ 124{
122 char *user_name; 125 const char *user_name;
123 register char *p; 126 register char *p;
124 struct passwd *pw; /* password entry for the current user */ 127 struct passwd *pw; /* password entry for the current user */
125 Lisp_Object tem; 128 Lisp_Object tem;
@@ -133,7 +136,7 @@ init_editfns (void)
133 return; 136 return;
134#endif /* not CANNOT_DUMP */ 137#endif /* not CANNOT_DUMP */
135 138
136 pw = (struct passwd *) getpwuid (getuid ()); 139 pw = getpwuid (getuid ());
137#ifdef MSDOS 140#ifdef MSDOS
138 /* We let the real user name default to "root" because that's quite 141 /* We let the real user name default to "root" because that's quite
139 accurate on MSDOG and because it lets Emacs find the init file. 142 accurate on MSDOG and because it lets Emacs find the init file.
@@ -145,17 +148,17 @@ init_editfns (void)
145 148
146 /* Get the effective user name, by consulting environment variables, 149 /* Get the effective user name, by consulting environment variables,
147 or the effective uid if those are unset. */ 150 or the effective uid if those are unset. */
148 user_name = (char *) getenv ("LOGNAME"); 151 user_name = getenv ("LOGNAME");
149 if (!user_name) 152 if (!user_name)
150#ifdef WINDOWSNT 153#ifdef WINDOWSNT
151 user_name = (char *) getenv ("USERNAME"); /* it's USERNAME on NT */ 154 user_name = getenv ("USERNAME"); /* it's USERNAME on NT */
152#else /* WINDOWSNT */ 155#else /* WINDOWSNT */
153 user_name = (char *) getenv ("USER"); 156 user_name = getenv ("USER");
154#endif /* WINDOWSNT */ 157#endif /* WINDOWSNT */
155 if (!user_name) 158 if (!user_name)
156 { 159 {
157 pw = (struct passwd *) getpwuid (geteuid ()); 160 pw = getpwuid (geteuid ());
158 user_name = (char *) (pw ? pw->pw_name : "unknown"); 161 user_name = pw ? pw->pw_name : "unknown";
159 } 162 }
160 Vuser_login_name = build_string (user_name); 163 Vuser_login_name = build_string (user_name);
161 164
@@ -1263,9 +1266,9 @@ of the user with that uid, or nil if there is no such user. */)
1263 if (NILP (uid)) 1266 if (NILP (uid))
1264 return Vuser_login_name; 1267 return Vuser_login_name;
1265 1268
1266 id = (uid_t)XFLOATINT (uid); 1269 id = XFLOATINT (uid);
1267 BLOCK_INPUT; 1270 BLOCK_INPUT;
1268 pw = (struct passwd *) getpwuid (id); 1271 pw = getpwuid (id);
1269 UNBLOCK_INPUT; 1272 UNBLOCK_INPUT;
1270 return (pw ? build_string (pw->pw_name) : Qnil); 1273 return (pw ? build_string (pw->pw_name) : Qnil);
1271} 1274}
@@ -1297,7 +1300,7 @@ Value is an integer or a float, depending on the value. */)
1297 /* Make sure we don't produce a negative UID due to signed integer 1300 /* Make sure we don't produce a negative UID due to signed integer
1298 overflow. */ 1301 overflow. */
1299 if (euid < 0) 1302 if (euid < 0)
1300 return make_float ((double)geteuid ()); 1303 return make_float (geteuid ());
1301 return make_fixnum_or_float (euid); 1304 return make_fixnum_or_float (euid);
1302} 1305}
1303 1306
@@ -1313,7 +1316,7 @@ Value is an integer or a float, depending on the value. */)
1313 /* Make sure we don't produce a negative UID due to signed integer 1316 /* Make sure we don't produce a negative UID due to signed integer
1314 overflow. */ 1317 overflow. */
1315 if (uid < 0) 1318 if (uid < 0)
1316 return make_float ((double)getuid ()); 1319 return make_float (getuid ());
1317 return make_fixnum_or_float (uid); 1320 return make_fixnum_or_float (uid);
1318} 1321}
1319 1322
@@ -1336,14 +1339,15 @@ name, or nil if there is no such user. */)
1336 return Vuser_full_name; 1339 return Vuser_full_name;
1337 else if (NUMBERP (uid)) 1340 else if (NUMBERP (uid))
1338 { 1341 {
1342 uid_t u = XFLOATINT (uid);
1339 BLOCK_INPUT; 1343 BLOCK_INPUT;
1340 pw = (struct passwd *) getpwuid ((uid_t) XFLOATINT (uid)); 1344 pw = getpwuid (u);
1341 UNBLOCK_INPUT; 1345 UNBLOCK_INPUT;
1342 } 1346 }
1343 else if (STRINGP (uid)) 1347 else if (STRINGP (uid))
1344 { 1348 {
1345 BLOCK_INPUT; 1349 BLOCK_INPUT;
1346 pw = (struct passwd *) getpwnam (SSDATA (uid)); 1350 pw = getpwnam (SSDATA (uid));
1347 UNBLOCK_INPUT; 1351 UNBLOCK_INPUT;
1348 } 1352 }
1349 else 1353 else
@@ -1371,7 +1375,7 @@ name, or nil if there is no such user. */)
1371 memcpy (r, p, q - p); 1375 memcpy (r, p, q - p);
1372 r[q - p] = 0; 1376 r[q - p] = 0;
1373 strcat (r, SSDATA (login)); 1377 strcat (r, SSDATA (login));
1374 r[q - p] = UPCASE ((unsigned char) r[q - p]); 1378 r[q - p] = upcase ((unsigned char) r[q - p]);
1375 strcat (r, q + 1); 1379 strcat (r, q + 1);
1376 full = build_string (r); 1380 full = build_string (r);
1377 } 1381 }
@@ -1387,8 +1391,6 @@ DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0,
1387 return Vsystem_name; 1391 return Vsystem_name;
1388} 1392}
1389 1393
1390/* For the benefit of callers who don't want to include lisp.h */
1391
1392const char * 1394const char *
1393get_system_name (void) 1395get_system_name (void)
1394{ 1396{
@@ -1414,6 +1416,49 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
1414 return make_number (getpid ()); 1416 return make_number (getpid ());
1415} 1417}
1416 1418
1419
1420
1421#ifndef TIME_T_MIN
1422# define TIME_T_MIN TYPE_MINIMUM (time_t)
1423#endif
1424#ifndef TIME_T_MAX
1425# define TIME_T_MAX TYPE_MAXIMUM (time_t)
1426#endif
1427
1428/* Report that a time value is out of range for Emacs. */
1429static void
1430time_overflow (void)
1431{
1432 error ("Specified time is not representable");
1433}
1434
1435/* Return the upper part of the time T (everything but the bottom 16 bits),
1436 making sure that it is representable. */
1437static EMACS_INT
1438hi_time (time_t t)
1439{
1440 time_t hi = t >> 16;
1441
1442 /* Check for overflow, helping the compiler for common cases where
1443 no runtime check is needed, and taking care not to convert
1444 negative numbers to unsigned before comparing them. */
1445 if (! ((! TYPE_SIGNED (time_t)
1446 || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16
1447 || MOST_NEGATIVE_FIXNUM <= hi)
1448 && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM
1449 || hi <= MOST_POSITIVE_FIXNUM)))
1450 time_overflow ();
1451
1452 return hi;
1453}
1454
1455/* Return the bottom 16 bits of the time T. */
1456static EMACS_INT
1457lo_time (time_t t)
1458{
1459 return t & ((1 << 16) - 1);
1460}
1461
1417DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, 1462DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0,
1418 doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00. 1463 doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00.
1419The time is returned as a list of three integers. The first has the 1464The time is returned as a list of three integers. The first has the
@@ -1428,8 +1473,8 @@ resolution finer than a second. */)
1428 EMACS_TIME t; 1473 EMACS_TIME t;
1429 1474
1430 EMACS_GET_TIME (t); 1475 EMACS_GET_TIME (t);
1431 return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), 1476 return list3 (make_number (hi_time (EMACS_SECS (t))),
1432 make_number ((EMACS_SECS (t) >> 0) & 0xffff), 1477 make_number (lo_time (EMACS_SECS (t))),
1433 make_number (EMACS_USECS (t))); 1478 make_number (EMACS_USECS (t)));
1434} 1479}
1435 1480
@@ -1448,7 +1493,8 @@ on systems that do not provide resolution finer than a second. */)
1448{ 1493{
1449#ifdef HAVE_GETRUSAGE 1494#ifdef HAVE_GETRUSAGE
1450 struct rusage usage; 1495 struct rusage usage;
1451 int secs, usecs; 1496 time_t secs;
1497 int usecs;
1452 1498
1453 if (getrusage (RUSAGE_SELF, &usage) < 0) 1499 if (getrusage (RUSAGE_SELF, &usage) < 0)
1454 /* This shouldn't happen. What action is appropriate? */ 1500 /* This shouldn't happen. What action is appropriate? */
@@ -1463,8 +1509,8 @@ on systems that do not provide resolution finer than a second. */)
1463 secs++; 1509 secs++;
1464 } 1510 }
1465 1511
1466 return list3 (make_number ((secs >> 16) & 0xffff), 1512 return list3 (make_number (hi_time (secs)),
1467 make_number ((secs >> 0) & 0xffff), 1513 make_number (lo_time (secs)),
1468 make_number (usecs)); 1514 make_number (usecs));
1469#else /* ! HAVE_GETRUSAGE */ 1515#else /* ! HAVE_GETRUSAGE */
1470#ifdef WINDOWSNT 1516#ifdef WINDOWSNT
@@ -1476,6 +1522,19 @@ on systems that do not provide resolution finer than a second. */)
1476} 1522}
1477 1523
1478 1524
1525/* Make a Lisp list that represents the time T. */
1526Lisp_Object
1527make_time (time_t t)
1528{
1529 return list2 (make_number (hi_time (t)),
1530 make_number (lo_time (t)));
1531}
1532
1533/* Decode a Lisp list SPECIFIED_TIME that represents a time.
1534 If SPECIFIED_TIME is nil, use the current time.
1535 Set *RESULT to seconds since the Epoch.
1536 If USEC is not null, set *USEC to the microseconds component.
1537 Return nonzero if successful. */
1479int 1538int
1480lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) 1539lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec)
1481{ 1540{
@@ -1496,6 +1555,7 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec)
1496 else 1555 else
1497 { 1556 {
1498 Lisp_Object high, low; 1557 Lisp_Object high, low;
1558 EMACS_INT hi;
1499 high = Fcar (specified_time); 1559 high = Fcar (specified_time);
1500 CHECK_NUMBER (high); 1560 CHECK_NUMBER (high);
1501 low = Fcdr (specified_time); 1561 low = Fcdr (specified_time);
@@ -1519,8 +1579,21 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec)
1519 else if (usec) 1579 else if (usec)
1520 *usec = 0; 1580 *usec = 0;
1521 CHECK_NUMBER (low); 1581 CHECK_NUMBER (low);
1522 *result = (XINT (high) << 16) + (XINT (low) & 0xffff); 1582 hi = XINT (high);
1523 return *result >> 16 == XINT (high); 1583
1584 /* Check for overflow, helping the compiler for common cases
1585 where no runtime check is needed, and taking care not to
1586 convert negative numbers to unsigned before comparing them. */
1587 if (! ((TYPE_SIGNED (time_t)
1588 ? (TIME_T_MIN >> 16 <= MOST_NEGATIVE_FIXNUM
1589 || TIME_T_MIN >> 16 <= hi)
1590 : 0 <= hi)
1591 && (MOST_POSITIVE_FIXNUM <= TIME_T_MAX >> 16
1592 || hi <= TIME_T_MAX >> 16)))
1593 return 0;
1594
1595 *result = (hi << 16) + (XINT (low) & 0xffff);
1596 return 1;
1524 } 1597 }
1525} 1598}
1526 1599
@@ -1648,7 +1721,7 @@ The modifiers are `E' and `O'. For certain characters X,
1648%OX is like %X, but uses the locale's number symbols. 1721%OX is like %X, but uses the locale's number symbols.
1649 1722
1650For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) 1723For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1651 (Lisp_Object format_string, Lisp_Object time, Lisp_Object universal) 1724 (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal)
1652{ 1725{
1653 time_t value; 1726 time_t value;
1654 int size; 1727 int size;
@@ -1659,7 +1732,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1659 1732
1660 CHECK_STRING (format_string); 1733 CHECK_STRING (format_string);
1661 1734
1662 if (! (lisp_time_argument (time, &value, &usec) 1735 if (! (lisp_time_argument (timeval, &value, &usec)
1663 && 0 <= usec && usec < 1000000)) 1736 && 0 <= usec && usec < 1000000))
1664 error ("Invalid time specification"); 1737 error ("Invalid time specification");
1665 ns = usec * 1000; 1738 ns = usec * 1000;
@@ -1674,7 +1747,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */)
1674 tm = ut ? gmtime (&value) : localtime (&value); 1747 tm = ut ? gmtime (&value) : localtime (&value);
1675 UNBLOCK_INPUT; 1748 UNBLOCK_INPUT;
1676 if (! tm) 1749 if (! tm)
1677 error ("Specified time is not representable"); 1750 time_overflow ();
1678 1751
1679 synchronize_system_time_locale (); 1752 synchronize_system_time_locale ();
1680 1753
@@ -1732,8 +1805,10 @@ DOW and ZONE.) */)
1732 BLOCK_INPUT; 1805 BLOCK_INPUT;
1733 decoded_time = localtime (&time_spec); 1806 decoded_time = localtime (&time_spec);
1734 UNBLOCK_INPUT; 1807 UNBLOCK_INPUT;
1735 if (! decoded_time) 1808 if (! (decoded_time
1736 error ("Specified time is not representable"); 1809 && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year
1810 && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
1811 time_overflow ();
1737 XSETFASTINT (list_args[0], decoded_time->tm_sec); 1812 XSETFASTINT (list_args[0], decoded_time->tm_sec);
1738 XSETFASTINT (list_args[1], decoded_time->tm_min); 1813 XSETFASTINT (list_args[1], decoded_time->tm_min);
1739 XSETFASTINT (list_args[2], decoded_time->tm_hour); 1814 XSETFASTINT (list_args[2], decoded_time->tm_hour);
@@ -1757,6 +1832,20 @@ DOW and ZONE.) */)
1757 return Flist (9, list_args); 1832 return Flist (9, list_args);
1758} 1833}
1759 1834
1835/* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that
1836 the result is representable as an int. Assume OFFSET is small and
1837 nonnegative. */
1838static int
1839check_tm_member (Lisp_Object obj, int offset)
1840{
1841 EMACS_INT n;
1842 CHECK_NUMBER (obj);
1843 n = XINT (obj);
1844 if (! (INT_MIN + offset <= n && n - offset <= INT_MAX))
1845 time_overflow ();
1846 return n - offset;
1847}
1848
1760DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, 1849DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0,
1761 doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. 1850 doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time.
1762This is the reverse operation of `decode-time', which see. 1851This is the reverse operation of `decode-time', which see.
@@ -1781,23 +1870,16 @@ year values as low as 1901 do work.
1781usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) 1870usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1782 (int nargs, register Lisp_Object *args) 1871 (int nargs, register Lisp_Object *args)
1783{ 1872{
1784 time_t time; 1873 time_t value;
1785 struct tm tm; 1874 struct tm tm;
1786 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); 1875 Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil);
1787 1876
1788 CHECK_NUMBER (args[0]); /* second */ 1877 tm.tm_sec = check_tm_member (args[0], 0);
1789 CHECK_NUMBER (args[1]); /* minute */ 1878 tm.tm_min = check_tm_member (args[1], 0);
1790 CHECK_NUMBER (args[2]); /* hour */ 1879 tm.tm_hour = check_tm_member (args[2], 0);
1791 CHECK_NUMBER (args[3]); /* day */ 1880 tm.tm_mday = check_tm_member (args[3], 0);
1792 CHECK_NUMBER (args[4]); /* month */ 1881 tm.tm_mon = check_tm_member (args[4], 1);
1793 CHECK_NUMBER (args[5]); /* year */ 1882 tm.tm_year = check_tm_member (args[5], TM_YEAR_BASE);
1794
1795 tm.tm_sec = XINT (args[0]);
1796 tm.tm_min = XINT (args[1]);
1797 tm.tm_hour = XINT (args[2]);
1798 tm.tm_mday = XINT (args[3]);
1799 tm.tm_mon = XINT (args[4]) - 1;
1800 tm.tm_year = XINT (args[5]) - TM_YEAR_BASE;
1801 tm.tm_isdst = -1; 1883 tm.tm_isdst = -1;
1802 1884
1803 if (CONSP (zone)) 1885 if (CONSP (zone))
@@ -1805,7 +1887,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1805 if (NILP (zone)) 1887 if (NILP (zone))
1806 { 1888 {
1807 BLOCK_INPUT; 1889 BLOCK_INPUT;
1808 time = mktime (&tm); 1890 value = mktime (&tm);
1809 UNBLOCK_INPUT; 1891 UNBLOCK_INPUT;
1810 } 1892 }
1811 else 1893 else
@@ -1833,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1833 set_time_zone_rule (tzstring); 1915 set_time_zone_rule (tzstring);
1834 1916
1835 BLOCK_INPUT; 1917 BLOCK_INPUT;
1836 time = mktime (&tm); 1918 value = mktime (&tm);
1837 UNBLOCK_INPUT; 1919 UNBLOCK_INPUT;
1838 1920
1839 /* Restore TZ to previous value. */ 1921 /* Restore TZ to previous value. */
@@ -1845,10 +1927,10 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1845#endif 1927#endif
1846 } 1928 }
1847 1929
1848 if (time == (time_t) -1) 1930 if (value == (time_t) -1)
1849 error ("Specified time is not representable"); 1931 time_overflow ();
1850 1932
1851 return make_time (time); 1933 return make_time (value);
1852} 1934}
1853 1935
1854DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, 1936DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0,
@@ -1881,7 +1963,7 @@ but this is considered obsolete. */)
1881 tm = localtime (&value); 1963 tm = localtime (&value);
1882 UNBLOCK_INPUT; 1964 UNBLOCK_INPUT;
1883 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) 1965 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm))))
1884 error ("Specified time is not representable"); 1966 time_overflow ();
1885 1967
1886 /* Remove the trailing newline. */ 1968 /* Remove the trailing newline. */
1887 tem[strlen (tem) - 1] = '\0'; 1969 tem[strlen (tem) - 1] = '\0';
@@ -2258,7 +2340,7 @@ from adjoining text, if those properties are sticky. */)
2258 (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) 2340 (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
2259{ 2341{
2260 register char *string; 2342 register char *string;
2261 register EMACS_INT strlen; 2343 register EMACS_INT stringlen;
2262 register int i; 2344 register int i;
2263 register EMACS_INT n; 2345 register EMACS_INT n;
2264 int len; 2346 int len;
@@ -2276,18 +2358,18 @@ from adjoining text, if those properties are sticky. */)
2276 n = XINT (count) * len; 2358 n = XINT (count) * len;
2277 if (n <= 0) 2359 if (n <= 0)
2278 return Qnil; 2360 return Qnil;
2279 strlen = min (n, 256 * len); 2361 stringlen = min (n, 256 * len);
2280 string = (char *) alloca (strlen); 2362 string = (char *) alloca (stringlen);
2281 for (i = 0; i < strlen; i++) 2363 for (i = 0; i < stringlen; i++)
2282 string[i] = str[i % len]; 2364 string[i] = str[i % len];
2283 while (n >= strlen) 2365 while (n >= stringlen)
2284 { 2366 {
2285 QUIT; 2367 QUIT;
2286 if (!NILP (inherit)) 2368 if (!NILP (inherit))
2287 insert_and_inherit (string, strlen); 2369 insert_and_inherit (string, stringlen);
2288 else 2370 else
2289 insert (string, strlen); 2371 insert (string, stringlen);
2290 n -= strlen; 2372 n -= stringlen;
2291 } 2373 }
2292 if (n > 0) 2374 if (n > 0)
2293 { 2375 {
@@ -2946,8 +3028,7 @@ It returns the number of characters changed. */)
2946 EMACS_INT size; /* Size of translate table. */ 3028 EMACS_INT size; /* Size of translate table. */
2947 EMACS_INT pos, pos_byte, end_pos; 3029 EMACS_INT pos, pos_byte, end_pos;
2948 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 3030 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
2949 int string_multibyte; 3031 int string_multibyte IF_LINT (= 0);
2950 Lisp_Object val;
2951 3032
2952 validate_region (&start, &end); 3033 validate_region (&start, &end);
2953 if (CHAR_TABLE_P (table)) 3034 if (CHAR_TABLE_P (table))
@@ -3846,7 +3927,7 @@ usage: (format STRING &rest OBJECTS) */)
3846 /* handle case (precision[n] >= 0) */ 3927 /* handle case (precision[n] >= 0) */
3847 3928
3848 int width, padding; 3929 int width, padding;
3849 EMACS_INT nbytes, start, end; 3930 EMACS_INT nbytes, start;
3850 EMACS_INT nchars_string; 3931 EMACS_INT nchars_string;
3851 3932
3852 /* lisp_string_width ignores a precision of 0, but GNU 3933 /* lisp_string_width ignores a precision of 0, but GNU
@@ -3878,7 +3959,6 @@ usage: (format STRING &rest OBJECTS) */)
3878 3959
3879 info[n].start = start = nchars; 3960 info[n].start = start = nchars;
3880 nchars += nchars_string; 3961 nchars += nchars_string;
3881 end = nchars;
3882 3962
3883 if (p > buf 3963 if (p > buf
3884 && multibyte 3964 && multibyte
@@ -4130,7 +4210,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4130{ 4210{
4131 int i1, i2; 4211 int i1, i2;
4132 /* Check they're chars, not just integers, otherwise we could get array 4212 /* Check they're chars, not just integers, otherwise we could get array
4133 bounds violations in DOWNCASE. */ 4213 bounds violations in downcase. */
4134 CHECK_CHARACTER (c1); 4214 CHECK_CHARACTER (c1);
4135 CHECK_CHARACTER (c2); 4215 CHECK_CHARACTER (c2);
4136 4216
@@ -4139,9 +4219,6 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4139 if (NILP (BVAR (current_buffer, case_fold_search))) 4219 if (NILP (BVAR (current_buffer, case_fold_search)))
4140 return Qnil; 4220 return Qnil;
4141 4221
4142 /* Do these in separate statements,
4143 then compare the variables.
4144 because of the way DOWNCASE uses temp variables. */
4145 i1 = XFASTINT (c1); 4222 i1 = XFASTINT (c1);
4146 if (NILP (BVAR (current_buffer, enable_multibyte_characters)) 4223 if (NILP (BVAR (current_buffer, enable_multibyte_characters))
4147 && ! ASCII_CHAR_P (i1)) 4224 && ! ASCII_CHAR_P (i1))
@@ -4154,9 +4231,7 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */)
4154 { 4231 {
4155 MAKE_CHAR_MULTIBYTE (i2); 4232 MAKE_CHAR_MULTIBYTE (i2);
4156 } 4233 }
4157 i1 = DOWNCASE (i1); 4234 return (downcase (i1) == downcase (i2) ? Qt : Qnil);
4158 i2 = DOWNCASE (i2);
4159 return (i1 == i2 ? Qt : Qnil);
4160} 4235}
4161 4236
4162/* Transpose the markers in two regions of the current buffer, and 4237/* Transpose the markers in two regions of the current buffer, and
diff --git a/src/emacs.c b/src/emacs.c
index 4455e6b4d9f..052f22ea622 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -141,7 +141,7 @@ Lisp_Object Qfile_name_handler_alist;
141 141
142Lisp_Object Qrisky_local_variable; 142Lisp_Object Qrisky_local_variable;
143 143
144/* If non-zero, emacs should not attempt to use a window-specific code, 144/* If non-zero, Emacs should not attempt to use a window-specific code,
145 but instead should use the virtual terminal under which it was started. */ 145 but instead should use the virtual terminal under which it was started. */
146int inhibit_window_system; 146int inhibit_window_system;
147 147
@@ -169,7 +169,6 @@ static unsigned long heap_bss_diff;
169#define MAX_HEAP_BSS_DIFF (1024*1024) 169#define MAX_HEAP_BSS_DIFF (1024*1024)
170 170
171/* Nonzero means running Emacs without interactive terminal. */ 171/* Nonzero means running Emacs without interactive terminal. */
172
173int noninteractive; 172int noninteractive;
174 173
175/* Nonzero means remove site-lisp directories from load-path. */ 174/* Nonzero means remove site-lisp directories from load-path. */
@@ -249,14 +248,14 @@ Display options:\n\
249--border-color, -bd COLOR main border color\n\ 248--border-color, -bd COLOR main border color\n\
250--border-width, -bw WIDTH width of main border\n\ 249--border-width, -bw WIDTH width of main border\n\
251--color, --color=MODE override color mode for character terminals;\n\ 250--color, --color=MODE override color mode for character terminals;\n\
252 MODE defaults to `auto', and can also\n\ 251 MODE defaults to `auto', and\n\
253 be `never', `auto', `always',\n\ 252 can also be `never', `always',\n\
254 or a mode name like `ansi8'\n\ 253 or a mode name like `ansi8'\n\
255--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\ 254--cursor-color, -cr COLOR color of the Emacs cursor indicating point\n\
256--font, -fn FONT default font; must be fixed-width\n\ 255--font, -fn FONT default font; must be fixed-width\n\
257--foreground-color, -fg COLOR window foreground color\n\ 256--foreground-color, -fg COLOR window foreground color\n\
258--fullheight, -fh make the first frame high as the screen\n\ 257--fullheight, -fh make the first frame high as the screen\n\
259--fullscreen, -fs make first frame fullscreen\n\ 258--fullscreen, -fs make the first frame fullscreen\n\
260--fullwidth, -fw make the first frame wide as the screen\n\ 259--fullwidth, -fw make the first frame wide as the screen\n\
261--maximized, -mm make the first frame maximized\n\ 260--maximized, -mm make the first frame maximized\n\
262--geometry, -g GEOMETRY window geometry\n\ 261--geometry, -g GEOMETRY window geometry\n\
@@ -382,7 +381,7 @@ static void
382init_cmdargs (int argc, char **argv, int skip_args) 381init_cmdargs (int argc, char **argv, int skip_args)
383{ 382{
384 register int i; 383 register int i;
385 Lisp_Object name, dir, tem; 384 Lisp_Object name, dir, handler;
386 int count = SPECPDL_INDEX (); 385 int count = SPECPDL_INDEX ();
387 Lisp_Object raw_name; 386 Lisp_Object raw_name;
388 387
@@ -393,8 +392,8 @@ init_cmdargs (int argc, char **argv, int skip_args)
393 392
394 /* Add /: to the front of the name 393 /* Add /: to the front of the name
395 if it would otherwise be treated as magic. */ 394 if it would otherwise be treated as magic. */
396 tem = Ffind_file_name_handler (raw_name, Qt); 395 handler = Ffind_file_name_handler (raw_name, Qt);
397 if (! NILP (tem)) 396 if (! NILP (handler))
398 raw_name = concat2 (build_string ("/:"), raw_name); 397 raw_name = concat2 (build_string ("/:"), raw_name);
399 398
400 Vinvocation_name = Ffile_name_nondirectory (raw_name); 399 Vinvocation_name = Ffile_name_nondirectory (raw_name);
@@ -411,8 +410,8 @@ init_cmdargs (int argc, char **argv, int skip_args)
411 { 410 {
412 /* Add /: to the front of the name 411 /* Add /: to the front of the name
413 if it would otherwise be treated as magic. */ 412 if it would otherwise be treated as magic. */
414 tem = Ffind_file_name_handler (found, Qt); 413 handler = Ffind_file_name_handler (found, Qt);
415 if (! NILP (tem)) 414 if (! NILP (handler))
416 found = concat2 (build_string ("/:"), found); 415 found = concat2 (build_string ("/:"), found);
417 Vinvocation_directory = Ffile_name_directory (found); 416 Vinvocation_directory = Ffile_name_directory (found);
418 } 417 }
@@ -547,21 +546,22 @@ static char dump_tz[] = "UtC0";
547 Provide dummy definitions to avoid error. 546 Provide dummy definitions to avoid error.
548 (We don't have any real constructors or destructors.) */ 547 (We don't have any real constructors or destructors.) */
549#ifdef __GNUC__ 548#ifdef __GNUC__
549
550/* Define a dummy function F. Declare F too, to pacify gcc
551 -Wmissing-prototypes. */
552#define DEFINE_DUMMY_FUNCTION(f) void f (void); void f (void) {}
553
550#ifndef GCC_CTORS_IN_LIBC 554#ifndef GCC_CTORS_IN_LIBC
551void __do_global_ctors (void) 555DEFINE_DUMMY_FUNCTION (__do_global_ctors)
552{} 556DEFINE_DUMMY_FUNCTION (__do_global_ctors_aux)
553void __do_global_ctors_aux (void) 557DEFINE_DUMMY_FUNCTION (__do_global_dtors)
554{}
555void __do_global_dtors (void)
556{}
557/* GNU/Linux has a bug in its library; avoid an error. */ 558/* GNU/Linux has a bug in its library; avoid an error. */
558#ifndef GNU_LINUX 559#ifndef GNU_LINUX
559char * __CTOR_LIST__[2] = { (char *) (-1), 0 }; 560char * __CTOR_LIST__[2] = { (char *) (-1), 0 };
560#endif 561#endif
561char * __DTOR_LIST__[2] = { (char *) (-1), 0 }; 562char * __DTOR_LIST__[2] = { (char *) (-1), 0 };
562#endif /* GCC_CTORS_IN_LIBC */ 563#endif /* GCC_CTORS_IN_LIBC */
563void __main (void) 564DEFINE_DUMMY_FUNCTION (__main)
564{}
565#endif /* __GNUC__ */ 565#endif /* __GNUC__ */
566#endif /* ORDINARY_LINK */ 566#endif /* ORDINARY_LINK */
567 567
@@ -576,7 +576,8 @@ void __main (void)
576 enough information to do it right. */ 576 enough information to do it right. */
577 577
578static int 578static int
579argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr) 579argmatch (char **argv, int argc, const char *sstr, const char *lstr,
580 int minlen, char **valptr, int *skipptr)
580{ 581{
581 char *p = NULL; 582 char *p = NULL;
582 int arglen; 583 int arglen;
@@ -948,7 +949,7 @@ main (int argc, char **argv)
948 /* Convert --script to -scriptload, un-skip it, and sort again 949 /* Convert --script to -scriptload, un-skip it, and sort again
949 so that it will be handled in proper sequence. */ 950 so that it will be handled in proper sequence. */
950 /* FIXME broken for --script=FILE - is that supposed to work? */ 951 /* FIXME broken for --script=FILE - is that supposed to work? */
951 argv[skip_args - 1] = "-scriptload"; 952 argv[skip_args - 1] = (char *) "-scriptload";
952 skip_args -= 2; 953 skip_args -= 2;
953 sort_args (argc, argv); 954 sort_args (argc, argv);
954 } 955 }
@@ -1347,7 +1348,7 @@ main (int argc, char **argv)
1347 1348
1348 for (j = 0; j < count_before + 1; j++) 1349 for (j = 0; j < count_before + 1; j++)
1349 new[j] = argv[j]; 1350 new[j] = argv[j];
1350 new[count_before + 1] = "-d"; 1351 new[count_before + 1] = (char *) "-d";
1351 new[count_before + 2] = displayname; 1352 new[count_before + 2] = displayname;
1352 for (j = count_before + 2; j <argc; j++) 1353 for (j = count_before + 2; j <argc; j++)
1353 new[j + 1] = argv[j]; 1354 new[j + 1] = argv[j];
@@ -1357,7 +1358,7 @@ main (int argc, char **argv)
1357 /* Change --display to -d, when its arg is separate. */ 1358 /* Change --display to -d, when its arg is separate. */
1358 else if (displayname != 0 && skip_args > count_before 1359 else if (displayname != 0 && skip_args > count_before
1359 && argv[count_before + 1][1] == '-') 1360 && argv[count_before + 1][1] == '-')
1360 argv[count_before + 1] = "-d"; 1361 argv[count_before + 1] = (char *) "-d";
1361 1362
1362 if (! no_site_lisp) 1363 if (! no_site_lisp)
1363 { 1364 {
@@ -2084,9 +2085,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
2084 2085
2085#ifndef CANNOT_DUMP 2086#ifndef CANNOT_DUMP
2086 2087
2087/* FIXME: maybe this should go into header file, config.h seems the 2088#include "unexec.h"
2088 only one appropriate. */
2089extern int unexec (const char *, const char *);
2090 2089
2091DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, 2090DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
2092 doc: /* Dump current state of Emacs into executable file FILENAME. 2091 doc: /* Dump current state of Emacs into executable file FILENAME.
@@ -2380,7 +2379,7 @@ Special values:
2380Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix, 2379Anything else (in Emacs 24.1, the possibilities are: aix, berkeley-unix,
2381hpux, irix, usg-unix-v) indicates some sort of Unix system. */); 2380hpux, irix, usg-unix-v) indicates some sort of Unix system. */);
2382 Vsystem_type = intern_c_string (SYSTEM_TYPE); 2381 Vsystem_type = intern_c_string (SYSTEM_TYPE);
2383 /* Above values are from SYSTEM_TYPE in src/s/*.h. */ 2382 /* The above values are from SYSTEM_TYPE in include files under src/s. */
2384 2383
2385 DEFVAR_LISP ("system-configuration", Vsystem_configuration, 2384 DEFVAR_LISP ("system-configuration", Vsystem_configuration,
2386 doc: /* Value is string indicating configuration Emacs was built for. 2385 doc: /* Value is string indicating configuration Emacs was built for.
diff --git a/src/eval.c b/src/eval.c
index 2fb89ce404e..c22e7d3f571 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -160,7 +160,7 @@ restore_stack_limits (Lisp_Object data)
160 160
161/* Call the Lisp debugger, giving it argument ARG. */ 161/* Call the Lisp debugger, giving it argument ARG. */
162 162
163Lisp_Object 163static Lisp_Object
164call_debugger (Lisp_Object arg) 164call_debugger (Lisp_Object arg)
165{ 165{
166 int debug_while_redisplaying; 166 int debug_while_redisplaying;
@@ -216,7 +216,7 @@ call_debugger (Lisp_Object arg)
216 return unbind_to (count, val); 216 return unbind_to (count, val);
217} 217}
218 218
219void 219static void
220do_debug_on_call (Lisp_Object code) 220do_debug_on_call (Lisp_Object code)
221{ 221{
222 debug_on_next_call = 0; 222 debug_on_next_call = 0;
@@ -796,11 +796,11 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
796 if (SYMBOL_CONSTANT_P (sym)) 796 if (SYMBOL_CONSTANT_P (sym))
797 { 797 {
798 /* For upward compatibility, allow (defvar :foo (quote :foo)). */ 798 /* For upward compatibility, allow (defvar :foo (quote :foo)). */
799 Lisp_Object tem = Fcar (tail); 799 Lisp_Object tem1 = Fcar (tail);
800 if (! (CONSP (tem) 800 if (! (CONSP (tem1)
801 && EQ (XCAR (tem), Qquote) 801 && EQ (XCAR (tem1), Qquote)
802 && CONSP (XCDR (tem)) 802 && CONSP (XCDR (tem1))
803 && EQ (XCAR (XCDR (tem)), sym))) 803 && EQ (XCAR (XCDR (tem1)), sym)))
804 error ("Constant symbol `%s' specified in defvar", 804 error ("Constant symbol `%s' specified in defvar",
805 SDATA (SYMBOL_NAME (sym))); 805 SDATA (SYMBOL_NAME (sym)));
806 } 806 }
@@ -840,11 +840,12 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
840 Vinternal_interpreter_environment = 840 Vinternal_interpreter_environment =
841 Fcons (sym, Vinternal_interpreter_environment); 841 Fcons (sym, Vinternal_interpreter_environment);
842 else 842 else
843 /* Simple (defvar <var>) should not count as a definition at all. 843 {
844 It could get in the way of other definitions, and unloading this 844 /* Simple (defvar <var>) should not count as a definition at all.
845 package could try to make the variable unbound. */ 845 It could get in the way of other definitions, and unloading this
846 ; 846 package could try to make the variable unbound. */
847 847 }
848
848 return sym; 849 return sym;
849} 850}
850 851
@@ -895,7 +896,8 @@ user_variable_p_eh (Lisp_Object ignore)
895static Lisp_Object 896static Lisp_Object
896lisp_indirect_variable (Lisp_Object sym) 897lisp_indirect_variable (Lisp_Object sym)
897{ 898{
898 XSETSYMBOL (sym, indirect_variable (XSYMBOL (sym))); 899 struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
900 XSETSYMBOL (sym, s);
899 return sym; 901 return sym;
900} 902}
901 903
@@ -1720,7 +1722,7 @@ See also the function `condition-case'. */)
1720 if (!NILP (clause)) 1722 if (!NILP (clause))
1721 break; 1723 break;
1722 } 1724 }
1723 1725
1724 if (/* Don't run the debugger for a memory-full error. 1726 if (/* Don't run the debugger for a memory-full error.
1725 (There is no room in memory to do that!) */ 1727 (There is no room in memory to do that!) */
1726 !NILP (error_symbol) 1728 !NILP (error_symbol)
@@ -1737,13 +1739,13 @@ See also the function `condition-case'. */)
1737 can continue code which has signaled a quit. */ 1739 can continue code which has signaled a quit. */
1738 if (debugger_called && EQ (real_error_symbol, Qquit)) 1740 if (debugger_called && EQ (real_error_symbol, Qquit))
1739 return Qnil; 1741 return Qnil;
1740 } 1742 }
1741 1743
1742 if (!NILP (clause)) 1744 if (!NILP (clause))
1743 { 1745 {
1744 Lisp_Object unwind_data 1746 Lisp_Object unwind_data
1745 = (NILP (error_symbol) ? data : Fcons (error_symbol, data)); 1747 = (NILP (error_symbol) ? data : Fcons (error_symbol, data));
1746 1748
1747 h->chosen_clause = clause; 1749 h->chosen_clause = clause;
1748 unwind_to_catch (h->tag, unwind_data); 1750 unwind_to_catch (h->tag, unwind_data);
1749 } 1751 }
@@ -1755,7 +1757,7 @@ See also the function `condition-case'. */)
1755 1757
1756 if (! NILP (error_symbol)) 1758 if (! NILP (error_symbol))
1757 data = Fcons (error_symbol, data); 1759 data = Fcons (error_symbol, data);
1758 1760
1759 string = Ferror_message_string (data); 1761 string = Ferror_message_string (data);
1760 fatal ("%s", SDATA (string), 0); 1762 fatal ("%s", SDATA (string), 0);
1761} 1763}
@@ -2648,8 +2650,8 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
2648 } 2650 }
2649 else 2651 else
2650 { 2652 {
2651 Lisp_Object globals = Qnil; 2653 Lisp_Object global_vals = Qnil;
2652 GCPRO3 (sym, val, globals); 2654 GCPRO3 (sym, val, global_vals);
2653 2655
2654 for (; 2656 for (;
2655 CONSP (val) && ((cond == to_completion) 2657 CONSP (val) && ((cond == to_completion)
@@ -2661,23 +2663,25 @@ run_hook_with_args (int nargs, Lisp_Object *args, enum run_hooks_condition cond)
2661 { 2663 {
2662 /* t indicates this hook has a local binding; 2664 /* t indicates this hook has a local binding;
2663 it means to run the global binding too. */ 2665 it means to run the global binding too. */
2664 globals = Fdefault_value (sym); 2666 global_vals = Fdefault_value (sym);
2665 if (NILP (globals)) continue; 2667 if (NILP (global_vals)) continue;
2666 2668
2667 if (!CONSP (globals) || EQ (XCAR (globals), Qlambda)) 2669 if (!CONSP (global_vals) || EQ (XCAR (global_vals), Qlambda))
2668 { 2670 {
2669 args[0] = globals; 2671 args[0] = global_vals;
2670 ret = Ffuncall (nargs, args); 2672 ret = Ffuncall (nargs, args);
2671 } 2673 }
2672 else 2674 else
2673 { 2675 {
2674 for (; 2676 for (;
2675 CONSP (globals) && ((cond == to_completion) 2677 (CONSP (global_vals)
2676 || (cond == until_success ? NILP (ret) 2678 && (cond == to_completion
2677 : !NILP (ret))); 2679 || (cond == until_success
2678 globals = XCDR (globals)) 2680 ? NILP (ret)
2681 : !NILP (ret))));
2682 global_vals = XCDR (global_vals))
2679 { 2683 {
2680 args[0] = XCAR (globals); 2684 args[0] = XCAR (global_vals);
2681 /* In a global value, t should not occur. If it does, we 2685 /* In a global value, t should not occur. If it does, we
2682 must ignore it to avoid an endless loop. */ 2686 must ignore it to avoid an endless loop. */
2683 if (!EQ (args[0], Qt)) 2687 if (!EQ (args[0], Qt))
@@ -3248,7 +3252,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
3248 return object; 3252 return object;
3249} 3253}
3250 3254
3251void 3255static void
3252grow_specpdl (void) 3256grow_specpdl (void)
3253{ 3257{
3254 register int count = SPECPDL_INDEX (); 3258 register int count = SPECPDL_INDEX ();
@@ -3823,4 +3827,3 @@ alist of active lexical bindings. */);
3823 defsubr (&Sspecial_variable_p); 3827 defsubr (&Sspecial_variable_p);
3824 defsubr (&Sfunctionp); 3828 defsubr (&Sfunctionp);
3825} 3829}
3826
diff --git a/src/fileio.c b/src/fileio.c
index 18e9dbe9680..5d33fb93878 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -178,7 +178,7 @@ report_file_error (const char *string, Lisp_Object data)
178 178
179 str = SSDATA (errstring); 179 str = SSDATA (errstring);
180 c = STRING_CHAR ((unsigned char *) str); 180 c = STRING_CHAR ((unsigned char *) str);
181 Faset (errstring, make_number (0), make_number (DOWNCASE (c))); 181 Faset (errstring, make_number (0), make_number (downcase (c)));
182 } 182 }
183 183
184 xsignal (Qfile_error, 184 xsignal (Qfile_error,
@@ -433,8 +433,8 @@ get a current directory to run processes in. */)
433} 433}
434 434
435 435
436char * 436static char *
437file_name_as_directory (char *out, char *in) 437file_name_as_directory (char *out, const char *in)
438{ 438{
439 int size = strlen (in) - 1; 439 int size = strlen (in) - 1;
440 440
@@ -496,7 +496,7 @@ For a Unix-syntax file name, just appends a slash. */)
496 * Value is nonzero if the string output is different from the input. 496 * Value is nonzero if the string output is different from the input.
497 */ 497 */
498 498
499int 499static int
500directory_file_name (char *src, char *dst) 500directory_file_name (char *src, char *dst)
501{ 501{
502 long slen; 502 long slen;
@@ -728,7 +728,8 @@ filesystem tree, not (expand-file-name ".." dirname). */)
728{ 728{
729 /* These point to SDATA and need to be careful with string-relocation 729 /* These point to SDATA and need to be careful with string-relocation
730 during GC (via DECODE_FILE). */ 730 during GC (via DECODE_FILE). */
731 char *nm, *newdir; 731 char *nm;
732 const char *newdir;
732 /* This should only point to alloca'd data. */ 733 /* This should only point to alloca'd data. */
733 char *target; 734 char *target;
734 735
@@ -1013,21 +1014,23 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1013 if (!newdir && drive) 1014 if (!newdir && drive)
1014 { 1015 {
1015 /* Get default directory if needed to make nm absolute. */ 1016 /* Get default directory if needed to make nm absolute. */
1017 char *adir = NULL;
1016 if (!IS_DIRECTORY_SEP (nm[0])) 1018 if (!IS_DIRECTORY_SEP (nm[0]))
1017 { 1019 {
1018 newdir = alloca (MAXPATHLEN + 1); 1020 adir = alloca (MAXPATHLEN + 1);
1019 if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) 1021 if (!getdefdir (toupper (drive) - 'A' + 1, adir))
1020 newdir = NULL; 1022 adir = NULL;
1021 } 1023 }
1022 if (!newdir) 1024 if (!adir)
1023 { 1025 {
1024 /* Either nm starts with /, or drive isn't mounted. */ 1026 /* Either nm starts with /, or drive isn't mounted. */
1025 newdir = alloca (4); 1027 adir = alloca (4);
1026 newdir[0] = DRIVE_LETTER (drive); 1028 adir[0] = DRIVE_LETTER (drive);
1027 newdir[1] = ':'; 1029 adir[1] = ':';
1028 newdir[2] = '/'; 1030 adir[2] = '/';
1029 newdir[3] = 0; 1031 adir[3] = 0;
1030 } 1032 }
1033 newdir = adir;
1031 } 1034 }
1032#endif /* DOS_NT */ 1035#endif /* DOS_NT */
1033 1036
@@ -1074,7 +1077,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1074 when we have pointers into lisp strings, we accomplish this 1077 when we have pointers into lisp strings, we accomplish this
1075 indirectly by prepending newdir to nm if necessary, and using 1078 indirectly by prepending newdir to nm if necessary, and using
1076 cwd (or the wd of newdir's drive) as the new newdir. */ 1079 cwd (or the wd of newdir's drive) as the new newdir. */
1077 1080 char *adir;
1078 if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1])) 1081 if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1]))
1079 { 1082 {
1080 drive = (unsigned char) newdir[0]; 1083 drive = (unsigned char) newdir[0];
@@ -1087,14 +1090,15 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1087 strcat (tmp, nm); 1090 strcat (tmp, nm);
1088 nm = tmp; 1091 nm = tmp;
1089 } 1092 }
1090 newdir = alloca (MAXPATHLEN + 1); 1093 adir = alloca (MAXPATHLEN + 1);
1091 if (drive) 1094 if (drive)
1092 { 1095 {
1093 if (!getdefdir (toupper (drive) - 'A' + 1, newdir)) 1096 if (!getdefdir (toupper (drive) - 'A' + 1, adir))
1094 newdir = "/"; 1097 newdir = "/";
1095 } 1098 }
1096 else 1099 else
1097 getwd (newdir); 1100 getwd (adir);
1101 newdir = adir;
1098 } 1102 }
1099 1103
1100 /* Strip off drive name from prefix, if present. */ 1104 /* Strip off drive name from prefix, if present. */
@@ -1111,13 +1115,13 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1111#ifdef WINDOWSNT 1115#ifdef WINDOWSNT
1112 if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1])) 1116 if (IS_DIRECTORY_SEP (newdir[0]) && IS_DIRECTORY_SEP (newdir[1]))
1113 { 1117 {
1114 char *p; 1118 char *adir = strcpy (alloca (strlen (newdir) + 1), newdir);
1115 newdir = strcpy (alloca (strlen (newdir) + 1), newdir); 1119 char *p = adir + 2;
1116 p = newdir + 2;
1117 while (*p && !IS_DIRECTORY_SEP (*p)) p++; 1120 while (*p && !IS_DIRECTORY_SEP (*p)) p++;
1118 p++; 1121 p++;
1119 while (*p && !IS_DIRECTORY_SEP (*p)) p++; 1122 while (*p && !IS_DIRECTORY_SEP (*p)) p++;
1120 *p = 0; 1123 *p = 0;
1124 newdir = adir;
1121 } 1125 }
1122 else 1126 else
1123#endif 1127#endif
@@ -1734,7 +1738,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
1734 1738
1735 If QUICK is nonzero, we ask for y or n, not yes or no. */ 1739 If QUICK is nonzero, we ask for y or n, not yes or no. */
1736 1740
1737void 1741static void
1738barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring, 1742barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring,
1739 int interactive, struct stat *statptr, int quick) 1743 int interactive, struct stat *statptr, int quick)
1740{ 1744{
@@ -2041,7 +2045,6 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
2041 (Lisp_Object directory) 2045 (Lisp_Object directory)
2042{ 2046{
2043 const char *dir; 2047 const char *dir;
2044 Lisp_Object handler;
2045 Lisp_Object encoded_dir; 2048 Lisp_Object encoded_dir;
2046 2049
2047 CHECK_STRING (directory); 2050 CHECK_STRING (directory);
@@ -2753,7 +2756,7 @@ if file does not exist, is not accessible, or SELinux is disabled */)
2753#if HAVE_LIBSELINUX 2756#if HAVE_LIBSELINUX
2754 if (is_selinux_enabled ()) 2757 if (is_selinux_enabled ())
2755 { 2758 {
2756 conlength = lgetfilecon (SDATA (absname), &con); 2759 conlength = lgetfilecon (SSDATA (absname), &con);
2757 if (conlength > 0) 2760 if (conlength > 0)
2758 { 2761 {
2759 context = context_new (con); 2762 context = context_new (con);
@@ -2808,34 +2811,35 @@ is disabled. */)
2808 if (is_selinux_enabled ()) 2811 if (is_selinux_enabled ())
2809 { 2812 {
2810 /* Get current file context. */ 2813 /* Get current file context. */
2811 conlength = lgetfilecon (SDATA (encoded_absname), &con); 2814 conlength = lgetfilecon (SSDATA (encoded_absname), &con);
2812 if (conlength > 0) 2815 if (conlength > 0)
2813 { 2816 {
2814 parsed_con = context_new (con); 2817 parsed_con = context_new (con);
2815 /* Change the parts defined in the parameter.*/ 2818 /* Change the parts defined in the parameter.*/
2816 if (STRINGP (user)) 2819 if (STRINGP (user))
2817 { 2820 {
2818 if (context_user_set (parsed_con, SDATA (user))) 2821 if (context_user_set (parsed_con, SSDATA (user)))
2819 error ("Doing context_user_set"); 2822 error ("Doing context_user_set");
2820 } 2823 }
2821 if (STRINGP (role)) 2824 if (STRINGP (role))
2822 { 2825 {
2823 if (context_role_set (parsed_con, SDATA (role))) 2826 if (context_role_set (parsed_con, SSDATA (role)))
2824 error ("Doing context_role_set"); 2827 error ("Doing context_role_set");
2825 } 2828 }
2826 if (STRINGP (type)) 2829 if (STRINGP (type))
2827 { 2830 {
2828 if (context_type_set (parsed_con, SDATA (type))) 2831 if (context_type_set (parsed_con, SSDATA (type)))
2829 error ("Doing context_type_set"); 2832 error ("Doing context_type_set");
2830 } 2833 }
2831 if (STRINGP (range)) 2834 if (STRINGP (range))
2832 { 2835 {
2833 if (context_range_set (parsed_con, SDATA (range))) 2836 if (context_range_set (parsed_con, SSDATA (range)))
2834 error ("Doing context_range_set"); 2837 error ("Doing context_range_set");
2835 } 2838 }
2836 2839
2837 /* Set the modified context back to the file. */ 2840 /* Set the modified context back to the file. */
2838 fail = lsetfilecon (SDATA (encoded_absname), context_str (parsed_con)); 2841 fail = lsetfilecon (SSDATA (encoded_absname),
2842 context_str (parsed_con));
2839 if (fail) 2843 if (fail)
2840 report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil)); 2844 report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil));
2841 2845
@@ -2937,19 +2941,19 @@ The value is an integer. */)
2937 2941
2938 2942
2939DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0, 2943DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
2940 doc: /* Set times of file FILENAME to TIME. 2944 doc: /* Set times of file FILENAME to TIMESTAMP.
2941Set both access and modification times. 2945Set both access and modification times.
2942Return t on success, else nil. 2946Return t on success, else nil.
2943Use the current time if TIME is nil. TIME is in the format of 2947Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of
2944`current-time'. */) 2948`current-time'. */)
2945 (Lisp_Object filename, Lisp_Object time) 2949 (Lisp_Object filename, Lisp_Object timestamp)
2946{ 2950{
2947 Lisp_Object absname, encoded_absname; 2951 Lisp_Object absname, encoded_absname;
2948 Lisp_Object handler; 2952 Lisp_Object handler;
2949 time_t sec; 2953 time_t sec;
2950 int usec; 2954 int usec;
2951 2955
2952 if (! lisp_time_argument (time, &sec, &usec)) 2956 if (! lisp_time_argument (timestamp, &sec, &usec))
2953 error ("Invalid time specification"); 2957 error ("Invalid time specification");
2954 2958
2955 absname = Fexpand_file_name (filename, BVAR (current_buffer, directory)); 2959 absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
@@ -2958,7 +2962,7 @@ Use the current time if TIME is nil. TIME is in the format of
2958 call the corresponding file handler. */ 2962 call the corresponding file handler. */
2959 handler = Ffind_file_name_handler (absname, Qset_file_times); 2963 handler = Ffind_file_name_handler (absname, Qset_file_times);
2960 if (!NILP (handler)) 2964 if (!NILP (handler))
2961 return call3 (handler, Qset_file_times, absname, time); 2965 return call3 (handler, Qset_file_times, absname, timestamp);
2962 2966
2963 encoded_absname = ENCODE_FILE (absname); 2967 encoded_absname = ENCODE_FILE (absname);
2964 2968
@@ -3354,13 +3358,13 @@ variable `last-coding-system-used' to the coding system actually used. */)
3354 else if (nread > 0) 3358 else if (nread > 0)
3355 { 3359 {
3356 struct buffer *prev = current_buffer; 3360 struct buffer *prev = current_buffer;
3357 Lisp_Object buffer; 3361 Lisp_Object workbuf;
3358 struct buffer *buf; 3362 struct buffer *buf;
3359 3363
3360 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 3364 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
3361 3365
3362 buffer = Fget_buffer_create (build_string (" *code-converting-work*")); 3366 workbuf = Fget_buffer_create (build_string (" *code-converting-work*"));
3363 buf = XBUFFER (buffer); 3367 buf = XBUFFER (workbuf);
3364 3368
3365 delete_all_overlays (buf); 3369 delete_all_overlays (buf);
3366 BVAR (buf, directory) = BVAR (current_buffer, directory); 3370 BVAR (buf, directory) = BVAR (current_buffer, directory);
@@ -3872,7 +3876,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3872 3876
3873 if (not_regular) 3877 if (not_regular)
3874 { 3878 {
3875 Lisp_Object val; 3879 Lisp_Object nbytes;
3876 3880
3877 /* Maybe make more room. */ 3881 /* Maybe make more room. */
3878 if (gap_size < trytry) 3882 if (gap_size < trytry)
@@ -3887,15 +3891,16 @@ variable `last-coding-system-used' to the coding system actually used. */)
3887 non_regular_fd = fd; 3891 non_regular_fd = fd;
3888 non_regular_inserted = inserted; 3892 non_regular_inserted = inserted;
3889 non_regular_nbytes = trytry; 3893 non_regular_nbytes = trytry;
3890 val = internal_condition_case_1 (read_non_regular, Qnil, Qerror, 3894 nbytes = internal_condition_case_1 (read_non_regular,
3891 read_non_regular_quit); 3895 Qnil, Qerror,
3892 if (NILP (val)) 3896 read_non_regular_quit);
3897 if (NILP (nbytes))
3893 { 3898 {
3894 read_quit = 1; 3899 read_quit = 1;
3895 break; 3900 break;
3896 } 3901 }
3897 3902
3898 this = XINT (val); 3903 this = XINT (nbytes);
3899 } 3904 }
3900 else 3905 else
3901 { 3906 {
@@ -3986,7 +3991,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3986 care of marker adjustment. By this way, we can run Lisp 3991 care of marker adjustment. By this way, we can run Lisp
3987 program safely before decoding the inserted text. */ 3992 program safely before decoding the inserted text. */
3988 Lisp_Object unwind_data; 3993 Lisp_Object unwind_data;
3989 int count = SPECPDL_INDEX (); 3994 int count1 = SPECPDL_INDEX ();
3990 3995
3991 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), 3996 unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
3992 Fcons (BVAR (current_buffer, undo_list), 3997 Fcons (BVAR (current_buffer, undo_list),
@@ -4013,7 +4018,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4013 if (CONSP (coding_system)) 4018 if (CONSP (coding_system))
4014 coding_system = XCAR (coding_system); 4019 coding_system = XCAR (coding_system);
4015 } 4020 }
4016 unbind_to (count, Qnil); 4021 unbind_to (count1, Qnil);
4017 inserted = Z_BYTE - BEG_BYTE; 4022 inserted = Z_BYTE - BEG_BYTE;
4018 } 4023 }
4019 4024
@@ -4116,7 +4121,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4116 if (inserted > 0) 4121 if (inserted > 0)
4117 { 4122 {
4118 /* Don't run point motion or modification hooks when decoding. */ 4123 /* Don't run point motion or modification hooks when decoding. */
4119 int count = SPECPDL_INDEX (); 4124 int count1 = SPECPDL_INDEX ();
4120 EMACS_INT old_inserted = inserted; 4125 EMACS_INT old_inserted = inserted;
4121 specbind (Qinhibit_point_motion_hooks, Qt); 4126 specbind (Qinhibit_point_motion_hooks, Qt);
4122 specbind (Qinhibit_modification_hooks, Qt); 4127 specbind (Qinhibit_modification_hooks, Qt);
@@ -4228,7 +4233,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
4228 Otherwise start with an empty undo_list. */ 4233 Otherwise start with an empty undo_list. */
4229 BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil; 4234 BVAR (current_buffer, undo_list) = EQ (old_undo, Qt) ? Qt : Qnil;
4230 4235
4231 unbind_to (count, Qnil); 4236 unbind_to (count1, Qnil);
4232 } 4237 }
4233 4238
4234 /* Call after-change hooks for the inserted text, aside from the case 4239 /* Call after-change hooks for the inserted text, aside from the case
@@ -5059,8 +5064,8 @@ An argument specifies the modification time value to use
5059 return Qnil; 5064 return Qnil;
5060} 5065}
5061 5066
5062Lisp_Object 5067static Lisp_Object
5063auto_save_error (Lisp_Object error) 5068auto_save_error (Lisp_Object error_val)
5064{ 5069{
5065 Lisp_Object args[3], msg; 5070 Lisp_Object args[3], msg;
5066 int i, nbytes; 5071 int i, nbytes;
@@ -5074,7 +5079,7 @@ auto_save_error (Lisp_Object error)
5074 5079
5075 args[0] = build_string ("Auto-saving %s: %s"); 5080 args[0] = build_string ("Auto-saving %s: %s");
5076 args[1] = BVAR (current_buffer, name); 5081 args[1] = BVAR (current_buffer, name);
5077 args[2] = Ferror_message_string (error); 5082 args[2] = Ferror_message_string (error_val);
5078 msg = Fformat (3, args); 5083 msg = Fformat (3, args);
5079 GCPRO1 (msg); 5084 GCPRO1 (msg);
5080 nbytes = SBYTES (msg); 5085 nbytes = SBYTES (msg);
@@ -5095,7 +5100,7 @@ auto_save_error (Lisp_Object error)
5095 return Qnil; 5100 return Qnil;
5096} 5101}
5097 5102
5098Lisp_Object 5103static Lisp_Object
5099auto_save_1 (void) 5104auto_save_1 (void)
5100{ 5105{
5101 struct stat st; 5106 struct stat st;
@@ -5426,7 +5431,7 @@ before any other event (mouse or keypress) is handled. */)
5426Lisp_Object 5431Lisp_Object
5427Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) 5432Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate)
5428{ 5433{
5429 struct gcpro gcpro1, gcpro2; 5434 struct gcpro gcpro1;
5430 Lisp_Object args[7]; 5435 Lisp_Object args[7];
5431 5436
5432 GCPRO1 (default_filename); 5437 GCPRO1 (default_filename);
diff --git a/src/filelock.c b/src/filelock.c
index 7f8f0e1c0fb..2138eaa502b 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -344,13 +344,13 @@ static int
344lock_file_1 (char *lfname, int force) 344lock_file_1 (char *lfname, int force)
345{ 345{
346 register int err; 346 register int err;
347 time_t boot_time; 347 time_t boot;
348 const char *user_name; 348 const char *user_name;
349 const char *host_name; 349 const char *host_name;
350 char *lock_info_str; 350 char *lock_info_str;
351 351
352 /* Call this first because it can GC. */ 352 /* Call this first because it can GC. */
353 boot_time = get_boot_time (); 353 boot = get_boot_time ();
354 354
355 if (STRINGP (Fuser_login_name (Qnil))) 355 if (STRINGP (Fuser_login_name (Qnil)))
356 user_name = SSDATA (Fuser_login_name (Qnil)); 356 user_name = SSDATA (Fuser_login_name (Qnil));
@@ -363,9 +363,9 @@ lock_file_1 (char *lfname, int force)
363 lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name) 363 lock_info_str = (char *)alloca (strlen (user_name) + strlen (host_name)
364 + LOCK_PID_MAX + 30); 364 + LOCK_PID_MAX + 30);
365 365
366 if (boot_time) 366 if (boot)
367 sprintf (lock_info_str, "%s@%s.%lu:%lu", user_name, host_name, 367 sprintf (lock_info_str, "%s@%s.%lu:%lu", user_name, host_name,
368 (unsigned long) getpid (), (unsigned long) boot_time); 368 (unsigned long) getpid (), (unsigned long) boot);
369 else 369 else
370 sprintf (lock_info_str, "%s@%s.%lu", user_name, host_name, 370 sprintf (lock_info_str, "%s@%s.%lu", user_name, host_name,
371 (unsigned long) getpid ()); 371 (unsigned long) getpid ());
@@ -382,7 +382,7 @@ lock_file_1 (char *lfname, int force)
382 382
383/* Return 1 if times A and B are no more than one second apart. */ 383/* Return 1 if times A and B are no more than one second apart. */
384 384
385int 385static int
386within_one_second (time_t a, time_t b) 386within_one_second (time_t a, time_t b)
387{ 387{
388 return (a - b >= -1 && a - b <= 1); 388 return (a - b >= -1 && a - b <= 1);
diff --git a/src/floatfns.c b/src/floatfns.c
index c00923643d1..bc03509b757 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -187,8 +187,10 @@ static const char *float_error_fn_name;
187 xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) 187 xsignal3 (Qrange_error, build_string ((op)), (a1), (a2))
188#define domain_error(op,arg) \ 188#define domain_error(op,arg) \
189 xsignal2 (Qdomain_error, build_string ((op)), (arg)) 189 xsignal2 (Qdomain_error, build_string ((op)), (arg))
190#ifdef FLOAT_CHECK_DOMAIN
190#define domain_error2(op,a1,a2) \ 191#define domain_error2(op,a1,a2) \
191 xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) 192 xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2))
193#endif
192 194
193/* Extract a Lisp number as a `double', or signal an error. */ 195/* Extract a Lisp number as a `double', or signal an error. */
194 196
@@ -326,9 +328,9 @@ If X is zero, both parts (SGNFCAND and EXP) are zero. */)
326 return Fcons (make_float (0.0), make_number (0)); 328 return Fcons (make_float (0.0), make_number (0));
327 else 329 else
328 { 330 {
329 int exp; 331 int exponent;
330 double sgnfcand = frexp (f, &exp); 332 double sgnfcand = frexp (f, &exponent);
331 return Fcons (make_float (sgnfcand), make_number (exp)); 333 return Fcons (make_float (sgnfcand), make_number (exponent));
332 } 334 }
333} 335}
334 336
@@ -336,10 +338,10 @@ DEFUN ("ldexp", Fldexp, Sldexp, 1, 2, 0,
336 doc: /* Construct number X from significand SGNFCAND and exponent EXP. 338 doc: /* Construct number X from significand SGNFCAND and exponent EXP.
337Returns the floating point value resulting from multiplying SGNFCAND 339Returns the floating point value resulting from multiplying SGNFCAND
338(the significand) by 2 raised to the power of EXP (the exponent). */) 340(the significand) by 2 raised to the power of EXP (the exponent). */)
339 (Lisp_Object sgnfcand, Lisp_Object exp) 341 (Lisp_Object sgnfcand, Lisp_Object exponent)
340{ 342{
341 CHECK_NUMBER (exp); 343 CHECK_NUMBER (exponent);
342 return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exp))); 344 return make_float (ldexp (XFLOATINT (sgnfcand), XINT (exponent)));
343} 345}
344#endif 346#endif
345 347
@@ -1037,7 +1039,7 @@ syms_of_floatfns (void)
1037 defsubr (&Scopysign); 1039 defsubr (&Scopysign);
1038 defsubr (&Sfrexp); 1040 defsubr (&Sfrexp);
1039 defsubr (&Sldexp); 1041 defsubr (&Sldexp);
1040#endif 1042#endif
1041#if 0 1043#if 0
1042 defsubr (&Sacosh); 1044 defsubr (&Sacosh);
1043 defsubr (&Sasinh); 1045 defsubr (&Sasinh);
@@ -1074,4 +1076,3 @@ syms_of_floatfns (void)
1074 defsubr (&Sround); 1076 defsubr (&Sround);
1075 defsubr (&Struncate); 1077 defsubr (&Struncate);
1076} 1078}
1077
diff --git a/src/fns.c b/src/fns.c
index b800846b781..9a009c8ab44 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -57,9 +57,6 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
57 57
58static int internal_equal (Lisp_Object , Lisp_Object, int, int); 58static int internal_equal (Lisp_Object , Lisp_Object, int, int);
59 59
60extern long get_random (void);
61extern void seed_random (long);
62
63#ifndef HAVE_UNISTD_H 60#ifndef HAVE_UNISTD_H
64extern long time (); 61extern long time ();
65#endif 62#endif
@@ -2136,15 +2133,15 @@ DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0,
2136ARRAY is a vector, string, char-table, or bool-vector. */) 2133ARRAY is a vector, string, char-table, or bool-vector. */)
2137 (Lisp_Object array, Lisp_Object item) 2134 (Lisp_Object array, Lisp_Object item)
2138{ 2135{
2139 register EMACS_INT size, index; 2136 register EMACS_INT size, idx;
2140 int charval; 2137 int charval;
2141 2138
2142 if (VECTORP (array)) 2139 if (VECTORP (array))
2143 { 2140 {
2144 register Lisp_Object *p = XVECTOR (array)->contents; 2141 register Lisp_Object *p = XVECTOR (array)->contents;
2145 size = ASIZE (array); 2142 size = ASIZE (array);
2146 for (index = 0; index < size; index++) 2143 for (idx = 0; idx < size; idx++)
2147 p[index] = item; 2144 p[idx] = item;
2148 } 2145 }
2149 else if (CHAR_TABLE_P (array)) 2146 else if (CHAR_TABLE_P (array))
2150 { 2147 {
@@ -2180,8 +2177,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2180 *p++ = str[i % len]; 2177 *p++ = str[i % len];
2181 } 2178 }
2182 else 2179 else
2183 for (index = 0; index < size; index++) 2180 for (idx = 0; idx < size; idx++)
2184 p[index] = charval; 2181 p[idx] = charval;
2185 } 2182 }
2186 else if (BOOL_VECTOR_P (array)) 2183 else if (BOOL_VECTOR_P (array))
2187 { 2184 {
@@ -2191,14 +2188,14 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2191 / BOOL_VECTOR_BITS_PER_CHAR); 2188 / BOOL_VECTOR_BITS_PER_CHAR);
2192 2189
2193 charval = (! NILP (item) ? -1 : 0); 2190 charval = (! NILP (item) ? -1 : 0);
2194 for (index = 0; index < size_in_chars - 1; index++) 2191 for (idx = 0; idx < size_in_chars - 1; idx++)
2195 p[index] = charval; 2192 p[idx] = charval;
2196 if (index < size_in_chars) 2193 if (idx < size_in_chars)
2197 { 2194 {
2198 /* Mask out bits beyond the vector size. */ 2195 /* Mask out bits beyond the vector size. */
2199 if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR) 2196 if (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)
2200 charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; 2197 charval &= (1 << (XBOOL_VECTOR (array)->size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
2201 p[index] = charval; 2198 p[idx] = charval;
2202 } 2199 }
2203 } 2200 }
2204 else 2201 else
@@ -2601,9 +2598,9 @@ particular subfeatures supported in this version of FEATURE. */)
2601 2598
2602/* List of features currently being require'd, innermost first. */ 2599/* List of features currently being require'd, innermost first. */
2603 2600
2604Lisp_Object require_nesting_list; 2601static Lisp_Object require_nesting_list;
2605 2602
2606Lisp_Object 2603static Lisp_Object
2607require_unwind (Lisp_Object old_value) 2604require_unwind (Lisp_Object old_value)
2608{ 2605{
2609 return require_nesting_list = old_value; 2606 return require_nesting_list = old_value;
diff --git a/src/font.c b/src/font.c
index 35821ae34f9..9e8b7029c22 100644
--- a/src/font.c
+++ b/src/font.c
@@ -311,10 +311,10 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
311{ 311{
312 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); 312 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
313 int len = ASIZE (table); 313 int len = ASIZE (table);
314 int i, j;
315 314
316 if (SYMBOLP (val)) 315 if (SYMBOLP (val))
317 { 316 {
317 int i, j;
318 char *s; 318 char *s;
319 Lisp_Object args[2], elt; 319 Lisp_Object args[2], elt;
320 320
@@ -500,10 +500,9 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val)
500 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX 500 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX
501 : EQ (style, QCslant) ? FONT_SLANT_INDEX 501 : EQ (style, QCslant) ? FONT_SLANT_INDEX
502 : FONT_WIDTH_INDEX); 502 : FONT_WIDTH_INDEX);
503 int n;
504 if (INTEGERP (val)) 503 if (INTEGERP (val))
505 { 504 {
506 n = XINT (val); 505 int n = XINT (val);
507 if (((n >> 4) & 0xF) 506 if (((n >> 4) & 0xF)
508 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) 507 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX)))
509 val = Qerror; 508 val = Qerror;
@@ -1163,7 +1162,8 @@ font_parse_xlfd (char *name, Lisp_Object font)
1163int 1162int
1164font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) 1163font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1165{ 1164{
1166 char *f[XLFD_REGISTRY_INDEX + 1]; 1165 char *p;
1166 const char *f[XLFD_REGISTRY_INDEX + 1];
1167 Lisp_Object val; 1167 Lisp_Object val;
1168 int i, j, len = 0; 1168 int i, j, len = 0;
1169 1169
@@ -1194,14 +1194,14 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1194 /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */ 1194 /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */
1195 if (SDATA (val)[SBYTES (val) - 1] == '*') 1195 if (SDATA (val)[SBYTES (val) - 1] == '*')
1196 { 1196 {
1197 f[j] = alloca (SBYTES (val) + 3); 1197 f[j] = p = alloca (SBYTES (val) + 3);
1198 sprintf (f[j], "%s-*", SDATA (val)); 1198 sprintf (p, "%s-*", SDATA (val));
1199 len += SBYTES (val) + 3; 1199 len += SBYTES (val) + 3;
1200 } 1200 }
1201 else 1201 else
1202 { 1202 {
1203 f[j] = alloca (SBYTES (val) + 4); 1203 f[j] = p = alloca (SBYTES (val) + 4);
1204 sprintf (f[j], "%s*-*", SDATA (val)); 1204 sprintf (p, "%s*-*", SDATA (val));
1205 len += SBYTES (val) + 4; 1205 len += SBYTES (val) + 4;
1206 } 1206 }
1207 } 1207 }
@@ -1232,8 +1232,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1232 i = pixel_size; 1232 i = pixel_size;
1233 if (i > 0) 1233 if (i > 0)
1234 { 1234 {
1235 f[XLFD_PIXEL_INDEX] = alloca (22); 1235 f[XLFD_PIXEL_INDEX] = p = alloca (22);
1236 len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1; 1236 len += sprintf (p, "%d-*", i) + 1;
1237 } 1237 }
1238 else 1238 else
1239 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; 1239 f[XLFD_PIXEL_INDEX] = "*-*", len += 4;
@@ -1241,8 +1241,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1241 else if (FLOATP (val)) 1241 else if (FLOATP (val))
1242 { 1242 {
1243 i = XFLOAT_DATA (val) * 10; 1243 i = XFLOAT_DATA (val) * 10;
1244 f[XLFD_PIXEL_INDEX] = alloca (12); 1244 f[XLFD_PIXEL_INDEX] = p = alloca (12);
1245 len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; 1245 len += sprintf (p, "*-%d", i) + 1;
1246 } 1246 }
1247 else 1247 else
1248 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; 1248 f[XLFD_PIXEL_INDEX] = "*-*", len += 4;
@@ -1250,9 +1250,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1250 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) 1250 if (INTEGERP (AREF (font, FONT_DPI_INDEX)))
1251 { 1251 {
1252 i = XINT (AREF (font, FONT_DPI_INDEX)); 1252 i = XINT (AREF (font, FONT_DPI_INDEX));
1253 f[XLFD_RESX_INDEX] = alloca (22); 1253 f[XLFD_RESX_INDEX] = p = alloca (22);
1254 len += sprintf (f[XLFD_RESX_INDEX], 1254 len += sprintf (p, "%d-%d", i, i) + 1;
1255 "%d-%d", i, i) + 1;
1256 } 1255 }
1257 else 1256 else
1258 f[XLFD_RESX_INDEX] = "*-*", len += 4; 1257 f[XLFD_RESX_INDEX] = "*-*", len += 4;
@@ -1270,8 +1269,8 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
1270 f[XLFD_SPACING_INDEX] = "*", len += 2; 1269 f[XLFD_SPACING_INDEX] = "*", len += 2;
1271 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) 1270 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX)))
1272 { 1271 {
1273 f[XLFD_AVGWIDTH_INDEX] = alloca (11); 1272 f[XLFD_AVGWIDTH_INDEX] = p = alloca (11);
1274 len += sprintf (f[XLFD_AVGWIDTH_INDEX], "%ld", 1273 len += sprintf (p, "%ld",
1275 (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; 1274 (long) XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1;
1276 } 1275 }
1277 else 1276 else
@@ -1448,12 +1447,10 @@ font_parse_fcname (char *name, Lisp_Object font)
1448 { 1447 {
1449 /* Either a fontconfig-style name with no size and property 1448 /* Either a fontconfig-style name with no size and property
1450 data, or a GTK-style name. */ 1449 data, or a GTK-style name. */
1451 Lisp_Object prop;
1452 Lisp_Object weight = Qnil, slant = Qnil; 1450 Lisp_Object weight = Qnil, slant = Qnil;
1453 Lisp_Object width = Qnil, size = Qnil; 1451 Lisp_Object width = Qnil, size = Qnil;
1454 char *word_start; 1452 char *word_start;
1455 int word_len; 1453 int word_len;
1456 int size_found = 0;
1457 1454
1458 /* Scan backwards from the end, looking for a size. */ 1455 /* Scan backwards from the end, looking for a size. */
1459 for (p = name + len - 1; p >= name; p--) 1456 for (p = name + len - 1; p >= name; p--)
@@ -1569,8 +1566,10 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1569 point_size = -1; 1566 point_size = -1;
1570 len += 21; /* for ":pixelsize=NUM" */ 1567 len += 21; /* for ":pixelsize=NUM" */
1571 } 1568 }
1572 else if (FLOATP (val)) 1569 else
1573 { 1570 {
1571 if (! FLOATP (val))
1572 abort ();
1574 pixel_size = -1; 1573 pixel_size = -1;
1575 point_size = (int) XFLOAT_DATA (val); 1574 point_size = (int) XFLOAT_DATA (val);
1576 len += 11; /* for "-NUM" */ 1575 len += 11; /* for "-NUM" */
@@ -1604,15 +1603,15 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
1604 len += strlen (":scalable=false"); /* or ":scalable=true" */ 1603 len += strlen (":scalable=false"); /* or ":scalable=true" */
1605 for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) 1604 for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail))
1606 { 1605 {
1607 Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); 1606 Lisp_Object key = XCAR (XCAR (tail)), value = XCDR (XCAR (tail));
1608 1607
1609 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ 1608 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */
1610 if (STRINGP (val)) 1609 if (STRINGP (value))
1611 len += SBYTES (val); 1610 len += SBYTES (value);
1612 else if (INTEGERP (val)) 1611 else if (INTEGERP (value))
1613 len += sprintf (work, "%ld", (long) XINT (val)); 1612 len += sprintf (work, "%ld", (long) XINT (value));
1614 else if (SYMBOLP (val)) 1613 else if (SYMBOLP (value))
1615 len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ 1614 len += (NILP (value) ? 5 : 4); /* for "false" or "true" */
1616 } 1615 }
1617 1616
1618 if (len > nbytes) 1617 if (len > nbytes)
@@ -2178,7 +2177,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int
2178 unsigned best_score; 2177 unsigned best_score;
2179 Lisp_Object best_entity; 2178 Lisp_Object best_entity;
2180 struct frame *f = XFRAME (frame); 2179 struct frame *f = XFRAME (frame);
2181 Lisp_Object tail, vec; 2180 Lisp_Object tail, vec IF_LINT (= Qnil);
2182 USE_SAFE_ALLOCA; 2181 USE_SAFE_ALLOCA;
2183 2182
2184 for (i = FONT_WEIGHT_INDEX; i <= FONT_AVGWIDTH_INDEX; i++) 2183 for (i = FONT_WEIGHT_INDEX; i <= FONT_AVGWIDTH_INDEX; i++)
@@ -2602,7 +2601,7 @@ static Lisp_Object scratch_font_spec, scratch_font_prefer;
2602 (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil). 2601 (2) doesn't match with any regexps in Vface_ignored_fonts (if non-nil).
2603*/ 2602*/
2604 2603
2605Lisp_Object 2604static Lisp_Object
2606font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size) 2605font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2607{ 2606{
2608 Lisp_Object entity, val; 2607 Lisp_Object entity, val;
@@ -2951,22 +2950,6 @@ font_get_name (Lisp_Object font_object)
2951} 2950}
2952 2951
2953 2952
2954/* Return the specification of FONT_OBJECT. */
2955
2956Lisp_Object
2957font_get_spec (Lisp_Object font_object)
2958{
2959 Lisp_Object spec = font_make_spec ();
2960 int i;
2961
2962 for (i = 0; i < FONT_SIZE_INDEX; i++)
2963 ASET (spec, i, AREF (font_object, i));
2964 ASET (spec, FONT_SIZE_INDEX,
2965 make_number (XFONT_OBJECT (font_object)->pixel_size));
2966 return spec;
2967}
2968
2969
2970/* Create a new font spec from FONT_NAME, and return it. If FONT_NAME 2953/* Create a new font spec from FONT_NAME, and return it. If FONT_NAME
2971 could not be parsed by font_parse_name, return Qnil. */ 2954 could not be parsed by font_parse_name, return Qnil. */
2972 2955
@@ -3436,14 +3419,13 @@ Lisp_Object
3436font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) 3419font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers)
3437{ 3420{
3438 Lisp_Object active_drivers = Qnil; 3421 Lisp_Object active_drivers = Qnil;
3439 struct font_driver *driver;
3440 struct font_driver_list *list; 3422 struct font_driver_list *list;
3441 3423
3442 /* At first, turn off non-requested drivers, and turn on requested 3424 /* At first, turn off non-requested drivers, and turn on requested
3443 drivers. */ 3425 drivers. */
3444 for (list = f->font_driver_list; list; list = list->next) 3426 for (list = f->font_driver_list; list; list = list->next)
3445 { 3427 {
3446 driver = list->driver; 3428 struct font_driver *driver = list->driver;
3447 if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers))) 3429 if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers)))
3448 != list->on) 3430 != list->on)
3449 { 3431 {
@@ -4669,7 +4651,7 @@ the corresponding element is nil. */)
4669 Lisp_Object object) 4651 Lisp_Object object)
4670{ 4652{
4671 struct font *font; 4653 struct font *font;
4672 int i, len, c; 4654 int i, len;
4673 Lisp_Object *chars, vec; 4655 Lisp_Object *chars, vec;
4674 USE_SAFE_ALLOCA; 4656 USE_SAFE_ALLOCA;
4675 4657
@@ -4687,6 +4669,7 @@ the corresponding element is nil. */)
4687 bytepos = CHAR_TO_BYTE (charpos); 4669 bytepos = CHAR_TO_BYTE (charpos);
4688 for (i = 0; charpos < XFASTINT (to); i++) 4670 for (i = 0; charpos < XFASTINT (to); i++)
4689 { 4671 {
4672 int c;
4690 FETCH_CHAR_ADVANCE (c, charpos, bytepos); 4673 FETCH_CHAR_ADVANCE (c, charpos, bytepos);
4691 chars[i] = make_number (c); 4674 chars[i] = make_number (c);
4692 } 4675 }
@@ -4708,7 +4691,7 @@ the corresponding element is nil. */)
4708 if (STRING_MULTIBYTE (object)) 4691 if (STRING_MULTIBYTE (object))
4709 for (i = 0; i < len; i++) 4692 for (i = 0; i < len; i++)
4710 { 4693 {
4711 c = STRING_CHAR_ADVANCE (p); 4694 int c = STRING_CHAR_ADVANCE (p);
4712 chars[i] = make_number (c); 4695 chars[i] = make_number (c);
4713 } 4696 }
4714 else 4697 else
@@ -4959,7 +4942,7 @@ static Lisp_Object Vfont_log_deferred;
4959void 4942void
4960font_add_log (const char *action, Lisp_Object arg, Lisp_Object result) 4943font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
4961{ 4944{
4962 Lisp_Object tail, val; 4945 Lisp_Object val;
4963 int i; 4946 int i;
4964 4947
4965 if (EQ (Vfont_log, Qt)) 4948 if (EQ (Vfont_log, Qt))
@@ -5015,6 +4998,7 @@ font_add_log (const char *action, Lisp_Object arg, Lisp_Object result)
5015 } 4998 }
5016 else if (CONSP (result)) 4999 else if (CONSP (result))
5017 { 5000 {
5001 Lisp_Object tail;
5018 result = Fcopy_sequence (result); 5002 result = Fcopy_sequence (result);
5019 for (tail = result; CONSP (tail); tail = XCDR (tail)) 5003 for (tail = result; CONSP (tail); tail = XCDR (tail))
5020 { 5004 {
diff --git a/src/fontset.c b/src/fontset.c
index f297fd10a71..b5d8a0db434 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -233,14 +233,14 @@ fontset_id_valid_p (int id)
233/* Macros to access special values of (base) FONTSET. */ 233/* Macros to access special values of (base) FONTSET. */
234#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] 234#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1]
235#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] 235#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4]
236#define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] 236/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */
237 237
238/* Macros to access special values of (realized) FONTSET. */ 238/* Macros to access special values of (realized) FONTSET. */
239#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 239#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2]
240#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 240#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3]
241#define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] 241#define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4]
242#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 242#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
243#define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] 243/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */
244#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 244#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7]
245 245
246/* For both base and realized fontset. */ 246/* For both base and realized fontset. */
@@ -266,7 +266,6 @@ fontset_id_valid_p (int id)
266 ASET ((rfont_def), 0, make_number (face_id)) 266 ASET ((rfont_def), 0, make_number (face_id))
267#define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1) 267#define RFONT_DEF_FONT_DEF(rfont_def) AREF (rfont_def, 1)
268#define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1)) 268#define RFONT_DEF_SPEC(rfont_def) FONT_DEF_SPEC (AREF (rfont_def, 1))
269#define RFONT_DEF_REPERTORY(rfont_def) FONT_DEF_REPERTORY (AREF (rfont_def, 1))
270#define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2) 269#define RFONT_DEF_OBJECT(rfont_def) AREF (rfont_def, 2)
271#define RFONT_DEF_SET_OBJECT(rfont_def, object) \ 270#define RFONT_DEF_SET_OBJECT(rfont_def, object) \
272 ASET ((rfont_def), 2, (object)) 271 ASET ((rfont_def), 2, (object))
@@ -713,7 +712,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fa
713static Lisp_Object 712static Lisp_Object
714fontset_font (Lisp_Object fontset, int c, struct face *face, int id) 713fontset_font (Lisp_Object fontset, int c, struct face *face, int id)
715{ 714{
716 Lisp_Object rfont_def, default_rfont_def; 715 Lisp_Object rfont_def, default_rfont_def IF_LINT (= Qnil);
717 Lisp_Object base_fontset; 716 Lisp_Object base_fontset;
718 717
719 /* Try a font-group of FONTSET. */ 718 /* Try a font-group of FONTSET. */
@@ -836,7 +835,7 @@ fontset_ascii (int id)
836 return elt; 835 return elt;
837} 836}
838 837
839void 838static void
840free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) 839free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
841{ 840{
842 Lisp_Object tail; 841 Lisp_Object tail;
@@ -1583,14 +1582,14 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1583 1582
1584 if (ascii_changed) 1583 if (ascii_changed)
1585 { 1584 {
1586 Lisp_Object tail, frame, alist; 1585 Lisp_Object tail, fr, alist;
1587 int fontset_id = XINT (FONTSET_ID (fontset)); 1586 int fontset_id = XINT (FONTSET_ID (fontset));
1588 1587
1589 FONTSET_ASCII (fontset) = fontname; 1588 FONTSET_ASCII (fontset) = fontname;
1590 name = FONTSET_NAME (fontset); 1589 name = FONTSET_NAME (fontset);
1591 FOR_EACH_FRAME (tail, frame) 1590 FOR_EACH_FRAME (tail, fr)
1592 { 1591 {
1593 FRAME_PTR f = XFRAME (frame); 1592 FRAME_PTR f = XFRAME (fr);
1594 Lisp_Object font_object; 1593 Lisp_Object font_object;
1595 struct face *face; 1594 struct face *face;
1596 1595
@@ -1607,7 +1606,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1607 { 1606 {
1608 update_auto_fontset_alist (font_object, fontset); 1607 update_auto_fontset_alist (font_object, fontset);
1609 alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil); 1608 alist = Fcons (Fcons (Qfont, Fcons (name, font_object)), Qnil);
1610 Fmodify_frame_parameters (frame, alist); 1609 Fmodify_frame_parameters (fr, alist);
1611 } 1610 }
1612 } 1611 }
1613 } 1612 }
diff --git a/src/fringe.c b/src/fringe.c
index d42d6467f31..ce75df766ee 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -913,7 +913,12 @@ update_window_fringes (struct window *w, int keep_current_p)
913 int bitmap_cache[MAX_BITMAP_CACHE]; 913 int bitmap_cache[MAX_BITMAP_CACHE];
914 int top_ind_rn, bot_ind_rn; 914 int top_ind_rn, bot_ind_rn;
915 int top_ind_min_y, bot_ind_max_y; 915 int top_ind_min_y, bot_ind_max_y;
916 int top_row_ends_at_zv_p, bot_row_ends_at_zv_p; 916
917 /* top_ind_rn is set to a nonnegative value whenver
918 row->indicate_bob_p is set, so it's OK that top_row_ends_at_zv_p
919 is not initialized here. Similarly for bot_ind_rn,
920 row->indicate_eob_p and bot_row_ends_at_zv_p. */
921 int top_row_ends_at_zv_p IF_LINT (= 0), bot_row_ends_at_zv_p IF_LINT (= 0);
917 922
918 if (w->pseudo_window_p) 923 if (w->pseudo_window_p)
919 return 0; 924 return 0;
@@ -949,18 +954,10 @@ update_window_fringes (struct window *w, int keep_current_p)
949 y < yb && rn < nrows; 954 y < yb && rn < nrows;
950 y += row->height, ++rn) 955 y += row->height, ++rn)
951 { 956 {
952 unsigned indicate_bob_p, indicate_top_line_p;
953 unsigned indicate_eob_p, indicate_bottom_line_p;
954
955 row = w->desired_matrix->rows + rn; 957 row = w->desired_matrix->rows + rn;
956 if (!row->enabled_p) 958 if (!row->enabled_p)
957 row = w->current_matrix->rows + rn; 959 row = w->current_matrix->rows + rn;
958 960
959 indicate_bob_p = row->indicate_bob_p;
960 indicate_top_line_p = row->indicate_top_line_p;
961 indicate_eob_p = row->indicate_eob_p;
962 indicate_bottom_line_p = row->indicate_bottom_line_p;
963
964 row->indicate_bob_p = row->indicate_top_line_p = 0; 961 row->indicate_bob_p = row->indicate_top_line_p = 0;
965 row->indicate_eob_p = row->indicate_bottom_line_p = 0; 962 row->indicate_eob_p = row->indicate_bottom_line_p = 0;
966 963
@@ -1380,7 +1377,7 @@ compute_fringe_widths (struct frame *f, int redraw)
1380 1377
1381/* Free resources used by a user-defined bitmap. */ 1378/* Free resources used by a user-defined bitmap. */
1382 1379
1383void 1380static void
1384destroy_fringe_bitmap (int n) 1381destroy_fringe_bitmap (int n)
1385{ 1382{
1386 struct fringe_bitmap **fbp; 1383 struct fringe_bitmap **fbp;
@@ -1448,7 +1445,7 @@ static const unsigned char swap_nibble[16] = {
1448 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */ 1445 0x3, 0xb, 0x7, 0xf}; /* 0011 1011 0111 1111 */
1449#endif /* HAVE_X_WINDOWS */ 1446#endif /* HAVE_X_WINDOWS */
1450 1447
1451void 1448static void
1452init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p) 1449init_fringe_bitmap (int which, struct fringe_bitmap *fb, int once_p)
1453{ 1450{
1454 if (once_p || fb->dynamic) 1451 if (once_p || fb->dynamic)
@@ -1831,4 +1828,3 @@ w32_reset_fringes (void)
1831#endif /* HAVE_NTGUI */ 1828#endif /* HAVE_NTGUI */
1832 1829
1833#endif /* HAVE_WINDOW_SYSTEM */ 1830#endif /* HAVE_WINDOW_SYSTEM */
1834
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 6ecd5d624af..754f61e366d 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -40,6 +40,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
40#include <X11/Xft/Xft.h> 40#include <X11/Xft/Xft.h>
41#endif 41#endif
42 42
43#ifdef HAVE_GTK3
44#include <gtk/gtkx.h>
45#endif
46
43#define FRAME_TOTAL_PIXEL_HEIGHT(f) \ 47#define FRAME_TOTAL_PIXEL_HEIGHT(f) \
44 (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f)) 48 (FRAME_PIXEL_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f))
45 49
@@ -69,8 +73,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
69#define remove_submenu(w) gtk_menu_item_remove_submenu ((w)) 73#define remove_submenu(w) gtk_menu_item_remove_submenu ((w))
70#endif 74#endif
71 75
76#ifndef HAVE_GTK3
77#ifdef USE_GTK_TOOLTIP
78#define gdk_window_get_screen(w) gdk_drawable_get_screen (w)
79#endif
80#define gdk_window_get_geometry(w, a, b, c, d) \
81 gdk_window_get_geometry (w, a, b, c, d, 0)
82#define gdk_x11_window_lookup_for_display(d, w) \
83 gdk_xid_table_lookup_for_display (d, w)
84#define GDK_KEY_g GDK_g
85#endif
86
72#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x)) 87#define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
73 88
89/* Get the current value of the range, truncated to an integer. */
90static int
91int_gtk_range_get_value (GtkRange *range)
92{
93 return gtk_range_get_value (range);
94}
95
74 96
75/*********************************************************************** 97/***********************************************************************
76 Display handling functions 98 Display handling functions
@@ -88,7 +110,7 @@ static GdkDisplay *gdpy_def;
88static void 110static void
89xg_set_screen (GtkWidget *w, FRAME_PTR f) 111xg_set_screen (GtkWidget *w, FRAME_PTR f)
90{ 112{
91 if (FRAME_X_DISPLAY (f) != GDK_DISPLAY ()) 113 if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ())
92 { 114 {
93 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); 115 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
94 GdkScreen *gscreen = gdk_display_get_default_screen (gdpy); 116 GdkScreen *gscreen = gdk_display_get_default_screen (gdpy);
@@ -229,29 +251,55 @@ xg_create_default_cursor (Display *dpy)
229 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); 251 return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR);
230} 252}
231 253
254static GdkPixbuf *
255xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix)
256{
257 int iunused;
258 GdkPixbuf *tmp_buf;
259 Window wunused;
260 unsigned int width, height, uunused;
261 XImage *xim;
262
263 XGetGeometry (FRAME_X_DISPLAY (f), pix, &wunused, &iunused, &iunused,
264 &width, &height, &uunused, &uunused);
265
266 xim = XGetImage (FRAME_X_DISPLAY (f), pix, 0, 0, width, height,
267 ~0, XYPixmap);
268 if (!xim) return 0;
269
270 tmp_buf = gdk_pixbuf_new_from_data ((guchar *) xim->data,
271 GDK_COLORSPACE_RGB,
272 FALSE,
273 xim->bitmap_unit,
274 (int) width,
275 (int) height,
276 xim->bytes_per_line,
277 NULL,
278 NULL);
279 XDestroyImage (xim);
280 return tmp_buf;
281}
282
232/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 283/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
233 284
234static GdkPixbuf * 285static GdkPixbuf *
235xg_get_pixbuf_from_pix_and_mask (GdkPixmap *gpix, 286xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f,
236 GdkPixmap *gmask, 287 Pixmap pix,
237 GdkColormap *cmap) 288 Pixmap mask)
238{ 289{
239 int width, height; 290 int width, height;
240 GdkPixbuf *icon_buf, *tmp_buf; 291 GdkPixbuf *icon_buf, *tmp_buf;
241 292
242 gdk_drawable_get_size (gpix, &width, &height); 293 tmp_buf = xg_get_pixbuf_from_pixmap (f, pix);
243 tmp_buf = gdk_pixbuf_get_from_drawable (NULL, gpix, cmap,
244 0, 0, 0, 0, width, height);
245 icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); 294 icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0);
246 g_object_unref (G_OBJECT (tmp_buf)); 295 g_object_unref (G_OBJECT (tmp_buf));
247 296
248 if (gmask) 297 width = gdk_pixbuf_get_width (icon_buf);
298 height = gdk_pixbuf_get_height (icon_buf);
299
300 if (mask)
249 { 301 {
250 GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL, 302 GdkPixbuf *mask_buf = xg_get_pixbuf_from_pixmap (f, mask);
251 gmask,
252 NULL,
253 0, 0, 0, 0,
254 width, height);
255 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); 303 guchar *pixels = gdk_pixbuf_get_pixels (icon_buf);
256 guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); 304 guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf);
257 int rowstride = gdk_pixbuf_get_rowstride (icon_buf); 305 int rowstride = gdk_pixbuf_get_rowstride (icon_buf);
@@ -316,10 +364,6 @@ xg_get_image_for_pixmap (FRAME_PTR f,
316 GtkWidget *widget, 364 GtkWidget *widget,
317 GtkImage *old_widget) 365 GtkImage *old_widget)
318{ 366{
319 GdkPixmap *gpix;
320 GdkPixmap *gmask;
321 GdkDisplay *gdpy;
322 GdkColormap *cmap;
323 GdkPixbuf *icon_buf; 367 GdkPixbuf *icon_buf;
324 368
325 /* If we have a file, let GTK do all the image handling. 369 /* If we have a file, let GTK do all the image handling.
@@ -347,10 +391,6 @@ xg_get_image_for_pixmap (FRAME_PTR f,
347 on a monochrome display, and sometimes bad on all displays with 391 on a monochrome display, and sometimes bad on all displays with
348 certain themes. */ 392 certain themes. */
349 393
350 gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
351 gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap);
352 gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0;
353
354 /* This is a workaround to make icons look good on pseudo color 394 /* This is a workaround to make icons look good on pseudo color
355 displays. Apparently GTK expects the images to have an alpha 395 displays. Apparently GTK expects the images to have an alpha
356 channel. If they don't, insensitive and activated icons will 396 channel. If they don't, insensitive and activated icons will
@@ -360,18 +400,17 @@ xg_get_image_for_pixmap (FRAME_PTR f,
360 not associated with the img->pixmap. The img->pixmap may be removed 400 not associated with the img->pixmap. The img->pixmap may be removed
361 by clearing the image cache and then the tool bar redraw fails, since 401 by clearing the image cache and then the tool bar redraw fails, since
362 Gtk+ assumes the pixmap is always there. */ 402 Gtk+ assumes the pixmap is always there. */
363 cmap = gtk_widget_get_colormap (widget); 403 icon_buf = xg_get_pixbuf_from_pix_and_mask (f, img->pixmap, img->mask);
364 icon_buf = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, cmap);
365 404
366 if (! old_widget) 405 if (icon_buf)
367 old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); 406 {
368 else 407 if (! old_widget)
369 gtk_image_set_from_pixbuf (old_widget, icon_buf); 408 old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf));
370 409 else
371 g_object_unref (G_OBJECT (icon_buf)); 410 gtk_image_set_from_pixbuf (old_widget, icon_buf);
372 411
373 g_object_unref (G_OBJECT (gpix)); 412 g_object_unref (G_OBJECT (icon_buf));
374 if (gmask) g_object_unref (G_OBJECT (gmask)); 413 }
375 414
376 return GTK_WIDGET (old_widget); 415 return GTK_WIDGET (old_widget);
377} 416}
@@ -455,22 +494,22 @@ get_utf8_string (const char *str)
455 gsize bytes_written; 494 gsize bytes_written;
456 unsigned char *p = (unsigned char *)str; 495 unsigned char *p = (unsigned char *)str;
457 char *cp, *up; 496 char *cp, *up;
458 GError *error = NULL; 497 GError *err = NULL;
459 498
460 while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, 499 while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read,
461 &bytes_written, &error)) 500 &bytes_written, &err))
462 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) 501 && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
463 { 502 {
464 ++nr_bad; 503 ++nr_bad;
465 p += bytes_written+1; 504 p += bytes_written+1;
466 g_error_free (error); 505 g_error_free (err);
467 error = NULL; 506 err = NULL;
468 } 507 }
469 508
470 if (error) 509 if (err)
471 { 510 {
472 g_error_free (error); 511 g_error_free (err);
473 error = NULL; 512 err = NULL;
474 } 513 }
475 if (cp) g_free (cp); 514 if (cp) g_free (cp);
476 515
@@ -478,16 +517,16 @@ get_utf8_string (const char *str)
478 p = (unsigned char *)str; 517 p = (unsigned char *)str;
479 518
480 while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read, 519 while (! (cp = g_locale_to_utf8 ((char *)p, -1, &bytes_read,
481 &bytes_written, &error)) 520 &bytes_written, &err))
482 && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) 521 && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
483 { 522 {
484 strncpy (up, (char *)p, bytes_written); 523 strncpy (up, (char *)p, bytes_written);
485 sprintf (up + bytes_written, "\\%03o", p[bytes_written]); 524 sprintf (up + bytes_written, "\\%03o", p[bytes_written]);
486 up[bytes_written+4] = '\0'; 525 up[bytes_written+4] = '\0';
487 up += bytes_written+4; 526 up += bytes_written+4;
488 p += bytes_written+1; 527 p += bytes_written+1;
489 g_error_free (error); 528 g_error_free (err);
490 error = NULL; 529 err = NULL;
491 } 530 }
492 531
493 if (cp) 532 if (cp)
@@ -495,10 +534,10 @@ get_utf8_string (const char *str)
495 strcat (utf8_str, cp); 534 strcat (utf8_str, cp);
496 g_free (cp); 535 g_free (cp);
497 } 536 }
498 if (error) 537 if (err)
499 { 538 {
500 g_error_free (error); 539 g_error_free (err);
501 error = NULL; 540 err = NULL;
502 } 541 }
503 } 542 }
504 return utf8_str; 543 return utf8_str;
@@ -514,28 +553,43 @@ xg_check_special_colors (struct frame *f,
514 XColor *color) 553 XColor *color)
515{ 554{
516 int success_p = 0; 555 int success_p = 0;
517 if (FRAME_GTK_WIDGET (f)) 556 int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
518 { 557 int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0;
519 if (strcmp ("gtk_selection_bg_color", color_name) == 0)
520 {
521 GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
522 color->red = gsty->bg[GTK_STATE_SELECTED].red;
523 color->green = gsty->bg[GTK_STATE_SELECTED].green;
524 color->blue = gsty->bg[GTK_STATE_SELECTED].blue;
525 color->pixel = gsty->bg[GTK_STATE_SELECTED].pixel;
526 success_p = 1;
527 }
528 else if (strcmp ("gtk_selection_fg_color", color_name) == 0)
529 {
530 GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
531 color->red = gsty->fg[GTK_STATE_SELECTED].red;
532 color->green = gsty->fg[GTK_STATE_SELECTED].green;
533 color->blue = gsty->fg[GTK_STATE_SELECTED].blue;
534 color->pixel = gsty->fg[GTK_STATE_SELECTED].pixel;
535 success_p = 1;
536 }
537 }
538 558
559 if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
560 return success_p;
561
562 BLOCK_INPUT;
563 {
564#ifdef HAVE_GTK3
565 GtkStyleContext *gsty
566 = gtk_widget_get_style_context (FRAME_GTK_OUTER_WIDGET (f));
567 GdkRGBA col;
568 char buf[64];
569 int state = GTK_STATE_FLAG_SELECTED|GTK_STATE_FLAG_FOCUSED;
570 if (get_fg)
571 gtk_style_context_get_color (gsty, state, &col);
572 else
573 gtk_style_context_get_background_color (gsty, state, &col);
574
575 sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue);
576 success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
577 buf, color);
578#else
579 GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
580 GdkColor *grgb = get_bg
581 ? &gsty->bg[GTK_STATE_SELECTED]
582 : &gsty->fg[GTK_STATE_SELECTED];
583
584 color->red = grgb->red;
585 color->green = grgb->green;
586 color->blue = grgb->blue;
587 color->pixel = grgb->pixel;
588 success_p = 1;
589#endif
590
591 }
592 UNBLOCK_INPUT;
539 return success_p; 593 return success_p;
540} 594}
541 595
@@ -629,7 +683,7 @@ xg_prepare_tooltip (FRAME_PTR f,
629 encoded_string = ENCODE_UTF_8 (string); 683 encoded_string = ENCODE_UTF_8 (string);
630 widget = GTK_WIDGET (x->ttip_lbl); 684 widget = GTK_WIDGET (x->ttip_lbl);
631 gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); 685 gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window));
632 screen = gdk_drawable_get_screen (gwin); 686 screen = gdk_window_get_screen (gwin);
633 settings = gtk_settings_get_for_screen (screen); 687 settings = gtk_settings_get_for_screen (screen);
634 g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL); 688 g_object_get (settings, "gtk-enable-tooltips", &tt_enabled, NULL);
635 if (tt_enabled) 689 if (tt_enabled)
@@ -650,7 +704,7 @@ xg_prepare_tooltip (FRAME_PTR f,
650 gtk_tooltip_set_custom (x->ttip_widget, widget); 704 gtk_tooltip_set_custom (x->ttip_widget, widget);
651 705
652 gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string)); 706 gtk_tooltip_set_text (x->ttip_widget, SDATA (encoded_string));
653 gtk_widget_size_request (GTK_WIDGET (x->ttip_window), &req); 707 gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req);
654 if (width) *width = req.width; 708 if (width) *width = req.width;
655 if (height) *height = req.height; 709 if (height) *height = req.height;
656 710
@@ -696,7 +750,7 @@ xg_hide_tooltip (FRAME_PTR f)
696 if (g_object_get_data (G_OBJECT (win), "restore-tt")) 750 if (g_object_get_data (G_OBJECT (win), "restore-tt"))
697 { 751 {
698 GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win)); 752 GdkWindow *gwin = gtk_widget_get_window (GTK_WIDGET (win));
699 GdkScreen *screen = gdk_drawable_get_screen (gwin); 753 GdkScreen *screen = gdk_window_get_screen (gwin);
700 GtkSettings *settings = gtk_settings_get_for_screen (screen); 754 GtkSettings *settings = gtk_settings_get_for_screen (screen);
701 g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); 755 g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL);
702 } 756 }
@@ -797,7 +851,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight)
797 if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f))) 851 if (FRAME_GTK_WIDGET (f) && gtk_widget_get_mapped (FRAME_GTK_WIDGET (f)))
798 gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)), 852 gdk_window_get_geometry (gtk_widget_get_window (FRAME_GTK_WIDGET (f)),
799 0, 0, 853 0, 0,
800 &pixelwidth, &pixelheight, 0); 854 &pixelwidth, &pixelheight);
801 else return; 855 else return;
802 } 856 }
803 857
@@ -910,8 +964,8 @@ xg_win_to_widget (Display *dpy, Window wdesc)
910 964
911 BLOCK_INPUT; 965 BLOCK_INPUT;
912 966
913 gdkwin = gdk_xid_table_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), 967 gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy),
914 wdesc); 968 wdesc);
915 if (gdkwin) 969 if (gdkwin)
916 { 970 {
917 GdkEvent event; 971 GdkEvent event;
@@ -923,14 +977,29 @@ xg_win_to_widget (Display *dpy, Window wdesc)
923 return gwdesc; 977 return gwdesc;
924} 978}
925 979
926/* Fill in the GdkColor C so that it represents PIXEL. 980/* Set the background of widget W to PIXEL. */
927 W is the widget that color will be used for. Used to find colormap. */
928 981
929static void 982static void
930xg_pix_to_gcolor (GtkWidget *w, long unsigned int pixel, GdkColor *c) 983xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel)
931{ 984{
985#ifdef HAVE_GTK3
986 GdkRGBA bg;
987 XColor xbg;
988 xbg.pixel = pixel;
989 if (XQueryColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &xbg))
990 {
991 bg.red = (double)xbg.red/65536.0;
992 bg.green = (double)xbg.green/65536.0;
993 bg.blue = (double)xbg.blue/65536.0;
994 bg.alpha = 1.0;
995 gtk_widget_override_background_color (w, GTK_STATE_FLAG_NORMAL, &bg);
996 }
997#else
998 GdkColor bg;
932 GdkColormap *map = gtk_widget_get_colormap (w); 999 GdkColormap *map = gtk_widget_get_colormap (w);
933 gdk_colormap_query_color (map, pixel, c); 1000 gdk_colormap_query_color (map, pixel, &bg);
1001 gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &bg);
1002#endif
934} 1003}
935 1004
936/* Callback called when the gtk theme changes. 1005/* Callback called when the gtk theme changes.
@@ -953,6 +1022,28 @@ style_changed_cb (GObject *go,
953 kbd_buffer_store_event (&event); 1022 kbd_buffer_store_event (&event);
954} 1023}
955 1024
1025/* Called when a delete-event occurs on WIDGET. */
1026
1027static gboolean
1028delete_cb (GtkWidget *widget,
1029 GdkEvent *event,
1030 gpointer user_data)
1031{
1032#ifdef HAVE_GTK3
1033 /* The event doesn't arrive in the normal event loop. Send event
1034 here. */
1035 FRAME_PTR f = (FRAME_PTR) user_data;
1036 struct input_event ie;
1037
1038 EVENT_INIT (ie);
1039 ie.kind = DELETE_WINDOW_EVENT;
1040 XSETFRAME (ie.frame_or_window, f);
1041 kbd_buffer_store_event (&ie);
1042#endif
1043
1044 return TRUE;
1045}
1046
956/* Create and set up the GTK widgets for frame F. 1047/* Create and set up the GTK widgets for frame F.
957 Return 0 if creation failed, non-zero otherwise. */ 1048 Return 0 if creation failed, non-zero otherwise. */
958 1049
@@ -962,7 +1053,6 @@ xg_create_frame_widgets (FRAME_PTR f)
962 GtkWidget *wtop; 1053 GtkWidget *wtop;
963 GtkWidget *wvbox, *whbox; 1054 GtkWidget *wvbox, *whbox;
964 GtkWidget *wfixed; 1055 GtkWidget *wfixed;
965 GdkColor bg;
966 GtkRcStyle *style; 1056 GtkRcStyle *style;
967 char *title = 0; 1057 char *title = 0;
968 1058
@@ -1029,7 +1119,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1029 /* Add callback to do nothing on WM_DELETE_WINDOW. The default in 1119 /* Add callback to do nothing on WM_DELETE_WINDOW. The default in
1030 GTK is to destroy the widget. We want Emacs to do that instead. */ 1120 GTK is to destroy the widget. We want Emacs to do that instead. */
1031 g_signal_connect (G_OBJECT (wtop), "delete-event", 1121 g_signal_connect (G_OBJECT (wtop), "delete-event",
1032 G_CALLBACK (gtk_true), 0); 1122 G_CALLBACK (delete_cb), f);
1033 1123
1034 /* Convert our geometry parameters into a geometry string 1124 /* Convert our geometry parameters into a geometry string
1035 and specify it. 1125 and specify it.
@@ -1057,9 +1147,9 @@ xg_create_frame_widgets (FRAME_PTR f)
1057 1147
1058 /* Since GTK clears its window by filling with the background color, 1148 /* Since GTK clears its window by filling with the background color,
1059 we must keep X and GTK background in sync. */ 1149 we must keep X and GTK background in sync. */
1060 xg_pix_to_gcolor (wfixed, FRAME_BACKGROUND_PIXEL (f), &bg); 1150 xg_set_widget_bg (f, wfixed, FRAME_BACKGROUND_PIXEL (f));
1061 gtk_widget_modify_bg (wfixed, GTK_STATE_NORMAL, &bg);
1062 1151
1152#ifndef HAVE_GTK3
1063 /* Also, do not let any background pixmap to be set, this looks very 1153 /* Also, do not let any background pixmap to be set, this looks very
1064 bad as Emacs overwrites the background pixmap with its own idea 1154 bad as Emacs overwrites the background pixmap with its own idea
1065 of background color. */ 1155 of background color. */
@@ -1068,6 +1158,9 @@ xg_create_frame_widgets (FRAME_PTR f)
1068 /* Must use g_strdup because gtk_widget_modify_style does g_free. */ 1158 /* Must use g_strdup because gtk_widget_modify_style does g_free. */
1069 style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>"); 1159 style->bg_pixmap_name[GTK_STATE_NORMAL] = g_strdup ("<none>");
1070 gtk_widget_modify_style (wfixed, style); 1160 gtk_widget_modify_style (wfixed, style);
1161#else
1162 gtk_widget_set_can_focus (wfixed, TRUE);
1163#endif
1071 1164
1072#ifdef USE_GTK_TOOLTIP 1165#ifdef USE_GTK_TOOLTIP
1073 /* Steal a tool tip window we can move ourselves. */ 1166 /* Steal a tool tip window we can move ourselves. */
@@ -1104,7 +1197,9 @@ xg_free_frame_widgets (FRAME_PTR f)
1104{ 1197{
1105 if (FRAME_GTK_OUTER_WIDGET (f)) 1198 if (FRAME_GTK_OUTER_WIDGET (f))
1106 { 1199 {
1200#ifdef USE_GTK_TOOLTIP
1107 struct x_output *x = f->output_data.x; 1201 struct x_output *x = f->output_data.x;
1202#endif
1108 gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f)); 1203 gtk_widget_destroy (FRAME_GTK_OUTER_WIDGET (f));
1109 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */ 1204 FRAME_X_WINDOW (f) = 0; /* Set to avoid XDestroyWindow in xterm.c */
1110 FRAME_GTK_OUTER_WIDGET (f) = 0; 1205 FRAME_GTK_OUTER_WIDGET (f) = 0;
@@ -1224,11 +1319,8 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
1224{ 1319{
1225 if (FRAME_GTK_WIDGET (f)) 1320 if (FRAME_GTK_WIDGET (f))
1226 { 1321 {
1227 GdkColor gdk_bg;
1228
1229 BLOCK_INPUT; 1322 BLOCK_INPUT;
1230 xg_pix_to_gcolor (FRAME_GTK_WIDGET (f), bg, &gdk_bg); 1323 xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f));
1231 gtk_widget_modify_bg (FRAME_GTK_WIDGET (f), GTK_STATE_NORMAL, &gdk_bg);
1232 UNBLOCK_INPUT; 1324 UNBLOCK_INPUT;
1233 } 1325 }
1234} 1326}
@@ -1240,11 +1332,10 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
1240void 1332void
1241xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) 1333xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask)
1242{ 1334{
1243 GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); 1335 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f,
1244 GdkPixmap *gpix = gdk_pixmap_foreign_new_for_display (gdpy, icon_pixmap); 1336 icon_pixmap,
1245 GdkPixmap *gmask = gdk_pixmap_foreign_new_for_display (gdpy, icon_mask); 1337 icon_mask);
1246 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (gpix, gmask, NULL); 1338 if (gp)
1247
1248 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp); 1339 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), gp);
1249} 1340}
1250 1341
@@ -1326,8 +1417,6 @@ create_dialog (widget_value *wv,
1326 GtkDialog *wd = GTK_DIALOG (wdialog); 1417 GtkDialog *wd = GTK_DIALOG (wdialog);
1327 GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd)); 1418 GtkBox *cur_box = GTK_BOX (gtk_dialog_get_action_area (wd));
1328 widget_value *item; 1419 widget_value *item;
1329 GtkWidget *wvbox;
1330 GtkWidget *whbox_up;
1331 GtkWidget *whbox_down; 1420 GtkWidget *whbox_down;
1332 1421
1333 /* If the number of buttons is greater than 4, make two rows of buttons 1422 /* If the number of buttons is greater than 4, make two rows of buttons
@@ -1343,8 +1432,8 @@ create_dialog (widget_value *wv,
1343 1432
1344 if (make_two_rows) 1433 if (make_two_rows)
1345 { 1434 {
1346 wvbox = gtk_vbox_new (TRUE, button_spacing); 1435 GtkWidget *wvbox = gtk_vbox_new (TRUE, button_spacing);
1347 whbox_up = gtk_hbox_new (FALSE, 0); 1436 GtkWidget *whbox_up = gtk_hbox_new (FALSE, 0);
1348 whbox_down = gtk_hbox_new (FALSE, 0); 1437 whbox_down = gtk_hbox_new (FALSE, 0);
1349 1438
1350 gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0); 1439 gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0);
@@ -1381,7 +1470,7 @@ create_dialog (widget_value *wv,
1381 /* Try to make dialog look better. Must realize first so 1470 /* Try to make dialog look better. Must realize first so
1382 the widget can calculate the size it needs. */ 1471 the widget can calculate the size it needs. */
1383 gtk_widget_realize (w); 1472 gtk_widget_realize (w);
1384 gtk_widget_size_request (w, &req); 1473 gtk_widget_get_preferred_size (w, NULL, &req);
1385 gtk_box_set_spacing (wvbox, req.height); 1474 gtk_box_set_spacing (wvbox, req.height);
1386 if (item->value && strlen (item->value) > 0) 1475 if (item->value && strlen (item->value) > 0)
1387 button_spacing = 2*req.width/strlen (item->value); 1476 button_spacing = 2*req.width/strlen (item->value);
@@ -1613,7 +1702,7 @@ xg_get_file_with_chooser (FRAME_PTR f,
1613 int mustmatch_p, int only_dir_p, 1702 int mustmatch_p, int only_dir_p,
1614 xg_get_file_func *func) 1703 xg_get_file_func *func)
1615{ 1704{
1616 char message[1024]; 1705 char msgbuf[1024];
1617 1706
1618 GtkWidget *filewin, *wtoggle, *wbox, *wmessage; 1707 GtkWidget *filewin, *wtoggle, *wbox, *wmessage;
1619 GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)); 1708 GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f));
@@ -1649,16 +1738,16 @@ xg_get_file_with_chooser (FRAME_PTR f,
1649 1738
1650 if (x_gtk_file_dialog_help_text) 1739 if (x_gtk_file_dialog_help_text)
1651 { 1740 {
1652 message[0] = '\0'; 1741 msgbuf[0] = '\0';
1653 /* Gtk+ 2.10 has the file name text entry box integrated in the dialog. 1742 /* Gtk+ 2.10 has the file name text entry box integrated in the dialog.
1654 Show the C-l help text only for versions < 2.10. */ 1743 Show the C-l help text only for versions < 2.10. */
1655 if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE) 1744 if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE)
1656 strcat (message, "\nType C-l to display a file name text entry box.\n"); 1745 strcat (msgbuf, "\nType C-l to display a file name text entry box.\n");
1657 strcat (message, "\nIf you don't like this file selector, use the " 1746 strcat (msgbuf, "\nIf you don't like this file selector, use the "
1658 "corresponding\nkey binding or customize " 1747 "corresponding\nkey binding or customize "
1659 "use-file-dialog to turn it off."); 1748 "use-file-dialog to turn it off.");
1660 1749
1661 wmessage = gtk_label_new (message); 1750 wmessage = gtk_label_new (msgbuf);
1662 gtk_widget_show (wmessage); 1751 gtk_widget_show (wmessage);
1663 } 1752 }
1664 1753
@@ -3028,7 +3117,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
3028{ 3117{
3029 GtkRequisition req; 3118 GtkRequisition req;
3030 FRAME_PTR f = (FRAME_PTR) user_data; 3119 FRAME_PTR f = (FRAME_PTR) user_data;
3031 gtk_widget_size_request (w, &req); 3120 gtk_widget_get_preferred_size (w, NULL, &req);
3032 if (FRAME_MENUBAR_HEIGHT (f) != req.height) 3121 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3033 { 3122 {
3034 FRAME_MENUBAR_HEIGHT (f) = req.height; 3123 FRAME_MENUBAR_HEIGHT (f) = req.height;
@@ -3059,7 +3148,7 @@ xg_update_frame_menubar (FRAME_PTR f)
3059 3148
3060 g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f); 3149 g_signal_connect (x->menubar_widget, "map", G_CALLBACK (menubar_map_cb), f);
3061 gtk_widget_show_all (x->menubar_widget); 3150 gtk_widget_show_all (x->menubar_widget);
3062 gtk_widget_size_request (x->menubar_widget, &req); 3151 gtk_widget_get_preferred_size (x->menubar_widget, NULL, &req);
3063 3152
3064 /* If menu bar doesn't know its height yet, cheat a little so the frame 3153 /* If menu bar doesn't know its height yet, cheat a little so the frame
3065 doesn't jump so much when resized later in menubar_map_cb. */ 3154 doesn't jump so much when resized later in menubar_map_cb. */
@@ -3120,7 +3209,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3120 return 0; 3209 return 0;
3121 3210
3122 gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); 3211 gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
3123 gw = gdk_xid_table_lookup_for_display (gdpy, event->xbutton.window); 3212 gw = gdk_x11_window_lookup_for_display (gdpy, event->xbutton.window);
3124 if (! gw) return 0; 3213 if (! gw) return 0;
3125 gevent.any.window = gw; 3214 gevent.any.window = gw;
3126 gwdesc = gtk_get_event_widget (&gevent); 3215 gwdesc = gtk_get_event_widget (&gevent);
@@ -3284,8 +3373,12 @@ xg_create_scroll_bar (FRAME_PTR f,
3284{ 3373{
3285 GtkWidget *wscroll; 3374 GtkWidget *wscroll;
3286 GtkWidget *webox; 3375 GtkWidget *webox;
3287 GtkObject *vadj;
3288 int scroll_id; 3376 int scroll_id;
3377#ifdef HAVE_GTK3
3378 GtkAdjustment *vadj;
3379#else
3380 GtkObject *vadj;
3381#endif
3289 3382
3290 /* Page, step increment values are not so important here, they 3383 /* Page, step increment values are not so important here, they
3291 will be corrected in x_set_toolkit_scroll_bar_thumb. */ 3384 will be corrected in x_set_toolkit_scroll_bar_thumb. */
@@ -3295,7 +3388,9 @@ xg_create_scroll_bar (FRAME_PTR f,
3295 wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj)); 3388 wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
3296 webox = gtk_event_box_new (); 3389 webox = gtk_event_box_new ();
3297 gtk_widget_set_name (wscroll, scroll_bar_name); 3390 gtk_widget_set_name (wscroll, scroll_bar_name);
3391#ifndef HAVE_GTK3
3298 gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS); 3392 gtk_range_set_update_policy (GTK_RANGE (wscroll), GTK_UPDATE_CONTINUOUS);
3393#endif
3299 g_object_set_data (G_OBJECT (wscroll), XG_FRAME_DATA, (gpointer)f); 3394 g_object_set_data (G_OBJECT (wscroll), XG_FRAME_DATA, (gpointer)f);
3300 3395
3301 scroll_id = xg_store_widget_in_map (wscroll); 3396 scroll_id = xg_store_widget_in_map (wscroll);
@@ -3474,7 +3569,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3474 changed = 1; 3569 changed = 1;
3475 } 3570 }
3476 3571
3477 if (changed || (int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) 3572 if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value)
3478 { 3573 {
3479 BLOCK_INPUT; 3574 BLOCK_INPUT;
3480 3575
@@ -3482,7 +3577,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3482 ignore_gtk_scrollbar to make the callback do nothing */ 3577 ignore_gtk_scrollbar to make the callback do nothing */
3483 xg_ignore_gtk_scrollbar = 1; 3578 xg_ignore_gtk_scrollbar = 1;
3484 3579
3485 if ((int) gtk_range_get_value (GTK_RANGE (wscroll)) != value) 3580 if (int_gtk_range_get_value (GTK_RANGE (wscroll)) != value)
3486 gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value); 3581 gtk_range_set_value (GTK_RANGE (wscroll), (gdouble)value);
3487 else if (changed) 3582 else if (changed)
3488 gtk_adjustment_changed (adj); 3583 gtk_adjustment_changed (adj);
@@ -3578,8 +3673,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
3578{ 3673{
3579 /* The EMACS_INT cast avoids a warning. */ 3674 /* The EMACS_INT cast avoids a warning. */
3580 int idx = (int) (EMACS_INT) client_data; 3675 int idx = (int) (EMACS_INT) client_data;
3581 int mod = (int) (EMACS_INT) g_object_get_data (G_OBJECT (w), 3676 gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER);
3582 XG_TOOL_BAR_LAST_MODIFIER); 3677 int mod = (int) (EMACS_INT) gmod;
3583 3678
3584 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 3679 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
3585 Lisp_Object key, frame; 3680 Lisp_Object key, frame;
@@ -3793,8 +3888,8 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox,
3793 { 3888 {
3794 GtkRequisition req, req2; 3889 GtkRequisition req, req2;
3795 FRAME_X_OUTPUT (f)->toolbar_detached = 1; 3890 FRAME_X_OUTPUT (f)->toolbar_detached = 1;
3796 gtk_widget_size_request (GTK_WIDGET (wbox), &req); 3891 gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req);
3797 gtk_widget_size_request (w, &req2); 3892 gtk_widget_get_preferred_size (w, NULL, &req2);
3798 req.width -= req2.width; 3893 req.width -= req2.width;
3799 req.height -= req2.height; 3894 req.height -= req2.height;
3800 if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) 3895 if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
@@ -3828,8 +3923,8 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox,
3828 { 3923 {
3829 GtkRequisition req, req2; 3924 GtkRequisition req, req2;
3830 FRAME_X_OUTPUT (f)->toolbar_detached = 0; 3925 FRAME_X_OUTPUT (f)->toolbar_detached = 0;
3831 gtk_widget_size_request (GTK_WIDGET (wbox), &req); 3926 gtk_widget_get_preferred_size (GTK_WIDGET (wbox), NULL, &req);
3832 gtk_widget_size_request (w, &req2); 3927 gtk_widget_get_preferred_size (w, NULL, &req2);
3833 req.width += req2.width; 3928 req.width += req2.width;
3834 req.height += req2.height; 3929 req.height += req2.height;
3835 if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0) 3930 if (FRAME_TOOLBAR_TOP_HEIGHT (f) != 0)
@@ -3894,6 +3989,7 @@ xg_tool_bar_help_callback (GtkWidget *w,
3894 3989
3895 Returns FALSE to tell GTK to keep processing this event. */ 3990 Returns FALSE to tell GTK to keep processing this event. */
3896 3991
3992#ifndef HAVE_GTK3
3897static gboolean 3993static gboolean
3898xg_tool_bar_item_expose_callback (GtkWidget *w, 3994xg_tool_bar_item_expose_callback (GtkWidget *w,
3899 GdkEventExpose *event, 3995 GdkEventExpose *event,
@@ -3902,7 +3998,6 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
3902 gint width, height; 3998 gint width, height;
3903 3999
3904 gdk_drawable_get_size (event->window, &width, &height); 4000 gdk_drawable_get_size (event->window, &width, &height);
3905
3906 event->area.x -= width > event->area.width ? width-event->area.width : 0; 4001 event->area.x -= width > event->area.width ? width-event->area.width : 0;
3907 event->area.y -= height > event->area.height ? height-event->area.height : 0; 4002 event->area.y -= height > event->area.height ? height-event->area.height : 0;
3908 4003
@@ -3914,6 +4009,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
3914 4009
3915 return FALSE; 4010 return FALSE;
3916} 4011}
4012#endif
3917 4013
3918#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION 4014#ifdef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
3919#define toolbar_set_orientation(w, o) \ 4015#define toolbar_set_orientation(w, o) \
@@ -4063,13 +4159,14 @@ xg_make_tool_item (FRAME_PTR f,
4063 4159
4064 g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f); 4160 g_object_set_data (G_OBJECT (weventbox), XG_FRAME_DATA, (gpointer)f);
4065 4161
4162#ifndef HAVE_GTK3
4066 /* Catch expose events to overcome an annoying redraw bug, see 4163 /* Catch expose events to overcome an annoying redraw bug, see
4067 comment for xg_tool_bar_item_expose_callback. */ 4164 comment for xg_tool_bar_item_expose_callback. */
4068 g_signal_connect (G_OBJECT (ti), 4165 g_signal_connect (G_OBJECT (ti),
4069 "expose-event", 4166 "expose-event",
4070 G_CALLBACK (xg_tool_bar_item_expose_callback), 4167 G_CALLBACK (xg_tool_bar_item_expose_callback),
4071 0); 4168 0);
4072 4169#endif
4073 gtk_tool_item_set_homogeneous (ti, FALSE); 4170 gtk_tool_item_set_homogeneous (ti, FALSE);
4074 4171
4075 /* Callback to save modifyer mask (Shift/Control, etc). GTK makes 4172 /* Callback to save modifyer mask (Shift/Control, etc). GTK makes
@@ -4128,9 +4225,9 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4128 } 4225 }
4129 else 4226 else
4130 { 4227 {
4131 Pixmap old_img 4228 gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
4132 = (Pixmap) g_object_get_data (G_OBJECT (wimage), 4229 XG_TOOL_BAR_IMAGE_DATA);
4133 XG_TOOL_BAR_IMAGE_DATA); 4230 Pixmap old_img = (Pixmap) gold_img;
4134 if (old_img != img->pixmap) 4231 if (old_img != img->pixmap)
4135 return 1; 4232 return 1;
4136 } 4233 }
@@ -4153,7 +4250,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4153 GtkRequisition req; 4250 GtkRequisition req;
4154 int nl = 0, nr = 0, nt = 0, nb = 0; 4251 int nl = 0, nr = 0, nt = 0, nb = 0;
4155 4252
4156 gtk_widget_size_request (GTK_WIDGET (x->handlebox_widget), &req); 4253 gtk_widget_get_preferred_size (GTK_WIDGET (x->handlebox_widget), NULL, &req);
4157 if (x->toolbar_in_hbox) 4254 if (x->toolbar_in_hbox)
4158 { 4255 {
4159 int pos; 4256 int pos;
@@ -4203,7 +4300,6 @@ update_frame_tool_bar (FRAME_PTR f)
4203 GtkToolItem *ti; 4300 GtkToolItem *ti;
4204 GtkTextDirection dir; 4301 GtkTextDirection dir;
4205 int pack_tool_bar = x->handlebox_widget == NULL; 4302 int pack_tool_bar = x->handlebox_widget == NULL;
4206
4207 Lisp_Object style; 4303 Lisp_Object style;
4208 int text_image, horiz; 4304 int text_image, horiz;
4209 4305
@@ -4551,13 +4647,13 @@ xg_initialize (void)
4551 /* Make dialogs close on C-g. Since file dialog inherits from 4647 /* Make dialogs close on C-g. Since file dialog inherits from
4552 dialog, this works for them also. */ 4648 dialog, this works for them also. */
4553 binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_DIALOG)); 4649 binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_DIALOG));
4554 gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, 4650 gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK,
4555 "close", 0); 4651 "close", 0);
4556 4652
4557 /* Make menus close on C-g. */ 4653 /* Make menus close on C-g. */
4558 binding_set = gtk_binding_set_by_class (g_type_class_ref 4654 binding_set = gtk_binding_set_by_class (g_type_class_ref
4559 (GTK_TYPE_MENU_SHELL)); 4655 (GTK_TYPE_MENU_SHELL));
4560 gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, 4656 gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK,
4561 "cancel", 0); 4657 "cancel", 0);
4562} 4658}
4563 4659
diff --git a/src/image.c b/src/image.c
index 73a45633f3b..91308c540b5 100644
--- a/src/image.c
+++ b/src/image.c
@@ -550,10 +550,6 @@ x_create_bitmap_mask (struct frame *f, int id)
550 Image types 550 Image types
551 ***********************************************************************/ 551 ***********************************************************************/
552 552
553/* Value is the number of elements of vector VECTOR. */
554
555#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
556
557/* List of supported image types. Use define_image_type to add new 553/* List of supported image types. Use define_image_type to add new
558 types. Use lookup_image_type to find a type for a given symbol. */ 554 types. Use lookup_image_type to find a type for a given symbol. */
559 555
@@ -1139,7 +1135,7 @@ static RGB_PIXEL_COLOR
1139four_corners_best (XImagePtr_or_DC ximg, int *corners, 1135four_corners_best (XImagePtr_or_DC ximg, int *corners,
1140 unsigned long width, unsigned long height) 1136 unsigned long width, unsigned long height)
1141{ 1137{
1142 RGB_PIXEL_COLOR corner_pixels[4], best; 1138 RGB_PIXEL_COLOR corner_pixels[4], best IF_LINT (= 0);
1143 int i, best_count; 1139 int i, best_count;
1144 1140
1145 if (corners && corners[BOT_CORNER] >= 0) 1141 if (corners && corners[BOT_CORNER] >= 0)
@@ -1491,7 +1487,7 @@ free_image_cache (struct frame *f)
1491 If image-cache-eviction-delay is non-nil, this frees images in the cache 1487 If image-cache-eviction-delay is non-nil, this frees images in the cache
1492 which weren't displayed for at least that many seconds. */ 1488 which weren't displayed for at least that many seconds. */
1493 1489
1494void 1490static void
1495clear_image_cache (struct frame *f, Lisp_Object filter) 1491clear_image_cache (struct frame *f, Lisp_Object filter)
1496{ 1492{
1497 struct image_cache *c = FRAME_IMAGE_CACHE (f); 1493 struct image_cache *c = FRAME_IMAGE_CACHE (f);
@@ -1559,9 +1555,9 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1559 1555
1560 FOR_EACH_FRAME (tail, frame) 1556 FOR_EACH_FRAME (tail, frame)
1561 { 1557 {
1562 struct frame *f = XFRAME (frame); 1558 struct frame *fr = XFRAME (frame);
1563 if (FRAME_IMAGE_CACHE (f) == c) 1559 if (FRAME_IMAGE_CACHE (fr) == c)
1564 clear_current_matrices (f); 1560 clear_current_matrices (fr);
1565 } 1561 }
1566 1562
1567 ++windows_or_buffers_changed; 1563 ++windows_or_buffers_changed;
@@ -2653,11 +2649,11 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
2653 2649
2654 if (LA1 == XBM_TK_NUMBER) 2650 if (LA1 == XBM_TK_NUMBER)
2655 { 2651 {
2656 char *p = strrchr (buffer, '_'); 2652 char *q = strrchr (buffer, '_');
2657 p = p ? p + 1 : buffer; 2653 q = q ? q + 1 : buffer;
2658 if (strcmp (p, "width") == 0) 2654 if (strcmp (q, "width") == 0)
2659 *width = value; 2655 *width = value;
2660 else if (strcmp (p, "height") == 0) 2656 else if (strcmp (q, "height") == 0)
2661 *height = value; 2657 *height = value;
2662 } 2658 }
2663 expect (XBM_TK_NUMBER); 2659 expect (XBM_TK_NUMBER);
@@ -3427,11 +3423,12 @@ xpm_load (struct frame *f, struct image *img)
3427 { 3423 {
3428 Lisp_Object name; 3424 Lisp_Object name;
3429 Lisp_Object color; 3425 Lisp_Object color;
3426 char *empty_string = (char *) "";
3430 3427
3431 if (!CONSP (XCAR (tail))) 3428 if (!CONSP (XCAR (tail)))
3432 { 3429 {
3433 xpm_syms[i].name = ""; 3430 xpm_syms[i].name = empty_string;
3434 xpm_syms[i].value = ""; 3431 xpm_syms[i].value = empty_string;
3435 continue; 3432 continue;
3436 } 3433 }
3437 name = XCAR (XCAR (tail)); 3434 name = XCAR (XCAR (tail));
@@ -3442,14 +3439,14 @@ xpm_load (struct frame *f, struct image *img)
3442 strcpy (xpm_syms[i].name, SSDATA (name)); 3439 strcpy (xpm_syms[i].name, SSDATA (name));
3443 } 3440 }
3444 else 3441 else
3445 xpm_syms[i].name = ""; 3442 xpm_syms[i].name = empty_string;
3446 if (STRINGP (color)) 3443 if (STRINGP (color))
3447 { 3444 {
3448 xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1); 3445 xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1);
3449 strcpy (xpm_syms[i].value, SSDATA (color)); 3446 strcpy (xpm_syms[i].value, SSDATA (color));
3450 } 3447 }
3451 else 3448 else
3452 xpm_syms[i].value = ""; 3449 xpm_syms[i].value = empty_string;
3453 } 3450 }
3454 } 3451 }
3455 3452
@@ -4605,14 +4602,14 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
4605 4602
4606 for (x = 1; x < img->width - 1; ++x, ++p) 4603 for (x = 1; x < img->width - 1; ++x, ++p)
4607 { 4604 {
4608 int r, g, b, y1, x1; 4605 int r, g, b, yy, xx;
4609 4606
4610 r = g = b = i = 0; 4607 r = g = b = i = 0;
4611 for (y1 = y - 1; y1 < y + 2; ++y1) 4608 for (yy = y - 1; yy < y + 2; ++yy)
4612 for (x1 = x - 1; x1 < x + 2; ++x1, ++i) 4609 for (xx = x - 1; xx < x + 2; ++xx, ++i)
4613 if (matrix[i]) 4610 if (matrix[i])
4614 { 4611 {
4615 XColor *t = COLOR (colors, x1, y1); 4612 XColor *t = COLOR (colors, xx, yy);
4616 r += matrix[i] * t->red; 4613 r += matrix[i] * t->red;
4617 g += matrix[i] * t->green; 4614 g += matrix[i] * t->green;
4618 b += matrix[i] * t->blue; 4615 b += matrix[i] * t->blue;
@@ -4688,7 +4685,7 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
4688 color_adjust = make_number (0xffff / 2); 4685 color_adjust = make_number (0xffff / 2);
4689 4686
4690 if (i == 9 && NUMBERP (color_adjust)) 4687 if (i == 9 && NUMBERP (color_adjust))
4691 x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust)); 4688 x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
4692} 4689}
4693 4690
4694 4691
@@ -5531,6 +5528,7 @@ init_png_functions (Lisp_Object libraries)
5531/* Error and warning handlers installed when the PNG library 5528/* Error and warning handlers installed when the PNG library
5532 is initialized. */ 5529 is initialized. */
5533 5530
5531static void my_png_error (png_struct *, const char *) NO_RETURN;
5534static void 5532static void
5535my_png_error (png_struct *png_ptr, const char *msg) 5533my_png_error (png_struct *png_ptr, const char *msg)
5536{ 5534{
@@ -6030,7 +6028,6 @@ jpeg_image_p (Lisp_Object object)
6030/* Work around a warning about HAVE_STDLIB_H being redefined in 6028/* Work around a warning about HAVE_STDLIB_H being redefined in
6031 jconfig.h. */ 6029 jconfig.h. */
6032#ifdef HAVE_STDLIB_H 6030#ifdef HAVE_STDLIB_H
6033#define HAVE_STDLIB_H_1
6034#undef HAVE_STDLIB_H 6031#undef HAVE_STDLIB_H
6035#endif /* HAVE_STLIB_H */ 6032#endif /* HAVE_STLIB_H */
6036 6033
@@ -6106,6 +6103,7 @@ struct my_jpeg_error_mgr
6106}; 6103};
6107 6104
6108 6105
6106static void my_error_exit (j_common_ptr) NO_RETURN;
6109static void 6107static void
6110my_error_exit (j_common_ptr cinfo) 6108my_error_exit (j_common_ptr cinfo)
6111{ 6109{
@@ -6366,10 +6364,10 @@ jpeg_load (struct frame *f, struct image *img)
6366 if (rc == 1) 6364 if (rc == 1)
6367 { 6365 {
6368 /* Called from my_error_exit. Display a JPEG error. */ 6366 /* Called from my_error_exit. Display a JPEG error. */
6369 char buffer[JMSG_LENGTH_MAX]; 6367 char buf[JMSG_LENGTH_MAX];
6370 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer); 6368 cinfo.err->format_message ((j_common_ptr) &cinfo, buf);
6371 image_error ("Error reading JPEG image `%s': %s", img->spec, 6369 image_error ("Error reading JPEG image `%s': %s", img->spec,
6372 build_string (buffer)); 6370 build_string (buf));
6373 } 6371 }
6374 6372
6375 /* Close the input file and destroy the JPEG object. */ 6373 /* Close the input file and destroy the JPEG object. */
@@ -7105,7 +7103,7 @@ gif_load (struct frame *f, struct image *img)
7105 Lisp_Object file, specified_file; 7103 Lisp_Object file, specified_file;
7106 Lisp_Object specified_data; 7104 Lisp_Object specified_data;
7107 int rc, width, height, x, y, i; 7105 int rc, width, height, x, y, i;
7108 boolean transparent_p; 7106 boolean transparent_p = 0;
7109 XImagePtr ximg; 7107 XImagePtr ximg;
7110 ColorMapObject *gif_color_map; 7108 ColorMapObject *gif_color_map;
7111 unsigned long pixel_colors[256]; 7109 unsigned long pixel_colors[256];
@@ -7114,7 +7112,7 @@ gif_load (struct frame *f, struct image *img)
7114 int ino, image_height, image_width; 7112 int ino, image_height, image_width;
7115 gif_memory_source memsrc; 7113 gif_memory_source memsrc;
7116 unsigned char *raster; 7114 unsigned char *raster;
7117 unsigned int transparency_color_index; 7115 unsigned int transparency_color_index IF_LINT (= 0);
7118 7116
7119 specified_file = image_spec_value (img->spec, QCfile, NULL); 7117 specified_file = image_spec_value (img->spec, QCfile, NULL);
7120 specified_data = image_spec_value (img->spec, QCdata, NULL); 7118 specified_data = image_spec_value (img->spec, QCdata, NULL);
@@ -7129,7 +7127,7 @@ gif_load (struct frame *f, struct image *img)
7129 } 7127 }
7130 7128
7131 /* Open the GIF file. */ 7129 /* Open the GIF file. */
7132 gif = fn_DGifOpenFileName (SDATA (file)); 7130 gif = fn_DGifOpenFileName (SSDATA (file));
7133 if (gif == NULL) 7131 if (gif == NULL)
7134 { 7132 {
7135 image_error ("Cannot open `%s'", file, Qnil); 7133 image_error ("Cannot open `%s'", file, Qnil);
@@ -7302,9 +7300,9 @@ gif_load (struct frame *f, struct image *img)
7302 7300
7303 for (x = 0; x < image_width; x++) 7301 for (x = 0; x < image_width; x++)
7304 { 7302 {
7305 int i = raster[(y * image_width) + x]; 7303 int c = raster[(y * image_width) + x];
7306 XPutPixel (ximg, x + img->corners[LEFT_CORNER], 7304 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
7307 row + img->corners[TOP_CORNER], pixel_colors[i]); 7305 row + img->corners[TOP_CORNER], pixel_colors[c]);
7308 } 7306 }
7309 7307
7310 row += interlace_increment[pass]; 7308 row += interlace_increment[pass];
@@ -7315,9 +7313,9 @@ gif_load (struct frame *f, struct image *img)
7315 for (y = 0; y < image_height; ++y) 7313 for (y = 0; y < image_height; ++y)
7316 for (x = 0; x < image_width; ++x) 7314 for (x = 0; x < image_width; ++x)
7317 { 7315 {
7318 int i = raster[y * image_width + x]; 7316 int c = raster[y * image_width + x];
7319 XPutPixel (ximg, x + img->corners[LEFT_CORNER], 7317 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
7320 y + img->corners[TOP_CORNER], pixel_colors[i]); 7318 y + img->corners[TOP_CORNER], pixel_colors[c]);
7321 } 7319 }
7322 } 7320 }
7323 7321
diff --git a/src/indent.c b/src/indent.c
index 37ce647556d..baea0641948 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -274,20 +274,20 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob
274 This macro is used in current_column_1, Fmove_to_column, and 274 This macro is used in current_column_1, Fmove_to_column, and
275 compute_motion. */ 275 compute_motion. */
276 276
277#define MULTIBYTE_BYTES_WIDTH(p, dp) \ 277#define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \
278 do { \ 278 do { \
279 int c; \ 279 int ch; \
280 \ 280 \
281 wide_column = 0; \ 281 wide_column = 0; \
282 c = STRING_CHAR_AND_LENGTH (p, bytes); \ 282 ch = STRING_CHAR_AND_LENGTH (p, bytes); \
283 if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ 283 if (BYTES_BY_CHAR_HEAD (*p) != bytes) \
284 width = bytes * 4; \ 284 width = bytes * 4; \
285 else \ 285 else \
286 { \ 286 { \
287 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c))) \ 287 if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch))) \
288 width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size; \ 288 width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \
289 else \ 289 else \
290 width = CHAR_WIDTH (c); \ 290 width = CHAR_WIDTH (ch); \
291 if (width > 1) \ 291 if (width > 1) \
292 wide_column = width; \ 292 wide_column = width; \
293 } \ 293 } \
@@ -569,14 +569,14 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
569 prev_col = col; 569 prev_col = col;
570 570
571 { /* Check display property. */ 571 { /* Check display property. */
572 EMACS_INT end; 572 EMACS_INT endp;
573 int width = check_display_width (scan, col, &end); 573 int width = check_display_width (scan, col, &endp);
574 if (width >= 0) 574 if (width >= 0)
575 { 575 {
576 col += width; 576 col += width;
577 if (end > scan) /* Avoid infinite loops with 0-width overlays. */ 577 if (endp > scan) /* Avoid infinite loops with 0-width overlays. */
578 { 578 {
579 scan = end; scan_byte = charpos_to_bytepos (scan); 579 scan = endp; scan_byte = charpos_to_bytepos (scan);
580 continue; 580 continue;
581 } 581 }
582 } 582 }
@@ -669,7 +669,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
669 int bytes, width, wide_column; 669 int bytes, width, wide_column;
670 670
671 ptr = BYTE_POS_ADDR (scan_byte); 671 ptr = BYTE_POS_ADDR (scan_byte);
672 MULTIBYTE_BYTES_WIDTH (ptr, dp); 672 MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width);
673 /* Subtract one to compensate for the increment 673 /* Subtract one to compensate for the increment
674 that is going to happen below. */ 674 that is going to happen below. */
675 scan_byte += bytes - 1; 675 scan_byte += bytes - 1;
@@ -1657,15 +1657,15 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1657 { 1657 {
1658 /* Start of multi-byte form. */ 1658 /* Start of multi-byte form. */
1659 unsigned char *ptr; 1659 unsigned char *ptr;
1660 int bytes, width, wide_column; 1660 int mb_bytes, mb_width, wide_column;
1661 1661
1662 pos_byte--; /* rewind POS_BYTE */ 1662 pos_byte--; /* rewind POS_BYTE */
1663 ptr = BYTE_POS_ADDR (pos_byte); 1663 ptr = BYTE_POS_ADDR (pos_byte);
1664 MULTIBYTE_BYTES_WIDTH (ptr, dp); 1664 MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width);
1665 pos_byte += bytes; 1665 pos_byte += mb_bytes;
1666 if (wide_column) 1666 if (wide_column)
1667 wide_column_end_hpos = hpos + wide_column; 1667 wide_column_end_hpos = hpos + wide_column;
1668 hpos += width; 1668 hpos += mb_width;
1669 } 1669 }
1670 else if (VECTORP (charvec)) 1670 else if (VECTORP (charvec))
1671 ++hpos; 1671 ++hpos;
@@ -1995,7 +1995,7 @@ whether or not it is currently displayed in some window. */)
1995 Lisp_Object old_buffer; 1995 Lisp_Object old_buffer;
1996 struct gcpro gcpro1; 1996 struct gcpro gcpro1;
1997 Lisp_Object lcols = Qnil; 1997 Lisp_Object lcols = Qnil;
1998 double cols; 1998 double cols IF_LINT (= 0);
1999 1999
2000 /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */ 2000 /* Allow LINES to be of the form (HPOS . VPOS) aka (COLUMNS . LINES). */
2001 if (CONSP (lines) && (NUMBERP (XCAR (lines)))) 2001 if (CONSP (lines) && (NUMBERP (XCAR (lines))))
@@ -2029,7 +2029,7 @@ whether or not it is currently displayed in some window. */)
2029 } 2029 }
2030 else 2030 else
2031 { 2031 {
2032 int it_start, first_x, it_overshoot_expected; 2032 int it_start, first_x, it_overshoot_expected IF_LINT (= 0);
2033 2033
2034 SET_TEXT_POS (pt, PT, PT_BYTE); 2034 SET_TEXT_POS (pt, PT, PT_BYTE);
2035 start_display (&it, w, pt); 2035 start_display (&it, w, pt);
diff --git a/src/insdel.c b/src/insdel.c
index 7fcf9522a33..ad3460f9a64 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -70,11 +70,14 @@ Lisp_Object combine_after_change_buffer;
70Lisp_Object Qinhibit_modification_hooks; 70Lisp_Object Qinhibit_modification_hooks;
71 71
72#define CHECK_MARKERS() \ 72#define CHECK_MARKERS() \
73 if (check_markers_debug_flag) \ 73 do \
74 check_markers (); \ 74 { \
75 else 75 if (check_markers_debug_flag) \
76 check_markers (); \
77 } \
78 while (0)
76 79
77void 80static void
78check_markers (void) 81check_markers (void)
79{ 82{
80 register struct Lisp_Marker *tail; 83 register struct Lisp_Marker *tail;
@@ -411,9 +414,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
411static void 414static void
412adjust_point (EMACS_INT nchars, EMACS_INT nbytes) 415adjust_point (EMACS_INT nchars, EMACS_INT nbytes)
413{ 416{
414 BUF_PT (current_buffer) += nchars; 417 SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes);
415 BUF_PT_BYTE (current_buffer) += nbytes;
416
417 /* In a single-byte buffer, the two positions must be equal. */ 418 /* In a single-byte buffer, the two positions must be equal. */
418 eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV); 419 eassert (PT_BYTE >= PT && PT_BYTE - PT <= ZV_BYTE - ZV);
419} 420}
@@ -453,7 +454,7 @@ adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte,
453 454
454/* Make the gap NBYTES_ADDED bytes longer. */ 455/* Make the gap NBYTES_ADDED bytes longer. */
455 456
456void 457static void
457make_gap_larger (EMACS_INT nbytes_added) 458make_gap_larger (EMACS_INT nbytes_added)
458{ 459{
459 Lisp_Object tem; 460 Lisp_Object tem;
@@ -508,7 +509,7 @@ make_gap_larger (EMACS_INT nbytes_added)
508 509
509/* Make the gap NBYTES_REMOVED bytes shorter. */ 510/* Make the gap NBYTES_REMOVED bytes shorter. */
510 511
511void 512static void
512make_gap_smaller (EMACS_INT nbytes_removed) 513make_gap_smaller (EMACS_INT nbytes_removed)
513{ 514{
514 Lisp_Object tem; 515 Lisp_Object tem;
@@ -595,7 +596,6 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
595 { 596 {
596 EMACS_INT nchars = 0; 597 EMACS_INT nchars = 0;
597 EMACS_INT bytes_left = nbytes; 598 EMACS_INT bytes_left = nbytes;
598 Lisp_Object tbl = Qnil;
599 599
600 while (bytes_left > 0) 600 while (bytes_left > 0)
601 { 601 {
@@ -2101,7 +2101,7 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
2101 VARIABLE is the variable to maybe set to nil. 2101 VARIABLE is the variable to maybe set to nil.
2102 NO-ERROR-FLAG is nil if there was an error, 2102 NO-ERROR-FLAG is nil if there was an error,
2103 anything else meaning no error (so this function does nothing). */ 2103 anything else meaning no error (so this function does nothing). */
2104Lisp_Object 2104static Lisp_Object
2105reset_var_on_error (Lisp_Object val) 2105reset_var_on_error (Lisp_Object val)
2106{ 2106{
2107 if (NILP (XCDR (val))) 2107 if (NILP (XCDR (val)))
@@ -2265,7 +2265,7 @@ signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins)
2265 unbind_to (count, Qnil); 2265 unbind_to (count, Qnil);
2266} 2266}
2267 2267
2268Lisp_Object 2268static Lisp_Object
2269Fcombine_after_change_execute_1 (Lisp_Object val) 2269Fcombine_after_change_execute_1 (Lisp_Object val)
2270{ 2270{
2271 Vcombine_after_change_calls = val; 2271 Vcombine_after_change_calls = val;
diff --git a/src/intervals.c b/src/intervals.c
index 6aee6e9d7fa..12b2789cc77 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1892,8 +1892,7 @@ temp_set_point_both (struct buffer *buffer,
1892 if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer)) 1892 if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer))
1893 abort (); 1893 abort ();
1894 1894
1895 BUF_PT_BYTE (buffer) = bytepos; 1895 SET_BUF_PT_BOTH (buffer, charpos, bytepos);
1896 BUF_PT (buffer) = charpos;
1897} 1896}
1898 1897
1899/* Set point "temporarily", without checking any text properties. */ 1898/* Set point "temporarily", without checking any text properties. */
@@ -2312,10 +2311,9 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
2312 old_zv = BUF_ZV (buffer); 2311 old_zv = BUF_ZV (buffer);
2313 old_begv_byte = BUF_BEGV_BYTE (buffer); 2312 old_begv_byte = BUF_BEGV_BYTE (buffer);
2314 old_zv_byte = BUF_ZV_BYTE (buffer); 2313 old_zv_byte = BUF_ZV_BYTE (buffer);
2315 BUF_BEGV (buffer) = BUF_BEG (buffer); 2314
2316 BUF_ZV (buffer) = BUF_Z (buffer); 2315 SET_BUF_BEGV_BOTH (buffer, BUF_BEG (buffer), BUF_BEG_BYTE (buffer));
2317 BUF_BEGV_BYTE (buffer) = BUF_BEG_BYTE (buffer); 2316 SET_BUF_ZV_BOTH (buffer, BUF_Z (buffer), BUF_Z_BYTE (buffer));
2318 BUF_ZV_BYTE (buffer) = BUF_Z_BYTE (buffer);
2319 2317
2320 XSETFASTINT (lispy_position, position); 2318 XSETFASTINT (lispy_position, position);
2321 XSETBUFFER (lispy_buffer, buffer); 2319 XSETBUFFER (lispy_buffer, buffer);
@@ -2329,10 +2327,8 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
2329 if (NILP (prop)) 2327 if (NILP (prop))
2330 prop = get_pos_property (lispy_position, type, lispy_buffer); 2328 prop = get_pos_property (lispy_position, type, lispy_buffer);
2331 2329
2332 BUF_BEGV (buffer) = old_begv; 2330 SET_BUF_BEGV_BOTH (buffer, old_begv, old_begv_byte);
2333 BUF_ZV (buffer) = old_zv; 2331 SET_BUF_ZV_BOTH (buffer, old_zv, old_zv_byte);
2334 BUF_BEGV_BYTE (buffer) = old_begv_byte;
2335 BUF_ZV_BYTE (buffer) = old_zv_byte;
2336 2332
2337 /* Use the local map only if it is valid. */ 2333 /* Use the local map only if it is valid. */
2338 prop = get_keymap (prop, 0, 0); 2334 prop = get_keymap (prop, 0, 0);
diff --git a/src/keyboard.c b/src/keyboard.c
index 78aa1cfea77..63e7573fbe9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -451,7 +451,7 @@ static int store_user_signal_events (void);
451 C can be a character, which is printed prettily ("M-C-x" and all that 451 C can be a character, which is printed prettily ("M-C-x" and all that
452 jazz), or a symbol, whose name is printed. */ 452 jazz), or a symbol, whose name is printed. */
453 453
454void 454static void
455echo_char (Lisp_Object c) 455echo_char (Lisp_Object c)
456{ 456{
457 if (current_kboard->immediate_echo) 457 if (current_kboard->immediate_echo)
@@ -538,7 +538,7 @@ echo_char (Lisp_Object c)
538/* Temporarily add a dash to the end of the echo string if it's not 538/* Temporarily add a dash to the end of the echo string if it's not
539 empty, so that it serves as a mini-prompt for the very next character. */ 539 empty, so that it serves as a mini-prompt for the very next character. */
540 540
541void 541static void
542echo_dash (void) 542echo_dash (void)
543{ 543{
544 /* Do nothing if not echoing at all. */ 544 /* Do nothing if not echoing at all. */
@@ -967,7 +967,7 @@ restore_kboard_configuration (Lisp_Object was_locked)
967/* Handle errors that are not handled at inner levels 967/* Handle errors that are not handled at inner levels
968 by printing an error message and returning to the editor command loop. */ 968 by printing an error message and returning to the editor command loop. */
969 969
970Lisp_Object 970static Lisp_Object
971cmd_error (Lisp_Object data) 971cmd_error (Lisp_Object data)
972{ 972{
973 Lisp_Object old_level, old_length; 973 Lisp_Object old_level, old_length;
@@ -1132,7 +1132,7 @@ command_loop_2 (Lisp_Object ignore)
1132 return Qnil; 1132 return Qnil;
1133} 1133}
1134 1134
1135Lisp_Object 1135static Lisp_Object
1136top_level_2 (void) 1136top_level_2 (void)
1137{ 1137{
1138 return Feval (Vtop_level, Qnil); 1138 return Feval (Vtop_level, Qnil);
@@ -1169,6 +1169,7 @@ This also exits all active minibuffers. */)
1169 Fthrow (Qtop_level, Qnil); 1169 Fthrow (Qtop_level, Qnil);
1170} 1170}
1171 1171
1172Lisp_Object Fexit_recursive_edit (void) NO_RETURN;
1172DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", 1173DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
1173 doc: /* Exit from the innermost recursive edit or minibuffer. */) 1174 doc: /* Exit from the innermost recursive edit or minibuffer. */)
1174 (void) 1175 (void)
@@ -1179,6 +1180,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0,
1179 error ("No recursive edit is in progress"); 1180 error ("No recursive edit is in progress");
1180} 1181}
1181 1182
1183Lisp_Object Fabort_recursive_edit (void) NO_RETURN;
1182DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", 1184DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "",
1183 doc: /* Abort the command that requested this recursive edit or minibuffer input. */) 1185 doc: /* Abort the command that requested this recursive edit or minibuffer input. */)
1184 (void) 1186 (void)
@@ -1885,7 +1887,7 @@ poll_for_input_1 (void)
1885/* Timer callback function for poll_timer. TIMER is equal to 1887/* Timer callback function for poll_timer. TIMER is equal to
1886 poll_timer. */ 1888 poll_timer. */
1887 1889
1888void 1890static void
1889poll_for_input (struct atimer *timer) 1891poll_for_input (struct atimer *timer)
1890{ 1892{
1891 if (poll_suppress_count == 0) 1893 if (poll_suppress_count == 0)
@@ -2184,7 +2186,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2184 int *used_mouse_menu, struct timeval *end_time) 2186 int *used_mouse_menu, struct timeval *end_time)
2185{ 2187{
2186 volatile Lisp_Object c; 2188 volatile Lisp_Object c;
2187 int count, jmpcount; 2189 int jmpcount;
2188 jmp_buf local_getcjmp; 2190 jmp_buf local_getcjmp;
2189 jmp_buf save_jump; 2191 jmp_buf save_jump;
2190 volatile int key_already_recorded = 0; 2192 volatile int key_already_recorded = 0;
@@ -2461,21 +2463,21 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2461 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame)); 2463 KBOARD *kb = FRAME_KBOARD (XFRAME (selected_frame));
2462 if (kb != current_kboard) 2464 if (kb != current_kboard)
2463 { 2465 {
2464 Lisp_Object link = KVAR (kb, kbd_queue); 2466 Lisp_Object last = KVAR (kb, kbd_queue);
2465 /* We shouldn't get here if we were in single-kboard mode! */ 2467 /* We shouldn't get here if we were in single-kboard mode! */
2466 if (single_kboard) 2468 if (single_kboard)
2467 abort (); 2469 abort ();
2468 if (CONSP (link)) 2470 if (CONSP (last))
2469 { 2471 {
2470 while (CONSP (XCDR (link))) 2472 while (CONSP (XCDR (last)))
2471 link = XCDR (link); 2473 last = XCDR (last);
2472 if (!NILP (XCDR (link))) 2474 if (!NILP (XCDR (last)))
2473 abort (); 2475 abort ();
2474 } 2476 }
2475 if (!CONSP (link)) 2477 if (!CONSP (last))
2476 KVAR (kb, kbd_queue) = Fcons (c, Qnil); 2478 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2477 else 2479 else
2478 XSETCDR (link, Fcons (c, Qnil)); 2480 XSETCDR (last, Fcons (c, Qnil));
2479 kb->kbd_queue_has_data = 1; 2481 kb->kbd_queue_has_data = 1;
2480 current_kboard = kb; 2482 current_kboard = kb;
2481 /* This is going to exit from read_char 2483 /* This is going to exit from read_char
@@ -2692,7 +2694,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2692 2694
2693 if (NILP (c)) 2695 if (NILP (c))
2694 { 2696 {
2695 KBOARD *kb; 2697 KBOARD *kb IF_LINT (= NULL);
2696 2698
2697 if (end_time) 2699 if (end_time)
2698 { 2700 {
@@ -2712,18 +2714,18 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2712 2714
2713 if (! NILP (c) && (kb != current_kboard)) 2715 if (! NILP (c) && (kb != current_kboard))
2714 { 2716 {
2715 Lisp_Object link = KVAR (kb, kbd_queue); 2717 Lisp_Object last = KVAR (kb, kbd_queue);
2716 if (CONSP (link)) 2718 if (CONSP (last))
2717 { 2719 {
2718 while (CONSP (XCDR (link))) 2720 while (CONSP (XCDR (last)))
2719 link = XCDR (link); 2721 last = XCDR (last);
2720 if (!NILP (XCDR (link))) 2722 if (!NILP (XCDR (last)))
2721 abort (); 2723 abort ();
2722 } 2724 }
2723 if (!CONSP (link)) 2725 if (!CONSP (last))
2724 KVAR (kb, kbd_queue) = Fcons (c, Qnil); 2726 KVAR (kb, kbd_queue) = Fcons (c, Qnil);
2725 else 2727 else
2726 XSETCDR (link, Fcons (c, Qnil)); 2728 XSETCDR (last, Fcons (c, Qnil));
2727 kb->kbd_queue_has_data = 1; 2729 kb->kbd_queue_has_data = 1;
2728 c = Qnil; 2730 c = Qnil;
2729 if (single_kboard) 2731 if (single_kboard)
@@ -2912,7 +2914,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2912 { 2914 {
2913 Lisp_Object keys; 2915 Lisp_Object keys;
2914 int key_count, key_count_reset; 2916 int key_count, key_count_reset;
2915 struct gcpro gcpro1; 2917 struct gcpro inner_gcpro1;
2916 int count = SPECPDL_INDEX (); 2918 int count = SPECPDL_INDEX ();
2917 2919
2918 /* Save the echo status. */ 2920 /* Save the echo status. */
@@ -2940,7 +2942,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2940 keys = Fcopy_sequence (this_command_keys); 2942 keys = Fcopy_sequence (this_command_keys);
2941 else 2943 else
2942 keys = Qnil; 2944 keys = Qnil;
2943 GCPRO1 (keys); 2945 GCPRO1_VAR (keys, inner_gcpro);
2944 2946
2945 /* Clear out this_command_keys. */ 2947 /* Clear out this_command_keys. */
2946 this_command_key_count = 0; 2948 this_command_key_count = 0;
@@ -2978,7 +2980,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
2978 if (saved_immediate_echo) 2980 if (saved_immediate_echo)
2979 echo_now (); 2981 echo_now ();
2980 2982
2981 UNGCPRO; 2983 UNGCPRO_VAR (inner_gcpro);
2982 2984
2983 /* The input method can return no events. */ 2985 /* The input method can return no events. */
2984 if (! CONSP (tem)) 2986 if (! CONSP (tem))
@@ -3000,16 +3002,16 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
3000 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo)) 3002 if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
3001 { 3003 {
3002 /* (help-echo FRAME HELP WINDOW OBJECT POS). */ 3004 /* (help-echo FRAME HELP WINDOW OBJECT POS). */
3003 Lisp_Object help, object, position, window, tem; 3005 Lisp_Object help, object, position, window, htem;
3004 3006
3005 tem = Fcdr (XCDR (c)); 3007 htem = Fcdr (XCDR (c));
3006 help = Fcar (tem); 3008 help = Fcar (htem);
3007 tem = Fcdr (tem); 3009 htem = Fcdr (htem);
3008 window = Fcar (tem); 3010 window = Fcar (htem);
3009 tem = Fcdr (tem); 3011 htem = Fcdr (htem);
3010 object = Fcar (tem); 3012 object = Fcar (htem);
3011 tem = Fcdr (tem); 3013 htem = Fcdr (htem);
3012 position = Fcar (tem); 3014 position = Fcar (htem);
3013 3015
3014 show_help_echo (help, window, object, position, 0); 3016 show_help_echo (help, window, object, position, 0);
3015 3017
@@ -3051,7 +3053,7 @@ read_char (int commandflag, int nmaps, Lisp_Object *maps, Lisp_Object prev_event
3051 if (!NILP (Vhelp_form) && help_char_p (c)) 3053 if (!NILP (Vhelp_form) && help_char_p (c))
3052 { 3054 {
3053 Lisp_Object tem0; 3055 Lisp_Object tem0;
3054 count = SPECPDL_INDEX (); 3056 int count = SPECPDL_INDEX ();
3055 3057
3056 help_form_saved_window_configs 3058 help_form_saved_window_configs
3057 = Fcons (Fcurrent_window_configuration (Qnil), 3059 = Fcons (Fcurrent_window_configuration (Qnil),
@@ -4024,7 +4026,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4024 Lisp_Object bar_window; 4026 Lisp_Object bar_window;
4025 enum scroll_bar_part part; 4027 enum scroll_bar_part part;
4026 Lisp_Object x, y; 4028 Lisp_Object x, y;
4027 unsigned long time; 4029 unsigned long t;
4028 4030
4029 *kbp = current_kboard; 4031 *kbp = current_kboard;
4030 /* Note that this uses F to determine which terminal to look at. 4032 /* Note that this uses F to determine which terminal to look at.
@@ -4035,7 +4037,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4035 /* XXX Can f or mouse_position_hook be NULL here? */ 4037 /* XXX Can f or mouse_position_hook be NULL here? */
4036 if (f && FRAME_TERMINAL (f)->mouse_position_hook) 4038 if (f && FRAME_TERMINAL (f)->mouse_position_hook)
4037 (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window, 4039 (*FRAME_TERMINAL (f)->mouse_position_hook) (&f, 0, &bar_window,
4038 &part, &x, &y, &time); 4040 &part, &x, &y, &t);
4039 4041
4040 obj = Qnil; 4042 obj = Qnil;
4041 4043
@@ -4059,7 +4061,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4059 /* If we didn't decide to make a switch-frame event, go ahead and 4061 /* If we didn't decide to make a switch-frame event, go ahead and
4060 return a mouse-motion event. */ 4062 return a mouse-motion event. */
4061 if (!NILP (x) && NILP (obj)) 4063 if (!NILP (x) && NILP (obj))
4062 obj = make_lispy_movement (f, bar_window, part, x, y, time); 4064 obj = make_lispy_movement (f, bar_window, part, x, y, t);
4063 } 4065 }
4064#endif /* HAVE_MOUSE || HAVE GPM */ 4066#endif /* HAVE_MOUSE || HAVE GPM */
4065 else 4067 else
@@ -5037,7 +5039,7 @@ int double_click_count;
5037 5039
5038static Lisp_Object 5040static Lisp_Object
5039make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, 5041make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5040 unsigned long time) 5042 unsigned long t)
5041{ 5043{
5042 enum window_part part; 5044 enum window_part part;
5043 Lisp_Object posn = Qnil; 5045 Lisp_Object posn = Qnil;
@@ -5218,7 +5220,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
5218 Fcons (posn, 5220 Fcons (posn,
5219 Fcons (Fcons (make_number (xret), 5221 Fcons (Fcons (make_number (xret),
5220 make_number (yret)), 5222 make_number (yret)),
5221 Fcons (make_number (time), 5223 Fcons (make_number (t),
5222 extra_info)))); 5224 extra_info))));
5223} 5225}
5224 5226
@@ -5642,19 +5644,19 @@ make_lispy_event (struct input_event *event)
5642 /* On window-system frames, use the value of 5644 /* On window-system frames, use the value of
5643 double-click-fuzz as is. On other frames, interpret it 5645 double-click-fuzz as is. On other frames, interpret it
5644 as a multiple of 1/8 characters. */ 5646 as a multiple of 1/8 characters. */
5645 struct frame *f; 5647 struct frame *fr;
5646 int fuzz; 5648 int fuzz;
5647 int symbol_num; 5649 int symbol_num;
5648 int is_double; 5650 int is_double;
5649 5651
5650 if (WINDOWP (event->frame_or_window)) 5652 if (WINDOWP (event->frame_or_window))
5651 f = XFRAME (XWINDOW (event->frame_or_window)->frame); 5653 fr = XFRAME (XWINDOW (event->frame_or_window)->frame);
5652 else if (FRAMEP (event->frame_or_window)) 5654 else if (FRAMEP (event->frame_or_window))
5653 f = XFRAME (event->frame_or_window); 5655 fr = XFRAME (event->frame_or_window);
5654 else 5656 else
5655 abort (); 5657 abort ();
5656 5658
5657 fuzz = FRAME_WINDOW_P (f) 5659 fuzz = FRAME_WINDOW_P (fr)
5658 ? double_click_fuzz : double_click_fuzz / 8; 5660 ? double_click_fuzz : double_click_fuzz / 8;
5659 5661
5660 if (event->modifiers & up_modifier) 5662 if (event->modifiers & up_modifier)
@@ -5927,7 +5929,7 @@ make_lispy_event (struct input_event *event)
5927 5929
5928static Lisp_Object 5930static Lisp_Object
5929make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 5931make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part,
5930 Lisp_Object x, Lisp_Object y, unsigned long time) 5932 Lisp_Object x, Lisp_Object y, unsigned long t)
5931{ 5933{
5932 /* Is it a scroll bar movement? */ 5934 /* Is it a scroll bar movement? */
5933 if (frame && ! NILP (bar_window)) 5935 if (frame && ! NILP (bar_window))
@@ -5939,7 +5941,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
5939 Fcons (list5 (bar_window, 5941 Fcons (list5 (bar_window,
5940 Qvertical_scroll_bar, 5942 Qvertical_scroll_bar,
5941 Fcons (x, y), 5943 Fcons (x, y),
5942 make_number (time), 5944 make_number (t),
5943 part_sym), 5945 part_sym),
5944 Qnil)); 5946 Qnil));
5945 } 5947 }
@@ -5947,7 +5949,7 @@ make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_pa
5947 else 5949 else
5948 { 5950 {
5949 Lisp_Object position; 5951 Lisp_Object position;
5950 position = make_lispy_position (frame, x, y, time); 5952 position = make_lispy_position (frame, x, y, t);
5951 return list2 (Qmouse_movement, position); 5953 return list2 (Qmouse_movement, position);
5952 } 5954 }
5953} 5955}
@@ -6236,7 +6238,7 @@ DEFUN ("internal-event-symbol-parse-modifiers", Fevent_symbol_parse_modifiers,
6236static Lisp_Object 6238static Lisp_Object
6237apply_modifiers (int modifiers, Lisp_Object base) 6239apply_modifiers (int modifiers, Lisp_Object base)
6238{ 6240{
6239 Lisp_Object cache, index, entry, new_symbol; 6241 Lisp_Object cache, idx, entry, new_symbol;
6240 6242
6241 /* Mask out upper bits. We don't know where this value's been. */ 6243 /* Mask out upper bits. We don't know where this value's been. */
6242 modifiers &= INTMASK; 6244 modifiers &= INTMASK;
@@ -6246,8 +6248,8 @@ apply_modifiers (int modifiers, Lisp_Object base)
6246 6248
6247 /* The click modifier never figures into cache indices. */ 6249 /* The click modifier never figures into cache indices. */
6248 cache = Fget (base, Qmodifier_cache); 6250 cache = Fget (base, Qmodifier_cache);
6249 XSETFASTINT (index, (modifiers & ~click_modifier)); 6251 XSETFASTINT (idx, (modifiers & ~click_modifier));
6250 entry = assq_no_quit (index, cache); 6252 entry = assq_no_quit (idx, cache);
6251 6253
6252 if (CONSP (entry)) 6254 if (CONSP (entry))
6253 new_symbol = XCDR (entry); 6255 new_symbol = XCDR (entry);
@@ -6260,14 +6262,14 @@ apply_modifiers (int modifiers, Lisp_Object base)
6260 SBYTES (SYMBOL_NAME (base))); 6262 SBYTES (SYMBOL_NAME (base)));
6261 6263
6262 /* Add the new symbol to the base's cache. */ 6264 /* Add the new symbol to the base's cache. */
6263 entry = Fcons (index, new_symbol); 6265 entry = Fcons (idx, new_symbol);
6264 Fput (base, Qmodifier_cache, Fcons (entry, cache)); 6266 Fput (base, Qmodifier_cache, Fcons (entry, cache));
6265 6267
6266 /* We have the parsing info now for free, so we could add it to 6268 /* We have the parsing info now for free, so we could add it to
6267 the caches: 6269 the caches:
6268 XSETFASTINT (index, modifiers); 6270 XSETFASTINT (idx, modifiers);
6269 Fput (new_symbol, Qevent_symbol_element_mask, 6271 Fput (new_symbol, Qevent_symbol_element_mask,
6270 Fcons (base, Fcons (index, Qnil))); 6272 Fcons (base, Fcons (idx, Qnil)));
6271 Fput (new_symbol, Qevent_symbol_elements, 6273 Fput (new_symbol, Qevent_symbol_elements,
6272 Fcons (base, lispy_modifier_list (modifiers))); 6274 Fcons (base, lispy_modifier_list (modifiers)));
6273 Sadly, this is only correct if `base' is indeed a base event, 6275 Sadly, this is only correct if `base' is indeed a base event,
@@ -6821,16 +6823,17 @@ decode_keyboard_code (struct tty_display_info *tty,
6821 return; 6823 return;
6822 for (i = 0, p = coding->destination; i < coding->produced_char; i++) 6824 for (i = 0, p = coding->destination; i < coding->produced_char; i++)
6823 { 6825 {
6824 struct input_event buf; 6826 struct input_event event_buf;
6825 6827
6826 EVENT_INIT (buf); 6828 EVENT_INIT (event_buf);
6827 buf.code = STRING_CHAR_ADVANCE (p); 6829 event_buf.code = STRING_CHAR_ADVANCE (p);
6828 buf.kind = (ASCII_CHAR_P (buf.code) 6830 event_buf.kind =
6829 ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); 6831 (ASCII_CHAR_P (event_buf.code)
6832 ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6830 /* See the comment in tty_read_avail_input. */ 6833 /* See the comment in tty_read_avail_input. */
6831 buf.frame_or_window = tty->top_frame; 6834 event_buf.frame_or_window = tty->top_frame;
6832 buf.arg = Qnil; 6835 event_buf.arg = Qnil;
6833 kbd_buffer_store_event (&buf); 6836 kbd_buffer_store_event (&event_buf);
6834 } 6837 }
6835} 6838}
6836 6839
@@ -6890,11 +6893,11 @@ tty_read_avail_input (struct terminal *terminal,
6890 if (gpm_tty == tty) 6893 if (gpm_tty == tty)
6891 { 6894 {
6892 Gpm_Event event; 6895 Gpm_Event event;
6893 struct input_event hold_quit; 6896 struct input_event gpm_hold_quit;
6894 int gpm, fd = gpm_fd; 6897 int gpm, fd = gpm_fd;
6895 6898
6896 EVENT_INIT (hold_quit); 6899 EVENT_INIT (gpm_hold_quit);
6897 hold_quit.kind = NO_EVENT; 6900 gpm_hold_quit.kind = NO_EVENT;
6898 6901
6899 /* gpm==1 if event received. 6902 /* gpm==1 if event received.
6900 gpm==0 if the GPM daemon has closed the connection, in which case 6903 gpm==0 if the GPM daemon has closed the connection, in which case
@@ -6903,13 +6906,13 @@ tty_read_avail_input (struct terminal *terminal,
6903 select masks. 6906 select masks.
6904 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ 6907 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */
6905 while (gpm = Gpm_GetEvent (&event), gpm == 1) { 6908 while (gpm = Gpm_GetEvent (&event), gpm == 1) {
6906 nread += handle_one_term_event (tty, &event, &hold_quit); 6909 nread += handle_one_term_event (tty, &event, &gpm_hold_quit);
6907 } 6910 }
6908 if (gpm == 0) 6911 if (gpm == 0)
6909 /* Presumably the GPM daemon has closed the connection. */ 6912 /* Presumably the GPM daemon has closed the connection. */
6910 close_gpm (fd); 6913 close_gpm (fd);
6911 if (hold_quit.kind != NO_EVENT) 6914 if (gpm_hold_quit.kind != NO_EVENT)
6912 kbd_buffer_store_event (&hold_quit); 6915 kbd_buffer_store_event (&gpm_hold_quit);
6913 if (nread) 6916 if (nread)
6914 return nread; 6917 return nread;
6915 } 6918 }
@@ -7056,7 +7059,7 @@ tty_read_avail_input (struct terminal *terminal,
7056 return nread; 7059 return nread;
7057} 7060}
7058 7061
7059void 7062static void
7060handle_async_input (void) 7063handle_async_input (void)
7061{ 7064{
7062 interrupt_input_pending = 0; 7065 interrupt_input_pending = 0;
@@ -7329,8 +7332,6 @@ menu_bar_items (Lisp_Object old)
7329 int mapno; 7332 int mapno;
7330 Lisp_Object oquit; 7333 Lisp_Object oquit;
7331 7334
7332 int i;
7333
7334 /* In order to build the menus, we need to call the keymap 7335 /* In order to build the menus, we need to call the keymap
7335 accessors. They all call QUIT. But this function is called 7336 accessors. They all call QUIT. But this function is called
7336 during redisplay, during which a quit is fatal. So inhibit 7337 during redisplay, during which a quit is fatal. So inhibit
@@ -7432,15 +7433,18 @@ menu_bar_items (Lisp_Object old)
7432 } 7433 }
7433 7434
7434 /* Add nil, nil, nil, nil at the end. */ 7435 /* Add nil, nil, nil, nil at the end. */
7435 i = menu_bar_items_index; 7436 {
7436 if (i + 4 > XVECTOR (menu_bar_items_vector)->size) 7437 int i = menu_bar_items_index;
7437 menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); 7438 if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
7438 /* Add this item. */ 7439 menu_bar_items_vector =
7439 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7440 larger_vector (menu_bar_items_vector, 2 * i, Qnil);
7440 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7441 /* Add this item. */
7441 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7442 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7442 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; 7443 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7443 menu_bar_items_index = i; 7444 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7445 XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
7446 menu_bar_items_index = i;
7447 }
7444 7448
7445 Vinhibit_quit = oquit; 7449 Vinhibit_quit = oquit;
7446 return menu_bar_items_vector; 7450 return menu_bar_items_vector;
@@ -8118,12 +8122,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8118 /* Process the rest of the properties. */ 8122 /* Process the rest of the properties. */
8119 for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item))) 8123 for (; CONSP (item) && CONSP (XCDR (item)); item = XCDR (XCDR (item)))
8120 { 8124 {
8121 Lisp_Object key, value; 8125 Lisp_Object ikey, value;
8122 8126
8123 key = XCAR (item); 8127 ikey = XCAR (item);
8124 value = XCAR (XCDR (item)); 8128 value = XCAR (XCDR (item));
8125 8129
8126 if (EQ (key, QCenable)) 8130 if (EQ (ikey, QCenable))
8127 { 8131 {
8128 /* `:enable FORM'. */ 8132 /* `:enable FORM'. */
8129 if (!NILP (Venable_disabled_menus_and_buttons)) 8133 if (!NILP (Venable_disabled_menus_and_buttons))
@@ -8131,20 +8135,20 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8131 else 8135 else
8132 PROP (TOOL_BAR_ITEM_ENABLED_P) = value; 8136 PROP (TOOL_BAR_ITEM_ENABLED_P) = value;
8133 } 8137 }
8134 else if (EQ (key, QCvisible)) 8138 else if (EQ (ikey, QCvisible))
8135 { 8139 {
8136 /* `:visible FORM'. If got a visible property and that 8140 /* `:visible FORM'. If got a visible property and that
8137 evaluates to nil then ignore this item. */ 8141 evaluates to nil then ignore this item. */
8138 if (NILP (menu_item_eval_property (value))) 8142 if (NILP (menu_item_eval_property (value)))
8139 return 0; 8143 return 0;
8140 } 8144 }
8141 else if (EQ (key, QChelp)) 8145 else if (EQ (ikey, QChelp))
8142 /* `:help HELP-STRING'. */ 8146 /* `:help HELP-STRING'. */
8143 PROP (TOOL_BAR_ITEM_HELP) = value; 8147 PROP (TOOL_BAR_ITEM_HELP) = value;
8144 else if (EQ (key, QCvert_only)) 8148 else if (EQ (ikey, QCvert_only))
8145 /* `:vert-only t/nil'. */ 8149 /* `:vert-only t/nil'. */
8146 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value; 8150 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
8147 else if (EQ (key, QClabel)) 8151 else if (EQ (ikey, QClabel))
8148 { 8152 {
8149 const char *bad_label = "!!?GARBLED ITEM?!!"; 8153 const char *bad_label = "!!?GARBLED ITEM?!!";
8150 /* `:label LABEL-STRING'. */ 8154 /* `:label LABEL-STRING'. */
@@ -8153,10 +8157,10 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8153 : make_string (bad_label, strlen (bad_label)); 8157 : make_string (bad_label, strlen (bad_label));
8154 have_label = 1; 8158 have_label = 1;
8155 } 8159 }
8156 else if (EQ (key, QCfilter)) 8160 else if (EQ (ikey, QCfilter))
8157 /* ':filter FORM'. */ 8161 /* ':filter FORM'. */
8158 filter = value; 8162 filter = value;
8159 else if (EQ (key, QCbutton) && CONSP (value)) 8163 else if (EQ (ikey, QCbutton) && CONSP (value))
8160 { 8164 {
8161 /* `:button (TYPE . SELECTED)'. */ 8165 /* `:button (TYPE . SELECTED)'. */
8162 Lisp_Object type, selected; 8166 Lisp_Object type, selected;
@@ -8169,13 +8173,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8169 PROP (TOOL_BAR_ITEM_TYPE) = type; 8173 PROP (TOOL_BAR_ITEM_TYPE) = type;
8170 } 8174 }
8171 } 8175 }
8172 else if (EQ (key, QCimage) 8176 else if (EQ (ikey, QCimage)
8173 && (CONSP (value) 8177 && (CONSP (value)
8174 || (VECTORP (value) && XVECTOR (value)->size == 4))) 8178 || (VECTORP (value) && XVECTOR (value)->size == 4)))
8175 /* Value is either a single image specification or a vector 8179 /* Value is either a single image specification or a vector
8176 of 4 such specifications for the different button states. */ 8180 of 4 such specifications for the different button states. */
8177 PROP (TOOL_BAR_ITEM_IMAGES) = value; 8181 PROP (TOOL_BAR_ITEM_IMAGES) = value;
8178 else if (EQ (key, Qrtl)) 8182 else if (EQ (ikey, Qrtl))
8179 /* ':rtl STRING' */ 8183 /* ':rtl STRING' */
8180 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value; 8184 PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
8181 } 8185 }
@@ -8184,35 +8188,34 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8184 if (!have_label) 8188 if (!have_label)
8185 { 8189 {
8186 /* Try to make one from caption and key. */ 8190 /* Try to make one from caption and key. */
8187 Lisp_Object key = PROP (TOOL_BAR_ITEM_KEY); 8191 Lisp_Object tkey = PROP (TOOL_BAR_ITEM_KEY);
8188 Lisp_Object capt = PROP (TOOL_BAR_ITEM_CAPTION); 8192 Lisp_Object tcapt = PROP (TOOL_BAR_ITEM_CAPTION);
8189 const char *label = SYMBOLP (key) ? SSDATA (SYMBOL_NAME (key)) : ""; 8193 const char *label = SYMBOLP (tkey) ? SSDATA (SYMBOL_NAME (tkey)) : "";
8190 const char *caption = STRINGP (capt) ? SSDATA (capt) : ""; 8194 const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
8191 EMACS_INT max_lbl = 2 * tool_bar_max_label_size; 8195 EMACS_INT max_lbl = 2 * tool_bar_max_label_size;
8192 char *buf = (char *) xmalloc (max_lbl + 1); 8196 char *buf = (char *) xmalloc (max_lbl + 1);
8193 Lisp_Object new_lbl; 8197 Lisp_Object new_lbl;
8194 size_t caption_len = strlen (caption); 8198 size_t caption_len = strlen (capt);
8195 8199
8196 if (caption_len <= max_lbl && caption[0] != '\0') 8200 if (caption_len <= max_lbl && capt[0] != '\0')
8197 { 8201 {
8198 strcpy (buf, caption); 8202 strcpy (buf, capt);
8199 while (caption_len > 0 && buf[caption_len - 1] == '.') 8203 while (caption_len > 0 && buf[caption_len - 1] == '.')
8200 caption_len--; 8204 caption_len--;
8201 buf[caption_len] = '\0'; 8205 buf[caption_len] = '\0';
8202 label = caption = buf; 8206 label = capt = buf;
8203 } 8207 }
8204 8208
8205 if (strlen (label) <= max_lbl && label[0] != '\0') 8209 if (strlen (label) <= max_lbl && label[0] != '\0')
8206 { 8210 {
8207 int i; 8211 int j;
8208 if (label != buf) 8212 if (label != buf)
8209 strcpy (buf, label); 8213 strcpy (buf, label);
8210 8214
8211 for (i = 0; buf[i] != '\0'; ++i) 8215 for (j = 0; buf[j] != '\0'; ++j)
8212 if (buf[i] == '-') 8216 if (buf[j] == '-')
8213 buf[i] = ' '; 8217 buf[j] = ' ';
8214 label = buf; 8218 label = buf;
8215
8216 } 8219 }
8217 else 8220 else
8218 label = ""; 8221 label = "";
@@ -8871,7 +8874,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8871 8874
8872 /* The length of the echo buffer when we started reading, and 8875 /* The length of the echo buffer when we started reading, and
8873 the length of this_command_keys when we started reading. */ 8876 the length of this_command_keys when we started reading. */
8874 int echo_start; 8877 int echo_start IF_LINT (= 0);
8875 int keys_start; 8878 int keys_start;
8876 8879
8877 /* The number of keymaps we're scanning right now, and the number of 8880 /* The number of keymaps we're scanning right now, and the number of
@@ -8949,7 +8952,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8949 Lisp_Object first_event; 8952 Lisp_Object first_event;
8950#endif 8953#endif
8951 8954
8952 Lisp_Object original_uppercase; 8955 Lisp_Object original_uppercase IF_LINT (= Qnil);
8953 int original_uppercase_position = -1; 8956 int original_uppercase_position = -1;
8954 8957
8955 /* Gets around Microsoft compiler limitations. */ 8958 /* Gets around Microsoft compiler limitations. */
@@ -8964,9 +8967,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8964 int junk; 8967 int junk;
8965#endif 8968#endif
8966 8969
8967 struct gcpro gcpro1; 8970 struct gcpro outer_gcpro1;
8968 8971
8969 GCPRO1 (fake_prefixed_keys); 8972 GCPRO1_VAR (fake_prefixed_keys, outer_gcpro);
8970 raw_keybuf_count = 0; 8973 raw_keybuf_count = 0;
8971 8974
8972 last_nonmenu_event = Qnil; 8975 last_nonmenu_event = Qnil;
@@ -9128,7 +9131,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9128 while those allow us to restart the entire key sequence, 9131 while those allow us to restart the entire key sequence,
9129 echo_local_start and keys_local_start allow us to throw away 9132 echo_local_start and keys_local_start allow us to throw away
9130 just one key. */ 9133 just one key. */
9131 int echo_local_start, keys_local_start, local_first_binding; 9134 int echo_local_start IF_LINT (= 0);
9135 int keys_local_start, local_first_binding;
9132 9136
9133 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input)); 9137 eassert (indec.end == t || (indec.end > t && indec.end <= mock_input));
9134 eassert (indec.start <= indec.end); 9138 eassert (indec.start <= indec.end);
@@ -9260,7 +9264,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9260 if (EQ (key, Qt)) 9264 if (EQ (key, Qt))
9261 { 9265 {
9262 unbind_to (count, Qnil); 9266 unbind_to (count, Qnil);
9263 UNGCPRO; 9267 UNGCPRO_VAR (outer_gcpro);
9264 return -1; 9268 return -1;
9265 } 9269 }
9266 9270
@@ -9838,7 +9842,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9838 && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t 9842 && /* indec.start >= t && fkey.start >= t && */ keytran.start >= t
9839 && INTEGERP (key) 9843 && INTEGERP (key)
9840 && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK)) 9844 && ((CHARACTERP (make_number (XINT (key) & ~CHAR_MODIFIER_MASK))
9841 && UPPERCASEP (XINT (key) & ~CHAR_MODIFIER_MASK)) 9845 && uppercasep (XINT (key) & ~CHAR_MODIFIER_MASK))
9842 || (XINT (key) & shift_modifier))) 9846 || (XINT (key) & shift_modifier)))
9843 { 9847 {
9844 Lisp_Object new_key; 9848 Lisp_Object new_key;
@@ -9849,7 +9853,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9849 if (XINT (key) & shift_modifier) 9853 if (XINT (key) & shift_modifier)
9850 XSETINT (new_key, XINT (key) & ~shift_modifier); 9854 XSETINT (new_key, XINT (key) & ~shift_modifier);
9851 else 9855 else
9852 XSETINT (new_key, (DOWNCASE (XINT (key) & ~CHAR_MODIFIER_MASK) 9856 XSETINT (new_key, (downcase (XINT (key) & ~CHAR_MODIFIER_MASK)
9853 | (XINT (key) & CHAR_MODIFIER_MASK))); 9857 | (XINT (key) & CHAR_MODIFIER_MASK)));
9854 9858
9855 /* We have to do this unconditionally, regardless of whether 9859 /* We have to do this unconditionally, regardless of whether
@@ -9877,13 +9881,13 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9877 || (INTEGERP (key) 9881 || (INTEGERP (key)
9878 && (KEY_TO_CHAR (key) 9882 && (KEY_TO_CHAR (key)
9879 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size) 9883 < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->size)
9880 && UPPERCASEP (KEY_TO_CHAR (key)))) 9884 && uppercasep (KEY_TO_CHAR (key))))
9881 { 9885 {
9882 Lisp_Object new_key 9886 Lisp_Object new_key
9883 = (modifiers & shift_modifier 9887 = (modifiers & shift_modifier
9884 ? apply_modifiers (modifiers & ~shift_modifier, 9888 ? apply_modifiers (modifiers & ~shift_modifier,
9885 XCAR (breakdown)) 9889 XCAR (breakdown))
9886 : make_number (DOWNCASE (KEY_TO_CHAR (key)) | modifiers)); 9890 : make_number (downcase (KEY_TO_CHAR (key)) | modifiers));
9887 9891
9888 original_uppercase = key; 9892 original_uppercase = key;
9889 original_uppercase_position = t - 1; 9893 original_uppercase_position = t - 1;
@@ -9943,7 +9947,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9943 add_command_key (keybuf[t]); 9947 add_command_key (keybuf[t]);
9944 } 9948 }
9945 9949
9946 UNGCPRO; 9950 UNGCPRO_VAR (outer_gcpro);
9947 return t; 9951 return t;
9948} 9952}
9949 9953
@@ -9990,11 +9994,11 @@ is nil, then the event will be put off until after the current key sequence.
9990sequences, where they wouldn't conflict with ordinary bindings. See 9994sequences, where they wouldn't conflict with ordinary bindings. See
9991`function-key-map' for more details. 9995`function-key-map' for more details.
9992 9996
9993The optional fifth argument COMMAND-LOOP, if non-nil, means 9997The optional fifth argument CMD-LOOP, if non-nil, means
9994that this key sequence is being read by something that will 9998that this key sequence is being read by something that will
9995read commands one after another. It should be nil if the caller 9999read commands one after another. It should be nil if the caller
9996will read just one key sequence. */) 10000will read just one key sequence. */)
9997 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) 10001 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop)
9998{ 10002{
9999 Lisp_Object keybuf[30]; 10003 Lisp_Object keybuf[30];
10000 register int i; 10004 register int i;
@@ -10006,9 +10010,9 @@ will read just one key sequence. */)
10006 QUIT; 10010 QUIT;
10007 10011
10008 specbind (Qinput_method_exit_on_first_char, 10012 specbind (Qinput_method_exit_on_first_char,
10009 (NILP (command_loop) ? Qt : Qnil)); 10013 (NILP (cmd_loop) ? Qt : Qnil));
10010 specbind (Qinput_method_use_echo_area, 10014 specbind (Qinput_method_use_echo_area,
10011 (NILP (command_loop) ? Qt : Qnil)); 10015 (NILP (cmd_loop) ? Qt : Qnil));
10012 10016
10013 memset (keybuf, 0, sizeof keybuf); 10017 memset (keybuf, 0, sizeof keybuf);
10014 GCPRO1 (keybuf[0]); 10018 GCPRO1 (keybuf[0]);
@@ -10051,7 +10055,7 @@ will read just one key sequence. */)
10051DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, 10055DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10052 Sread_key_sequence_vector, 1, 5, 0, 10056 Sread_key_sequence_vector, 1, 5, 0,
10053 doc: /* Like `read-key-sequence' but always return a vector. */) 10057 doc: /* Like `read-key-sequence' but always return a vector. */)
10054 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object command_loop) 10058 (Lisp_Object prompt, Lisp_Object continue_echo, Lisp_Object dont_downcase_last, Lisp_Object can_return_switch_frame, Lisp_Object cmd_loop)
10055{ 10059{
10056 Lisp_Object keybuf[30]; 10060 Lisp_Object keybuf[30];
10057 register int i; 10061 register int i;
@@ -10063,9 +10067,9 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
10063 QUIT; 10067 QUIT;
10064 10068
10065 specbind (Qinput_method_exit_on_first_char, 10069 specbind (Qinput_method_exit_on_first_char,
10066 (NILP (command_loop) ? Qt : Qnil)); 10070 (NILP (cmd_loop) ? Qt : Qnil));
10067 specbind (Qinput_method_use_echo_area, 10071 specbind (Qinput_method_use_echo_area,
10068 (NILP (command_loop) ? Qt : Qnil)); 10072 (NILP (cmd_loop) ? Qt : Qnil));
10069 10073
10070 memset (keybuf, 0, sizeof keybuf); 10074 memset (keybuf, 0, sizeof keybuf);
10071 GCPRO1 (keybuf[0]); 10075 GCPRO1 (keybuf[0]);
diff --git a/src/keyboard.h b/src/keyboard.h
index 10bf16d5c5c..00745a09140 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -90,7 +90,7 @@ struct kboard
90 90
91 /* User-supplied table to translate input characters through. */ 91 /* User-supplied table to translate input characters through. */
92 Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); 92 Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table);
93 93
94 /* Last command that may be repeated by `repeat'. */ 94 /* Last command that may be repeated by `repeat'. */
95 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); 95 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command);
96 96
@@ -140,12 +140,12 @@ struct kboard
140 /* Keymap mapping keys to alternative preferred forms. 140 /* Keymap mapping keys to alternative preferred forms.
141 See the DEFVAR for more documentation. */ 141 See the DEFVAR for more documentation. */
142 Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); 142 Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map);
143 143
144 /* Keymap mapping ASCII function key sequences onto their preferred 144 /* Keymap mapping ASCII function key sequences onto their preferred
145 forms. Initialized by the terminal-specific lisp files. See the 145 forms. Initialized by the terminal-specific lisp files. See the
146 DEFVAR for more documentation. */ 146 DEFVAR for more documentation. */
147 Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); 147 Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map);
148 148
149 /* Minibufferless frames on this display use this frame's minibuffer. */ 149 /* Minibufferless frames on this display use this frame's minibuffer. */
150 Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); 150 Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame);
151 151
@@ -494,6 +494,7 @@ extern int input_polling_used (void);
494extern void clear_input_pending (void); 494extern void clear_input_pending (void);
495extern int requeued_events_pending_p (void); 495extern int requeued_events_pending_p (void);
496extern void bind_polling_period (int); 496extern void bind_polling_period (int);
497extern int make_ctrl_char (int);
497extern void stuff_buffered_input (Lisp_Object); 498extern void stuff_buffered_input (Lisp_Object);
498extern void clear_waiting_for_input (void); 499extern void clear_waiting_for_input (void);
499extern void swallow_events (int); 500extern void swallow_events (int);
@@ -517,4 +518,8 @@ extern void add_user_signal (int, const char *);
517extern int tty_read_avail_input (struct terminal *, int, 518extern int tty_read_avail_input (struct terminal *, int,
518 struct input_event *); 519 struct input_event *);
519extern EMACS_TIME timer_check (int); 520extern EMACS_TIME timer_check (int);
521extern void mark_kboards (void);
520 522
523#ifdef WINDOWSNT
524extern const char *const lispy_function_keys[];
525#endif
diff --git a/src/keymap.c b/src/keymap.c
index 4459ef07d68..06968a0d944 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -34,9 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#include "keymap.h" 34#include "keymap.h"
35#include "window.h" 35#include "window.h"
36 36
37/* The number of elements in keymap vectors. */
38#define DENSE_TABLE_SIZE (0200)
39
40/* Actually allocate storage for these variables */ 37/* Actually allocate storage for these variables */
41 38
42Lisp_Object current_global_map; /* Current global keymap */ 39Lisp_Object current_global_map; /* Current global keymap */
@@ -191,8 +188,9 @@ when reading a key-sequence to be looked-up in this keymap. */)
191 If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR 188 If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
192 is zero as well), return Qt. 189 is zero as well), return Qt.
193 190
194 ERROR controls how we respond if OBJECT isn't a keymap. 191 ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap.
195 If ERROR is non-zero, signal an error; otherwise, just return Qnil. 192 If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise,
193 just return Qnil.
196 194
197 Note that most of the time, we don't want to pursue autoloads. 195 Note that most of the time, we don't want to pursue autoloads.
198 Functions like Faccessible_keymaps which scan entire keymap trees 196 Functions like Faccessible_keymaps which scan entire keymap trees
@@ -204,7 +202,7 @@ when reading a key-sequence to be looked-up in this keymap. */)
204 do_autoload which can GC. */ 202 do_autoload which can GC. */
205 203
206Lisp_Object 204Lisp_Object
207get_keymap (Lisp_Object object, int error, int autoload) 205get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload)
208{ 206{
209 Lisp_Object tem; 207 Lisp_Object tem;
210 208
@@ -222,7 +220,7 @@ get_keymap (Lisp_Object object, int error, int autoload)
222 220
223 /* Should we do an autoload? Autoload forms for keymaps have 221 /* Should we do an autoload? Autoload forms for keymaps have
224 Qkeymap as their fifth element. */ 222 Qkeymap as their fifth element. */
225 if ((autoload || !error) && EQ (XCAR (tem), Qautoload) 223 if ((autoload || !error_if_not_keymap) && EQ (XCAR (tem), Qautoload)
226 && SYMBOLP (object)) 224 && SYMBOLP (object))
227 { 225 {
228 Lisp_Object tail; 226 Lisp_Object tail;
@@ -247,7 +245,7 @@ get_keymap (Lisp_Object object, int error, int autoload)
247 } 245 }
248 246
249 end: 247 end:
250 if (error) 248 if (error_if_not_keymap)
251 wrong_type_argument (Qkeymapp, object); 249 wrong_type_argument (Qkeymapp, object);
252 return Qnil; 250 return Qnil;
253} 251}
@@ -255,7 +253,7 @@ get_keymap (Lisp_Object object, int error, int autoload)
255/* Return the parent map of KEYMAP, or nil if it has none. 253/* Return the parent map of KEYMAP, or nil if it has none.
256 We assume that KEYMAP is a valid keymap. */ 254 We assume that KEYMAP is a valid keymap. */
257 255
258Lisp_Object 256static Lisp_Object
259keymap_parent (Lisp_Object keymap, int autoload) 257keymap_parent (Lisp_Object keymap, int autoload)
260{ 258{
261 Lisp_Object list; 259 Lisp_Object list;
@@ -283,7 +281,7 @@ If KEYMAP has no parent, return nil. */)
283} 281}
284 282
285/* Check whether MAP is one of MAPS parents. */ 283/* Check whether MAP is one of MAPS parents. */
286int 284static int
287keymap_memberp (Lisp_Object map, Lisp_Object maps) 285keymap_memberp (Lisp_Object map, Lisp_Object maps)
288{ 286{
289 if (NILP (map)) return 0; 287 if (NILP (map)) return 0;
@@ -468,19 +466,19 @@ access_keymap (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int au
468 /* See if there is a meta-map. If there's none, there is 466 /* See if there is a meta-map. If there's none, there is
469 no binding for IDX, unless a default binding exists in MAP. */ 467 no binding for IDX, unless a default binding exists in MAP. */
470 struct gcpro gcpro1; 468 struct gcpro gcpro1;
471 Lisp_Object meta_map; 469 Lisp_Object event_meta_map;
472 GCPRO1 (map); 470 GCPRO1 (map);
473 /* A strange value in which Meta is set would cause 471 /* A strange value in which Meta is set would cause
474 infinite recursion. Protect against that. */ 472 infinite recursion. Protect against that. */
475 if (XINT (meta_prefix_char) & CHAR_META) 473 if (XINT (meta_prefix_char) & CHAR_META)
476 meta_prefix_char = make_number (27); 474 meta_prefix_char = make_number (27);
477 meta_map = get_keymap (access_keymap (map, meta_prefix_char, 475 event_meta_map = get_keymap (access_keymap (map, meta_prefix_char,
478 t_ok, noinherit, autoload), 476 t_ok, noinherit, autoload),
479 0, autoload); 477 0, autoload);
480 UNGCPRO; 478 UNGCPRO;
481 if (CONSP (meta_map)) 479 if (CONSP (event_meta_map))
482 { 480 {
483 map = meta_map; 481 map = event_meta_map;
484 idx = make_number (XUINT (idx) & ~meta_modifier); 482 idx = make_number (XUINT (idx) & ~meta_modifier);
485 } 483 }
486 else if (t_ok) 484 else if (t_ok)
@@ -598,7 +596,7 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
598 596
599/* Call FUN for every binding in MAP and stop at (and return) the parent. 597/* Call FUN for every binding in MAP and stop at (and return) the parent.
600 FUN is called with 4 arguments: FUN (KEY, BINDING, ARGS, DATA). */ 598 FUN is called with 4 arguments: FUN (KEY, BINDING, ARGS, DATA). */
601Lisp_Object 599static Lisp_Object
602map_keymap_internal (Lisp_Object map, 600map_keymap_internal (Lisp_Object map,
603 map_keymap_function_t fun, 601 map_keymap_function_t fun,
604 Lisp_Object args, 602 Lisp_Object args,
@@ -960,7 +958,7 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def)
960 958
961EXFUN (Fcopy_keymap, 1); 959EXFUN (Fcopy_keymap, 1);
962 960
963Lisp_Object 961static Lisp_Object
964copy_keymap_item (Lisp_Object elt) 962copy_keymap_item (Lisp_Object elt)
965{ 963{
966 Lisp_Object res, tem; 964 Lisp_Object res, tem;
@@ -1142,10 +1140,10 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1142 int i = ASIZE (def); 1140 int i = ASIZE (def);
1143 while (--i >= 0) 1141 while (--i >= 0)
1144 { 1142 {
1145 Lisp_Object c = AREF (def, i); 1143 Lisp_Object defi = AREF (def, i);
1146 if (CONSP (c) && lucid_event_type_list_p (c)) 1144 if (CONSP (defi) && lucid_event_type_list_p (defi))
1147 c = Fevent_convert_list (c); 1145 defi = Fevent_convert_list (defi);
1148 ASET (tmp, i, c); 1146 ASET (tmp, i, defi);
1149 } 1147 }
1150 def = tmp; 1148 def = tmp;
1151 } 1149 }
@@ -1337,7 +1335,7 @@ define_as_prefix (Lisp_Object keymap, Lisp_Object c)
1337 1335
1338/* Append a key to the end of a key sequence. We always make a vector. */ 1336/* Append a key to the end of a key sequence. We always make a vector. */
1339 1337
1340Lisp_Object 1338static Lisp_Object
1341append_key (Lisp_Object key_sequence, Lisp_Object key) 1339append_key (Lisp_Object key_sequence, Lisp_Object key)
1342{ 1340{
1343 Lisp_Object args[2]; 1341 Lisp_Object args[2];
@@ -2439,7 +2437,7 @@ around function keys and event symbols. */)
2439 return Qnil; 2437 return Qnil;
2440} 2438}
2441 2439
2442char * 2440static char *
2443push_text_char_description (register unsigned int c, register char *p) 2441push_text_char_description (register unsigned int c, register char *p)
2444{ 2442{
2445 if (c >= 0200) 2443 if (c >= 0200)
@@ -2774,8 +2772,8 @@ remapped command in the returned list. */)
2774 considered remapped sequences yet, copy them over and 2772 considered remapped sequences yet, copy them over and
2775 process them. */ 2773 process them. */
2776 || (!remapped && (sequences = remapped_sequences, 2774 || (!remapped && (sequences = remapped_sequences,
2777 remapped = 1), 2775 remapped = 1,
2778 CONSP (sequences))) 2776 CONSP (sequences))))
2779 { 2777 {
2780 Lisp_Object sequence, function; 2778 Lisp_Object sequence, function;
2781 2779
@@ -2815,9 +2813,9 @@ remapped command in the returned list. */)
2815 seems to be only one menu item to report. */ 2813 seems to be only one menu item to report. */
2816 if (! NILP (sequence)) 2814 if (! NILP (sequence))
2817 { 2815 {
2818 Lisp_Object tem; 2816 Lisp_Object tem1;
2819 tem = Faref (sequence, make_number (ASIZE (sequence) - 1)); 2817 tem1 = Faref (sequence, make_number (ASIZE (sequence) - 1));
2820 if (STRINGP (tem)) 2818 if (STRINGP (tem1))
2821 Faset (sequence, make_number (ASIZE (sequence) - 1), 2819 Faset (sequence, make_number (ASIZE (sequence) - 1),
2822 build_string ("(any string)")); 2820 build_string ("(any string)"));
2823 } 2821 }
@@ -3122,13 +3120,13 @@ key binding\n\
3122 /* Delete from MAPS each element that is for the menu bar. */ 3120 /* Delete from MAPS each element that is for the menu bar. */
3123 for (list = maps; CONSP (list); list = XCDR (list)) 3121 for (list = maps; CONSP (list); list = XCDR (list))
3124 { 3122 {
3125 Lisp_Object elt, prefix, tem; 3123 Lisp_Object elt, elt_prefix, tem;
3126 3124
3127 elt = XCAR (list); 3125 elt = XCAR (list);
3128 prefix = Fcar (elt); 3126 elt_prefix = Fcar (elt);
3129 if (XVECTOR (prefix)->size >= 1) 3127 if (XVECTOR (elt_prefix)->size >= 1)
3130 { 3128 {
3131 tem = Faref (prefix, make_number (0)); 3129 tem = Faref (elt_prefix, make_number (0));
3132 if (EQ (tem, Qmenu_bar)) 3130 if (EQ (tem, Qmenu_bar))
3133 maps = Fdelq (elt, maps); 3131 maps = Fdelq (elt, maps);
3134 } 3132 }
@@ -3153,10 +3151,10 @@ key binding\n\
3153 3151
3154 for (; CONSP (maps); maps = XCDR (maps)) 3152 for (; CONSP (maps); maps = XCDR (maps))
3155 { 3153 {
3156 register Lisp_Object elt, prefix, tail; 3154 register Lisp_Object elt, elt_prefix, tail;
3157 3155
3158 elt = XCAR (maps); 3156 elt = XCAR (maps);
3159 prefix = Fcar (elt); 3157 elt_prefix = Fcar (elt);
3160 3158
3161 sub_shadows = Qnil; 3159 sub_shadows = Qnil;
3162 3160
@@ -3168,8 +3166,8 @@ key binding\n\
3168 3166
3169 /* If the sequence by which we reach this keymap is zero-length, 3167 /* If the sequence by which we reach this keymap is zero-length,
3170 then the shadow map for this keymap is just SHADOW. */ 3168 then the shadow map for this keymap is just SHADOW. */
3171 if ((STRINGP (prefix) && SCHARS (prefix) == 0) 3169 if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0)
3172 || (VECTORP (prefix) && XVECTOR (prefix)->size == 0)) 3170 || (VECTORP (elt_prefix) && XVECTOR (elt_prefix)->size == 0))
3173 ; 3171 ;
3174 /* If the sequence by which we reach this keymap actually has 3172 /* If the sequence by which we reach this keymap actually has
3175 some elements, then the sequence's definition in SHADOW is 3173 some elements, then the sequence's definition in SHADOW is
@@ -3195,12 +3193,12 @@ key binding\n\
3195 for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail)) 3193 for (tail = orig_maps; !EQ (tail, maps); tail = XCDR (tail))
3196 { 3194 {
3197 Lisp_Object tem; 3195 Lisp_Object tem;
3198 tem = Fequal (Fcar (XCAR (tail)), prefix); 3196 tem = Fequal (Fcar (XCAR (tail)), elt_prefix);
3199 if (!NILP (tem)) 3197 if (!NILP (tem))
3200 sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows); 3198 sub_shadows = Fcons (XCDR (XCAR (tail)), sub_shadows);
3201 } 3199 }
3202 3200
3203 describe_map (Fcdr (elt), prefix, 3201 describe_map (Fcdr (elt), elt_prefix,
3204 transl ? describe_translation : describe_command, 3202 transl ? describe_translation : describe_command,
3205 partial, sub_shadows, &seen, nomenu, mention_shadow); 3203 partial, sub_shadows, &seen, nomenu, mention_shadow);
3206 3204
diff --git a/src/lisp.h b/src/lisp.h
index e4788e63f5b..9cbaf24cacf 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -27,9 +27,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 types of run time checks for Lisp objects. */ 27 types of run time checks for Lisp objects. */
28 28
29#ifdef GC_CHECK_CONS_LIST 29#ifdef GC_CHECK_CONS_LIST
30#define CHECK_CONS_LIST() check_cons_list() 30extern void check_cons_list (void);
31#define CHECK_CONS_LIST() check_cons_list ()
31#else 32#else
32#define CHECK_CONS_LIST() ((void)0) 33#define CHECK_CONS_LIST() ((void) 0)
33#endif 34#endif
34 35
35/* These are default choices for the types to use. */ 36/* These are default choices for the types to use. */
@@ -85,7 +86,7 @@ extern void die (const char *, const char *, int) NO_RETURN;
85/* Define an Emacs version of "assert", since some system ones are 86/* Define an Emacs version of "assert", since some system ones are
86 flaky. */ 87 flaky. */
87#ifndef ENABLE_CHECKING 88#ifndef ENABLE_CHECKING
88#define eassert(X) (void) 0 89#define eassert(X) ((void) (0 && (X))) /* Check that X compiles. */
89#else /* ENABLE_CHECKING */ 90#else /* ENABLE_CHECKING */
90#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__) 91#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
91#define eassert(cond) CHECK(cond,"assertion failed: " #cond) 92#define eassert(cond) CHECK(cond,"assertion failed: " #cond)
@@ -841,6 +842,9 @@ struct Lisp_Vector
841 842
842#endif /* not __GNUC__ */ 843#endif /* not __GNUC__ */
843 844
845/* Nonzero iff C is an ASCII character. */
846#define ASCII_CHAR_P(c) ((unsigned) (c) < 0x80)
847
844/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII 848/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
845 characters. Do not check validity of CT. */ 849 characters. Do not check validity of CT. */
846#define CHAR_TABLE_REF(CT, IDX) \ 850#define CHAR_TABLE_REF(CT, IDX) \
@@ -2046,50 +2050,6 @@ extern int pending_signals;
2046 2050
2047#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) 2051#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
2048 2052
2049/* Variables used locally in the following case handling macros. */
2050extern int case_temp1;
2051extern Lisp_Object case_temp2;
2052
2053/* Current buffer's map from characters to lower-case characters. */
2054
2055#define DOWNCASE_TABLE BVAR (current_buffer, downcase_table)
2056
2057/* Current buffer's map from characters to upper-case characters. */
2058
2059#define UPCASE_TABLE BVAR (current_buffer, upcase_table)
2060
2061/* Downcase a character, or make no change if that cannot be done. */
2062
2063#define DOWNCASE(CH) \
2064 ((case_temp1 = (CH), \
2065 case_temp2 = CHAR_TABLE_REF (DOWNCASE_TABLE, case_temp1), \
2066 NATNUMP (case_temp2)) \
2067 ? XFASTINT (case_temp2) : case_temp1)
2068
2069/* 1 if CH is upper case. */
2070
2071#define UPPERCASEP(CH) (DOWNCASE (CH) != (CH))
2072
2073/* 1 if CH is neither upper nor lower case. */
2074
2075#define NOCASEP(CH) (UPCASE1 (CH) == (CH))
2076
2077/* 1 if CH is lower case. */
2078
2079#define LOWERCASEP(CH) (!UPPERCASEP (CH) && !NOCASEP(CH))
2080
2081/* Upcase a character, or make no change if that cannot be done. */
2082
2083#define UPCASE(CH) (!UPPERCASEP (CH) ? UPCASE1 (CH) : (CH))
2084
2085/* Upcase a character known to be not upper case. */
2086
2087#define UPCASE1(CH) \
2088 ((case_temp1 = (CH), \
2089 case_temp2 = CHAR_TABLE_REF (UPCASE_TABLE, case_temp1), \
2090 NATNUMP (case_temp2)) \
2091 ? XFASTINT (case_temp2) : case_temp1)
2092
2093extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table; 2053extern Lisp_Object Vascii_downcase_table, Vascii_upcase_table;
2094extern Lisp_Object Vascii_canon_table, Vascii_eqv_table; 2054extern Lisp_Object Vascii_canon_table, Vascii_eqv_table;
2095 2055
@@ -2155,126 +2115,143 @@ struct gcpro
2155 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) 2115 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
2156 2116
2157 2117
2118#define GCPRO1(var) \
2119 GCPRO1_VAR (var, gcpro)
2120#define GCPRO2(var1, var2) \
2121 GCPRO2_VAR (var1, var2, gcpro)
2122#define GCPRO3(var1, var2, var3) \
2123 GCPRO3_VAR (var1, var2, var3, gcpro)
2124#define GCPRO4(var1, var2, var3, var4) \
2125 GCPRO4_VAR (var1, var2, var3, var4, gcpro)
2126#define GCPRO5(var1, var2, var3, var4, var5) \
2127 GCPRO5_VAR (var1, var2, var3, var4, var5, gcpro)
2128#define GCPRO6(var1, var2, var3, var4, var5, var6) \
2129 GCPRO6_VAR (var1, var2, var3, var4, var5, var6, gcpro)
2130#define UNGCPRO UNGCPRO_VAR (gcpro)
2131
2158#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS 2132#if GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS
2159 2133
2160/* Do something silly with gcproN vars just so gcc shuts up. */ 2134/* Do something silly with gcproN vars just so gcc shuts up. */
2161/* You get warnings from MIPSPro... */ 2135/* You get warnings from MIPSPro... */
2162 2136
2163#define GCPRO1(varname) ((void) gcpro1) 2137#define GCPRO1_VAR(var, gcpro) ((void) gcpro##1)
2164#define GCPRO2(varname1, varname2)(((void) gcpro2, (void) gcpro1)) 2138#define GCPRO2_VAR(var1, var2, gcpro) \
2165#define GCPRO3(varname1, varname2, varname3) \ 2139 ((void) gcpro##2, (void) gcpro##1)
2166 (((void) gcpro3, (void) gcpro2, (void) gcpro1)) 2140#define GCPRO3_VAR(var1, var2, var3, gcpro) \
2167#define GCPRO4(varname1, varname2, varname3, varname4) \ 2141 ((void) gcpro##3, (void) gcpro##2, (void) gcpro##1)
2168 (((void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) 2142#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
2169#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ 2143 ((void) gcpro##4, (void) gcpro##3, (void) gcpro##2, (void) gcpro##1)
2170 (((void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) 2144#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
2171#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ 2145 ((void) gcpro##5, (void) gcpro##4, (void) gcpro##3, (void) gcpro##2, \
2172 (((void) gcpro6, (void) gcpro5, (void) gcpro4, (void) gcpro3, (void) gcpro2, (void) gcpro1)) 2146 (void) gcpro##1)
2173#define UNGCPRO ((void) 0) 2147#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
2148 ((void) gcpro##6, (void) gcpro##5, (void) gcpro##4, (void) gcpro##3, \
2149 (void) gcpro##2, (void) gcpro##1)
2150#define UNGCPRO_VAR(gcpro) ((void) 0)
2174 2151
2175#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ 2152#else /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
2176 2153
2177#ifndef DEBUG_GCPRO 2154#ifndef DEBUG_GCPRO
2178 2155
2179#define GCPRO1(varname) \ 2156#define GCPRO1_VAR(var, gcpro) \
2180 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ 2157 {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \
2181 gcprolist = &gcpro1; } 2158 gcprolist = &gcpro##1; }
2182 2159
2183#define GCPRO2(varname1, varname2) \ 2160#define GCPRO2_VAR(var1, var2, gcpro) \
2184 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2161 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2185 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2162 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2186 gcprolist = &gcpro2; } 2163 gcprolist = &gcpro##2; }
2187 2164
2188#define GCPRO3(varname1, varname2, varname3) \ 2165#define GCPRO3_VAR(var1, var2, var3, gcpro) \
2189 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2166 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2190 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2167 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2191 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2168 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2192 gcprolist = &gcpro3; } 2169 gcprolist = &gcpro##3; }
2193 2170
2194#define GCPRO4(varname1, varname2, varname3, varname4) \ 2171#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
2195 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2172 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2196 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2173 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2197 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2174 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2198 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2175 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2199 gcprolist = &gcpro4; } 2176 gcprolist = &gcpro##4; }
2200 2177
2201#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ 2178#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
2202 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2179 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2203 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2180 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2204 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2181 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2205 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2182 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2206 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ 2183 gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
2207 gcprolist = &gcpro5; } 2184 gcprolist = &gcpro##5; }
2208 2185
2209#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ 2186#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
2210 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2187 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2211 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2188 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2212 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2189 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2213 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2190 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2214 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ 2191 gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
2215 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ 2192 gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \
2216 gcprolist = &gcpro6; } 2193 gcprolist = &gcpro##6; }
2217 2194
2218#define UNGCPRO (gcprolist = gcpro1.next) 2195#define UNGCPRO_VAR(gcpro) (gcprolist = gcpro##1.next)
2219 2196
2220#else 2197#else
2221 2198
2222extern int gcpro_level; 2199extern int gcpro_level;
2223 2200
2224#define GCPRO1(varname) \ 2201#define GCPRO1_VAR(var, gcpro) \
2225 {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \ 2202 {gcpro##1.next = gcprolist; gcpro##1.var = &var; gcpro##1.nvars = 1; \
2226 gcpro1.level = gcpro_level++; \ 2203 gcpro##1.level = gcpro_level++; \
2227 gcprolist = &gcpro1; } 2204 gcprolist = &gcpro##1; }
2228 2205
2229#define GCPRO2(varname1, varname2) \ 2206#define GCPRO2_VAR(var1, var2, gcpro) \
2230 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2207 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2231 gcpro1.level = gcpro_level; \ 2208 gcpro##1.level = gcpro_level; \
2232 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2209 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2233 gcpro2.level = gcpro_level++; \ 2210 gcpro##2.level = gcpro_level++; \
2234 gcprolist = &gcpro2; } 2211 gcprolist = &gcpro##2; }
2235 2212
2236#define GCPRO3(varname1, varname2, varname3) \ 2213#define GCPRO3_VAR(var1, var2, var3, gcpro) \
2237 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2214 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2238 gcpro1.level = gcpro_level; \ 2215 gcpro##1.level = gcpro_level; \
2239 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2216 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2240 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2217 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2241 gcpro3.level = gcpro_level++; \ 2218 gcpro##3.level = gcpro_level++; \
2242 gcprolist = &gcpro3; } 2219 gcprolist = &gcpro##3; }
2243 2220
2244#define GCPRO4(varname1, varname2, varname3, varname4) \ 2221#define GCPRO4_VAR(var1, var2, var3, var4, gcpro) \
2245 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2222 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2246 gcpro1.level = gcpro_level; \ 2223 gcpro##1.level = gcpro_level; \
2247 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2224 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2248 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2225 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2249 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2226 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2250 gcpro4.level = gcpro_level++; \ 2227 gcpro##4.level = gcpro_level++; \
2251 gcprolist = &gcpro4; } 2228 gcprolist = &gcpro##4; }
2252 2229
2253#define GCPRO5(varname1, varname2, varname3, varname4, varname5) \ 2230#define GCPRO5_VAR(var1, var2, var3, var4, var5, gcpro) \
2254 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2231 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2255 gcpro1.level = gcpro_level; \ 2232 gcpro##1.level = gcpro_level; \
2256 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2233 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2257 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2234 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2258 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2235 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2259 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ 2236 gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
2260 gcpro5.level = gcpro_level++; \ 2237 gcpro##5.level = gcpro_level++; \
2261 gcprolist = &gcpro5; } 2238 gcprolist = &gcpro##5; }
2262 2239
2263#define GCPRO6(varname1, varname2, varname3, varname4, varname5, varname6) \ 2240#define GCPRO6_VAR(var1, var2, var3, var4, var5, var6, gcpro) \
2264 {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \ 2241 {gcpro##1.next = gcprolist; gcpro##1.var = &var1; gcpro##1.nvars = 1; \
2265 gcpro1.level = gcpro_level; \ 2242 gcpro##1.level = gcpro_level; \
2266 gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \ 2243 gcpro##2.next = &gcpro##1; gcpro##2.var = &var2; gcpro##2.nvars = 1; \
2267 gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \ 2244 gcpro##3.next = &gcpro##2; gcpro##3.var = &var3; gcpro##3.nvars = 1; \
2268 gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \ 2245 gcpro##4.next = &gcpro##3; gcpro##4.var = &var4; gcpro##4.nvars = 1; \
2269 gcpro5.next = &gcpro4; gcpro5.var = &varname5; gcpro5.nvars = 1; \ 2246 gcpro##5.next = &gcpro##4; gcpro##5.var = &var5; gcpro##5.nvars = 1; \
2270 gcpro6.next = &gcpro5; gcpro6.var = &varname6; gcpro6.nvars = 1; \ 2247 gcpro##6.next = &gcpro##5; gcpro##6.var = &var6; gcpro##6.nvars = 1; \
2271 gcpro6.level = gcpro_level++; \ 2248 gcpro##6.level = gcpro_level++; \
2272 gcprolist = &gcpro6; } 2249 gcprolist = &gcpro##6; }
2273 2250
2274#define UNGCPRO \ 2251#define UNGCPRO_VAR(gcpro) \
2275 ((--gcpro_level != gcpro1.level) \ 2252 ((--gcpro_level != gcpro##1.level) \
2276 ? (abort (), 0) \ 2253 ? (abort (), 0) \
2277 : ((gcprolist = gcpro1.next), 0)) 2254 : ((gcprolist = gcpro##1.next), 0))
2278 2255
2279#endif /* DEBUG_GCPRO */ 2256#endif /* DEBUG_GCPRO */
2280#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ 2257#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
@@ -2542,7 +2519,10 @@ extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
2542/* Defined in fringe.c */ 2519/* Defined in fringe.c */
2543extern void syms_of_fringe (void); 2520extern void syms_of_fringe (void);
2544extern void init_fringe (void); 2521extern void init_fringe (void);
2522#ifdef HAVE_WINDOW_SYSTEM
2523extern void mark_fringe_data (void);
2545extern void init_fringe_once (void); 2524extern void init_fringe_once (void);
2525#endif /* HAVE_WINDOW_SYSTEM */
2546 2526
2547/* Defined in image.c */ 2527/* Defined in image.c */
2548extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; 2528extern Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
@@ -2606,6 +2586,7 @@ extern void syms_of_insdel (void);
2606 2586
2607/* Defined in dispnew.c */ 2587/* Defined in dispnew.c */
2608extern Lisp_Object selected_frame; 2588extern Lisp_Object selected_frame;
2589extern Lisp_Object Vwindow_system;
2609EXFUN (Fding, 1); 2590EXFUN (Fding, 1);
2610EXFUN (Fredraw_frame, 1); 2591EXFUN (Fredraw_frame, 1);
2611EXFUN (Fsleep_for, 2); 2592EXFUN (Fsleep_for, 2);
@@ -2788,6 +2769,7 @@ EXFUN (Fprint, 2);
2788EXFUN (Ferror_message_string, 1); 2769EXFUN (Ferror_message_string, 1);
2789extern Lisp_Object Qstandard_output; 2770extern Lisp_Object Qstandard_output;
2790extern Lisp_Object Qexternal_debugging_output; 2771extern Lisp_Object Qexternal_debugging_output;
2772extern void debug_output_compilation_hack (int);
2791extern void temp_output_buffer_setup (const char *); 2773extern void temp_output_buffer_setup (const char *);
2792extern int print_level; 2774extern int print_level;
2793extern Lisp_Object Qprint_escape_newlines; 2775extern Lisp_Object Qprint_escape_newlines;
@@ -2899,8 +2881,10 @@ extern Lisp_Object safe_call (int, Lisp_Object *);
2899extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); 2881extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
2900extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object); 2882extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
2901extern void init_eval (void); 2883extern void init_eval (void);
2884extern void mark_backtrace (void);
2902extern void syms_of_eval (void); 2885extern void syms_of_eval (void);
2903 2886
2887/* Defined in editfns.c */
2904extern Lisp_Object Qfield; 2888extern Lisp_Object Qfield;
2905EXFUN (Fcurrent_message, 0); 2889EXFUN (Fcurrent_message, 0);
2906EXFUN (Fgoto_char, 1); 2890EXFUN (Fgoto_char, 1);
@@ -2940,6 +2924,8 @@ extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int);
2940extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, 2924extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT,
2941 EMACS_INT, int); 2925 EMACS_INT, int);
2942extern void init_editfns (void); 2926extern void init_editfns (void);
2927const char *get_system_name (void);
2928const char *get_operating_system_release (void);
2943extern void syms_of_editfns (void); 2929extern void syms_of_editfns (void);
2944EXFUN (Fconstrain_to_field, 5); 2930EXFUN (Fconstrain_to_field, 5);
2945EXFUN (Ffield_end, 3); 2931EXFUN (Ffield_end, 3);
@@ -2996,12 +2982,14 @@ extern EMACS_INT marker_byte_position (Lisp_Object);
2996extern void clear_charpos_cache (struct buffer *); 2982extern void clear_charpos_cache (struct buffer *);
2997extern EMACS_INT charpos_to_bytepos (EMACS_INT); 2983extern EMACS_INT charpos_to_bytepos (EMACS_INT);
2998extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT); 2984extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT);
2985extern EMACS_INT verify_bytepos (EMACS_INT charpos);
2999extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT); 2986extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT);
3000extern void unchain_marker (struct Lisp_Marker *marker); 2987extern void unchain_marker (struct Lisp_Marker *marker);
3001extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); 2988extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
3002extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); 2989extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT);
3003extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, 2990extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
3004 EMACS_INT, EMACS_INT); 2991 EMACS_INT, EMACS_INT);
2992extern int count_markers (struct buffer *);
3005extern void syms_of_marker (void); 2993extern void syms_of_marker (void);
3006 2994
3007/* Defined in fileio.c */ 2995/* Defined in fileio.c */
@@ -3010,6 +2998,7 @@ extern Lisp_Object Qfile_error;
3010extern Lisp_Object Qfile_exists_p; 2998extern Lisp_Object Qfile_exists_p;
3011extern Lisp_Object Qfile_directory_p; 2999extern Lisp_Object Qfile_directory_p;
3012extern Lisp_Object Qinsert_file_contents; 3000extern Lisp_Object Qinsert_file_contents;
3001extern Lisp_Object Qfile_name_history;
3013EXFUN (Ffind_file_name_handler, 2); 3002EXFUN (Ffind_file_name_handler, 2);
3014EXFUN (Ffile_name_as_directory, 1); 3003EXFUN (Ffile_name_as_directory, 1);
3015EXFUN (Fexpand_file_name, 2); 3004EXFUN (Fexpand_file_name, 2);
@@ -3051,6 +3040,10 @@ EXFUN (Fset_match_data, 2);
3051EXFUN (Fmatch_beginning, 1); 3040EXFUN (Fmatch_beginning, 1);
3052EXFUN (Fmatch_end, 1); 3041EXFUN (Fmatch_end, 1);
3053extern void record_unwind_save_match_data (void); 3042extern void record_unwind_save_match_data (void);
3043struct re_registers;
3044extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
3045 struct re_registers *,
3046 Lisp_Object, int, int);
3054extern int fast_string_match (Lisp_Object, Lisp_Object); 3047extern int fast_string_match (Lisp_Object, Lisp_Object);
3055extern int fast_c_string_match_ignore_case (Lisp_Object, const char *); 3048extern int fast_c_string_match_ignore_case (Lisp_Object, const char *);
3056extern int fast_string_match_ignore_case (Lisp_Object, Lisp_Object); 3049extern int fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
@@ -3142,6 +3135,7 @@ extern void cmd_error_internal (Lisp_Object, const char *);
3142extern Lisp_Object command_loop_1 (void); 3135extern Lisp_Object command_loop_1 (void);
3143extern Lisp_Object recursive_edit_1 (void); 3136extern Lisp_Object recursive_edit_1 (void);
3144extern void record_auto_save (void); 3137extern void record_auto_save (void);
3138extern void force_auto_save_soon (void);
3145extern void init_keyboard (void); 3139extern void init_keyboard (void);
3146extern void syms_of_keyboard (void); 3140extern void syms_of_keyboard (void);
3147extern void keys_of_keyboard (void); 3141extern void keys_of_keyboard (void);
@@ -3194,6 +3188,7 @@ extern Lisp_Object decode_env_path (const char *, const char *);
3194extern Lisp_Object empty_unibyte_string, empty_multibyte_string; 3188extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
3195extern Lisp_Object Qfile_name_handler_alist; 3189extern Lisp_Object Qfile_name_handler_alist;
3196extern void (*fatal_error_signal_hook) (void); 3190extern void (*fatal_error_signal_hook) (void);
3191extern SIGTYPE fatal_error_signal (int);
3197EXFUN (Fkill_emacs, 1) NO_RETURN; 3192EXFUN (Fkill_emacs, 1) NO_RETURN;
3198#if HAVE_SETLOCALE 3193#if HAVE_SETLOCALE
3199void fixup_locale (void); 3194void fixup_locale (void);
@@ -3341,6 +3336,8 @@ extern void child_setup_tty (int);
3341extern void setup_pty (int); 3336extern void setup_pty (int);
3342extern int set_window_size (int, int, int); 3337extern int set_window_size (int, int, int);
3343extern void create_process (Lisp_Object, char **, Lisp_Object); 3338extern void create_process (Lisp_Object, char **, Lisp_Object);
3339extern long get_random (void);
3340extern void seed_random (long);
3344extern int emacs_open (const char *, int, int); 3341extern int emacs_open (const char *, int, int);
3345extern int emacs_close (int); 3342extern int emacs_close (int);
3346extern int emacs_read (int, char *, unsigned int); 3343extern int emacs_read (int, char *, unsigned int);
@@ -3387,6 +3384,7 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
3387 3384
3388/* Defined in term.c */ 3385/* Defined in term.c */
3389extern int *char_ins_del_vector; 3386extern int *char_ins_del_vector;
3387extern void mark_ttys (void);
3390extern void syms_of_term (void); 3388extern void syms_of_term (void);
3391extern void fatal (const char *msgid, ...) NO_RETURN; 3389extern void fatal (const char *msgid, ...) NO_RETURN;
3392 3390
@@ -3533,6 +3531,13 @@ extern void init_system_name (void);
3533 && (circular_list_error ((list)), 1))) \ 3531 && (circular_list_error ((list)), 1))) \
3534 : 0))) 3532 : 0)))
3535 3533
3534/* Use this to suppress gcc's `...may be used before initialized' warnings. */
3535#ifdef lint
3536# define IF_LINT(Code) Code
3537#else
3538# define IF_LINT(Code) /* empty */
3539#endif
3540
3536/* The ubiquitous min and max macros. */ 3541/* The ubiquitous min and max macros. */
3537 3542
3538#ifdef max 3543#ifdef max
diff --git a/src/lread.c b/src/lread.c
index c8c07bed476..7a8d7cf9a6a 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -370,15 +370,15 @@ unreadchar (Lisp_Object readcharfun, int c)
370 else if (BUFFERP (readcharfun)) 370 else if (BUFFERP (readcharfun))
371 { 371 {
372 struct buffer *b = XBUFFER (readcharfun); 372 struct buffer *b = XBUFFER (readcharfun);
373 EMACS_INT charpos = BUF_PT (b);
373 EMACS_INT bytepos = BUF_PT_BYTE (b); 374 EMACS_INT bytepos = BUF_PT_BYTE (b);
374 375
375 BUF_PT (b)--;
376 if (! NILP (BVAR (b, enable_multibyte_characters))) 376 if (! NILP (BVAR (b, enable_multibyte_characters)))
377 BUF_DEC_POS (b, bytepos); 377 BUF_DEC_POS (b, bytepos);
378 else 378 else
379 bytepos--; 379 bytepos--;
380 380
381 BUF_PT_BYTE (b) = bytepos; 381 SET_BUF_PT_BOTH (b, charpos - 1, bytepos);
382 } 382 }
383 else if (MARKERP (readcharfun)) 383 else if (MARKERP (readcharfun))
384 { 384 {
@@ -1133,10 +1133,10 @@ Return t if the file exists and loads successfully. */)
1133 Also, just loading a file recursively is not always an error in 1133 Also, just loading a file recursively is not always an error in
1134 the general case; the second load may do something different. */ 1134 the general case; the second load may do something different. */
1135 { 1135 {
1136 int count = 0; 1136 int load_count = 0;
1137 Lisp_Object tem; 1137 Lisp_Object tem;
1138 for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem)) 1138 for (tem = Vloads_in_progress; CONSP (tem); tem = XCDR (tem))
1139 if (!NILP (Fequal (found, XCAR (tem))) && (++count > 3)) 1139 if (!NILP (Fequal (found, XCAR (tem))) && (++load_count > 3))
1140 { 1140 {
1141 if (fd >= 0) 1141 if (fd >= 0)
1142 emacs_close (fd); 1142 emacs_close (fd);
@@ -1787,8 +1787,8 @@ readevalloop (Lisp_Object readcharfun,
1787 to a different value when evaluated. */ 1787 to a different value when evaluated. */
1788 if (BUFFERP (readcharfun)) 1788 if (BUFFERP (readcharfun))
1789 { 1789 {
1790 struct buffer *b = XBUFFER (readcharfun); 1790 struct buffer *buf = XBUFFER (readcharfun);
1791 if (BUF_PT (b) == BUF_ZV (b)) 1791 if (BUF_PT (buf) == BUF_ZV (buf))
1792 continue_reading_p = 0; 1792 continue_reading_p = 0;
1793 } 1793 }
1794 } 1794 }
@@ -2810,7 +2810,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2810 { 2810 {
2811 char *p = read_buffer; 2811 char *p = read_buffer;
2812 char *end = read_buffer + read_buffer_size; 2812 char *end = read_buffer + read_buffer_size;
2813 register int c; 2813 register int ch;
2814 /* Nonzero if we saw an escape sequence specifying 2814 /* Nonzero if we saw an escape sequence specifying
2815 a multibyte character. */ 2815 a multibyte character. */
2816 int force_multibyte = 0; 2816 int force_multibyte = 0;
@@ -2820,8 +2820,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2820 int cancel = 0; 2820 int cancel = 0;
2821 int nchars = 0; 2821 int nchars = 0;
2822 2822
2823 while ((c = READCHAR) >= 0 2823 while ((ch = READCHAR) >= 0
2824 && c != '\"') 2824 && ch != '\"')
2825 { 2825 {
2826 if (end - p < MAX_MULTIBYTE_LENGTH) 2826 if (end - p < MAX_MULTIBYTE_LENGTH)
2827 { 2827 {
@@ -2832,44 +2832,44 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2832 end = read_buffer + read_buffer_size; 2832 end = read_buffer + read_buffer_size;
2833 } 2833 }
2834 2834
2835 if (c == '\\') 2835 if (ch == '\\')
2836 { 2836 {
2837 int modifiers; 2837 int modifiers;
2838 2838
2839 c = read_escape (readcharfun, 1); 2839 ch = read_escape (readcharfun, 1);
2840 2840
2841 /* C is -1 if \ newline has just been seen */ 2841 /* CH is -1 if \ newline has just been seen */
2842 if (c == -1) 2842 if (ch == -1)
2843 { 2843 {
2844 if (p == read_buffer) 2844 if (p == read_buffer)
2845 cancel = 1; 2845 cancel = 1;
2846 continue; 2846 continue;
2847 } 2847 }
2848 2848
2849 modifiers = c & CHAR_MODIFIER_MASK; 2849 modifiers = ch & CHAR_MODIFIER_MASK;
2850 c = c & ~CHAR_MODIFIER_MASK; 2850 ch = ch & ~CHAR_MODIFIER_MASK;
2851 2851
2852 if (CHAR_BYTE8_P (c)) 2852 if (CHAR_BYTE8_P (ch))
2853 force_singlebyte = 1; 2853 force_singlebyte = 1;
2854 else if (! ASCII_CHAR_P (c)) 2854 else if (! ASCII_CHAR_P (ch))
2855 force_multibyte = 1; 2855 force_multibyte = 1;
2856 else /* i.e. ASCII_CHAR_P (c) */ 2856 else /* i.e. ASCII_CHAR_P (ch) */
2857 { 2857 {
2858 /* Allow `\C- ' and `\C-?'. */ 2858 /* Allow `\C- ' and `\C-?'. */
2859 if (modifiers == CHAR_CTL) 2859 if (modifiers == CHAR_CTL)
2860 { 2860 {
2861 if (c == ' ') 2861 if (ch == ' ')
2862 c = 0, modifiers = 0; 2862 ch = 0, modifiers = 0;
2863 else if (c == '?') 2863 else if (ch == '?')
2864 c = 127, modifiers = 0; 2864 ch = 127, modifiers = 0;
2865 } 2865 }
2866 if (modifiers & CHAR_SHIFT) 2866 if (modifiers & CHAR_SHIFT)
2867 { 2867 {
2868 /* Shift modifier is valid only with [A-Za-z]. */ 2868 /* Shift modifier is valid only with [A-Za-z]. */
2869 if (c >= 'A' && c <= 'Z') 2869 if (ch >= 'A' && ch <= 'Z')
2870 modifiers &= ~CHAR_SHIFT; 2870 modifiers &= ~CHAR_SHIFT;
2871 else if (c >= 'a' && c <= 'z') 2871 else if (ch >= 'a' && ch <= 'z')
2872 c -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT; 2872 ch -= ('a' - 'A'), modifiers &= ~CHAR_SHIFT;
2873 } 2873 }
2874 2874
2875 if (modifiers & CHAR_META) 2875 if (modifiers & CHAR_META)
@@ -2877,7 +2877,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2877 /* Move the meta bit to the right place for a 2877 /* Move the meta bit to the right place for a
2878 string. */ 2878 string. */
2879 modifiers &= ~CHAR_META; 2879 modifiers &= ~CHAR_META;
2880 c = BYTE8_TO_CHAR (c | 0x80); 2880 ch = BYTE8_TO_CHAR (ch | 0x80);
2881 force_singlebyte = 1; 2881 force_singlebyte = 1;
2882 } 2882 }
2883 } 2883 }
@@ -2885,20 +2885,20 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2885 /* Any modifiers remaining are invalid. */ 2885 /* Any modifiers remaining are invalid. */
2886 if (modifiers) 2886 if (modifiers)
2887 error ("Invalid modifier in string"); 2887 error ("Invalid modifier in string");
2888 p += CHAR_STRING (c, (unsigned char *) p); 2888 p += CHAR_STRING (ch, (unsigned char *) p);
2889 } 2889 }
2890 else 2890 else
2891 { 2891 {
2892 p += CHAR_STRING (c, (unsigned char *) p); 2892 p += CHAR_STRING (ch, (unsigned char *) p);
2893 if (CHAR_BYTE8_P (c)) 2893 if (CHAR_BYTE8_P (ch))
2894 force_singlebyte = 1; 2894 force_singlebyte = 1;
2895 else if (! ASCII_CHAR_P (c)) 2895 else if (! ASCII_CHAR_P (ch))
2896 force_multibyte = 1; 2896 force_multibyte = 1;
2897 } 2897 }
2898 nchars++; 2898 nchars++;
2899 } 2899 }
2900 2900
2901 if (c < 0) 2901 if (ch < 0)
2902 end_of_file_error (); 2902 end_of_file_error ();
2903 2903
2904 /* If purifying, and string starts with \ newline, 2904 /* If purifying, and string starts with \ newline,
@@ -2917,8 +2917,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2917 p = read_buffer + nchars; 2917 p = read_buffer + nchars;
2918 } 2918 }
2919 else 2919 else
2920 /* Otherwise, READ_BUFFER contains only ASCII. */ 2920 {
2921 ; 2921 /* Otherwise, READ_BUFFER contains only ASCII. */
2922 }
2922 2923
2923 /* We want readchar_count to be the number of characters, not 2924 /* We want readchar_count to be the number of characters, not
2924 bytes. Hence we adjust for multibyte characters in the 2925 bytes. Hence we adjust for multibyte characters in the
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 7a702fd45bf..62c40ca1f94 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -221,7 +221,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \
221 region-cache.c sound.c atimer.c \ 221 region-cache.c sound.c atimer.c \
222 doprnt.c intervals.c textprop.c composite.c 222 doprnt.c intervals.c textprop.c composite.c
223SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ 223SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
224 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o 224 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
225obj = $(GLOBAL_SOURCES:.c=.o) 225obj = $(GLOBAL_SOURCES:.c=.o)
226 226
227globals.h: gl-stamp 227globals.h: gl-stamp
@@ -386,6 +386,7 @@ $(BLD)/alloc.$(O) : \
386 $(EMACS_ROOT)/nt/inc/unistd.h \ 386 $(EMACS_ROOT)/nt/inc/unistd.h \
387 $(EMACS_ROOT)/nt/inc/sys/time.h \ 387 $(EMACS_ROOT)/nt/inc/sys/time.h \
388 $(LISP_H) \ 388 $(LISP_H) \
389 $(PROCESS_H) \
389 $(SRC)/atimer.h \ 390 $(SRC)/atimer.h \
390 $(SRC)/blockinput.h \ 391 $(SRC)/blockinput.h \
391 $(SRC)/buffer.h \ 392 $(SRC)/buffer.h \
@@ -396,7 +397,6 @@ $(BLD)/alloc.$(O) : \
396 $(SRC)/frame.h \ 397 $(SRC)/frame.h \
397 $(SRC)/intervals.h \ 398 $(SRC)/intervals.h \
398 $(SRC)/keyboard.h \ 399 $(SRC)/keyboard.h \
399 $(PROCESS_H) \
400 $(SRC)/puresize.h \ 400 $(SRC)/puresize.h \
401 $(SRC)/syssignal.h \ 401 $(SRC)/syssignal.h \
402 $(SRC)/systime.h \ 402 $(SRC)/systime.h \
@@ -484,8 +484,10 @@ $(BLD)/callproc.$(O) : \
484 $(CONFIG_H) \ 484 $(CONFIG_H) \
485 $(EMACS_ROOT)/nt/inc/unistd.h \ 485 $(EMACS_ROOT)/nt/inc/unistd.h \
486 $(EMACS_ROOT)/nt/inc/sys/file.h \ 486 $(EMACS_ROOT)/nt/inc/sys/file.h \
487 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
487 $(EMACS_ROOT)/nt/inc/sys/time.h \ 488 $(EMACS_ROOT)/nt/inc/sys/time.h \
488 $(LISP_H) \ 489 $(LISP_H) \
490 $(PROCESS_H) \
489 $(SRC)/atimer.h \ 491 $(SRC)/atimer.h \
490 $(SRC)/blockinput.h \ 492 $(SRC)/blockinput.h \
491 $(SRC)/buffer.h \ 493 $(SRC)/buffer.h \
@@ -497,7 +499,6 @@ $(BLD)/callproc.$(O) : \
497 $(SRC)/dispextern.h \ 499 $(SRC)/dispextern.h \
498 $(SRC)/epaths.h \ 500 $(SRC)/epaths.h \
499 $(SRC)/frame.h \ 501 $(SRC)/frame.h \
500 $(PROCESS_H) \
501 $(SRC)/syssignal.h \ 502 $(SRC)/syssignal.h \
502 $(SRC)/systime.h \ 503 $(SRC)/systime.h \
503 $(SRC)/systty.h \ 504 $(SRC)/systty.h \
@@ -653,6 +654,7 @@ $(BLD)/dired.$(O) : \
653 $(EMACS_ROOT)/nt/inc/unistd.h \ 654 $(EMACS_ROOT)/nt/inc/unistd.h \
654 $(EMACS_ROOT)/nt/inc/sys/dir.h \ 655 $(EMACS_ROOT)/nt/inc/sys/dir.h \
655 $(EMACS_ROOT)/nt/inc/sys/time.h \ 656 $(EMACS_ROOT)/nt/inc/sys/time.h \
657 $(EMACS_ROOT)/lib/filemode.h \
656 $(LISP_H) \ 658 $(LISP_H) \
657 $(SRC)/atimer.h \ 659 $(SRC)/atimer.h \
658 $(SRC)/blockinput.h \ 660 $(SRC)/blockinput.h \
@@ -662,7 +664,6 @@ $(BLD)/dired.$(O) : \
662 $(SRC)/coding.h \ 664 $(SRC)/coding.h \
663 $(SRC)/commands.h \ 665 $(SRC)/commands.h \
664 $(SRC)/composite.h \ 666 $(SRC)/composite.h \
665 $(EMACS_ROOT)/lib/filemode.h \
666 $(SRC)/ndir.h \ 667 $(SRC)/ndir.h \
667 $(SRC)/regex.h \ 668 $(SRC)/regex.h \
668 $(SRC)/systime.h 669 $(SRC)/systime.h
@@ -673,6 +674,7 @@ $(BLD)/dispnew.$(O) : \
673 $(EMACS_ROOT)/nt/inc/unistd.h \ 674 $(EMACS_ROOT)/nt/inc/unistd.h \
674 $(EMACS_ROOT)/nt/inc/sys/time.h \ 675 $(EMACS_ROOT)/nt/inc/sys/time.h \
675 $(LISP_H) \ 676 $(LISP_H) \
677 $(PROCESS_H) \
676 $(SRC)/atimer.h \ 678 $(SRC)/atimer.h \
677 $(SRC)/blockinput.h \ 679 $(SRC)/blockinput.h \
678 $(SRC)/buffer.h \ 680 $(SRC)/buffer.h \
@@ -687,7 +689,6 @@ $(BLD)/dispnew.$(O) : \
687 $(SRC)/indent.h \ 689 $(SRC)/indent.h \
688 $(SRC)/intervals.h \ 690 $(SRC)/intervals.h \
689 $(SRC)/keyboard.h \ 691 $(SRC)/keyboard.h \
690 $(PROCESS_H) \
691 $(SRC)/syssignal.h \ 692 $(SRC)/syssignal.h \
692 $(SRC)/systime.h \ 693 $(SRC)/systime.h \
693 $(SRC)/termchar.h \ 694 $(SRC)/termchar.h \
@@ -726,6 +727,7 @@ $(BLD)/editfns.$(O) : \
726 $(EMACS_ROOT)/nt/inc/pwd.h \ 727 $(EMACS_ROOT)/nt/inc/pwd.h \
727 $(EMACS_ROOT)/nt/inc/unistd.h \ 728 $(EMACS_ROOT)/nt/inc/unistd.h \
728 $(EMACS_ROOT)/nt/inc/sys/time.h \ 729 $(EMACS_ROOT)/nt/inc/sys/time.h \
730 $(EMACS_ROOT)/lib/intprops.h \
729 $(EMACS_ROOT)/lib/strftime.h \ 731 $(EMACS_ROOT)/lib/strftime.h \
730 $(LISP_H) \ 732 $(LISP_H) \
731 $(SRC)/atimer.h \ 733 $(SRC)/atimer.h \
@@ -746,8 +748,10 @@ $(BLD)/emacs.$(O) : \
746 $(CONFIG_H) \ 748 $(CONFIG_H) \
747 $(EMACS_ROOT)/nt/inc/unistd.h \ 749 $(EMACS_ROOT)/nt/inc/unistd.h \
748 $(EMACS_ROOT)/nt/inc/sys/file.h \ 750 $(EMACS_ROOT)/nt/inc/sys/file.h \
751 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
749 $(EMACS_ROOT)/nt/inc/sys/time.h \ 752 $(EMACS_ROOT)/nt/inc/sys/time.h \
750 $(LISP_H) \ 753 $(LISP_H) \
754 $(PROCESS_H) \
751 $(SRC)/atimer.h \ 755 $(SRC)/atimer.h \
752 $(SRC)/blockinput.h \ 756 $(SRC)/blockinput.h \
753 $(SRC)/buffer.h \ 757 $(SRC)/buffer.h \
@@ -756,15 +760,14 @@ $(BLD)/emacs.$(O) : \
756 $(SRC)/composite.h \ 760 $(SRC)/composite.h \
757 $(SRC)/dispextern.h \ 761 $(SRC)/dispextern.h \
758 $(SRC)/frame.h \ 762 $(SRC)/frame.h \
759 $(SRC)/gnutls.h \
760 $(SRC)/intervals.h \ 763 $(SRC)/intervals.h \
761 $(SRC)/keyboard.h \ 764 $(SRC)/keyboard.h \
762 $(SRC)/keymap.h \ 765 $(SRC)/keymap.h \
763 $(PROCESS_H) \
764 $(SRC)/syssignal.h \ 766 $(SRC)/syssignal.h \
765 $(SRC)/systime.h \ 767 $(SRC)/systime.h \
766 $(SRC)/systty.h \ 768 $(SRC)/systty.h \
767 $(SRC)/termhooks.h \ 769 $(SRC)/termhooks.h \
770 $(SRC)/unexec.h \
768 $(SRC)/w32.h \ 771 $(SRC)/w32.h \
769 $(SRC)/w32gui.h \ 772 $(SRC)/w32gui.h \
770 $(SRC)/w32heap.h \ 773 $(SRC)/w32heap.h \
@@ -836,6 +839,7 @@ $(BLD)/fns.$(O) : \
836 $(CONFIG_H) \ 839 $(CONFIG_H) \
837 $(EMACS_ROOT)/nt/inc/langinfo.h \ 840 $(EMACS_ROOT)/nt/inc/langinfo.h \
838 $(EMACS_ROOT)/nt/inc/nl_types.h \ 841 $(EMACS_ROOT)/nt/inc/nl_types.h \
842 $(EMACS_ROOT)/nt/inc/stdint.h \
839 $(EMACS_ROOT)/nt/inc/unistd.h \ 843 $(EMACS_ROOT)/nt/inc/unistd.h \
840 $(EMACS_ROOT)/nt/inc/sys/time.h \ 844 $(EMACS_ROOT)/nt/inc/sys/time.h \
841 $(EMACS_ROOT)/lib/md5.h \ 845 $(EMACS_ROOT)/lib/md5.h \
@@ -1029,6 +1033,7 @@ $(BLD)/keyboard.$(O) : \
1029 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \ 1033 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1030 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1034 $(EMACS_ROOT)/nt/inc/sys/time.h \
1031 $(LISP_H) \ 1035 $(LISP_H) \
1036 $(PROCESS_H) \
1032 $(SRC)/atimer.h \ 1037 $(SRC)/atimer.h \
1033 $(SRC)/blockinput.h \ 1038 $(SRC)/blockinput.h \
1034 $(SRC)/buffer.h \ 1039 $(SRC)/buffer.h \
@@ -1043,7 +1048,6 @@ $(BLD)/keyboard.$(O) : \
1043 $(SRC)/keyboard.h \ 1048 $(SRC)/keyboard.h \
1044 $(SRC)/keymap.h \ 1049 $(SRC)/keymap.h \
1045 $(SRC)/macros.h \ 1050 $(SRC)/macros.h \
1046 $(PROCESS_H) \
1047 $(SRC)/puresize.h \ 1051 $(SRC)/puresize.h \
1048 $(SRC)/syntax.h \ 1052 $(SRC)/syntax.h \
1049 $(SRC)/syssignal.h \ 1053 $(SRC)/syssignal.h \
@@ -1181,11 +1185,11 @@ $(BLD)/w32.$(O) : \
1181 $(EMACS_ROOT)/nt/inc/sys/socket.h \ 1185 $(EMACS_ROOT)/nt/inc/sys/socket.h \
1182 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1186 $(EMACS_ROOT)/nt/inc/sys/time.h \
1183 $(LISP_H) \ 1187 $(LISP_H) \
1188 $(PROCESS_H) \
1184 $(SRC)/coding.h \ 1189 $(SRC)/coding.h \
1185 $(SRC)/composite.h \ 1190 $(SRC)/composite.h \
1186 $(SRC)/dispextern.h \ 1191 $(SRC)/dispextern.h \
1187 $(SRC)/ndir.h \ 1192 $(SRC)/ndir.h \
1188 $(PROCESS_H) \
1189 $(SRC)/systime.h \ 1193 $(SRC)/systime.h \
1190 $(SRC)/w32.h \ 1194 $(SRC)/w32.h \
1191 $(SRC)/w32gui.h \ 1195 $(SRC)/w32gui.h \
@@ -1224,11 +1228,11 @@ $(BLD)/w32proc.$(O) : \
1224 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1228 $(EMACS_ROOT)/nt/inc/sys/file.h \
1225 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1229 $(EMACS_ROOT)/nt/inc/sys/time.h \
1226 $(LISP_H) \ 1230 $(LISP_H) \
1231 $(PROCESS_H) \
1227 $(SRC)/character.h \ 1232 $(SRC)/character.h \
1228 $(SRC)/coding.h \ 1233 $(SRC)/coding.h \
1229 $(SRC)/composite.h \ 1234 $(SRC)/composite.h \
1230 $(SRC)/dispextern.h \ 1235 $(SRC)/dispextern.h \
1231 $(PROCESS_H) \
1232 $(SRC)/syssignal.h \ 1236 $(SRC)/syssignal.h \
1233 $(SRC)/systime.h \ 1237 $(SRC)/systime.h \
1234 $(SRC)/syswait.h \ 1238 $(SRC)/syswait.h \
@@ -1260,6 +1264,7 @@ $(BLD)/print.$(O) : \
1260 $(EMACS_ROOT)/lib/ftoastr.h \ 1264 $(EMACS_ROOT)/lib/ftoastr.h \
1261 $(EMACS_ROOT)/lib/intprops.h \ 1265 $(EMACS_ROOT)/lib/intprops.h \
1262 $(LISP_H) \ 1266 $(LISP_H) \
1267 $(PROCESS_H) \
1263 $(SRC)/atimer.h \ 1268 $(SRC)/atimer.h \
1264 $(SRC)/blockinput.h \ 1269 $(SRC)/blockinput.h \
1265 $(SRC)/buffer.h \ 1270 $(SRC)/buffer.h \
@@ -1273,7 +1278,6 @@ $(BLD)/print.$(O) : \
1273 $(SRC)/frame.h \ 1278 $(SRC)/frame.h \
1274 $(SRC)/intervals.h \ 1279 $(SRC)/intervals.h \
1275 $(SRC)/keyboard.h \ 1280 $(SRC)/keyboard.h \
1276 $(PROCESS_H) \
1277 $(SRC)/systime.h \ 1281 $(SRC)/systime.h \
1278 $(SRC)/termchar.h \ 1282 $(SRC)/termchar.h \
1279 $(SRC)/termhooks.h \ 1283 $(SRC)/termhooks.h \
@@ -1288,9 +1292,11 @@ $(BLD)/process.$(O) : \
1288 $(EMACS_ROOT)/nt/inc/arpa/inet.h \ 1292 $(EMACS_ROOT)/nt/inc/arpa/inet.h \
1289 $(EMACS_ROOT)/nt/inc/netinet/in.h \ 1293 $(EMACS_ROOT)/nt/inc/netinet/in.h \
1290 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1294 $(EMACS_ROOT)/nt/inc/sys/file.h \
1295 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1291 $(EMACS_ROOT)/nt/inc/sys/socket.h \ 1296 $(EMACS_ROOT)/nt/inc/sys/socket.h \
1292 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1297 $(EMACS_ROOT)/nt/inc/sys/time.h \
1293 $(LISP_H) \ 1298 $(LISP_H) \
1299 $(PROCESS_H) \
1294 $(SRC)/atimer.h \ 1300 $(SRC)/atimer.h \
1295 $(SRC)/blockinput.h \ 1301 $(SRC)/blockinput.h \
1296 $(SRC)/buffer.h \ 1302 $(SRC)/buffer.h \
@@ -1301,7 +1307,6 @@ $(BLD)/process.$(O) : \
1301 $(SRC)/dispextern.h \ 1307 $(SRC)/dispextern.h \
1302 $(SRC)/frame.h \ 1308 $(SRC)/frame.h \
1303 $(SRC)/keyboard.h \ 1309 $(SRC)/keyboard.h \
1304 $(PROCESS_H) \
1305 $(SRC)/sysselect.h \ 1310 $(SRC)/sysselect.h \
1306 $(SRC)/syssignal.h \ 1311 $(SRC)/syssignal.h \
1307 $(SRC)/systime.h \ 1312 $(SRC)/systime.h \
@@ -1414,10 +1419,12 @@ $(BLD)/sysdep.$(O) : \
1414 $(EMACS_ROOT)/nt/inc/pwd.h \ 1419 $(EMACS_ROOT)/nt/inc/pwd.h \
1415 $(EMACS_ROOT)/nt/inc/unistd.h \ 1420 $(EMACS_ROOT)/nt/inc/unistd.h \
1416 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1421 $(EMACS_ROOT)/nt/inc/sys/file.h \
1422 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1417 $(EMACS_ROOT)/nt/inc/sys/socket.h \ 1423 $(EMACS_ROOT)/nt/inc/sys/socket.h \
1418 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1424 $(EMACS_ROOT)/nt/inc/sys/time.h \
1419 $(EMACS_ROOT)/lib/ignore-value.h \ 1425 $(EMACS_ROOT)/lib/ignore-value.h \
1420 $(LISP_H) \ 1426 $(LISP_H) \
1427 $(PROCESS_H) \
1421 $(SRC)/atimer.h \ 1428 $(SRC)/atimer.h \
1422 $(SRC)/blockinput.h \ 1429 $(SRC)/blockinput.h \
1423 $(SRC)/cm.h \ 1430 $(SRC)/cm.h \
@@ -1426,7 +1433,6 @@ $(BLD)/sysdep.$(O) : \
1426 $(SRC)/dispextern.h \ 1433 $(SRC)/dispextern.h \
1427 $(SRC)/frame.h \ 1434 $(SRC)/frame.h \
1428 $(SRC)/keyboard.h \ 1435 $(SRC)/keyboard.h \
1429 $(PROCESS_H) \
1430 $(SRC)/sysselect.h \ 1436 $(SRC)/sysselect.h \
1431 $(SRC)/syssignal.h \ 1437 $(SRC)/syssignal.h \
1432 $(SRC)/systime.h \ 1438 $(SRC)/systime.h \
@@ -1444,6 +1450,7 @@ $(BLD)/term.$(O) : \
1444 $(CONFIG_H) \ 1450 $(CONFIG_H) \
1445 $(EMACS_ROOT)/nt/inc/unistd.h \ 1451 $(EMACS_ROOT)/nt/inc/unistd.h \
1446 $(EMACS_ROOT)/nt/inc/sys/file.h \ 1452 $(EMACS_ROOT)/nt/inc/sys/file.h \
1453 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1447 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1454 $(EMACS_ROOT)/nt/inc/sys/time.h \
1448 $(LISP_H) \ 1455 $(LISP_H) \
1449 $(SRC)/atimer.h \ 1456 $(SRC)/atimer.h \
@@ -1466,6 +1473,7 @@ $(BLD)/term.$(O) : \
1466 $(SRC)/termchar.h \ 1473 $(SRC)/termchar.h \
1467 $(SRC)/termhooks.h \ 1474 $(SRC)/termhooks.h \
1468 $(SRC)/termopts.h \ 1475 $(SRC)/termopts.h \
1476 $(SRC)/tparam.h \
1469 $(SRC)/w32gui.h \ 1477 $(SRC)/w32gui.h \
1470 $(SRC)/window.h 1478 $(SRC)/window.h
1471 1479
@@ -1499,7 +1507,8 @@ $(BLD)/textprop.$(O) : \
1499$(BLD)/tparam.$(O) : \ 1507$(BLD)/tparam.$(O) : \
1500 $(SRC)/tparam.c \ 1508 $(SRC)/tparam.c \
1501 $(CONFIG_H) \ 1509 $(CONFIG_H) \
1502 $(LISP_H) 1510 $(LISP_H) \
1511 $(SRC)/tparam.h
1503 1512
1504$(BLD)/undo.$(O) : \ 1513$(BLD)/undo.$(O) : \
1505 $(SRC)/undo.c \ 1514 $(SRC)/undo.c \
@@ -1514,6 +1523,7 @@ $(BLD)/undo.$(O) : \
1514$(BLD)/unexw32.$(O) : \ 1523$(BLD)/unexw32.$(O) : \
1515 $(SRC)/unexw32.c \ 1524 $(SRC)/unexw32.c \
1516 $(CONFIG_H) \ 1525 $(CONFIG_H) \
1526 $(SRC)/unexec.h \
1517 $(SRC)/w32heap.h 1527 $(SRC)/w32heap.h
1518 1528
1519$(BLD)/vm-limit.$(O) : \ 1529$(BLD)/vm-limit.$(O) : \
@@ -1553,6 +1563,7 @@ $(BLD)/xdisp.$(O) : \
1553 $(EMACS_ROOT)/nt/inc/unistd.h \ 1563 $(EMACS_ROOT)/nt/inc/unistd.h \
1554 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1564 $(EMACS_ROOT)/nt/inc/sys/time.h \
1555 $(LISP_H) \ 1565 $(LISP_H) \
1566 $(PROCESS_H) \
1556 $(SRC)/atimer.h \ 1567 $(SRC)/atimer.h \
1557 $(SRC)/blockinput.h \ 1568 $(SRC)/blockinput.h \
1558 $(SRC)/buffer.h \ 1569 $(SRC)/buffer.h \
@@ -1572,7 +1583,6 @@ $(BLD)/xdisp.$(O) : \
1572 $(SRC)/keyboard.h \ 1583 $(SRC)/keyboard.h \
1573 $(SRC)/keymap.h \ 1584 $(SRC)/keymap.h \
1574 $(SRC)/macros.h \ 1585 $(SRC)/macros.h \
1575 $(PROCESS_H) \
1576 $(SRC)/region-cache.h \ 1586 $(SRC)/region-cache.h \
1577 $(SRC)/systime.h \ 1587 $(SRC)/systime.h \
1578 $(SRC)/termchar.h \ 1588 $(SRC)/termchar.h \
@@ -1664,8 +1674,10 @@ $(BLD)/w32term.$(O) : \
1664 $(SRC)/w32term.c \ 1674 $(SRC)/w32term.c \
1665 $(CONFIG_H) \ 1675 $(CONFIG_H) \
1666 $(EMACS_ROOT)/nt/inc/unistd.h \ 1676 $(EMACS_ROOT)/nt/inc/unistd.h \
1677 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1667 $(EMACS_ROOT)/nt/inc/sys/time.h \ 1678 $(EMACS_ROOT)/nt/inc/sys/time.h \
1668 $(LISP_H) \ 1679 $(LISP_H) \
1680 $(PROCESS_H) \
1669 $(SRC)/atimer.h \ 1681 $(SRC)/atimer.h \
1670 $(SRC)/blockinput.h \ 1682 $(SRC)/blockinput.h \
1671 $(SRC)/buffer.h \ 1683 $(SRC)/buffer.h \
@@ -1682,7 +1694,6 @@ $(BLD)/w32term.$(O) : \
1682 $(SRC)/intervals.h \ 1694 $(SRC)/intervals.h \
1683 $(SRC)/keyboard.h \ 1695 $(SRC)/keyboard.h \
1684 $(SRC)/keymap.h \ 1696 $(SRC)/keymap.h \
1685 $(PROCESS_H) \
1686 $(SRC)/systime.h \ 1697 $(SRC)/systime.h \
1687 $(SRC)/systty.h \ 1698 $(SRC)/systty.h \
1688 $(SRC)/termchar.h \ 1699 $(SRC)/termchar.h \
@@ -1705,7 +1716,6 @@ $(BLD)/w32select.$(O) : \
1705 $(SRC)/charset.h \ 1716 $(SRC)/charset.h \
1706 $(SRC)/coding.h \ 1717 $(SRC)/coding.h \
1707 $(SRC)/composite.h \ 1718 $(SRC)/composite.h \
1708 $(SRC)/keyboard.h \
1709 $(SRC)/systime.h \ 1719 $(SRC)/systime.h \
1710 $(SRC)/w32gui.h \ 1720 $(SRC)/w32gui.h \
1711 $(SRC)/w32heap.h \ 1721 $(SRC)/w32heap.h \
diff --git a/src/marker.c b/src/marker.c
index 72c564f420f..7d461099140 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -257,9 +257,10 @@ verify_bytepos (EMACS_INT charpos)
257 return below_byte; 257 return below_byte;
258} 258}
259 259
260/* bytepos_to_charpos returns the char position corresponding to BYTEPOS. */ 260/* buf_bytepos_to_charpos returns the char position corresponding to
261 BYTEPOS. */
261 262
262/* This macro is a subroutine of bytepos_to_charpos. 263/* This macro is a subroutine of buf_bytepos_to_charpos.
263 It is used when BYTEPOS is actually the byte position. */ 264 It is used when BYTEPOS is actually the byte position. */
264 265
265#define CONSIDER(BYTEPOS, CHARPOS) \ 266#define CONSIDER(BYTEPOS, CHARPOS) \
@@ -303,12 +304,6 @@ verify_bytepos (EMACS_INT charpos)
303} 304}
304 305
305EMACS_INT 306EMACS_INT
306bytepos_to_charpos (EMACS_INT bytepos)
307{
308 return buf_bytepos_to_charpos (current_buffer, bytepos);
309}
310
311EMACS_INT
312buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos) 307buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos)
313{ 308{
314 struct Lisp_Marker *tail; 309 struct Lisp_Marker *tail;
@@ -896,4 +891,3 @@ syms_of_marker (void)
896 doc: /* Non-nil enables debugging checks in byte/char position conversions. */); 891 doc: /* Non-nil enables debugging checks in byte/char position conversions. */);
897 byte_debug_flag = 0; 892 byte_debug_flag = 0;
898} 893}
899
diff --git a/src/minibuf.c b/src/minibuf.c
index 75a24686d5a..986765ae6fb 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -72,6 +72,7 @@ Lisp_Object Qcompletion_ignore_case;
72Lisp_Object Qminibuffer_completion_table; 72Lisp_Object Qminibuffer_completion_table;
73Lisp_Object Qminibuffer_completion_predicate; 73Lisp_Object Qminibuffer_completion_predicate;
74Lisp_Object Qminibuffer_completion_confirm; 74Lisp_Object Qminibuffer_completion_confirm;
75Lisp_Object Qcompleting_read_default;
75Lisp_Object Quser_variable_p; 76Lisp_Object Quser_variable_p;
76 77
77Lisp_Object Qminibuffer_default; 78Lisp_Object Qminibuffer_default;
@@ -135,7 +136,7 @@ choose_minibuf_frame (void)
135 } 136 }
136} 137}
137 138
138Lisp_Object 139static Lisp_Object
139choose_minibuf_frame_1 (Lisp_Object ignore) 140choose_minibuf_frame_1 (Lisp_Object ignore)
140{ 141{
141 choose_minibuf_frame (); 142 choose_minibuf_frame ();
@@ -1213,7 +1214,7 @@ is used to further constrain the set of candidates. */)
1213 && (!SYMBOLP (XCAR (collection)) 1214 && (!SYMBOLP (XCAR (collection))
1214 || NILP (XCAR (collection))))) 1215 || NILP (XCAR (collection)))))
1215 ? list_table : function_table)); 1216 ? list_table : function_table));
1216 int index = 0, obsize = 0; 1217 int idx = 0, obsize = 0;
1217 int matchcount = 0; 1218 int matchcount = 0;
1218 int bindcount = -1; 1219 int bindcount = -1;
1219 Lisp_Object bucket, zero, end, tem; 1220 Lisp_Object bucket, zero, end, tem;
@@ -1232,7 +1233,7 @@ is used to further constrain the set of candidates. */)
1232 { 1233 {
1233 collection = check_obarray (collection); 1234 collection = check_obarray (collection);
1234 obsize = XVECTOR (collection)->size; 1235 obsize = XVECTOR (collection)->size;
1235 bucket = XVECTOR (collection)->contents[index]; 1236 bucket = XVECTOR (collection)->contents[idx];
1236 } 1237 }
1237 1238
1238 while (1) 1239 while (1)
@@ -1263,23 +1264,23 @@ is used to further constrain the set of candidates. */)
1263 else 1264 else
1264 XSETFASTINT (bucket, 0); 1265 XSETFASTINT (bucket, 0);
1265 } 1266 }
1266 else if (++index >= obsize) 1267 else if (++idx >= obsize)
1267 break; 1268 break;
1268 else 1269 else
1269 { 1270 {
1270 bucket = XVECTOR (collection)->contents[index]; 1271 bucket = XVECTOR (collection)->contents[idx];
1271 continue; 1272 continue;
1272 } 1273 }
1273 } 1274 }
1274 else /* if (type == hash_table) */ 1275 else /* if (type == hash_table) */
1275 { 1276 {
1276 while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) 1277 while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection))
1277 && NILP (HASH_HASH (XHASH_TABLE (collection), index))) 1278 && NILP (HASH_HASH (XHASH_TABLE (collection), idx)))
1278 index++; 1279 idx++;
1279 if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) 1280 if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection)))
1280 break; 1281 break;
1281 else 1282 else
1282 elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); 1283 elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++);
1283 } 1284 }
1284 1285
1285 /* Is this element a possible completion? */ 1286 /* Is this element a possible completion? */
@@ -1334,7 +1335,7 @@ is used to further constrain the set of candidates. */)
1334 tem = (type == hash_table 1335 tem = (type == hash_table
1335 ? call2 (predicate, elt, 1336 ? call2 (predicate, elt,
1336 HASH_VALUE (XHASH_TABLE (collection), 1337 HASH_VALUE (XHASH_TABLE (collection),
1337 index - 1)) 1338 idx - 1))
1338 : call1 (predicate, elt)); 1339 : call1 (predicate, elt));
1339 UNGCPRO; 1340 UNGCPRO;
1340 } 1341 }
@@ -1478,7 +1479,7 @@ with a space are ignored unless STRING itself starts with a space. */)
1478 : NILP (collection) || (CONSP (collection) 1479 : NILP (collection) || (CONSP (collection)
1479 && (!SYMBOLP (XCAR (collection)) 1480 && (!SYMBOLP (XCAR (collection))
1480 || NILP (XCAR (collection)))); 1481 || NILP (XCAR (collection))));
1481 int index = 0, obsize = 0; 1482 int idx = 0, obsize = 0;
1482 int bindcount = -1; 1483 int bindcount = -1;
1483 Lisp_Object bucket, tem, zero; 1484 Lisp_Object bucket, tem, zero;
1484 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1485 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -1495,7 +1496,7 @@ with a space are ignored unless STRING itself starts with a space. */)
1495 { 1496 {
1496 collection = check_obarray (collection); 1497 collection = check_obarray (collection);
1497 obsize = XVECTOR (collection)->size; 1498 obsize = XVECTOR (collection)->size;
1498 bucket = XVECTOR (collection)->contents[index]; 1499 bucket = XVECTOR (collection)->contents[idx];
1499 } 1500 }
1500 1501
1501 while (1) 1502 while (1)
@@ -1526,23 +1527,23 @@ with a space are ignored unless STRING itself starts with a space. */)
1526 else 1527 else
1527 XSETFASTINT (bucket, 0); 1528 XSETFASTINT (bucket, 0);
1528 } 1529 }
1529 else if (++index >= obsize) 1530 else if (++idx >= obsize)
1530 break; 1531 break;
1531 else 1532 else
1532 { 1533 {
1533 bucket = XVECTOR (collection)->contents[index]; 1534 bucket = XVECTOR (collection)->contents[idx];
1534 continue; 1535 continue;
1535 } 1536 }
1536 } 1537 }
1537 else /* if (type == 3) */ 1538 else /* if (type == 3) */
1538 { 1539 {
1539 while (index < HASH_TABLE_SIZE (XHASH_TABLE (collection)) 1540 while (idx < HASH_TABLE_SIZE (XHASH_TABLE (collection))
1540 && NILP (HASH_HASH (XHASH_TABLE (collection), index))) 1541 && NILP (HASH_HASH (XHASH_TABLE (collection), idx)))
1541 index++; 1542 idx++;
1542 if (index >= HASH_TABLE_SIZE (XHASH_TABLE (collection))) 1543 if (idx >= HASH_TABLE_SIZE (XHASH_TABLE (collection)))
1543 break; 1544 break;
1544 else 1545 else
1545 elt = eltstring = HASH_KEY (XHASH_TABLE (collection), index++); 1546 elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++);
1546 } 1547 }
1547 1548
1548 /* Is this element a possible completion? */ 1549 /* Is this element a possible completion? */
@@ -1567,8 +1568,6 @@ with a space are ignored unless STRING itself starts with a space. */)
1567 { 1568 {
1568 /* Yes. */ 1569 /* Yes. */
1569 Lisp_Object regexps; 1570 Lisp_Object regexps;
1570 Lisp_Object zero;
1571 XSETFASTINT (zero, 0);
1572 1571
1573 /* Ignore this element if it fails to match all the regexps. */ 1572 /* Ignore this element if it fails to match all the regexps. */
1574 { 1573 {
@@ -1604,7 +1603,7 @@ with a space are ignored unless STRING itself starts with a space. */)
1604 GCPRO4 (tail, eltstring, allmatches, string); 1603 GCPRO4 (tail, eltstring, allmatches, string);
1605 tem = type == 3 1604 tem = type == 3
1606 ? call2 (predicate, elt, 1605 ? call2 (predicate, elt,
1607 HASH_VALUE (XHASH_TABLE (collection), index - 1)) 1606 HASH_VALUE (XHASH_TABLE (collection), idx - 1))
1608 : call1 (predicate, elt); 1607 : call1 (predicate, elt);
1609 UNGCPRO; 1608 UNGCPRO;
1610 } 1609 }
@@ -1677,7 +1676,27 @@ If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits
1677 the current input method and the setting of `enable-multibyte-characters'. 1676 the current input method and the setting of `enable-multibyte-characters'.
1678 1677
1679Completion ignores case if the ambient value of 1678Completion ignores case if the ambient value of
1680 `completion-ignore-case' is non-nil. */) 1679 `completion-ignore-case' is non-nil.
1680
1681See also `completing-read-function'. */)
1682 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
1683{
1684 Lisp_Object args[9];
1685 args[0] = Vcompleting_read_function;
1686 args[1] = prompt;
1687 args[2] = collection;
1688 args[3] = predicate;
1689 args[4] = require_match;
1690 args[5] = initial_input;
1691 args[6] = hist;
1692 args[7] = def;
1693 args[8] = inherit_input_method;
1694 return Ffuncall (9, args);
1695}
1696
1697DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0,
1698 doc: /* Default method for reading from the minibuffer with completion.
1699See `completing-read' for the meaning of the arguments. */)
1681 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) 1700 (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method)
1682{ 1701{
1683 Lisp_Object val, histvar, histpos, position; 1702 Lisp_Object val, histvar, histpos, position;
@@ -1975,6 +1994,9 @@ syms_of_minibuf (void)
1975 minibuf_save_list = Qnil; 1994 minibuf_save_list = Qnil;
1976 staticpro (&minibuf_save_list); 1995 staticpro (&minibuf_save_list);
1977 1996
1997 Qcompleting_read_default = intern_c_string ("completing-read-default");
1998 staticpro (&Qcompleting_read_default);
1999
1978 Qcompletion_ignore_case = intern_c_string ("completion-ignore-case"); 2000 Qcompletion_ignore_case = intern_c_string ("completion-ignore-case");
1979 staticpro (&Qcompletion_ignore_case); 2001 staticpro (&Qcompletion_ignore_case);
1980 2002
@@ -2119,6 +2141,12 @@ If the value is `confirm-after-completion', the user may exit with an
2119 doc: /* Non-nil means completing file names. */); 2141 doc: /* Non-nil means completing file names. */);
2120 Vminibuffer_completing_file_name = Qnil; 2142 Vminibuffer_completing_file_name = Qnil;
2121 2143
2144 DEFVAR_LISP ("completing-read-function",
2145 Vcompleting_read_function,
2146 doc: /* The function called by `completing-read' to do the work.
2147It should accept the same arguments as `completing-read'. */);
2148 Vcompleting_read_function = Qcompleting_read_default;
2149
2122 DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, 2150 DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form,
2123 doc: /* Value that `help-form' takes on inside the minibuffer. */); 2151 doc: /* Value that `help-form' takes on inside the minibuffer. */);
2124 Vminibuffer_help_form = Qnil; 2152 Vminibuffer_help_form = Qnil;
@@ -2194,4 +2222,5 @@ properties. */);
2194 defsubr (&Stest_completion); 2222 defsubr (&Stest_completion);
2195 defsubr (&Sassoc_string); 2223 defsubr (&Sassoc_string);
2196 defsubr (&Scompleting_read); 2224 defsubr (&Scompleting_read);
2225 defsubr (&Scompleting_read_default);
2197} 2226}
diff --git a/src/msdos.c b/src/msdos.c
index 261a09ac859..b0bf5c4fdd9 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -844,6 +844,7 @@ IT_set_face (int face)
844 844
845extern unsigned char *encode_terminal_code (struct glyph *, int, 845extern unsigned char *encode_terminal_code (struct glyph *, int,
846 struct coding_system *); 846 struct coding_system *);
847
847static void 848static void
848IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) 849IT_write_glyphs (struct frame *f, struct glyph *str, int str_len)
849{ 850{
@@ -2998,17 +2999,17 @@ XMenuCreate (Display *foo1, Window foo2, char *foo3)
2998 to do. */ 2999 to do. */
2999 3000
3000int 3001int
3001XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) 3002XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable)
3002{ 3003{
3003 int len; 3004 int len;
3004 char *p; 3005 const char *p;
3005 3006
3006 if (!enable) 3007 if (!enable)
3007 abort (); 3008 abort ();
3008 3009
3009 IT_menu_make_room (menu); 3010 IT_menu_make_room (menu);
3010 menu->submenu[menu->count] = IT_menu_create (); 3011 menu->submenu[menu->count] = IT_menu_create ();
3011 menu->text[menu->count] = txt; 3012 menu->text[menu->count] = (char *)txt;
3012 menu->panenumber[menu->count] = ++menu->panecount; 3013 menu->panenumber[menu->count] = ++menu->panecount;
3013 menu->help_text[menu->count] = NULL; 3014 menu->help_text[menu->count] = NULL;
3014 menu->count++; 3015 menu->count++;
diff --git a/src/msdos.h b/src/msdos.h
index 4bbe9b134de..5051f2f3837 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -105,7 +105,7 @@ typedef struct x_menu_struct
105} XMenu; 105} XMenu;
106 106
107XMenu *XMenuCreate (Display *, Window, char *); 107XMenu *XMenuCreate (Display *, Window, char *);
108int XMenuAddPane (Display *, XMenu *, char *, int); 108int XMenuAddPane (Display *, XMenu *, const char *, int);
109int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *); 109int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *);
110void XMenuLocate (Display *, XMenu *, int, int, int, int, 110void XMenuLocate (Display *, XMenu *, int, int, int, int,
111 int *, int *, int *, int *); 111 int *, int *, int *, int *);
diff --git a/src/nsterm.m b/src/nsterm.m
index cc2c4cf9807..c7cd411c614 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2235 -------------------------------------------------------------------------- */ 2235 -------------------------------------------------------------------------- */
2236{ 2236{
2237 NSRect r, s; 2237 NSRect r, s;
2238 int fx, fy, h; 2238 int fx, fy, h, cursor_height;
2239 struct frame *f = WINDOW_XFRAME (w); 2239 struct frame *f = WINDOW_XFRAME (w);
2240 struct glyph *phys_cursor_glyph; 2240 struct glyph *phys_cursor_glyph;
2241 int overspill; 2241 int overspill;
@@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2279 get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h); 2279 get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h);
2280 2280
2281 /* The above get_phys_cursor_geometry call set w->phys_cursor_width 2281 /* The above get_phys_cursor_geometry call set w->phys_cursor_width
2282 to the glyph width; replace with CURSOR_WIDTH for bar cursors. */ 2282 to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */
2283 if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR) 2283 if (cursor_type == BAR_CURSOR)
2284 { 2284 {
2285 if (cursor_width < 1) 2285 if (cursor_width < 1)
2286 cursor_width = max (FRAME_CURSOR_WIDTH (f), 1); 2286 cursor_width = max (FRAME_CURSOR_WIDTH (f), 1);
2287 w->phys_cursor_width = cursor_width; 2287 w->phys_cursor_width = cursor_width;
2288 } 2288 }
2289 /* If we have an HBAR, "cursor_width" MAY specify height. */
2290 else if (cursor_type == HBAR_CURSOR)
2291 {
2292 cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width;
2293 fy += h - cursor_height;
2294 h = cursor_height;
2295 }
2289 2296
2290 r.origin.x = fx, r.origin.y = fy; 2297 r.origin.x = fx, r.origin.y = fy;
2291 r.size.height = h; 2298 r.size.height = h;
@@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
2337 [FRAME_CURSOR_COLOR (f) set]; 2344 [FRAME_CURSOR_COLOR (f) set];
2338 break; 2345 break;
2339 case HBAR_CURSOR: 2346 case HBAR_CURSOR:
2340 s = r; 2347 NSRectFill (r);
2341 s.origin.y += lrint (0.75 * s.size.height);
2342 s.size.height = lrint (s.size.height * 0.25);
2343 NSRectFill (s);
2344 break; 2348 break;
2345 case BAR_CURSOR: 2349 case BAR_CURSOR:
2346 s = r; 2350 s = r;
diff --git a/src/print.c b/src/print.c
index 602575b5b08..b8266422473 100644
--- a/src/print.c
+++ b/src/print.c
@@ -801,7 +801,7 @@ append to existing target file. */)
801 { 801 {
802 file = Fexpand_file_name (file, Qnil); 802 file = Fexpand_file_name (file, Qnil);
803 initial_stderr_stream = stderr; 803 initial_stderr_stream = stderr;
804 stderr = fopen (SDATA (file), NILP (append) ? "w" : "a"); 804 stderr = fopen (SSDATA (file), NILP (append) ? "w" : "a");
805 if (stderr == NULL) 805 if (stderr == NULL)
806 { 806 {
807 stderr = initial_stderr_stream; 807 stderr = initial_stderr_stream;
@@ -1120,6 +1120,16 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
1120 print_object (obj, printcharfun, escapeflag); 1120 print_object (obj, printcharfun, escapeflag);
1121} 1121}
1122 1122
1123#define PRINT_CIRCLE_CANDIDATE_P(obj) \
1124 (STRINGP (obj) || CONSP (obj) \
1125 || (VECTORLIKEP (obj) \
1126 && (VECTORP (obj) || COMPILEDP (obj) \
1127 || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \
1128 || HASH_TABLE_P (obj) || FONTP (obj))) \
1129 || (! NILP (Vprint_gensym) \
1130 && SYMBOLP (obj) \
1131 && !SYMBOL_INTERNED_P (obj)))
1132
1123/* Construct Vprint_number_table according to the structure of OBJ. 1133/* Construct Vprint_number_table according to the structure of OBJ.
1124 OBJ itself and all its elements will be added to Vprint_number_table 1134 OBJ itself and all its elements will be added to Vprint_number_table
1125 recursively if it is a list, vector, compiled function, char-table, 1135 recursively if it is a list, vector, compiled function, char-table,
@@ -1154,12 +1164,7 @@ print_preprocess (Lisp_Object obj)
1154 halftail = obj; 1164 halftail = obj;
1155 1165
1156 loop: 1166 loop:
1157 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1167 if (PRINT_CIRCLE_CANDIDATE_P (obj))
1158 || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
1159 || HASH_TABLE_P (obj)
1160 || (! NILP (Vprint_gensym)
1161 && SYMBOLP (obj)
1162 && !SYMBOL_INTERNED_P (obj)))
1163 { 1168 {
1164 if (!HASH_TABLE_P (Vprint_number_table)) 1169 if (!HASH_TABLE_P (Vprint_number_table))
1165 { 1170 {
@@ -1336,12 +1341,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
1336 error ("Apparently circular structure being printed"); 1341 error ("Apparently circular structure being printed");
1337 1342
1338 /* Detect circularities and truncate them. */ 1343 /* Detect circularities and truncate them. */
1339 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1344 if (PRINT_CIRCLE_CANDIDATE_P (obj))
1340 || COMPILEDP (obj) || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj)
1341 || HASH_TABLE_P (obj)
1342 || (! NILP (Vprint_gensym)
1343 && SYMBOLP (obj)
1344 && !SYMBOL_INTERNED_P (obj)))
1345 { 1345 {
1346 if (NILP (Vprint_circle) && NILP (Vprint_gensym)) 1346 if (NILP (Vprint_circle) && NILP (Vprint_gensym))
1347 { 1347 {
diff --git a/src/process.c b/src/process.c
index 210287a85f1..c9b420ab2ae 100644
--- a/src/process.c
+++ b/src/process.c
@@ -162,12 +162,6 @@ extern Lisp_Object QCfilter;
162/* Define first descriptor number available for subprocesses. */ 162/* Define first descriptor number available for subprocesses. */
163#define FIRST_PROC_DESC 3 163#define FIRST_PROC_DESC 3
164 164
165extern const char *get_operating_system_release (void);
166
167/* From sysdep.c or w32.c */
168extern int serial_open (char *port);
169extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
170
171#ifndef HAVE_H_ERRNO 165#ifndef HAVE_H_ERRNO
172extern int h_errno; 166extern int h_errno;
173#endif 167#endif
@@ -499,7 +493,7 @@ status_message (struct Lisp_Process *p)
499 string = (code_convert_string_norecord 493 string = (code_convert_string_norecord
500 (string, Vlocale_coding_system, 0)); 494 (string, Vlocale_coding_system, 0));
501 c1 = STRING_CHAR (SDATA (string)); 495 c1 = STRING_CHAR (SDATA (string));
502 c2 = DOWNCASE (c1); 496 c2 = downcase (c1);
503 if (c1 != c2) 497 if (c1 != c2)
504 Faset (string, make_number (0), make_number (c2)); 498 Faset (string, make_number (0), make_number (c2));
505 } 499 }
@@ -541,17 +535,16 @@ static char pty_name[24];
541static int 535static int
542allocate_pty (void) 536allocate_pty (void)
543{ 537{
544 register int c, i;
545 int fd; 538 int fd;
546 539
547#ifdef PTY_ITERATION 540#ifdef PTY_ITERATION
548 PTY_ITERATION 541 PTY_ITERATION
549#else 542#else
543 register int c, i;
550 for (c = FIRST_PTY_LETTER; c <= 'z'; c++) 544 for (c = FIRST_PTY_LETTER; c <= 'z'; c++)
551 for (i = 0; i < 16; i++) 545 for (i = 0; i < 16; i++)
552#endif 546#endif
553 { 547 {
554 struct stat stb; /* Used in some PTY_OPEN. */
555#ifdef PTY_NAME_SPRINTF 548#ifdef PTY_NAME_SPRINTF
556 PTY_NAME_SPRINTF 549 PTY_NAME_SPRINTF
557#else 550#else
@@ -568,6 +561,7 @@ allocate_pty (void)
568 three failures in a row before deciding that we've reached the 561 three failures in a row before deciding that we've reached the
569 end of the ptys. */ 562 end of the ptys. */
570 int failed_count = 0; 563 int failed_count = 0;
564 struct stat stb;
571 565
572 if (stat (pty_name, &stb) < 0) 566 if (stat (pty_name, &stb) < 0)
573 { 567 {
@@ -2730,7 +2724,8 @@ usage: (serial-process-configure &rest ARGS) */)
2730} 2724}
2731 2725
2732/* Used by make-serial-process to recover from errors. */ 2726/* Used by make-serial-process to recover from errors. */
2733Lisp_Object make_serial_process_unwind (Lisp_Object proc) 2727static Lisp_Object
2728make_serial_process_unwind (Lisp_Object proc)
2734{ 2729{
2735 if (!PROCESSP (proc)) 2730 if (!PROCESSP (proc))
2736 abort (); 2731 abort ();
@@ -5482,7 +5477,7 @@ read_process_output (Lisp_Object proc, register int channel)
5482jmp_buf send_process_frame; 5477jmp_buf send_process_frame;
5483Lisp_Object process_sent_to; 5478Lisp_Object process_sent_to;
5484 5479
5485SIGTYPE 5480static SIGTYPE
5486send_process_trap (int ignore) 5481send_process_trap (int ignore)
5487{ 5482{
5488 SIGNAL_THREAD_CHECK (SIGPIPE); 5483 SIGNAL_THREAD_CHECK (SIGPIPE);
@@ -6391,7 +6386,7 @@ process has been transmitted to the serial port. */)
6391 indirectly; if it does, that is a bug */ 6386 indirectly; if it does, that is a bug */
6392 6387
6393#ifdef SIGCHLD 6388#ifdef SIGCHLD
6394SIGTYPE 6389static SIGTYPE
6395sigchld_handler (int signo) 6390sigchld_handler (int signo)
6396{ 6391{
6397 int old_errno = errno; 6392 int old_errno = errno;
diff --git a/src/regex.c b/src/regex.c
index 9284be95ffb..a60ff0ce35c 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -340,7 +340,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
340 || ((c) >= 'A' && (c) <= 'Z')) \ 340 || ((c) >= 'A' && (c) <= 'Z')) \
341 : SYNTAX (c) == Sword) 341 : SYNTAX (c) == Sword)
342 342
343# define ISLOWER(c) (LOWERCASEP (c)) 343# define ISLOWER(c) lowercasep (c)
344 344
345# define ISPUNCT(c) (IS_REAL_ASCII (c) \ 345# define ISPUNCT(c) (IS_REAL_ASCII (c) \
346 ? ((c) > ' ' && (c) < 0177 \ 346 ? ((c) > ' ' && (c) < 0177 \
@@ -351,7 +351,7 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 };
351 351
352# define ISSPACE(c) (SYNTAX (c) == Swhitespace) 352# define ISSPACE(c) (SYNTAX (c) == Swhitespace)
353 353
354# define ISUPPER(c) (UPPERCASEP (c)) 354# define ISUPPER(c) uppercasep (c)
355 355
356# define ISWORD(c) (SYNTAX (c) == Sword) 356# define ISWORD(c) (SYNTAX (c) == Sword)
357 357
@@ -551,8 +551,6 @@ init_syntax_once (void)
551/* (Re)Allocate N items of type T using malloc, or fail. */ 551/* (Re)Allocate N items of type T using malloc, or fail. */
552#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) 552#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t)))
553#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) 553#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t)))
554#define RETALLOC_IF(addr, n, t) \
555 if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
556#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) 554#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t)))
557 555
558#define BYTEWIDTH 8 /* In bits. */ 556#define BYTEWIDTH 8 /* In bits. */
@@ -843,11 +841,6 @@ extract_number_and_incr (destination, source)
843 ((p)[2 + CHARSET_BITMAP_SIZE (p)] \ 841 ((p)[2 + CHARSET_BITMAP_SIZE (p)] \
844 + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100) 842 + (p)[3 + CHARSET_BITMAP_SIZE (p)] * 0x100)
845 843
846/* Test if C is listed in the bitmap of charset P. */
847#define CHARSET_LOOKUP_BITMAP(p, c) \
848 ((c) < CHARSET_BITMAP_SIZE (p) * BYTEWIDTH \
849 && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH)))
850
851/* Return the address of end of RANGE_TABLE. COUNT is number of 844/* Return the address of end of RANGE_TABLE. COUNT is number of
852 ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' 845 ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2'
853 is start of range and end of range. `* 3' is size of each start 846 is start of range and end of range. `* 3' is size of each start
@@ -861,14 +854,14 @@ extract_number_and_incr (destination, source)
861 do \ 854 do \
862 { \ 855 { \
863 re_wchar_t range_start, range_end; \ 856 re_wchar_t range_start, range_end; \
864 re_char *p; \ 857 re_char *rtp; \
865 re_char *range_table_end \ 858 re_char *range_table_end \
866 = CHARSET_RANGE_TABLE_END ((range_table), (count)); \ 859 = CHARSET_RANGE_TABLE_END ((range_table), (count)); \
867 \ 860 \
868 for (p = (range_table); p < range_table_end; p += 2 * 3) \ 861 for (rtp = (range_table); rtp < range_table_end; rtp += 2 * 3) \
869 { \ 862 { \
870 EXTRACT_CHARACTER (range_start, p); \ 863 EXTRACT_CHARACTER (range_start, rtp); \
871 EXTRACT_CHARACTER (range_end, p + 3); \ 864 EXTRACT_CHARACTER (range_end, rtp + 3); \
872 \ 865 \
873 if (range_start <= (c) && (c) <= range_end) \ 866 if (range_start <= (c) && (c) <= range_end) \
874 { \ 867 { \
@@ -1274,6 +1267,13 @@ print_double_string (where, string1, size1, string2, size2)
1274 1267
1275#endif /* not DEBUG */ 1268#endif /* not DEBUG */
1276 1269
1270/* Use this to suppress gcc's `...may be used before initialized' warnings. */
1271#ifdef lint
1272# define IF_LINT(Code) Code
1273#else
1274# define IF_LINT(Code) /* empty */
1275#endif
1276
1277/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can 1277/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can
1278 also be assigned to arbitrarily: each pattern buffer stores its own 1278 also be assigned to arbitrarily: each pattern buffer stores its own
1279 syntax, so it can be changed between regex compilations. */ 1279 syntax, so it can be changed between regex compilations. */
@@ -1413,7 +1413,6 @@ typedef struct
1413} fail_stack_type; 1413} fail_stack_type;
1414 1414
1415#define FAIL_STACK_EMPTY() (fail_stack.frame == 0) 1415#define FAIL_STACK_EMPTY() (fail_stack.frame == 0)
1416#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size)
1417 1416
1418 1417
1419/* Define macros to initialize and free the failure stack. 1418/* Define macros to initialize and free the failure stack.
@@ -1433,8 +1432,6 @@ typedef struct
1433 fail_stack.avail = 0; \ 1432 fail_stack.avail = 0; \
1434 fail_stack.frame = 0; \ 1433 fail_stack.frame = 0; \
1435 } while (0) 1434 } while (0)
1436
1437# define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack)
1438#else 1435#else
1439# define INIT_FAIL_STACK() \ 1436# define INIT_FAIL_STACK() \
1440 do { \ 1437 do { \
@@ -1442,7 +1439,8 @@ typedef struct
1442 fail_stack.frame = 0; \ 1439 fail_stack.frame = 0; \
1443 } while (0) 1440 } while (0)
1444 1441
1445# define RESET_FAIL_STACK() ((void)0) 1442# define RETALLOC_IF(addr, n, t) \
1443 if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t)
1446#endif 1444#endif
1447 1445
1448 1446
@@ -1495,17 +1493,10 @@ typedef struct
1495#define PUSH_FAILURE_INT(item) \ 1493#define PUSH_FAILURE_INT(item) \
1496 fail_stack.stack[fail_stack.avail++].integer = (item) 1494 fail_stack.stack[fail_stack.avail++].integer = (item)
1497 1495
1498/* Push a fail_stack_elt_t value onto the failure stack. 1496/* These POP... operations complement the PUSH... operations.
1499 Assumes the variable `fail_stack'. Probably should only
1500 be called from within `PUSH_FAILURE_POINT'. */
1501#define PUSH_FAILURE_ELT(item) \
1502 fail_stack.stack[fail_stack.avail++] = (item)
1503
1504/* These three POP... operations complement the three PUSH... operations.
1505 All assume that `fail_stack' is nonempty. */ 1497 All assume that `fail_stack' is nonempty. */
1506#define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer 1498#define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer
1507#define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer 1499#define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer
1508#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail]
1509 1500
1510/* Individual items aside from the registers. */ 1501/* Individual items aside from the registers. */
1511#define NUM_NONREG_ITEMS 3 1502#define NUM_NONREG_ITEMS 3
@@ -1555,22 +1546,22 @@ do { \
1555/* Pop a saved register off the stack. */ 1546/* Pop a saved register off the stack. */
1556#define POP_FAILURE_REG_OR_COUNT() \ 1547#define POP_FAILURE_REG_OR_COUNT() \
1557do { \ 1548do { \
1558 int reg = POP_FAILURE_INT (); \ 1549 int pfreg = POP_FAILURE_INT (); \
1559 if (reg == -1) \ 1550 if (pfreg == -1) \
1560 { \ 1551 { \
1561 /* It's a counter. */ \ 1552 /* It's a counter. */ \
1562 /* Here, we discard `const', making re_match non-reentrant. */ \ 1553 /* Here, we discard `const', making re_match non-reentrant. */ \
1563 unsigned char *ptr = (unsigned char*) POP_FAILURE_POINTER (); \ 1554 unsigned char *ptr = (unsigned char*) POP_FAILURE_POINTER (); \
1564 reg = POP_FAILURE_INT (); \ 1555 pfreg = POP_FAILURE_INT (); \
1565 STORE_NUMBER (ptr, reg); \ 1556 STORE_NUMBER (ptr, pfreg); \
1566 DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, reg); \ 1557 DEBUG_PRINT3 (" Pop counter %p = %d\n", ptr, pfreg); \
1567 } \ 1558 } \
1568 else \ 1559 else \
1569 { \ 1560 { \
1570 regend[reg] = POP_FAILURE_POINTER (); \ 1561 regend[pfreg] = POP_FAILURE_POINTER (); \
1571 regstart[reg] = POP_FAILURE_POINTER (); \ 1562 regstart[pfreg] = POP_FAILURE_POINTER (); \
1572 DEBUG_PRINT4 (" Pop reg %d (spanning %p -> %p)\n", \ 1563 DEBUG_PRINT4 (" Pop reg %d (spanning %p -> %p)\n", \
1573 reg, regstart[reg], regend[reg]); \ 1564 pfreg, regstart[pfreg], regend[pfreg]); \
1574 } \ 1565 } \
1575} while (0) 1566} while (0)
1576 1567
@@ -1765,16 +1756,6 @@ static int analyse_first _RE_ARGS ((re_char *p, re_char *pend,
1765 } while (0) 1756 } while (0)
1766 1757
1767 1758
1768/* As with BUF_PUSH_2, except for three bytes. */
1769#define BUF_PUSH_3(c1, c2, c3) \
1770 do { \
1771 GET_BUFFER_SPACE (3); \
1772 *b++ = (unsigned char) (c1); \
1773 *b++ = (unsigned char) (c2); \
1774 *b++ = (unsigned char) (c3); \
1775 } while (0)
1776
1777
1778/* Store a jump with opcode OP at LOC to location TO. We store a 1759/* Store a jump with opcode OP at LOC to location TO. We store a
1779 relative address offset by the three bytes the jump itself occupies. */ 1760 relative address offset by the three bytes the jump itself occupies. */
1780#define STORE_JUMP(op, loc, to) \ 1761#define STORE_JUMP(op, loc, to) \
@@ -2524,9 +2505,6 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2524 /* We fetch characters from PATTERN here. */ 2505 /* We fetch characters from PATTERN here. */
2525 register re_wchar_t c, c1; 2506 register re_wchar_t c, c1;
2526 2507
2527 /* A random temporary spot in PATTERN. */
2528 re_char *p1;
2529
2530 /* Points to the end of the buffer, where we should append. */ 2508 /* Points to the end of the buffer, where we should append. */
2531 register unsigned char *b; 2509 register unsigned char *b;
2532 2510
@@ -2574,17 +2552,14 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2574 /* If the object matched can contain multibyte characters. */ 2552 /* If the object matched can contain multibyte characters. */
2575 const boolean multibyte = RE_MULTIBYTE_P (bufp); 2553 const boolean multibyte = RE_MULTIBYTE_P (bufp);
2576 2554
2577 /* If a target of matching can contain multibyte characters. */
2578 const boolean target_multibyte = RE_TARGET_MULTIBYTE_P (bufp);
2579
2580 /* Nonzero if we have pushed down into a subpattern. */ 2555 /* Nonzero if we have pushed down into a subpattern. */
2581 int in_subpattern = 0; 2556 int in_subpattern = 0;
2582 2557
2583 /* These hold the values of p, pattern, and pend from the main 2558 /* These hold the values of p, pattern, and pend from the main
2584 pattern when we have pushed into a subpattern. */ 2559 pattern when we have pushed into a subpattern. */
2585 re_char *main_p; 2560 re_char *main_p IF_LINT (= NULL);
2586 re_char *main_pattern; 2561 re_char *main_pattern IF_LINT (= NULL);
2587 re_char *main_pend; 2562 re_char *main_pend IF_LINT (= NULL);
2588 2563
2589#ifdef DEBUG 2564#ifdef DEBUG
2590 debug++; 2565 debug++;
@@ -2894,6 +2869,8 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2894 2869
2895 case '[': 2870 case '[':
2896 { 2871 {
2872 re_char *p1;
2873
2897 CLEAR_RANGE_TABLE_WORK_USED (range_table_work); 2874 CLEAR_RANGE_TABLE_WORK_USED (range_table_work);
2898 2875
2899 if (p == pend) FREE_STACK_RETURN (REG_EBRACK); 2876 if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
@@ -2929,7 +2906,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2929 { 2906 {
2930 boolean escaped_char = false; 2907 boolean escaped_char = false;
2931 const unsigned char *p2 = p; 2908 const unsigned char *p2 = p;
2932 re_wchar_t ch, c2; 2909 re_wchar_t ch;
2933 2910
2934 if (p == pend) FREE_STACK_RETURN (REG_EBRACK); 2911 if (p == pend) FREE_STACK_RETURN (REG_EBRACK);
2935 2912
@@ -2992,10 +2969,7 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
2992 them). */ 2969 them). */
2993 if (c == ':' && *p == ']') 2970 if (c == ':' && *p == ']')
2994 { 2971 {
2995 re_wctype_t cc; 2972 re_wctype_t cc = re_wctype (str);
2996 int limit;
2997
2998 cc = re_wctype (str);
2999 2973
3000 if (cc == 0) 2974 if (cc == 0)
3001 FREE_STACK_RETURN (REG_ECTYPE); 2975 FREE_STACK_RETURN (REG_ECTYPE);
@@ -4329,10 +4303,6 @@ WEAK_ALIAS (__re_search, re_search)
4329#define HEAD_ADDR_VSTRING(P) \ 4303#define HEAD_ADDR_VSTRING(P) \
4330 (((P) >= size1 ? string2 : string1)) 4304 (((P) >= size1 ? string2 : string1))
4331 4305
4332/* End address of virtual concatenation of string. */
4333#define STOP_ADDR_VSTRING(P) \
4334 (((P) >= size1 ? string2 + size2 : string1 + size1))
4335
4336/* Address of POS in the concatenation of virtual string. */ 4306/* Address of POS in the concatenation of virtual string. */
4337#define POS_ADDR_VSTRING(POS) \ 4307#define POS_ADDR_VSTRING(POS) \
4338 (((POS) >= size1 ? string2 - size1 : string1) + (POS)) 4308 (((POS) >= size1 ? string2 - size1 : string1) + (POS))
@@ -4559,7 +4529,6 @@ re_search_2 (struct re_pattern_buffer *bufp, const char *str1, int size1, const
4559 if (multibyte) 4529 if (multibyte)
4560 { 4530 {
4561 re_char *p = POS_ADDR_VSTRING (startpos); 4531 re_char *p = POS_ADDR_VSTRING (startpos);
4562 re_char *pend = STOP_ADDR_VSTRING (startpos);
4563 int len = BYTES_BY_CHAR_HEAD (*p); 4532 int len = BYTES_BY_CHAR_HEAD (*p);
4564 4533
4565 range -= len; 4534 range -= len;
@@ -4644,16 +4613,6 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
4644#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) 4613#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
4645#define AT_STRINGS_END(d) ((d) == end2) 4614#define AT_STRINGS_END(d) ((d) == end2)
4646 4615
4647
4648/* Test if D points to a character which is word-constituent. We have
4649 two special cases to check for: if past the end of string1, look at
4650 the first character in string2; and if before the beginning of
4651 string2, look at the last character in string1. */
4652#define WORDCHAR_P(d) \
4653 (SYNTAX ((d) == end1 ? *string2 \
4654 : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
4655 == Sword)
4656
4657/* Disabled due to a compiler bug -- see comment at case wordbound */ 4616/* Disabled due to a compiler bug -- see comment at case wordbound */
4658 4617
4659/* The comment at case wordbound is following one, but we don't use 4618/* The comment at case wordbound is following one, but we don't use
@@ -4665,6 +4624,15 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
4665 macro and introducing temporary variables works around the bug. */ 4624 macro and introducing temporary variables works around the bug. */
4666 4625
4667#if 0 4626#if 0
4627/* Test if D points to a character which is word-constituent. We have
4628 two special cases to check for: if past the end of string1, look at
4629 the first character in string2; and if before the beginning of
4630 string2, look at the last character in string1. */
4631#define WORDCHAR_P(d) \
4632 (SYNTAX ((d) == end1 ? *string2 \
4633 : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
4634 == Sword)
4635
4668/* Test if the character before D and the one at D differ with respect 4636/* Test if the character before D and the one at D differ with respect
4669 to being word-constituent. */ 4637 to being word-constituent. */
4670#define AT_WORD_BOUNDARY(d) \ 4638#define AT_WORD_BOUNDARY(d) \
@@ -4674,7 +4642,14 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
4674 4642
4675/* Free everything we malloc. */ 4643/* Free everything we malloc. */
4676#ifdef MATCH_MAY_ALLOCATE 4644#ifdef MATCH_MAY_ALLOCATE
4677# define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else 4645# define FREE_VAR(var) \
4646 do { \
4647 if (var) \
4648 { \
4649 REGEX_FREE (var); \
4650 var = NULL; \
4651 } \
4652 } while (0)
4678# define FREE_VARIABLES() \ 4653# define FREE_VARIABLES() \
4679 do { \ 4654 do { \
4680 REGEX_FREE_STACK (fail_stack.stack); \ 4655 REGEX_FREE_STACK (fail_stack.stack); \
@@ -5024,7 +4999,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
5024 /* General temporaries. */ 4999 /* General temporaries. */
5025 int mcnt; 5000 int mcnt;
5026 size_t reg; 5001 size_t reg;
5027 boolean not;
5028 5002
5029 /* Just past the end of the corresponding string. */ 5003 /* Just past the end of the corresponding string. */
5030 re_char *end1, *end2; 5004 re_char *end1, *end2;
@@ -5464,7 +5438,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
5464 else 5438 else
5465 do 5439 do
5466 { 5440 {
5467 int pat_charlen, buf_charlen; 5441 int pat_charlen;
5468 int pat_ch, buf_ch; 5442 int pat_ch, buf_ch;
5469 5443
5470 PREFETCH (); 5444 PREFETCH ();
@@ -5535,7 +5509,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
5535 5509
5536 /* Start of actual range_table, or end of bitmap if there is no 5510 /* Start of actual range_table, or end of bitmap if there is no
5537 range table. */ 5511 range table. */
5538 re_char *range_table; 5512 re_char *range_table IF_LINT (= NULL);
5539 5513
5540 /* Nonzero if there is a range table. */ 5514 /* Nonzero if there is a range table. */
5541 int range_table_exists; 5515 int range_table_exists;
@@ -5622,8 +5596,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
5622 if (!not) goto fail; 5596 if (!not) goto fail;
5623 5597
5624 d += len; 5598 d += len;
5625 break;
5626 } 5599 }
5600 break;
5627 5601
5628 5602
5629 /* The beginning of a group is represented by start_memory. 5603 /* The beginning of a group is represented by start_memory.
@@ -6005,46 +5979,48 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
6005 5979
6006 case wordbound: 5980 case wordbound:
6007 case notwordbound: 5981 case notwordbound:
6008 not = (re_opcode_t) *(p - 1) == notwordbound; 5982 {
6009 DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":""); 5983 boolean not = (re_opcode_t) *(p - 1) == notwordbound;
5984 DEBUG_PRINT2 ("EXECUTING %swordbound.\n", not?"not":"");
6010 5985
6011 /* We SUCCEED (or FAIL) in one of the following cases: */ 5986 /* We SUCCEED (or FAIL) in one of the following cases: */
6012 5987
6013 /* Case 1: D is at the beginning or the end of string. */ 5988 /* Case 1: D is at the beginning or the end of string. */
6014 if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) 5989 if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d))
6015 not = !not; 5990 not = !not;
6016 else 5991 else
6017 { 5992 {
6018 /* C1 is the character before D, S1 is the syntax of C1, C2 5993 /* C1 is the character before D, S1 is the syntax of C1, C2
6019 is the character at D, and S2 is the syntax of C2. */ 5994 is the character at D, and S2 is the syntax of C2. */
6020 re_wchar_t c1, c2; 5995 re_wchar_t c1, c2;
6021 int s1, s2; 5996 int s1, s2;
6022 int dummy; 5997 int dummy;
6023#ifdef emacs 5998#ifdef emacs
6024 int offset = PTR_TO_OFFSET (d - 1); 5999 int offset = PTR_TO_OFFSET (d - 1);
6025 int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset); 6000 int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
6026 UPDATE_SYNTAX_TABLE (charpos); 6001 UPDATE_SYNTAX_TABLE (charpos);
6027#endif 6002#endif
6028 GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2); 6003 GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
6029 s1 = SYNTAX (c1); 6004 s1 = SYNTAX (c1);
6030#ifdef emacs 6005#ifdef emacs
6031 UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1); 6006 UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
6032#endif 6007#endif
6033 PREFETCH_NOLIMIT (); 6008 PREFETCH_NOLIMIT ();
6034 GET_CHAR_AFTER (c2, d, dummy); 6009 GET_CHAR_AFTER (c2, d, dummy);
6035 s2 = SYNTAX (c2); 6010 s2 = SYNTAX (c2);
6036 6011
6037 if (/* Case 2: Only one of S1 and S2 is Sword. */ 6012 if (/* Case 2: Only one of S1 and S2 is Sword. */
6038 ((s1 == Sword) != (s2 == Sword)) 6013 ((s1 == Sword) != (s2 == Sword))
6039 /* Case 3: Both of S1 and S2 are Sword, and macro 6014 /* Case 3: Both of S1 and S2 are Sword, and macro
6040 WORD_BOUNDARY_P (C1, C2) returns nonzero. */ 6015 WORD_BOUNDARY_P (C1, C2) returns nonzero. */
6041 || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) 6016 || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2)))
6042 not = !not; 6017 not = !not;
6043 } 6018 }
6044 if (not) 6019 if (not)
6045 break; 6020 break;
6046 else 6021 else
6047 goto fail; 6022 goto fail;
6023 }
6048 6024
6049 case wordbeg: 6025 case wordbeg:
6050 DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); 6026 DEBUG_PRINT1 ("EXECUTING wordbeg.\n");
@@ -6224,25 +6200,27 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
6224 6200
6225 case syntaxspec: 6201 case syntaxspec:
6226 case notsyntaxspec: 6202 case notsyntaxspec:
6227 not = (re_opcode_t) *(p - 1) == notsyntaxspec;
6228 mcnt = *p++;
6229 DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt);
6230 PREFETCH ();
6231#ifdef emacs
6232 { 6203 {
6233 int offset = PTR_TO_OFFSET (d); 6204 boolean not = (re_opcode_t) *(p - 1) == notsyntaxspec;
6234 int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset); 6205 mcnt = *p++;
6235 UPDATE_SYNTAX_TABLE (pos1); 6206 DEBUG_PRINT3 ("EXECUTING %ssyntaxspec %d.\n", not?"not":"", mcnt);
6236 } 6207 PREFETCH ();
6208#ifdef emacs
6209 {
6210 int offset = PTR_TO_OFFSET (d);
6211 int pos1 = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
6212 UPDATE_SYNTAX_TABLE (pos1);
6213 }
6237#endif 6214#endif
6238 { 6215 {
6239 int len; 6216 int len;
6240 re_wchar_t c; 6217 re_wchar_t c;
6241 6218
6242 GET_CHAR_AFTER (c, d, len); 6219 GET_CHAR_AFTER (c, d, len);
6243 if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) 6220 if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not)
6244 goto fail; 6221 goto fail;
6245 d += len; 6222 d += len;
6223 }
6246 } 6224 }
6247 break; 6225 break;
6248 6226
@@ -6267,18 +6245,21 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, int
6267 6245
6268 case categoryspec: 6246 case categoryspec:
6269 case notcategoryspec: 6247 case notcategoryspec:
6270 not = (re_opcode_t) *(p - 1) == notcategoryspec;
6271 mcnt = *p++;
6272 DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n", not?"not":"", mcnt);
6273 PREFETCH ();
6274 { 6248 {
6275 int len; 6249 boolean not = (re_opcode_t) *(p - 1) == notcategoryspec;
6276 re_wchar_t c; 6250 mcnt = *p++;
6251 DEBUG_PRINT3 ("EXECUTING %scategoryspec %d.\n",
6252 not?"not":"", mcnt);
6253 PREFETCH ();
6277 6254
6278 GET_CHAR_AFTER (c, d, len); 6255 {
6279 if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not) 6256 int len;
6280 goto fail; 6257 re_wchar_t c;
6281 d += len; 6258 GET_CHAR_AFTER (c, d, len);
6259 if ((!CHAR_HAS_CATEGORY (c, mcnt)) ^ not)
6260 goto fail;
6261 d += len;
6262 }
6282 } 6263 }
6283 break; 6264 break;
6284 6265
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 443fc034570..c2715fffe01 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -32,7 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32 32
33/* In AIX, you allocate a pty by opening /dev/ptc to get the master side. 33/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
34 To get the name of the slave side, you just ttyname() the master side. */ 34 To get the name of the slave side, you just ttyname() the master side. */
35#define PTY_ITERATION for (c = 0; !c ; c++) 35#define PTY_ITERATION int c; for (c = 0; !c ; c++)
36#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc"); 36#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
37#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); 37#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
38 38
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index ceebe23f1e7..af5308ff7bb 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -46,7 +46,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46 46
47/* Define HAVE_PTYS if the system supports pty devices. */ 47/* Define HAVE_PTYS if the system supports pty devices. */
48#define HAVE_PTYS 48#define HAVE_PTYS
49#define PTY_ITERATION for (i = 0; i < 1; i++) /* ick */ 49#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */
50#define PTY_NAME_SPRINTF /* none */ 50#define PTY_NAME_SPRINTF /* none */
51#define PTY_TTY_NAME_SPRINTF /* none */ 51#define PTY_TTY_NAME_SPRINTF /* none */
52#define PTY_OPEN \ 52#define PTY_OPEN \
@@ -102,4 +102,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
102 102
103/* Send signals to subprocesses by "typing" special chars at them. */ 103/* Send signals to subprocesses by "typing" special chars at them. */
104#define SIGNALS_VIA_CHARACTERS 104#define SIGNALS_VIA_CHARACTERS
105
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 4fc2f4d1031..dd0d0c34021 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -68,7 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
68 Note: PTYs are broken on darwin <6. Use at your own risk. */ 68 Note: PTYs are broken on darwin <6. Use at your own risk. */
69#define HAVE_PTYS 69#define HAVE_PTYS
70/* Run only once. We need a `for'-loop because the code uses `continue'. */ 70/* Run only once. We need a `for'-loop because the code uses `continue'. */
71#define PTY_ITERATION for (i = 0; i < 1; i++) 71#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
72#define PTY_NAME_SPRINTF /* none */ 72#define PTY_NAME_SPRINTF /* none */
73#define PTY_TTY_NAME_SPRINTF /* none */ 73#define PTY_TTY_NAME_SPRINTF /* none */
74/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8. 74/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
@@ -148,4 +148,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
148 148
149/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */ 149/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack. */
150#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 150#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
151
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 84fe5b92da9..178d7082f72 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -44,7 +44,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#define UNIX98_PTYS 44#define UNIX98_PTYS
45 45
46/* Run only once. We need a `for'-loop because the code uses `continue'. */ 46/* Run only once. We need a `for'-loop because the code uses `continue'. */
47#define PTY_ITERATION for (i = 0; i < 1; i++) 47#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
48 48
49#ifdef HAVE_GETPT 49#ifdef HAVE_GETPT
50#define PTY_NAME_SPRINTF 50#define PTY_NAME_SPRINTF
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index 92465ded2ef..d283571d8fb 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -60,6 +60,7 @@ char *_getpty();
60#define PTY_OPEN \ 60#define PTY_OPEN \
61{ \ 61{ \
62 struct sigaction ocstat, cstat; \ 62 struct sigaction ocstat, cstat; \
63 struct stat stb; \
63 char * name; \ 64 char * name; \
64 sigemptyset(&cstat.sa_mask); \ 65 sigemptyset(&cstat.sa_mask); \
65 cstat.sa_handler = SIG_DFL; \ 66 cstat.sa_handler = SIG_DFL; \
@@ -95,5 +96,3 @@ char *_getpty();
95/* Tested on Irix 6.5. SCM worked on earlier versions. */ 96/* Tested on Irix 6.5. SCM worked on earlier versions. */
96#define GC_SETJMP_WORKS 1 97#define GC_SETJMP_WORKS 1
97#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 98#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
98
99
diff --git a/src/scroll.c b/src/scroll.c
index 1343b89c41e..33af18d2090 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -938,8 +938,8 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, register int
938 938
939static void 939static void
940ins_del_costs (FRAME_PTR frame, 940ins_del_costs (FRAME_PTR frame,
941 char *one_line_string, char *multi_string, 941 const char *one_line_string, const char *multi_string,
942 char *setup_string, char *cleanup_string, 942 const char *setup_string, const char *cleanup_string,
943 int *costvec, int *ncostvec, 943 int *costvec, int *ncostvec,
944 int coefficient) 944 int coefficient)
945{ 945{
@@ -994,9 +994,12 @@ ins_del_costs (FRAME_PTR frame,
994 994
995void 995void
996do_line_insertion_deletion_costs (FRAME_PTR frame, 996do_line_insertion_deletion_costs (FRAME_PTR frame,
997 char *ins_line_string, char *multi_ins_string, 997 const char *ins_line_string,
998 char *del_line_string, char *multi_del_string, 998 const char *multi_ins_string,
999 char *setup_string, char *cleanup_string, 999 const char *del_line_string,
1000 const char *multi_del_string,
1001 const char *setup_string,
1002 const char *cleanup_string,
1000 int coefficient) 1003 int coefficient)
1001{ 1004{
1002 if (FRAME_INSERT_COST (frame) != 0) 1005 if (FRAME_INSERT_COST (frame) != 0)
diff --git a/src/search.c b/src/search.c
index 1e2036f6dc2..bf93a7fe442 100644
--- a/src/search.c
+++ b/src/search.c
@@ -114,17 +114,13 @@ matcher_overflow (void)
114 PATTERN is the pattern to compile. 114 PATTERN is the pattern to compile.
115 CP is the place to put the result. 115 CP is the place to put the result.
116 TRANSLATE is a translation table for ignoring case, or nil for none. 116 TRANSLATE is a translation table for ignoring case, or nil for none.
117 REGP is the structure that says where to store the "register"
118 values that will result from matching this pattern.
119 If it is 0, we should compile the pattern not to record any
120 subexpression bounds.
121 POSIX is nonzero if we want full backtracking (POSIX style) 117 POSIX is nonzero if we want full backtracking (POSIX style)
122 for this pattern. 0 means backtrack only enough to get a valid match. 118 for this pattern. 0 means backtrack only enough to get a valid match.
123 119
124 The behavior also depends on Vsearch_spaces_regexp. */ 120 The behavior also depends on Vsearch_spaces_regexp. */
125 121
126static void 122static void
127compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, struct re_registers *regp, int posix) 123compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix)
128{ 124{
129 char *val; 125 char *val;
130 reg_syntax_t old; 126 reg_syntax_t old;
@@ -247,7 +243,7 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, Lisp_Object tra
247 if (cp->next == 0) 243 if (cp->next == 0)
248 { 244 {
249 compile_it: 245 compile_it:
250 compile_pattern_1 (cp, pattern, translate, regp, posix); 246 compile_pattern_1 (cp, pattern, translate, posix);
251 break; 247 break;
252 } 248 }
253 } 249 }
@@ -1558,7 +1554,6 @@ simple_search (EMACS_INT n, unsigned char *pat,
1558 1554
1559 while (this_len > 0) 1555 while (this_len > 0)
1560 { 1556 {
1561 int charlen;
1562 int pat_ch, buf_ch; 1557 int pat_ch, buf_ch;
1563 1558
1564 DEC_BOTH (this_pos, this_pos_byte); 1559 DEC_BOTH (this_pos, this_pos_byte);
@@ -1730,17 +1725,17 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1730 /* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a 1725 /* Setup translate_prev_byte1/2/3/4 from CHAR_BASE. Only a
1731 byte following them are the target of translation. */ 1726 byte following them are the target of translation. */
1732 unsigned char str[MAX_MULTIBYTE_LENGTH]; 1727 unsigned char str[MAX_MULTIBYTE_LENGTH];
1733 int len = CHAR_STRING (char_base, str); 1728 int cblen = CHAR_STRING (char_base, str);
1734 1729
1735 translate_prev_byte1 = str[len - 2]; 1730 translate_prev_byte1 = str[cblen - 2];
1736 if (len > 2) 1731 if (cblen > 2)
1737 { 1732 {
1738 translate_prev_byte2 = str[len - 3]; 1733 translate_prev_byte2 = str[cblen - 3];
1739 if (len > 3) 1734 if (cblen > 3)
1740 { 1735 {
1741 translate_prev_byte3 = str[len - 4]; 1736 translate_prev_byte3 = str[cblen - 4];
1742 if (len > 4) 1737 if (cblen > 4)
1743 translate_prev_byte4 = str[len - 5]; 1738 translate_prev_byte4 = str[cblen - 5];
1744 } 1739 }
1745 } 1740 }
1746 } 1741 }
@@ -2474,7 +2469,7 @@ since only regular expressions have distinguished subexpressions. */)
2474 else 2469 else
2475 FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, pos, pos_byte); 2470 FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, pos, pos_byte);
2476 2471
2477 if (LOWERCASEP (c)) 2472 if (lowercasep (c))
2478 { 2473 {
2479 /* Cannot be all caps if any original char is lower case */ 2474 /* Cannot be all caps if any original char is lower case */
2480 2475
@@ -2484,7 +2479,7 @@ since only regular expressions have distinguished subexpressions. */)
2484 else 2479 else
2485 some_multiletter_word = 1; 2480 some_multiletter_word = 1;
2486 } 2481 }
2487 else if (UPPERCASEP (c)) 2482 else if (uppercasep (c))
2488 { 2483 {
2489 some_uppercase = 1; 2484 some_uppercase = 1;
2490 if (SYNTAX (prevc) != Sword) 2485 if (SYNTAX (prevc) != Sword)
diff --git a/src/syntax.c b/src/syntax.c
index 707c2c19f31..c1442c396c1 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -513,7 +513,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
513 EMACS_INT comment_end = from; 513 EMACS_INT comment_end = from;
514 EMACS_INT comment_end_byte = from_byte; 514 EMACS_INT comment_end_byte = from_byte;
515 EMACS_INT comstart_pos = 0; 515 EMACS_INT comstart_pos = 0;
516 EMACS_INT comstart_byte; 516 EMACS_INT comstart_byte IF_LINT (= 0);
517 /* Place where the containing defun starts, 517 /* Place where the containing defun starts,
518 or 0 if we didn't come across it yet. */ 518 or 0 if we didn't come across it yet. */
519 EMACS_INT defun_start = 0; 519 EMACS_INT defun_start = 0;
@@ -554,7 +554,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
554 com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax) 554 com2end = (SYNTAX_FLAGS_COMEND_FIRST (syntax)
555 && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax)); 555 && SYNTAX_FLAGS_COMEND_SECOND (prev_syntax));
556 comstart = (com2start || code == Scomment); 556 comstart = (com2start || code == Scomment);
557 557
558 /* Nasty cases with overlapping 2-char comment markers: 558 /* Nasty cases with overlapping 2-char comment markers:
559 - snmp-mode: -- c -- foo -- c -- 559 - snmp-mode: -- c -- foo -- c --
560 --- c -- 560 --- c --
@@ -1421,7 +1421,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
1421 register unsigned int c; 1421 register unsigned int c;
1422 unsigned char fastmap[0400]; 1422 unsigned char fastmap[0400];
1423 /* Store the ranges of non-ASCII characters. */ 1423 /* Store the ranges of non-ASCII characters. */
1424 int *char_ranges; 1424 int *char_ranges IF_LINT (= NULL);
1425 int n_char_ranges = 0; 1425 int n_char_ranges = 0;
1426 int negate = 0; 1426 int negate = 0;
1427 register EMACS_INT i, i_byte; 1427 register EMACS_INT i, i_byte;
@@ -2363,7 +2363,7 @@ between them, return t; otherwise return nil. */)
2363 if (code == Scomment_fence) 2363 if (code == Scomment_fence)
2364 { 2364 {
2365 /* Skip until first preceding unquoted comment_fence. */ 2365 /* Skip until first preceding unquoted comment_fence. */
2366 int found = 0; 2366 int fence_found = 0;
2367 EMACS_INT ini = from, ini_byte = from_byte; 2367 EMACS_INT ini = from, ini_byte = from_byte;
2368 2368
2369 while (1) 2369 while (1)
@@ -2374,13 +2374,13 @@ between them, return t; otherwise return nil. */)
2374 if (SYNTAX (c) == Scomment_fence 2374 if (SYNTAX (c) == Scomment_fence
2375 && !char_quoted (from, from_byte)) 2375 && !char_quoted (from, from_byte))
2376 { 2376 {
2377 found = 1; 2377 fence_found = 1;
2378 break; 2378 break;
2379 } 2379 }
2380 else if (from == stop) 2380 else if (from == stop)
2381 break; 2381 break;
2382 } 2382 }
2383 if (found == 0) 2383 if (fence_found == 0)
2384 { 2384 {
2385 from = ini; /* Set point to ini + 1. */ 2385 from = ini; /* Set point to ini + 1. */
2386 from_byte = ini_byte; 2386 from_byte = ini_byte;
@@ -2669,12 +2669,12 @@ scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpf
2669 /* We must record the comment style encountered so that 2669 /* We must record the comment style encountered so that
2670 later, we can match only the proper comment begin 2670 later, we can match only the proper comment begin
2671 sequence of the same style. */ 2671 sequence of the same style. */
2672 int c1, other_syntax; 2672 int c2, other_syntax;
2673 DEC_BOTH (from, from_byte); 2673 DEC_BOTH (from, from_byte);
2674 UPDATE_SYNTAX_TABLE_BACKWARD (from); 2674 UPDATE_SYNTAX_TABLE_BACKWARD (from);
2675 code = Sendcomment; 2675 code = Sendcomment;
2676 c1 = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2676 c2 = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2677 other_syntax = SYNTAX_WITH_FLAGS (c1); 2677 other_syntax = SYNTAX_WITH_FLAGS (c2);
2678 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax); 2678 comstyle = SYNTAX_FLAGS_COMMENT_STYLE (other_syntax, syntax);
2679 comnested 2679 comnested
2680 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax); 2680 = comnested || SYNTAX_FLAGS_COMMENT_NESTED (other_syntax);
@@ -3528,4 +3528,3 @@ In both cases, LIMIT bounds the search. */);
3528 defsubr (&Sbackward_prefix_chars); 3528 defsubr (&Sbackward_prefix_chars);
3529 defsubr (&Sparse_partial_sexp); 3529 defsubr (&Sparse_partial_sexp);
3530} 3530}
3531
diff --git a/src/sysdep.c b/src/sysdep.c
index 5760d0224eb..6ef3d88c5c8 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -292,10 +292,6 @@ init_baud_rate (int fd)
292int wait_debugging; /* Set nonzero to make following function work under dbx 292int wait_debugging; /* Set nonzero to make following function work under dbx
293 (at least for bsd). */ 293 (at least for bsd). */
294 294
295SIGTYPE
296wait_for_termination_signal (void)
297{}
298
299#ifndef MSDOS 295#ifndef MSDOS
300/* Wait for subprocess with process id `pid' to terminate and 296/* Wait for subprocess with process id `pid' to terminate and
301 make sure it will get eliminated (not remain forever as a zombie) */ 297 make sure it will get eliminated (not remain forever as a zombie) */
@@ -492,7 +488,7 @@ sys_subshell (void)
492 int pid; 488 int pid;
493 struct save_signal saved_handlers[5]; 489 struct save_signal saved_handlers[5];
494 Lisp_Object dir; 490 Lisp_Object dir;
495 unsigned char *str = 0; 491 unsigned char * IF_LINT (volatile) str = 0;
496 int len; 492 int len;
497 493
498 saved_handlers[0].code = SIGINT; 494 saved_handlers[0].code = SIGINT;
@@ -632,7 +628,7 @@ init_sigio (int fd)
632{ 628{
633} 629}
634 630
635void 631static void
636reset_sigio (int fd) 632reset_sigio (int fd)
637{ 633{
638} 634}
@@ -662,7 +658,7 @@ init_sigio (int fd)
662 interrupts_deferred = 0; 658 interrupts_deferred = 0;
663} 659}
664 660
665void 661static void
666reset_sigio (int fd) 662reset_sigio (int fd)
667{ 663{
668#ifdef FASYNC 664#ifdef FASYNC
@@ -1890,13 +1886,13 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte)
1890 * under error conditions. 1886 * under error conditions.
1891 */ 1887 */
1892 1888
1889#ifndef HAVE_GETWD
1890
1893#ifndef MAXPATHLEN 1891#ifndef MAXPATHLEN
1894/* In 4.1, param.h fails to define this. */ 1892/* In 4.1, param.h fails to define this. */
1895#define MAXPATHLEN 1024 1893#define MAXPATHLEN 1024
1896#endif 1894#endif
1897 1895
1898#ifndef HAVE_GETWD
1899
1900char * 1896char *
1901getwd (char *pathname) 1897getwd (char *pathname)
1902{ 1898{
@@ -2671,8 +2667,8 @@ system_process_attributes (Lisp_Object pid)
2671 size_t cmdsize = 0, cmdline_size; 2667 size_t cmdsize = 0, cmdline_size;
2672 unsigned char c; 2668 unsigned char c;
2673 int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount; 2669 int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount;
2674 unsigned long long utime, stime, cutime, cstime, start; 2670 unsigned long long u_time, s_time, cutime, cstime, start;
2675 long priority, nice, rss; 2671 long priority, niceness, rss;
2676 unsigned long minflt, majflt, cminflt, cmajflt, vsize; 2672 unsigned long minflt, majflt, cminflt, cmajflt, vsize;
2677 time_t sec; 2673 time_t sec;
2678 unsigned usec; 2674 unsigned usec;
@@ -2752,8 +2748,8 @@ system_process_attributes (Lisp_Object pid)
2752 sscanf (p, "%c %d %d %d %d %d %*u %lu %lu %lu %lu %Lu %Lu %Lu %Lu %ld %ld %d %*d %Lu %lu %ld", 2748 sscanf (p, "%c %d %d %d %d %d %*u %lu %lu %lu %lu %Lu %Lu %Lu %Lu %ld %ld %d %*d %Lu %lu %ld",
2753 &c, &ppid, &pgrp, &sess, &tty, &tpgid, 2749 &c, &ppid, &pgrp, &sess, &tty, &tpgid,
2754 &minflt, &cminflt, &majflt, &cmajflt, 2750 &minflt, &cminflt, &majflt, &cmajflt,
2755 &utime, &stime, &cutime, &cstime, 2751 &u_time, &s_time, &cutime, &cstime,
2756 &priority, &nice, &thcount, &start, &vsize, &rss); 2752 &priority, &niceness, &thcount, &start, &vsize, &rss);
2757 { 2753 {
2758 char state_str[2]; 2754 char state_str[2];
2759 2755
@@ -2781,13 +2777,14 @@ system_process_attributes (Lisp_Object pid)
2781 if (clocks_per_sec < 0) 2777 if (clocks_per_sec < 0)
2782 clocks_per_sec = 100; 2778 clocks_per_sec = 100;
2783 attrs = Fcons (Fcons (Qutime, 2779 attrs = Fcons (Fcons (Qutime,
2784 ltime_from_jiffies (utime, clocks_per_sec)), 2780 ltime_from_jiffies (u_time, clocks_per_sec)),
2785 attrs); 2781 attrs);
2786 attrs = Fcons (Fcons (Qstime, 2782 attrs = Fcons (Fcons (Qstime,
2787 ltime_from_jiffies (stime, clocks_per_sec)), 2783 ltime_from_jiffies (s_time, clocks_per_sec)),
2788 attrs); 2784 attrs);
2789 attrs = Fcons (Fcons (Qtime, 2785 attrs = Fcons (Fcons (Qtime,
2790 ltime_from_jiffies (stime+utime, clocks_per_sec)), 2786 ltime_from_jiffies (s_time + u_time,
2787 clocks_per_sec)),
2791 attrs); 2788 attrs);
2792 attrs = Fcons (Fcons (Qcutime, 2789 attrs = Fcons (Fcons (Qcutime,
2793 ltime_from_jiffies (cutime, clocks_per_sec)), 2790 ltime_from_jiffies (cutime, clocks_per_sec)),
@@ -2799,7 +2796,7 @@ system_process_attributes (Lisp_Object pid)
2799 ltime_from_jiffies (cstime+cutime, clocks_per_sec)), 2796 ltime_from_jiffies (cstime+cutime, clocks_per_sec)),
2800 attrs); 2797 attrs);
2801 attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs); 2798 attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs);
2802 attrs = Fcons (Fcons (Qnice, make_number (nice)), attrs); 2799 attrs = Fcons (Fcons (Qnice, make_number (niceness)), attrs);
2803 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs); 2800 attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs);
2804 EMACS_GET_TIME (tnow); 2801 EMACS_GET_TIME (tnow);
2805 get_up_time (&sec, &usec); 2802 get_up_time (&sec, &usec);
@@ -2829,7 +2826,7 @@ system_process_attributes (Lisp_Object pid)
2829 make_number 2826 make_number
2830 (EMACS_USECS (telapsed)))), 2827 (EMACS_USECS (telapsed)))),
2831 attrs); 2828 attrs);
2832 time_from_jiffies (utime + stime, clocks_per_sec, &sec, &usec); 2829 time_from_jiffies (u_time + s_time, clocks_per_sec, &sec, &usec);
2833 pcpu = (sec + usec / 1000000.0) / (EMACS_SECS (telapsed) + EMACS_USECS (telapsed) / 1000000.0); 2830 pcpu = (sec + usec / 1000000.0) / (EMACS_SECS (telapsed) + EMACS_USECS (telapsed) / 1000000.0);
2834 if (pcpu > 1.0) 2831 if (pcpu > 1.0)
2835 pcpu = 1.0; 2832 pcpu = 1.0;
@@ -2848,8 +2845,10 @@ system_process_attributes (Lisp_Object pid)
2848 fd = emacs_open (fn, O_RDONLY, 0); 2845 fd = emacs_open (fn, O_RDONLY, 0);
2849 if (fd >= 0) 2846 if (fd >= 0)
2850 { 2847 {
2851 for (cmdline_size = 0; emacs_read (fd, &c, 1) == 1; cmdline_size++) 2848 char ch;
2849 for (cmdline_size = 0; emacs_read (fd, &ch, 1) == 1; cmdline_size++)
2852 { 2850 {
2851 c = ch;
2853 if (isspace (c) || c == '\\') 2852 if (isspace (c) || c == '\\')
2854 cmdline_size++; /* for later quoting, see below */ 2853 cmdline_size++; /* for later quoting, see below */
2855 } 2854 }
diff --git a/src/systime.h b/src/systime.h
index eae302904fa..cb1ea230f7d 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -144,10 +144,8 @@ extern void set_waiting_for_input (EMACS_TIME *);
144 happen when this files is used outside the src directory). 144 happen when this files is used outside the src directory).
145 Use GCPRO1 to determine if lisp.h was included. */ 145 Use GCPRO1 to determine if lisp.h was included. */
146#ifdef GCPRO1 146#ifdef GCPRO1
147/* defined in dired.c */
148extern Lisp_Object make_time (time_t);
149
150/* defined in editfns.c*/ 147/* defined in editfns.c*/
148extern Lisp_Object make_time (time_t);
151extern int lisp_time_argument (Lisp_Object, time_t *, int *); 149extern int lisp_time_argument (Lisp_Object, time_t *, int *);
152#endif 150#endif
153 151
@@ -172,4 +170,3 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *);
172#define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0) 170#define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0)
173 171
174#endif /* EMACS_SYSTIME_H */ 172#endif /* EMACS_SYSTIME_H */
175
diff --git a/src/systty.h b/src/systty.h
index 2eacfdb2716..1548952e7a8 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -118,3 +118,6 @@ struct emacs_tty {
118extern int emacs_get_tty (int, struct emacs_tty *); 118extern int emacs_get_tty (int, struct emacs_tty *);
119extern int emacs_set_tty (int, struct emacs_tty *, int); 119extern int emacs_set_tty (int, struct emacs_tty *, int);
120 120
121/* From sysdep.c or w32.c */
122extern int serial_open (char *);
123extern void serial_configure (struct Lisp_Process *, Lisp_Object);
diff --git a/src/term.c b/src/term.c
index f082bb40e89..e84bbe125f8 100644
--- a/src/term.c
+++ b/src/term.c
@@ -32,6 +32,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
32#include "lisp.h" 32#include "lisp.h"
33#include "termchar.h" 33#include "termchar.h"
34#include "termopts.h" 34#include "termopts.h"
35#include "tparam.h"
35#include "buffer.h" 36#include "buffer.h"
36#include "character.h" 37#include "character.h"
37#include "charset.h" 38#include "charset.h"
@@ -53,18 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
53static int been_here = -1; 54static int been_here = -1;
54#endif 55#endif
55 56
56/* For now, don't try to include termcap.h. On some systems,
57 configure finds a non-standard termcap.h that the main build
58 won't find. */
59extern void tputs (const char *, int, int (*)(int));
60extern int tgetent (char *, const char *);
61extern int tgetflag (char *id);
62extern int tgetnum (char *id);
63
64char *tparam (char *, char *, int, int, ...);
65
66extern char *tgetstr (char *, char **);
67
68#include "cm.h" 57#include "cm.h"
69#ifdef HAVE_X_WINDOWS 58#ifdef HAVE_X_WINDOWS
70#include "xterm.h" 59#include "xterm.h"
@@ -262,7 +251,7 @@ tty_set_scroll_region (struct frame *f, int start, int stop)
262 struct tty_display_info *tty = FRAME_TTY (f); 251 struct tty_display_info *tty = FRAME_TTY (f);
263 252
264 if (tty->TS_set_scroll_region) 253 if (tty->TS_set_scroll_region)
265 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); 254 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1, 0, 0);
266 else if (tty->TS_set_scroll_region_1) 255 else if (tty->TS_set_scroll_region_1)
267 buf = tparam (tty->TS_set_scroll_region_1, 0, 0, 256 buf = tparam (tty->TS_set_scroll_region_1, 0, 0,
268 FRAME_LINES (f), start, 257 FRAME_LINES (f), start,
@@ -544,8 +533,8 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
544 { 533 {
545 if (src->type == COMPOSITE_GLYPH) 534 if (src->type == COMPOSITE_GLYPH)
546 { 535 {
547 struct composition *cmp; 536 struct composition *cmp IF_LINT (= NULL);
548 Lisp_Object gstring; 537 Lisp_Object gstring IF_LINT (= Qnil);
549 int i; 538 int i;
550 539
551 nbytes = buf - encode_terminal_src; 540 nbytes = buf - encode_terminal_src;
@@ -606,7 +595,7 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
606 else if (! CHAR_GLYPH_PADDING_P (*src)) 595 else if (! CHAR_GLYPH_PADDING_P (*src))
607 { 596 {
608 GLYPH g; 597 GLYPH g;
609 int c; 598 int c IF_LINT (= 0);
610 Lisp_Object string; 599 Lisp_Object string;
611 600
612 string = Qnil; 601 string = Qnil;
@@ -664,8 +653,6 @@ encode_terminal_code (struct glyph *src, int src_len, struct coding_system *codi
664 } 653 }
665 else 654 else
666 { 655 {
667 unsigned char *p = SDATA (string);
668
669 if (! STRING_MULTIBYTE (string)) 656 if (! STRING_MULTIBYTE (string))
670 string = string_to_multibyte (string); 657 string = string_to_multibyte (string);
671 nbytes = buf - encode_terminal_src; 658 nbytes = buf - encode_terminal_src;
@@ -861,7 +848,7 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
861 848
862 if (tty->TS_ins_multi_chars) 849 if (tty->TS_ins_multi_chars)
863 { 850 {
864 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len); 851 buf = tparam (tty->TS_ins_multi_chars, 0, 0, len, 0, 0, 0);
865 OUTPUT1 (tty, buf); 852 OUTPUT1 (tty, buf);
866 xfree (buf); 853 xfree (buf);
867 if (start) 854 if (start)
@@ -957,7 +944,7 @@ tty_delete_glyphs (struct frame *f, int n)
957 944
958 if (tty->TS_del_multi_chars) 945 if (tty->TS_del_multi_chars)
959 { 946 {
960 buf = tparam (tty->TS_del_multi_chars, 0, 0, n); 947 buf = tparam (tty->TS_del_multi_chars, 0, 0, n, 0, 0, 0);
961 OUTPUT1 (tty, buf); 948 OUTPUT1 (tty, buf);
962 xfree (buf); 949 xfree (buf);
963 } 950 }
@@ -974,9 +961,10 @@ static void
974tty_ins_del_lines (struct frame *f, int vpos, int n) 961tty_ins_del_lines (struct frame *f, int vpos, int n)
975{ 962{
976 struct tty_display_info *tty = FRAME_TTY (f); 963 struct tty_display_info *tty = FRAME_TTY (f);
977 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 964 const char *multi =
978 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; 965 n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
979 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; 966 const char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
967 const char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
980 968
981 register int i = n > 0 ? n : -n; 969 register int i = n > 0 ? n : -n;
982 register char *buf; 970 register char *buf;
@@ -999,7 +987,7 @@ tty_ins_del_lines (struct frame *f, int vpos, int n)
999 { 987 {
1000 raw_cursor_to (f, vpos, 0); 988 raw_cursor_to (f, vpos, 0);
1001 tty_background_highlight (tty); 989 tty_background_highlight (tty);
1002 buf = tparam (multi, 0, 0, i); 990 buf = tparam (multi, 0, 0, i, 0, 0, 0);
1003 OUTPUT (tty, buf); 991 OUTPUT (tty, buf);
1004 xfree (buf); 992 xfree (buf);
1005 } 993 }
@@ -1151,9 +1139,9 @@ calculate_costs (struct frame *frame)
1151 if (FRAME_TERMCAP_P (frame)) 1139 if (FRAME_TERMCAP_P (frame))
1152 { 1140 {
1153 struct tty_display_info *tty = FRAME_TTY (frame); 1141 struct tty_display_info *tty = FRAME_TTY (frame);
1154 register char *f = (tty->TS_set_scroll_region 1142 register const char *f = (tty->TS_set_scroll_region
1155 ? tty->TS_set_scroll_region 1143 ? tty->TS_set_scroll_region
1156 : tty->TS_set_scroll_region_1); 1144 : tty->TS_set_scroll_region_1);
1157 1145
1158 FRAME_SCROLL_REGION_COST (frame) = string_cost (f); 1146 FRAME_SCROLL_REGION_COST (frame) = string_cost (f);
1159 1147
@@ -1207,7 +1195,7 @@ calculate_costs (struct frame *frame)
1207} 1195}
1208 1196
1209struct fkey_table { 1197struct fkey_table {
1210 char *cap, *name; 1198 const char *cap, *name;
1211}; 1199};
1212 1200
1213 /* Termcap capability names that correspond directly to X keysyms. 1201 /* Termcap capability names that correspond directly to X keysyms.
@@ -1365,9 +1353,9 @@ term_get_fkeys_1 (void)
1365 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10. 1353 "k;", and if it is present, assuming that "k0" denotes F0, otherwise F10.
1366 */ 1354 */
1367 { 1355 {
1368 char *k_semi = tgetstr ("k;", address); 1356 const char *k_semi = tgetstr ("k;", address);
1369 char *k0 = tgetstr ("k0", address); 1357 const char *k0 = tgetstr ("k0", address);
1370 char *k0_name = "f10"; 1358 const char *k0_name = "f10";
1371 1359
1372 if (k_semi) 1360 if (k_semi)
1373 { 1361 {
@@ -1460,7 +1448,7 @@ static void append_glyph (struct it *);
1460static void produce_stretch_glyph (struct it *); 1448static void produce_stretch_glyph (struct it *);
1461static void append_composite_glyph (struct it *); 1449static void append_composite_glyph (struct it *);
1462static void produce_composite_glyph (struct it *); 1450static void produce_composite_glyph (struct it *);
1463static void append_glyphless_glyph (struct it *, int, char *); 1451static void append_glyphless_glyph (struct it *, int, const char *);
1464static void produce_glyphless_glyph (struct it *, int, Lisp_Object); 1452static void produce_glyphless_glyph (struct it *, int, Lisp_Object);
1465 1453
1466/* Append glyphs to IT's glyph_row. Called from produce_glyphs for 1454/* Append glyphs to IT's glyph_row. Called from produce_glyphs for
@@ -1828,7 +1816,7 @@ produce_composite_glyph (struct it *it)
1828 comes from it->nglyphs bytes). */ 1816 comes from it->nglyphs bytes). */
1829 1817
1830static void 1818static void
1831append_glyphless_glyph (struct it *it, int face_id, char *str) 1819append_glyphless_glyph (struct it *it, int face_id, const char *str)
1832{ 1820{
1833 struct glyph *glyph, *end; 1821 struct glyph *glyph, *end;
1834 int i; 1822 int i;
@@ -1903,7 +1891,8 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1903{ 1891{
1904 int face_id; 1892 int face_id;
1905 int len; 1893 int len;
1906 char buf[9], *str = " "; 1894 char buf[9];
1895 char const *str = " ";
1907 1896
1908 /* Get a face ID for the glyph by utilizing a cache (the same way as 1897 /* Get a face ID for the glyph by utilizing a cache (the same way as
1909 done for `escape-glyph' in get_next_display_element). */ 1898 done for `escape-glyph' in get_next_display_element). */
@@ -2122,12 +2111,13 @@ turn_on_face (struct frame *f, int face_id)
2122 2111
2123 if (tty->TN_max_colors > 0) 2112 if (tty->TN_max_colors > 0)
2124 { 2113 {
2125 char *ts, *p; 2114 const char *ts;
2115 char *p;
2126 2116
2127 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground; 2117 ts = tty->standout_mode ? tty->TS_set_background : tty->TS_set_foreground;
2128 if (fg >= 0 && ts) 2118 if (fg >= 0 && ts)
2129 { 2119 {
2130 p = tparam (ts, NULL, 0, (int) fg); 2120 p = tparam (ts, NULL, 0, (int) fg, 0, 0, 0);
2131 OUTPUT (tty, p); 2121 OUTPUT (tty, p);
2132 xfree (p); 2122 xfree (p);
2133 } 2123 }
@@ -2135,7 +2125,7 @@ turn_on_face (struct frame *f, int face_id)
2135 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background; 2125 ts = tty->standout_mode ? tty->TS_set_foreground : tty->TS_set_background;
2136 if (bg >= 0 && ts) 2126 if (bg >= 0 && ts)
2137 { 2127 {
2138 p = tparam (ts, NULL, 0, (int) bg); 2128 p = tparam (ts, NULL, 0, (int) bg, 0, 0, 0);
2139 OUTPUT (tty, p); 2129 OUTPUT (tty, p);
2140 xfree (p); 2130 xfree (p);
2141 } 2131 }
@@ -2698,14 +2688,14 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
2698 Set *bar_window to Qnil, and *x and *y to the column and 2688 Set *bar_window to Qnil, and *x and *y to the column and
2699 row of the character cell the mouse is over. 2689 row of the character cell the mouse is over.
2700 2690
2701 Set *time to the time the mouse was at the returned position. 2691 Set *timeptr to the time the mouse was at the returned position.
2702 2692
2703 This clears mouse_moved until the next motion 2693 This clears mouse_moved until the next motion
2704 event arrives. */ 2694 event arrives. */
2705static void 2695static void
2706term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2696term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2707 enum scroll_bar_part *part, Lisp_Object *x, 2697 enum scroll_bar_part *part, Lisp_Object *x,
2708 Lisp_Object *y, unsigned long *time) 2698 Lisp_Object *y, unsigned long *timeptr)
2709{ 2699{
2710 struct timeval now; 2700 struct timeval now;
2711 2701
@@ -2718,7 +2708,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
2718 XSETINT (*x, last_mouse_x); 2708 XSETINT (*x, last_mouse_x);
2719 XSETINT (*y, last_mouse_y); 2709 XSETINT (*y, last_mouse_y);
2720 gettimeofday(&now, 0); 2710 gettimeofday(&now, 0);
2721 *time = (now.tv_sec * 1000) + (now.tv_usec / 1000); 2711 *timeptr = (now.tv_sec * 1000) + (now.tv_usec / 1000);
2722} 2712}
2723 2713
2724/* Prepare a mouse-event in *RESULT for placement in the input queue. 2714/* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -3532,10 +3522,10 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3532 If it were in the termcap entry, it would confuse other programs. */ 3522 If it were in the termcap entry, it would confuse other programs. */
3533 if (!tty->TS_set_window) 3523 if (!tty->TS_set_window)
3534 { 3524 {
3535 p = tty->TS_termcap_modes; 3525 const char *m = tty->TS_termcap_modes;
3536 while (*p && strcmp (p, "\033v ")) 3526 while (*m && strcmp (m, "\033v "))
3537 p++; 3527 m++;
3538 if (*p) 3528 if (*m)
3539 tty->TS_set_window = "\033v%C %C %C %C "; 3529 tty->TS_set_window = "\033v%C %C %C %C ";
3540 } 3530 }
3541 /* Termcap entry often fails to have :in: flag */ 3531 /* Termcap entry often fails to have :in: flag */
diff --git a/src/termcap.c b/src/termcap.c
index 69ce56d93b3..27a20a67ae1 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -25,6 +25,10 @@ Boston, MA 02110-1301, USA. */
25#include <unistd.h> 25#include <unistd.h>
26 26
27#include "lisp.h" 27#include "lisp.h"
28#include "tparam.h"
29#ifdef MSDOS
30#include "msdos.h"
31#endif
28 32
29#ifndef NULL 33#ifndef NULL
30#define NULL (char *) 0 34#define NULL (char *) 0
@@ -65,7 +69,7 @@ static char *tgetst1 (char *ptr, char **area);
65 0 if not found. */ 69 0 if not found. */
66 70
67static char * 71static char *
68find_capability (register char *bp, register char *cap) 72find_capability (register char *bp, register const char *cap)
69{ 73{
70 for (; *bp; bp++) 74 for (; *bp; bp++)
71 if (bp[0] == ':' 75 if (bp[0] == ':'
@@ -76,7 +80,7 @@ find_capability (register char *bp, register char *cap)
76} 80}
77 81
78int 82int
79tgetnum (char *cap) 83tgetnum (const char *cap)
80{ 84{
81 register char *ptr = find_capability (term_entry, cap); 85 register char *ptr = find_capability (term_entry, cap);
82 if (!ptr || ptr[-1] != '#') 86 if (!ptr || ptr[-1] != '#')
@@ -85,7 +89,7 @@ tgetnum (char *cap)
85} 89}
86 90
87int 91int
88tgetflag (char *cap) 92tgetflag (const char *cap)
89{ 93{
90 register char *ptr = find_capability (term_entry, cap); 94 register char *ptr = find_capability (term_entry, cap);
91 return ptr && ptr[-1] == ':'; 95 return ptr && ptr[-1] == ':';
@@ -97,7 +101,7 @@ tgetflag (char *cap)
97 If AREA is null, space is allocated with `malloc'. */ 101 If AREA is null, space is allocated with `malloc'. */
98 102
99char * 103char *
100tgetstr (char *cap, char **area) 104tgetstr (const char *cap, char **area)
101{ 105{
102 register char *ptr = find_capability (term_entry, cap); 106 register char *ptr = find_capability (term_entry, cap);
103 if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) 107 if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~'))
@@ -263,7 +267,7 @@ tgetst1 (char *ptr, char **area)
263char PC; 267char PC;
264 268
265void 269void
266tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) 270tputs (register const char *str, int nlines, int (*outfun) (int))
267{ 271{
268 register int padcount = 0; 272 register int padcount = 0;
269 register int speed; 273 register int speed;
@@ -355,7 +359,7 @@ valid_filename_p (fn)
355 in it, and some other value otherwise. */ 359 in it, and some other value otherwise. */
356 360
357int 361int
358tgetent (char *bp, char *name) 362tgetent (char *bp, const char *name)
359{ 363{
360 register char *termcap_name; 364 register char *termcap_name;
361 register int fd; 365 register int fd;
@@ -442,7 +446,7 @@ tgetent (char *bp, char *name)
442 buf.size = BUFSIZE; 446 buf.size = BUFSIZE;
443 /* Add 1 to size to ensure room for terminating null. */ 447 /* Add 1 to size to ensure room for terminating null. */
444 buf.beg = (char *) xmalloc (buf.size + 1); 448 buf.beg = (char *) xmalloc (buf.size + 1);
445 term = indirect ? indirect : name; 449 term = indirect ? indirect : (char *)name;
446 450
447 if (!bp) 451 if (!bp)
448 { 452 {
diff --git a/src/termchar.h b/src/termchar.h
index 277a96932b4..035974a8ce6 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -84,58 +84,58 @@ struct tty_display_info
84 84
85 /* Strings, numbers and flags taken from the termcap entry. */ 85 /* Strings, numbers and flags taken from the termcap entry. */
86 86
87 char *TS_ins_line; /* "al" */ 87 const char *TS_ins_line; /* "al" */
88 char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ 88 const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
89 char *TS_bell; /* "bl" */ 89 const char *TS_bell; /* "bl" */
90 char *TS_clr_to_bottom; /* "cd" */ 90 const char *TS_clr_to_bottom; /* "cd" */
91 char *TS_clr_line; /* "ce", clear to end of line */ 91 const char *TS_clr_line; /* "ce", clear to end of line */
92 char *TS_clr_frame; /* "cl" */ 92 const char *TS_clr_frame; /* "cl" */
93 char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ 93 const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
94 char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, 94 const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
95 lines above scroll region, lines below it, 95 lines above scroll region, lines below it,
96 total lines again) */ 96 total lines again) */
97 char *TS_del_char; /* "dc" */ 97 const char *TS_del_char; /* "dc" */
98 char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ 98 const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
99 char *TS_del_line; /* "dl" */ 99 const char *TS_del_line; /* "dl" */
100 char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ 100 const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
101 char *TS_delete_mode; /* "dm", enter character-delete mode */ 101 const char *TS_delete_mode; /* "dm", enter character-delete mode */
102 char *TS_end_delete_mode; /* "ed", leave character-delete mode */ 102 const char *TS_end_delete_mode; /* "ed", leave character-delete mode */
103 char *TS_end_insert_mode; /* "ei", leave character-insert mode */ 103 const char *TS_end_insert_mode; /* "ei", leave character-insert mode */
104 char *TS_ins_char; /* "ic" */ 104 const char *TS_ins_char; /* "ic" */
105 char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ 105 const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
106 char *TS_insert_mode; /* "im", enter character-insert mode */ 106 const char *TS_insert_mode; /* "im", enter character-insert mode */
107 char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ 107 const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
108 char *TS_end_keypad_mode; /* "ke" */ 108 const char *TS_end_keypad_mode; /* "ke" */
109 char *TS_keypad_mode; /* "ks" */ 109 const char *TS_keypad_mode; /* "ks" */
110 char *TS_pad_char; /* "pc", char to use as padding */ 110 const char *TS_pad_char; /* "pc", char to use as padding */
111 char *TS_repeat; /* "rp" (2 params, # times to repeat 111 const char *TS_repeat; /* "rp" (2 params, # times to repeat
112 and character to be repeated) */ 112 and character to be repeated) */
113 char *TS_end_standout_mode; /* "se" */ 113 const char *TS_end_standout_mode; /* "se" */
114 char *TS_fwd_scroll; /* "sf" */ 114 const char *TS_fwd_scroll; /* "sf" */
115 char *TS_standout_mode; /* "so" */ 115 const char *TS_standout_mode; /* "so" */
116 char *TS_rev_scroll; /* "sr" */ 116 const char *TS_rev_scroll; /* "sr" */
117 char *TS_end_termcap_modes; /* "te" */ 117 const char *TS_end_termcap_modes; /* "te" */
118 char *TS_termcap_modes; /* "ti" */ 118 const char *TS_termcap_modes; /* "ti" */
119 char *TS_visible_bell; /* "vb" */ 119 const char *TS_visible_bell; /* "vb" */
120 char *TS_cursor_normal; /* "ve" */ 120 const char *TS_cursor_normal; /* "ve" */
121 char *TS_cursor_visible; /* "vs" */ 121 const char *TS_cursor_visible; /* "vs" */
122 char *TS_cursor_invisible; /* "vi" */ 122 const char *TS_cursor_invisible; /* "vi" */
123 char *TS_set_window; /* "wi" (4 params, start and end of window, 123 const char *TS_set_window; /* "wi" (4 params, start and end of window,
124 each as vpos and hpos) */ 124 each as vpos and hpos) */
125 125
126 char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ 126 const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
127 char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ 127 const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
128 char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ 128 const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */
129 char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ 129 const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
130 char *TS_exit_underline_mode; /* "us" -- start underlining. */ 130 const char *TS_exit_underline_mode; /* "us" -- start underlining. */
131 char *TS_enter_underline_mode; /* "ue" -- end underlining. */ 131 const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
132 132
133 /* "as"/"ae" -- start/end alternate character set. Not really 133 /* "as"/"ae" -- start/end alternate character set. Not really
134 supported, yet. */ 134 supported, yet. */
135 char *TS_enter_alt_charset_mode; 135 const char *TS_enter_alt_charset_mode;
136 char *TS_exit_alt_charset_mode; 136 const char *TS_exit_alt_charset_mode;
137 137
138 char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ 138 const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
139 139
140 /* Value of the "NC" (no_color_video) capability, or 0 if not present. */ 140 /* Value of the "NC" (no_color_video) capability, or 0 if not present. */
141 int TN_no_color_video; 141 int TN_no_color_video;
@@ -147,12 +147,12 @@ struct tty_display_info
147 int TN_max_pairs; 147 int TN_max_pairs;
148 148
149 /* "op" -- SVr4 set default pair to its original value. */ 149 /* "op" -- SVr4 set default pair to its original value. */
150 char *TS_orig_pair; 150 const char *TS_orig_pair;
151 151
152 /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color. 152 /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
153 1 param, the color index. */ 153 1 param, the color index. */
154 char *TS_set_foreground; 154 const char *TS_set_foreground;
155 char *TS_set_background; 155 const char *TS_set_background;
156 156
157 int TF_hazeltine; /* termcap hz flag. */ 157 int TF_hazeltine; /* termcap hz flag. */
158 int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ 158 int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
@@ -210,4 +210,3 @@ extern struct tty_display_info *tty_list;
210 : (abort(), (struct tty_display_info *) 0)) 210 : (abort(), (struct tty_display_info *) 0))
211 211
212#define CURTTY() FRAME_TTY (SELECTED_FRAME()) 212#define CURTTY() FRAME_TTY (SELECTED_FRAME())
213
diff --git a/src/termhooks.h b/src/termhooks.h
index b147f6ed0a1..0ccd2dac9e1 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -654,6 +654,9 @@ extern void delete_terminal (struct terminal *);
654/* The initial terminal device, created by initial_term_init. */ 654/* The initial terminal device, created by initial_term_init. */
655extern struct terminal *initial_terminal; 655extern struct terminal *initial_terminal;
656 656
657extern unsigned char *encode_terminal_code (struct glyph *, int,
658 struct coding_system *);
659
657#ifdef HAVE_GPM 660#ifdef HAVE_GPM
658extern void close_gpm (int gpm_fd); 661extern void close_gpm (int gpm_fd);
659#endif 662#endif
diff --git a/src/terminal.c b/src/terminal.c
index 309cc0095e8..c5185601fb6 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -109,7 +109,7 @@ void
109raw_cursor_to (struct frame *f, int row, int col) 109raw_cursor_to (struct frame *f, int row, int col)
110{ 110{
111 if (FRAME_TERMINAL (f)->raw_cursor_to_hook) 111 if (FRAME_TERMINAL (f)->raw_cursor_to_hook)
112 (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); 112 (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col);
113} 113}
114 114
115/* Erase operations */ 115/* Erase operations */
@@ -444,7 +444,7 @@ selected frame's terminal). */)
444/* Set the value of terminal parameter PARAMETER in terminal D to VALUE. 444/* Set the value of terminal parameter PARAMETER in terminal D to VALUE.
445 Return the previous value. */ 445 Return the previous value. */
446 446
447Lisp_Object 447static Lisp_Object
448store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) 448store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value)
449{ 449{
450 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); 450 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist);
@@ -569,4 +569,3 @@ or some time later. */);
569 569
570 Fprovide (intern_c_string ("multi-tty"), Qnil); 570 Fprovide (intern_c_string ("multi-tty"), Qnil);
571} 571}
572
diff --git a/src/tparam.c b/src/tparam.c
index fcbb63881e6..6aae0b97db9 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -21,6 +21,7 @@ Boston, MA 02110-1301, USA. */
21#include <config.h> 21#include <config.h>
22#include <setjmp.h> 22#include <setjmp.h>
23#include "lisp.h" /* for xmalloc */ 23#include "lisp.h" /* for xmalloc */
24#include "tparam.h"
24 25
25#ifndef NULL 26#ifndef NULL
26#define NULL (char *) 0 27#define NULL (char *) 0
@@ -38,11 +39,12 @@ Boston, MA 02110-1301, USA. */
38 39
39 The fourth and following args to tparam serve as the parameter values. */ 40 The fourth and following args to tparam serve as the parameter values. */
40 41
41static char *tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp); 42static char *tparam1 (char const *string, char *outstring, int len,
43 char *up, char *left, int *argp);
42 44
43/* VARARGS 2 */
44char * 45char *
45tparam (char *string, char *outstring, int len, int arg0, int arg1, int arg2, int arg3) 46tparam (const char *string, char *outstring, int len,
47 int arg0, int arg1, int arg2, int arg3)
46{ 48{
47 int arg[4]; 49 int arg[4];
48 50
@@ -59,7 +61,7 @@ char *UP;
59static char tgoto_buf[50]; 61static char tgoto_buf[50];
60 62
61char * 63char *
62tgoto (char *cm, int hpos, int vpos) 64tgoto (const char *cm, int hpos, int vpos)
63{ 65{
64 int args[2]; 66 int args[2];
65 if (!cm) 67 if (!cm)
@@ -70,10 +72,11 @@ tgoto (char *cm, int hpos, int vpos)
70} 72}
71 73
72static char * 74static char *
73tparam1 (char *string, char *outstring, int len, char *up, char *left, register int *argp) 75tparam1 (const char *string, char *outstring, int len,
76 char *up, char *left, register int *argp)
74{ 77{
75 register int c; 78 register int c;
76 register char *p = string; 79 register const char *p = string;
77 register char *op = outstring; 80 register char *op = outstring;
78 char *outend; 81 char *outend;
79 int outlen = 0; 82 int outlen = 0;
@@ -277,4 +280,3 @@ main (argc, argv)
277} 280}
278 281
279#endif /* DEBUG */ 282#endif /* DEBUG */
280
diff --git a/src/tparam.h b/src/tparam.h
new file mode 100644
index 00000000000..3cd3e6053cc
--- /dev/null
+++ b/src/tparam.h
@@ -0,0 +1,31 @@
1/* Interface definitions for termcap entries.
2
3Copyright (C) 2011 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20
21/* Don't try to include termcap.h. On some systems, configure finds a
22 non-standard termcap.h that the main build won't find. */
23
24void tputs (const char *, int, int (*) (int));
25int tgetent (char *, const char *);
26int tgetflag (const char *);
27int tgetnum (const char *);
28char *tgetstr (const char *, char **);
29char *tgoto (const char *, int, int);
30
31char *tparam (const char *, char *, int, int, int, int, int);
diff --git a/src/unexaix.c b/src/unexaix.c
index fe9d13d3e47..df4c5b8905c 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -40,6 +40,8 @@ what you give them. Help stamp out software-hoarding! */
40 */ 40 */
41 41
42#include <config.h> 42#include <config.h>
43#include "unexec.h"
44
43#define PERROR(file) report_error (file, new) 45#define PERROR(file) report_error (file, new)
44#include <a.out.h> 46#include <a.out.h>
45/* Define getpagesize () if the system does not. 47/* Define getpagesize () if the system does not.
@@ -119,7 +121,8 @@ static void write_segment (int, char *, char *);
119 * 121 *
120 * driving logic. 122 * driving logic.
121 */ 123 */
122int unexec (const char *new_name, const char *a_name) 124void
125unexec (const char *new_name, const char *a_name)
123{ 126{
124 int new = -1, a_out = -1; 127 int new = -1, a_out = -1;
125 128
@@ -139,14 +142,13 @@ int unexec (const char *new_name, const char *a_name)
139 || unrelocate_symbols (new, a_out, a_name, new_name) < 0) 142 || unrelocate_symbols (new, a_out, a_name, new_name) < 0)
140 { 143 {
141 close (new); 144 close (new);
142 return -1; 145 return;
143 } 146 }
144 147
145 close (new); 148 close (new);
146 if (a_out >= 0) 149 if (a_out >= 0)
147 close (a_out); 150 close (a_out);
148 mark_x (new_name); 151 mark_x (new_name);
149 return 0;
150} 152}
151 153
152/* **************************************************************** 154/* ****************************************************************
@@ -637,4 +639,3 @@ start_of_text (void)
637{ 639{
638 return ((char *) 0x10000000); 640 return ((char *) 0x10000000);
639} 641}
640
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 4dafabab689..ef86a400239 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -50,6 +50,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50 */ 50 */
51 51
52#include <config.h> 52#include <config.h>
53#include "unexec.h"
54
53#define PERROR(file) report_error (file, new) 55#define PERROR(file) report_error (file, new)
54 56
55#ifndef CANNOT_DUMP /* all rest of file! */ 57#ifndef CANNOT_DUMP /* all rest of file! */
@@ -522,7 +524,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
522 * 524 *
523 * driving logic. 525 * driving logic.
524 */ 526 */
525int 527void
526unexec (const char *new_name, const char *a_name) 528unexec (const char *new_name, const char *a_name)
527{ 529{
528 int new = -1, a_out = -1; 530 int new = -1, a_out = -1;
@@ -543,15 +545,13 @@ unexec (const char *new_name, const char *a_name)
543 ) 545 )
544 { 546 {
545 close (new); 547 close (new);
546 return -1; 548 return;
547 } 549 }
548 550
549 close (new); 551 close (new);
550 if (a_out >= 0) 552 if (a_out >= 0)
551 close (a_out); 553 close (a_out);
552 mark_x (new_name); 554 mark_x (new_name);
553 return 0;
554} 555}
555 556
556#endif /* not CANNOT_DUMP */ 557#endif /* not CANNOT_DUMP */
557
diff --git a/src/unexcw.c b/src/unexcw.c
index 02add901bbd..f643c196de0 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -19,6 +19,8 @@ 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#include "unexec.h"
23
22#include <setjmp.h> 24#include <setjmp.h>
23#include <lisp.h> 25#include <lisp.h>
24#include <stdio.h> 26#include <stdio.h>
@@ -247,7 +249,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified)
247 return (modified); 249 return (modified);
248} 250}
249 251
250int 252void
251unexec (const char *outfile, const char *infile) 253unexec (const char *outfile, const char *infile)
252{ 254{
253 char infile_buffer[FILENAME_MAX]; 255 char infile_buffer[FILENAME_MAX];
@@ -261,7 +263,7 @@ unexec (const char *outfile, const char *infile)
261 { 263 {
262 /* can only dump once */ 264 /* can only dump once */
263 printf ("You can only dump Emacs once on this platform.\n"); 265 printf ("You can only dump Emacs once on this platform.\n");
264 return (1); 266 return;
265 } 267 }
266 268
267 report_sheap_usage (1); 269 report_sheap_usage (1);
@@ -296,7 +298,4 @@ unexec (const char *outfile, const char *infile)
296 298
297 ret = close (fd_out); 299 ret = close (fd_out);
298 assert (ret == 0); 300 assert (ret == 0);
299
300 return (0);
301} 301}
302
diff --git a/src/unexec.h b/src/unexec.h
new file mode 100644
index 00000000000..343eb6d8db5
--- /dev/null
+++ b/src/unexec.h
@@ -0,0 +1 @@
void unexec (const char *, const char *);
diff --git a/src/unexelf.c b/src/unexelf.c
index 1009c87066b..b58c78501b8 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -386,6 +386,8 @@ temacs:
386 Instead we read the whole file, modify it, and write it out. */ 386 Instead we read the whole file, modify it, and write it out. */
387 387
388#include <config.h> 388#include <config.h>
389#include <unexec.h>
390
389extern void fatal (const char *msgid, ...); 391extern void fatal (const char *msgid, ...);
390 392
391#include <sys/types.h> 393#include <sys/types.h>
@@ -518,10 +520,6 @@ typedef struct {
518# define ElfW(type) ElfExpandBitsW (ELFSIZE, type) 520# define ElfW(type) ElfExpandBitsW (ELFSIZE, type)
519#endif 521#endif
520 522
521#ifndef ELF_BSS_SECTION_NAME
522#define ELF_BSS_SECTION_NAME ".bss"
523#endif
524
525/* Get the address of a particular section or program header entry, 523/* Get the address of a particular section or program header entry,
526 * accounting for the size of the entries. 524 * accounting for the size of the entries.
527 */ 525 */
@@ -553,8 +551,6 @@ typedef struct {
553 (*(ElfW(Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n))) 551 (*(ElfW(Shdr) *) ((byte *) old_section_h + old_file_h->e_shentsize * (n)))
554#define NEW_SECTION_H(n) \ 552#define NEW_SECTION_H(n) \
555 (*(ElfW(Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n))) 553 (*(ElfW(Shdr) *) ((byte *) new_section_h + new_file_h->e_shentsize * (n)))
556#define OLD_PROGRAM_H(n) \
557 (*(ElfW(Phdr) *) ((byte *) old_program_h + old_file_h->e_phentsize * (n)))
558#define NEW_PROGRAM_H(n) \ 554#define NEW_PROGRAM_H(n) \
559 (*(ElfW(Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n))) 555 (*(ElfW(Phdr) *) ((byte *) new_program_h + new_file_h->e_phentsize * (n)))
560 556
@@ -623,6 +619,10 @@ unexec (const char *new_name, const char *old_name)
623{ 619{
624 int new_file, old_file, new_file_size; 620 int new_file, old_file, new_file_size;
625 621
622#if defined (emacs) || !defined (DEBUG)
623 void *new_break;
624#endif
625
626 /* Pointers to the base of the image of the two files. */ 626 /* Pointers to the base of the image of the two files. */
627 caddr_t old_base, new_base; 627 caddr_t old_base, new_base;
628 628
@@ -753,7 +753,8 @@ unexec (const char *new_name, const char *old_name)
753 old_name, old_file_h, old_section_h, 0); 753 old_name, old_file_h, old_section_h, 0);
754 754
755#if defined (emacs) || !defined (DEBUG) 755#if defined (emacs) || !defined (DEBUG)
756 new_bss_addr = (ElfW(Addr)) sbrk (0); 756 new_break = sbrk (0);
757 new_bss_addr = (ElfW(Addr)) new_break;
757#else 758#else
758 new_bss_addr = old_bss_addr + old_bss_size + 0x1234; 759 new_bss_addr = old_bss_addr + old_bss_size + 0x1234;
759#endif 760#endif
@@ -954,13 +955,13 @@ temacs:
954 Link Info Adralgn Entsize 955 Link Info Adralgn Entsize
955 956
956[22] 1 3 0x335150 0x315150 0x4 .data.rel.local 957[22] 1 3 0x335150 0x315150 0x4 .data.rel.local
957 0 0 0x4 0 958 0 0 0x4 0
958 959
959[23] 8 3 0x335158 0x315158 0x42720 .bss 960[23] 8 3 0x335158 0x315158 0x42720 .bss
960 0 0 0x8 0 961 0 0 0x8 0
961 962
962[24] 2 0 0 0x315154 0x1c9d0 .symtab 963[24] 2 0 0 0x315154 0x1c9d0 .symtab
963 25 1709 0x4 0x10 964 25 1709 0x4 0x10
964 */ 965 */
965 966
966 if (NEW_SECTION_H (nn).sh_offset >= old_bss_offset 967 if (NEW_SECTION_H (nn).sh_offset >= old_bss_offset
@@ -1228,8 +1229,8 @@ temacs:
1228 ElfW(Shdr) section = NEW_SECTION_H (n); 1229 ElfW(Shdr) section = NEW_SECTION_H (n);
1229 1230
1230 /* Cause a compilation error if anyone uses n instead of nn below. */ 1231 /* Cause a compilation error if anyone uses n instead of nn below. */
1231 struct {int a;} n; 1232 #define n ((void) 0);
1232 (void)n.a; /* Prevent `unused variable' warnings. */ 1233 n /* Prevent 'macro "n" is not used' warnings. */
1233 1234
1234 switch (section.sh_type) 1235 switch (section.sh_type)
1235 { 1236 {
@@ -1276,6 +1277,8 @@ temacs:
1276 } 1277 }
1277 break; 1278 break;
1278 } 1279 }
1280
1281 #undef n
1279 } 1282 }
1280 1283
1281 /* Write out new_file, and free the buffers. */ 1284 /* Write out new_file, and free the buffers. */
@@ -1307,4 +1310,3 @@ temacs:
1307 if (chmod (new_name, stat_buf.st_mode) == -1) 1310 if (chmod (new_name, stat_buf.st_mode) == -1)
1308 fatal ("Can't chmod (%s): errno %d\n", new_name, errno); 1311 fatal ("Can't chmod (%s): errno %d\n", new_name, errno);
1309} 1312}
1310
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c
index c0471992a72..f27415a252c 100644
--- a/src/unexhp9k800.c
+++ b/src/unexhp9k800.c
@@ -50,6 +50,8 @@
50*/ 50*/
51 51
52#include <config.h> 52#include <config.h>
53#include "unexec.h"
54
53#include <stdio.h> 55#include <stdio.h>
54#include <fcntl.h> 56#include <fcntl.h>
55#include <errno.h> 57#include <errno.h>
@@ -74,7 +76,7 @@ run_time_remap (ignored)
74 76
75 77
76/* Create a new a.out file, same as old but with current data space */ 78/* Create a new a.out file, same as old but with current data space */
77int 79void
78unexec (const char *new_name, /* name of the new a.out file to be created */ 80unexec (const char *new_name, /* name of the new a.out file to be created */
79 const char *old_name) /* name of the old a.out file */ 81 const char *old_name) /* name of the old a.out file */
80{ 82{
@@ -131,7 +133,6 @@ unexec (const char *new_name, /* name of the new a.out file to be created *
131 /* Close the binary file */ 133 /* Close the binary file */
132 close (old); 134 close (old);
133 close (new); 135 close (new);
134 return 0;
135} 136}
136 137
137/* Save current data space in the file, update header. */ 138/* Save current data space in the file, update header. */
@@ -319,4 +320,3 @@ display_header (hdr, auxhdr)
319 hdr->unloadable_sp_location, hdr->unloadable_sp_size); 320 hdr->unloadable_sp_location, hdr->unloadable_sp_size);
320} 321}
321#endif /* DEBUG */ 322#endif /* DEBUG */
322
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 7a55498085d..04e3edf463e 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -95,6 +95,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95#undef malloc 95#undef malloc
96#undef realloc 96#undef realloc
97#undef free 97#undef free
98
99#include "unexec.h"
100
98#include <stdio.h> 101#include <stdio.h>
99#include <fcntl.h> 102#include <fcntl.h>
100#include <stdarg.h> 103#include <stdarg.h>
@@ -828,6 +831,7 @@ copy_data_segment (struct load_command *lc)
828 } 831 }
829 else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 832 else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
830 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 833 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
834 || strncmp (sectp->sectname, "__got", 16) == 0
831 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 835 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
832 || strncmp (sectp->sectname, "__dyld", 16) == 0 836 || strncmp (sectp->sectname, "__dyld", 16) == 0
833 || strncmp (sectp->sectname, "__const", 16) == 0 837 || strncmp (sectp->sectname, "__const", 16) == 0
@@ -1223,7 +1227,7 @@ dump_it (void)
1223 from it. The file names of the output and input files are outfile 1227 from it. The file names of the output and input files are outfile
1224 and infile, respectively. The three other parameters are 1228 and infile, respectively. The three other parameters are
1225 ignored. */ 1229 ignored. */
1226int 1230void
1227unexec (const char *outfile, const char *infile) 1231unexec (const char *outfile, const char *infile)
1228{ 1232{
1229 if (in_dumped_exec) 1233 if (in_dumped_exec)
@@ -1254,7 +1258,6 @@ unexec (const char *outfile, const char *infile)
1254 dump_it (); 1258 dump_it ();
1255 1259
1256 close (outfd); 1260 close (outfd);
1257 return 0;
1258} 1261}
1259 1262
1260 1263
@@ -1379,4 +1382,3 @@ unexec_free (void *ptr)
1379 else 1382 else
1380 malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1); 1383 malloc_zone_free (emacs_zone, (unexec_malloc_header_t *) ptr - 1);
1381} 1384}
1382
diff --git a/src/unexsol.c b/src/unexsol.c
index e1a10f7d211..ef1e34e6f0f 100644
--- a/src/unexsol.c
+++ b/src/unexsol.c
@@ -1,6 +1,8 @@
1/* Trivial unexec for Solaris. */ 1/* Trivial unexec for Solaris. */
2 2
3#include <config.h> 3#include <config.h>
4#include "unexec.h"
5
4#include <dlfcn.h> 6#include <dlfcn.h>
5#include <setjmp.h> 7#include <setjmp.h>
6 8
@@ -9,14 +11,14 @@
9#include "charset.h" 11#include "charset.h"
10#include "coding.h" 12#include "coding.h"
11 13
12int 14void
13unexec (const char *new_name, const char *old_name) 15unexec (const char *new_name, const char *old_name)
14{ 16{
15 Lisp_Object data; 17 Lisp_Object data;
16 Lisp_Object errstring; 18 Lisp_Object errstring;
17 19
18 if (! dldump (0, new_name, RTLD_MEMORY)) 20 if (! dldump (0, new_name, RTLD_MEMORY))
19 return 0; 21 return;
20 22
21 data = Fcons (build_string (new_name), Qnil); 23 data = Fcons (build_string (new_name), Qnil);
22 synchronize_system_messages_locale (); 24 synchronize_system_messages_locale ();
@@ -26,4 +28,3 @@ unexec (const char *new_name, const char *old_name)
26 xsignal (Qfile_error, 28 xsignal (Qfile_error,
27 Fcons (build_string ("Cannot unexec"), Fcons (errstring, data))); 29 Fcons (build_string ("Cannot unexec"), Fcons (errstring, data)));
28} 30}
29
diff --git a/src/unexw32.c b/src/unexw32.c
index 829c864c960..cd8211d6bee 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -21,6 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21*/ 21*/
22 22
23#include <config.h> 23#include <config.h>
24#include "unexec.h"
24 25
25#include <stdio.h> 26#include <stdio.h>
26#include <fcntl.h> 27#include <fcntl.h>
@@ -723,7 +724,7 @@ copy_executable_and_dump_data (file_data *p_infile,
723 724
724 725
725/* Dump out .data and .bss sections into a new executable. */ 726/* Dump out .data and .bss sections into a new executable. */
726int 727void
727unexec (const char *new_name, const char *old_name) 728unexec (const char *new_name, const char *old_name)
728{ 729{
729 file_data in_file, out_file; 730 file_data in_file, out_file;
@@ -819,9 +820,6 @@ unexec (const char *new_name, const char *old_name)
819 820
820 close_file_data (&in_file); 821 close_file_data (&in_file);
821 close_file_data (&out_file); 822 close_file_data (&out_file);
822
823 return 0;
824} 823}
825 824
826/* eof */ 825/* eof */
827
diff --git a/src/w32.c b/src/w32.c
index ae2373be46e..721cea07d20 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -147,9 +147,6 @@ typedef HRESULT (WINAPI * ShGetFolderPath_fn)
147void globals_of_w32 (void); 147void globals_of_w32 (void);
148static DWORD get_rid (PSID); 148static DWORD get_rid (PSID);
149 149
150/* Defined in process.c for its own purpose. */
151extern Lisp_Object Qlocal;
152
153 150
154/* Initialization states. 151/* Initialization states.
155 152
@@ -5666,8 +5663,6 @@ sys_write (int fd, const void * buffer, unsigned int count)
5666static void 5663static void
5667check_windows_init_file (void) 5664check_windows_init_file (void)
5668{ 5665{
5669 extern int noninteractive, inhibit_window_system;
5670
5671 /* A common indication that Emacs is not installed properly is when 5666 /* A common indication that Emacs is not installed properly is when
5672 it cannot find the Windows installation file. If this file does 5667 it cannot find the Windows installation file. If this file does
5673 not exist in the expected place, tell the user. */ 5668 not exist in the expected place, tell the user. */
diff --git a/src/w32console.c b/src/w32console.c
index 31c4a7c4e5a..3c200405cb5 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -41,12 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41/* from window.c */ 41/* from window.c */
42extern Lisp_Object Frecenter (Lisp_Object); 42extern Lisp_Object Frecenter (Lisp_Object);
43 43
44/* from keyboard.c */
45extern int detect_input_pending (void);
46
47/* from sysdep.c */
48extern int read_input_pending (void);
49
50static void w32con_move_cursor (struct frame *f, int row, int col); 44static void w32con_move_cursor (struct frame *f, int row, int col);
51static void w32con_clear_to_end (struct frame *f); 45static void w32con_clear_to_end (struct frame *f);
52static void w32con_clear_frame (struct frame *f); 46static void w32con_clear_frame (struct frame *f);
@@ -277,9 +271,6 @@ w32con_insert_glyphs (struct frame *f, register struct glyph *start,
277 } 271 }
278} 272}
279 273
280extern unsigned char *encode_terminal_code (struct glyph *, int,
281 struct coding_system *);
282
283static void 274static void
284w32con_write_glyphs (struct frame *f, register struct glyph *string, 275w32con_write_glyphs (struct frame *f, register struct glyph *string,
285 register int len) 276 register int len)
diff --git a/src/w32fns.c b/src/w32fns.c
index ec48397657a..0c899cdceff 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -60,6 +60,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
60#include <dlgs.h> 60#include <dlgs.h>
61#include <imm.h> 61#include <imm.h>
62#define FILE_NAME_TEXT_FIELD edt1 62#define FILE_NAME_TEXT_FIELD edt1
63#define FILE_NAME_COMBO_BOX cmb13
64#define FILE_NAME_LIST lst1
63 65
64#include "font.h" 66#include "font.h"
65#include "w32font.h" 67#include "w32font.h"
@@ -78,10 +80,6 @@ extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
78extern void w32_free_menu_strings (HWND); 80extern void w32_free_menu_strings (HWND);
79extern const char *map_w32_filename (const char *, const char **); 81extern const char *map_w32_filename (const char *, const char **);
80 82
81extern int quit_char;
82
83extern const char *const lispy_function_keys[];
84
85/* If non-zero, a w32 timer that, when it expires, displays an 83/* If non-zero, a w32 timer that, when it expires, displays an
86 hourglass cursor on all frames. */ 84 hourglass cursor on all frames. */
87static unsigned hourglass_timer = 0; 85static unsigned hourglass_timer = 0;
@@ -185,18 +183,10 @@ unsigned int msh_mousewheel = 0;
185#define MENU_FREE_DELAY 1000 183#define MENU_FREE_DELAY 1000
186static unsigned menu_free_timer = 0; 184static unsigned menu_free_timer = 0;
187 185
188extern Lisp_Object Qtooltip;
189
190#ifdef GLYPH_DEBUG 186#ifdef GLYPH_DEBUG
191int image_cache_refcount, dpyinfo_refcount; 187int image_cache_refcount, dpyinfo_refcount;
192#endif 188#endif
193 189
194
195extern HWND w32_system_caret_hwnd;
196
197extern int w32_system_caret_height;
198extern int w32_system_caret_x;
199extern int w32_system_caret_y;
200static HWND w32_visible_system_caret_hwnd; 190static HWND w32_visible_system_caret_hwnd;
201 191
202/* From w32menu.c */ 192/* From w32menu.c */
@@ -5849,7 +5839,6 @@ Value is t if tooltip was open, nil otherwise. */)
5849/*********************************************************************** 5839/***********************************************************************
5850 File selection dialog 5840 File selection dialog
5851 ***********************************************************************/ 5841 ***********************************************************************/
5852extern Lisp_Object Qfile_name_history;
5853 5842
5854/* Callback for altering the behavior of the Open File dialog. 5843/* Callback for altering the behavior of the Open File dialog.
5855 Makes the Filename text field contain "Current Directory" and be 5844 Makes the Filename text field contain "Current Directory" and be
@@ -5868,13 +5857,37 @@ file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
5868 { 5857 {
5869 HWND dialog = GetParent (hwnd); 5858 HWND dialog = GetParent (hwnd);
5870 HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD); 5859 HWND edit_control = GetDlgItem (dialog, FILE_NAME_TEXT_FIELD);
5860 HWND list = GetDlgItem (dialog, FILE_NAME_LIST);
5871 5861
5872 /* Directories is in index 2. */ 5862 /* At least on Windows 7, the above attempt to get the window handle
5863 to the File Name Text Field fails. The following code does the
5864 job though. Note that this code is based on my examination of the
5865 window hierarchy using Microsoft Spy++. bk */
5866 if (edit_control == NULL)
5867 {
5868 HWND tmp = GetDlgItem (dialog, FILE_NAME_COMBO_BOX);
5869 if (tmp)
5870 {
5871 tmp = GetWindow (tmp, GW_CHILD);
5872 if (tmp)
5873 edit_control = GetWindow (tmp, GW_CHILD);
5874 }
5875 }
5876
5877 /* Directories is in index 2. */
5873 if (notify->lpOFN->nFilterIndex == 2) 5878 if (notify->lpOFN->nFilterIndex == 2)
5874 { 5879 {
5875 CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD, 5880 CommDlg_OpenSave_SetControlText (dialog, FILE_NAME_TEXT_FIELD,
5876 "Current Directory"); 5881 "Current Directory");
5877 EnableWindow (edit_control, FALSE); 5882 EnableWindow (edit_control, FALSE);
5883 /* Note that at least on Windows 7, the above call to EnableWindow
5884 disables the window that would ordinarily have focus. If we
5885 do not set focus to some other window here, focus will land in
5886 no man's land and the user will be unable to tab through the
5887 dialog box (pressing tab will only result in a beep).
5888 Avoid that problem by setting focus to the list here. */
5889 if (notify->hdr.code == CDN_INITDONE)
5890 SetFocus (list);
5878 } 5891 }
5879 else 5892 else
5880 { 5893 {
@@ -5951,6 +5964,13 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5951 else 5964 else
5952 filename[0] = '\0'; 5965 filename[0] = '\0';
5953 5966
5967 /* The code in file_dialog_callback that attempts to set the text
5968 of the file name edit window when handling the CDN_INITDONE
5969 WM_NOTIFY message does not work. Setting filename to "Current
5970 Directory" in the only_dir_p case here does work however. */
5971 if (filename[0] == 0 && ! NILP (only_dir_p))
5972 strcpy (filename, "Current Directory");
5973
5954 { 5974 {
5955 NEWOPENFILENAME new_file_details; 5975 NEWOPENFILENAME new_file_details;
5956 BOOL file_opened = FALSE; 5976 BOOL file_opened = FALSE;
diff --git a/src/w32font.c b/src/w32font.c
index aef62f61a3a..40ff0782b88 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -54,8 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54#define JOHAB_CHARSET 130 54#define JOHAB_CHARSET 130
55#endif 55#endif
56 56
57extern struct font_driver w32font_driver;
58
59Lisp_Object Qgdi; 57Lisp_Object Qgdi;
60Lisp_Object Quniscribe; 58Lisp_Object Quniscribe;
61static Lisp_Object QCformat; 59static Lisp_Object QCformat;
@@ -64,7 +62,6 @@ static Lisp_Object Qserif, Qscript, Qdecorative;
64static Lisp_Object Qraster, Qoutline, Qunknown; 62static Lisp_Object Qraster, Qoutline, Qunknown;
65 63
66/* antialiasing */ 64/* antialiasing */
67extern Lisp_Object QCantialias, QCotf, QClang; /* defined in font.c */
68extern Lisp_Object Qnone; /* reuse from w32fns.c */ 65extern Lisp_Object Qnone; /* reuse from w32fns.c */
69static Lisp_Object Qstandard, Qsubpixel, Qnatural; 66static Lisp_Object Qstandard, Qsubpixel, Qnatural;
70 67
diff --git a/src/w32inevt.c b/src/w32inevt.c
index d0b097100fd..c4858dea908 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -40,18 +40,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
40#include "w32heap.h" 40#include "w32heap.h"
41#include "w32term.h" 41#include "w32term.h"
42 42
43/* stdin, from ntterm */ 43/* stdin, from w32console.c */
44extern HANDLE keyboard_handle; 44extern HANDLE keyboard_handle;
45 45
46/* Info for last mouse motion */ 46/* Info for last mouse motion */
47static COORD movement_pos; 47static COORD movement_pos;
48static DWORD movement_time; 48static DWORD movement_time;
49 49
50/* from keyboard.c */ 50/* from w32fns.c */
51extern void reinvoke_input_signal (void);
52
53extern unsigned int map_keypad_keys (unsigned int, unsigned int); 51extern unsigned int map_keypad_keys (unsigned int, unsigned int);
54
55extern unsigned int w32_key_to_modifier (int key); 52extern unsigned int w32_key_to_modifier (int key);
56 53
57/* Event queue */ 54/* Event queue */
@@ -261,8 +258,6 @@ w32_kbd_patch_key (KEY_EVENT_RECORD *event)
261} 258}
262 259
263 260
264extern const char *const lispy_function_keys[];
265
266static int faked_key = 0; 261static int faked_key = 0;
267 262
268/* return code -1 means that event_queue_ptr won't be incremented. 263/* return code -1 means that event_queue_ptr won't be incremented.
diff --git a/src/w32menu.c b/src/w32menu.c
index 92447eb9fae..a2e62f24f6a 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -84,14 +84,6 @@ MessageBoxW_Proc unicode_message_box = NULL;
84 84
85Lisp_Object Qdebug_on_next_call; 85Lisp_Object Qdebug_on_next_call;
86 86
87extern Lisp_Object Qmenu_bar;
88
89extern Lisp_Object QCtoggle, QCradio;
90
91extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
92
93extern Lisp_Object Qmenu_bar_update_hook;
94
95void set_frame_menubar (FRAME_PTR, int, int); 87void set_frame_menubar (FRAME_PTR, int, int);
96 88
97#ifdef HAVE_DIALOGS 89#ifdef HAVE_DIALOGS
diff --git a/src/w32proc.c b/src/w32proc.c
index bb8b428ffe4..e94d9aa3254 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -67,8 +67,6 @@ extern BOOL WINAPI IsValidLocale (LCID, DWORD);
67 + ((DWORD)(var) - (section)->VirtualAddress) \ 67 + ((DWORD)(var) - (section)->VirtualAddress) \
68 + (filedata).file_base)) 68 + (filedata).file_base))
69 69
70extern Lisp_Object Qlocal;
71
72Lisp_Object Qhigh, Qlow; 70Lisp_Object Qhigh, Qlow;
73 71
74#ifdef EMACSDEBUG 72#ifdef EMACSDEBUG
@@ -1053,7 +1051,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
1053 detect that we were woken up by C-g, we return -1 with errno set to 1051 detect that we were woken up by C-g, we return -1 with errno set to
1054 EINTR as on Unix. */ 1052 EINTR as on Unix. */
1055 1053
1056/* From ntterm.c */ 1054/* From w32console.c */
1057extern HANDLE keyboard_handle; 1055extern HANDLE keyboard_handle;
1058 1056
1059/* From w32xfns.c */ 1057/* From w32xfns.c */
@@ -1559,8 +1557,6 @@ sys_kill (int pid, int sig)
1559 return rc; 1557 return rc;
1560} 1558}
1561 1559
1562/* extern int report_file_error (char *, Lisp_Object); */
1563
1564/* The following two routines are used to manipulate stdin, stdout, and 1560/* The following two routines are used to manipulate stdin, stdout, and
1565 stderr of our child processes. 1561 stderr of our child processes.
1566 1562
@@ -1660,7 +1656,7 @@ set_process_dir (char * dir)
1660 dial-up users to only be connected when they actually need to use 1656 dial-up users to only be connected when they actually need to use
1661 socket services. */ 1657 socket services. */
1662 1658
1663/* From nt.c */ 1659/* From w32.c */
1664extern HANDLE winsock_lib; 1660extern HANDLE winsock_lib;
1665extern BOOL term_winsock (void); 1661extern BOOL term_winsock (void);
1666extern BOOL init_winsock (int load_now); 1662extern BOOL init_winsock (int load_now);
diff --git a/src/w32select.c b/src/w32select.c
index 23d5fb68c77..ef0cb3adc24 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -78,7 +78,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
78#include "w32term.h" /* for all of the w32 includes */ 78#include "w32term.h" /* for all of the w32 includes */
79#include "w32heap.h" /* os_subtype */ 79#include "w32heap.h" /* os_subtype */
80#include "blockinput.h" 80#include "blockinput.h"
81#include "keyboard.h" /* cmd_error_internal() */
82#include "charset.h" 81#include "charset.h"
83#include "coding.h" 82#include "coding.h"
84#include "character.h" 83#include "character.h"
@@ -391,6 +390,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
391 with global variables and calling strange looking functions. Is 390 with global variables and calling strange looking functions. Is
392 this really the right way to run Lisp callbacks? */ 391 this really the right way to run Lisp callbacks? */
393 392
393 extern int waiting_for_input; /* from keyboard.c */
394 int owfi; 394 int owfi;
395 395
396 BLOCK_INPUT; 396 BLOCK_INPUT;
diff --git a/src/w32term.c b/src/w32term.c
index 67e853f21f0..f31c4e90e77 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -88,8 +88,6 @@ extern void free_frame_menubar (struct frame *);
88extern int w32_codepage_for_font (char *fontname); 88extern int w32_codepage_for_font (char *fontname);
89extern Cursor w32_load_cursor (LPCTSTR name); 89extern Cursor w32_load_cursor (LPCTSTR name);
90 90
91extern Lisp_Object Vwindow_system;
92
93#define x_any_window_to_frame x_window_to_frame 91#define x_any_window_to_frame x_window_to_frame
94#define x_top_window_to_frame x_window_to_frame 92#define x_top_window_to_frame x_window_to_frame
95 93
@@ -138,13 +136,6 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
138#define WS_EX_LAYERED 0x80000 136#define WS_EX_LAYERED 0x80000
139#endif 137#endif
140 138
141/* Frame being updated by update_frame. This is declared in term.c.
142 This is set by update_begin and looked at by all the
143 w32 functions. It is zero while not inside an update.
144 In that case, the w32 functions assume that `SELECTED_FRAME ()'
145 is the frame to apply to. */
146extern struct frame *updating_frame;
147
148/* This is a frame waiting to be autoraised, within w32_read_socket. */ 139/* This is a frame waiting to be autoraised, within w32_read_socket. */
149struct frame *pending_autoraise_frame; 140struct frame *pending_autoraise_frame;
150 141
@@ -2536,8 +2527,7 @@ x_delete_glyphs (struct frame *f, register int n)
2536} 2527}
2537 2528
2538 2529
2539/* Clear entire frame. If updating_frame is non-null, clear that 2530/* Clear entire frame. */
2540 frame. Otherwise clear the selected frame. */
2541 2531
2542static void 2532static void
2543x_clear_frame (struct frame *f) 2533x_clear_frame (struct frame *f)
@@ -6060,7 +6050,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
6060 terminal->mouse_position_hook = w32_mouse_position; 6050 terminal->mouse_position_hook = w32_mouse_position;
6061 terminal->frame_rehighlight_hook = w32_frame_rehighlight; 6051 terminal->frame_rehighlight_hook = w32_frame_rehighlight;
6062 terminal->frame_raise_lower_hook = w32_frame_raise_lower; 6052 terminal->frame_raise_lower_hook = w32_frame_raise_lower;
6063 // terminal->fullscreen_hook = XTfullscreen_hook; 6053 /* terminal->fullscreen_hook = XTfullscreen_hook; */
6064 terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; 6054 terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
6065 terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars; 6055 terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
6066 terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar; 6056 terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
diff --git a/src/w32term.h b/src/w32term.h
index c79352a8db8..cf6751b7d63 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -547,7 +547,7 @@ do { \
547#define WM_APPCOMMAND 0x319 547#define WM_APPCOMMAND 0x319
548#define GET_APPCOMMAND_LPARAM(lParam) (HIWORD(lParam) & 0x7fff) 548#define GET_APPCOMMAND_LPARAM(lParam) (HIWORD(lParam) & 0x7fff)
549#endif 549#endif
550#ifndef WM_UNICHAR 550#ifndef WM_UNICHAR
551#define WM_UNICHAR 0x109 551#define WM_UNICHAR 0x109
552#endif 552#endif
553#ifndef UNICODE_NOCHAR 553#ifndef UNICODE_NOCHAR
@@ -697,3 +697,7 @@ typedef BOOL (WINAPI * AppendMenuW_Proc) (
697 IN UINT_PTR, 697 IN UINT_PTR,
698 IN LPCWSTR); 698 IN LPCWSTR);
699 699
700extern HWND w32_system_caret_hwnd;
701extern int w32_system_caret_height;
702extern int w32_system_caret_x;
703extern int w32_system_caret_y;
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 319f934e3bb..39d1ee5c851 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -52,10 +52,6 @@ int uniscribe_available = 0;
52extern Lisp_Object Quniscribe; 52extern Lisp_Object Quniscribe;
53extern Lisp_Object Qopentype; 53extern Lisp_Object Qopentype;
54 54
55extern int initialized;
56
57extern struct font_driver uniscribe_font_driver;
58
59/* EnumFontFamiliesEx callback. */ 55/* EnumFontFamiliesEx callback. */
60static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *, 56static int CALLBACK add_opentype_font_name_to_list (ENUMLOGFONTEX *,
61 NEWTEXTMETRICEX *, 57 NEWTEXTMETRICEX *,
diff --git a/src/w32xfns.c b/src/w32xfns.c
index df9acca5fb9..fbbf11bd65c 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -97,7 +97,7 @@ select_palette (FRAME_PTR f, HDC hdc)
97 else 97 else
98 f->output_data.w32->old_palette = NULL; 98 f->output_data.w32->old_palette = NULL;
99 99
100 if (RealizePalette (hdc)) 100 if (RealizePalette (hdc) != GDI_ERROR)
101 { 101 {
102 Lisp_Object frame, framelist; 102 Lisp_Object frame, framelist;
103 FOR_EACH_FRAME (framelist, frame) 103 FOR_EACH_FRAME (framelist, frame)
diff --git a/src/window.c b/src/window.c
index 9a0955955fa..f35815d757c 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2209,13 +2209,13 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2209 case DELETE_BUFFER_WINDOWS: 2209 case DELETE_BUFFER_WINDOWS:
2210 if (EQ (w->buffer, obj)) 2210 if (EQ (w->buffer, obj))
2211 { 2211 {
2212 struct frame *f = XFRAME (WINDOW_FRAME (w)); 2212 struct frame *fr = XFRAME (WINDOW_FRAME (w));
2213 2213
2214 /* If this window is dedicated, and in a frame of its own, 2214 /* If this window is dedicated, and in a frame of its own,
2215 kill the frame. */ 2215 kill the frame. */
2216 if (EQ (window, FRAME_ROOT_WINDOW (f)) 2216 if (EQ (window, FRAME_ROOT_WINDOW (fr))
2217 && !NILP (w->dedicated) 2217 && !NILP (w->dedicated)
2218 && other_visible_frames (f)) 2218 && other_visible_frames (fr))
2219 { 2219 {
2220 /* Skip the other windows on this frame. 2220 /* Skip the other windows on this frame.
2221 There might be one, the minibuffer! */ 2221 There might be one, the minibuffer! */
@@ -2267,16 +2267,16 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2267 if (EQ (w->buffer, obj)) 2267 if (EQ (w->buffer, obj))
2268 { 2268 {
2269 Lisp_Object buffer; 2269 Lisp_Object buffer;
2270 struct frame *f = XFRAME (w->frame); 2270 struct frame *fr = XFRAME (w->frame);
2271 2271
2272 /* Find another buffer to show in this window. */ 2272 /* Find another buffer to show in this window. */
2273 buffer = Fother_buffer (obj, Qnil, w->frame); 2273 buffer = Fother_buffer (obj, Qnil, w->frame);
2274 2274
2275 /* If this window is dedicated, and in a frame of its own, 2275 /* If this window is dedicated, and in a frame of its own,
2276 kill the frame. */ 2276 kill the frame. */
2277 if (EQ (window, FRAME_ROOT_WINDOW (f)) 2277 if (EQ (window, FRAME_ROOT_WINDOW (fr))
2278 && !NILP (w->dedicated) 2278 && !NILP (w->dedicated)
2279 && other_visible_frames (f)) 2279 && other_visible_frames (fr))
2280 { 2280 {
2281 /* Skip the other windows on this frame. 2281 /* Skip the other windows on this frame.
2282 There might be one, the minibuffer! */ 2282 There might be one, the minibuffer! */
@@ -2290,11 +2290,11 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2290 } 2290 }
2291 else if (!NILP (w->dedicated) && !NILP (w->parent)) 2291 else if (!NILP (w->dedicated) && !NILP (w->parent))
2292 { 2292 {
2293 Lisp_Object window; 2293 Lisp_Object window_to_delete;
2294 XSETWINDOW (window, w); 2294 XSETWINDOW (window_to_delete, w);
2295 /* If this window is dedicated and not the only window 2295 /* If this window is dedicated and not the only window
2296 in its frame, then kill it. */ 2296 in its frame, then kill it. */
2297 Fdelete_window (window); 2297 Fdelete_window (window_to_delete);
2298 } 2298 }
2299 else 2299 else
2300 { 2300 {
@@ -3124,7 +3124,7 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3124 } 3124 }
3125 else if (!NILP (*forward)) 3125 else if (!NILP (*forward))
3126 { 3126 {
3127 int fixed_size, each, extra, n; 3127 int fixed_size, each IF_LINT (= 0), extra IF_LINT (= 0), n;
3128 int resize_fixed_p, nfixed; 3128 int resize_fixed_p, nfixed;
3129 int last_pos, first_pos, nchildren, total; 3129 int last_pos, first_pos, nchildren, total;
3130 int *new_sizes = NULL; 3130 int *new_sizes = NULL;
@@ -3170,11 +3170,11 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3170 last_pos = first_pos; 3170 last_pos = first_pos;
3171 for (n = 0, child = *forward; !NILP (child); child = c->next, ++n) 3171 for (n = 0, child = *forward; !NILP (child); child = c->next, ++n)
3172 { 3172 {
3173 int new_size, old_size; 3173 int new_child_size, old_child_size;
3174 3174
3175 c = XWINDOW (child); 3175 c = XWINDOW (child);
3176 old_size = WINDOW_TOTAL_SIZE (c, width_p); 3176 old_child_size = WINDOW_TOTAL_SIZE (c, width_p);
3177 new_size = old_size; 3177 new_child_size = old_child_size;
3178 3178
3179 /* The top or left edge position of this child equals the 3179 /* The top or left edge position of this child equals the
3180 bottom or right edge of its predecessor. */ 3180 bottom or right edge of its predecessor. */
@@ -3186,18 +3186,20 @@ size_window (Lisp_Object window, int size, int width_p, int nodelete_p, int firs
3186 /* If this child can be resized, do it. */ 3186 /* If this child can be resized, do it. */
3187 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0)) 3187 if (resize_fixed_p || !window_fixed_size_p (c, width_p, 0))
3188 { 3188 {
3189 new_size = new_sizes ? new_sizes[n] : old_size + each + extra; 3189 new_child_size =
3190 new_sizes ? new_sizes[n] : old_child_size + each + extra;
3190 extra = 0; 3191 extra = 0;
3191 } 3192 }
3192 3193
3193 /* Set new size. Note that size_window also propagates 3194 /* Set new size. Note that size_window also propagates
3194 edge positions to children, so it's not a no-op if we 3195 edge positions to children, so it's not a no-op if we
3195 didn't change the child's size. */ 3196 didn't change the child's size. */
3196 size_window (child, new_size, width_p, 1, first_only, last_only); 3197 size_window (child, new_child_size, width_p, 1,
3198 first_only, last_only);
3197 3199
3198 /* Remember the bottom/right edge position of this child; it 3200 /* Remember the bottom/right edge position of this child; it
3199 will be used to set the top/left edge of the next child. */ 3201 will be used to set the top/left edge of the next child. */
3200 last_pos += new_size; 3202 last_pos += new_child_size;
3201 } 3203 }
3202 3204
3203 xfree (new_sizes); 3205 xfree (new_sizes);
@@ -3325,12 +3327,12 @@ run_window_configuration_change_hook (struct frame *f)
3325 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, 3327 if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook,
3326 buffer))) 3328 buffer)))
3327 { 3329 {
3328 int count = SPECPDL_INDEX (); 3330 int count1 = SPECPDL_INDEX ();
3329 record_unwind_protect (select_window_norecord, Fselected_window ()); 3331 record_unwind_protect (select_window_norecord, Fselected_window ());
3330 select_window_norecord (window); 3332 select_window_norecord (window);
3331 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, 3333 run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook,
3332 buffer)); 3334 buffer));
3333 unbind_to (count, Qnil); 3335 unbind_to (count1, Qnil);
3334 } 3336 }
3335 } 3337 }
3336 } 3338 }
@@ -3602,7 +3604,7 @@ select_frame_norecord (Lisp_Object frame)
3602 ? Fselect_frame (frame, Qt) : selected_frame; 3604 ? Fselect_frame (frame, Qt) : selected_frame;
3603} 3605}
3604 3606
3605Lisp_Object 3607static Lisp_Object
3606display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame) 3608display_buffer (Lisp_Object buffer, Lisp_Object not_this_window_p, Lisp_Object override_frame)
3607{ 3609{
3608 return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame); 3610 return call3 (Qdisplay_buffer, buffer, not_this_window_p, override_frame);
@@ -4128,7 +4130,7 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4128 { 4130 {
4129 /* If trying to grow this window to or beyond size of the parent, 4131 /* If trying to grow this window to or beyond size of the parent,
4130 just delete all the sibling windows. */ 4132 just delete all the sibling windows. */
4131 Lisp_Object start, tem, next; 4133 Lisp_Object start, tem;
4132 4134
4133 start = XWINDOW (parent)->vchild; 4135 start = XWINDOW (parent)->vchild;
4134 if (NILP (start)) 4136 if (NILP (start))
@@ -4138,9 +4140,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4138 tem = XWINDOW (window)->next; 4140 tem = XWINDOW (window)->next;
4139 while (! NILP (tem)) 4141 while (! NILP (tem))
4140 { 4142 {
4141 next = XWINDOW (tem)->next; 4143 Lisp_Object next1 = XWINDOW (tem)->next;
4142 delete_window (tem); 4144 delete_window (tem);
4143 tem = next; 4145 tem = next1;
4144 } 4146 }
4145 4147
4146 /* Delete any siblings that come after WINDOW. 4148 /* Delete any siblings that come after WINDOW.
@@ -4149,9 +4151,9 @@ enlarge_window (Lisp_Object window, int delta, int horiz_flag)
4149 tem = start; 4151 tem = start;
4150 while (! EQ (tem, window)) 4152 while (! EQ (tem, window))
4151 { 4153 {
4152 next = XWINDOW (tem)->next; 4154 Lisp_Object next1 = XWINDOW (tem)->next;
4153 delete_window (tem); 4155 delete_window (tem);
4154 tem = next; 4156 tem = next1;
4155 } 4157 }
4156 } 4158 }
4157 else 4159 else
@@ -5529,7 +5531,7 @@ and redisplay normally--don't erase and redraw the frame. */)
5529 struct buffer *obuf = current_buffer; 5531 struct buffer *obuf = current_buffer;
5530 int center_p = 0; 5532 int center_p = 0;
5531 EMACS_INT charpos, bytepos; 5533 EMACS_INT charpos, bytepos;
5532 int iarg; 5534 int iarg IF_LINT (= 0);
5533 int this_scroll_margin; 5535 int this_scroll_margin;
5534 5536
5535 /* If redisplay is suppressed due to an error, try again. */ 5537 /* If redisplay is suppressed due to an error, try again. */
@@ -7211,4 +7213,3 @@ keys_of_window (void)
7211 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window"); 7213 initial_define_key (meta_map, Ctl ('V'), "scroll-other-window");
7212 initial_define_key (meta_map, 'v', "scroll-down-command"); 7214 initial_define_key (meta_map, 'v', "scroll-down-command");
7213} 7215}
7214
diff --git a/src/window.h b/src/window.h
index 9f0809e4f16..ad627aca340 100644
--- a/src/window.h
+++ b/src/window.h
@@ -778,6 +778,7 @@ extern void freeze_window_starts (struct frame *, int);
778extern void grow_mini_window (struct window *, int); 778extern void grow_mini_window (struct window *, int);
779extern void shrink_mini_window (struct window *); 779extern void shrink_mini_window (struct window *);
780extern int window_relative_x_coord (struct window *, enum window_part, int); 780extern int window_relative_x_coord (struct window *, enum window_part, int);
781extern void check_all_windows (void);
781 782
782void run_window_configuration_change_hook (struct frame *f); 783void run_window_configuration_change_hook (struct frame *f);
783 784
diff --git a/src/xdisp.c b/src/xdisp.c
index 44cb7130119..a7955f41e0c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10909,7 +10909,7 @@ hscroll_window_tree (Lisp_Object window)
10909 current_buffer = XBUFFER (w->buffer); 10909 current_buffer = XBUFFER (w->buffer);
10910 10910
10911 if (w == XWINDOW (selected_window)) 10911 if (w == XWINDOW (selected_window))
10912 pt = BUF_PT (current_buffer); 10912 pt = PT;
10913 else 10913 else
10914 { 10914 {
10915 pt = marker_position (w->pointm); 10915 pt = marker_position (w->pointm);
@@ -11347,7 +11347,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
11347 EMACS_INT pt; 11347 EMACS_INT pt;
11348 11348
11349 if (w == XWINDOW (selected_window)) 11349 if (w == XWINDOW (selected_window))
11350 pt = BUF_PT (current_buffer); 11350 pt = PT;
11351 else 11351 else
11352 pt = marker_position (w->pointm); 11352 pt = marker_position (w->pointm);
11353 11353
@@ -13697,6 +13697,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
13697 int buffer_unchanged_p = 0; 13697 int buffer_unchanged_p = 0;
13698 int temp_scroll_step = 0; 13698 int temp_scroll_step = 0;
13699 int count = SPECPDL_INDEX (); 13699 int count = SPECPDL_INDEX ();
13700 int rc;
13700 int centering_position = -1; 13701 int centering_position = -1;
13701 int last_line_misfit = 0; 13702 int last_line_misfit = 0;
13702 EMACS_INT beg_unchanged, end_unchanged; 13703 EMACS_INT beg_unchanged, end_unchanged;
@@ -14008,15 +14009,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14008 /* Handle case where text has not changed, only point, and it has 14009 /* Handle case where text has not changed, only point, and it has
14009 not moved off the frame, and we are not retrying after hscroll. 14010 not moved off the frame, and we are not retrying after hscroll.
14010 (current_matrix_up_to_date_p is nonzero when retrying.) */ 14011 (current_matrix_up_to_date_p is nonzero when retrying.) */
14011 if (current_matrix_up_to_date_p) 14012 if (current_matrix_up_to_date_p
14013 && (rc = try_cursor_movement (window, startp, &temp_scroll_step),
14014 rc != CURSOR_MOVEMENT_CANNOT_BE_USED))
14012 { 14015 {
14013 int rc = try_cursor_movement (window, startp, &temp_scroll_step);
14014
14015 switch (rc) 14016 switch (rc)
14016 { 14017 {
14017 case CURSOR_MOVEMENT_CANNOT_BE_USED:
14018 break;
14019
14020 case CURSOR_MOVEMENT_SUCCESS: 14018 case CURSOR_MOVEMENT_SUCCESS:
14021 used_current_matrix_p = 1; 14019 used_current_matrix_p = 1;
14022 goto done; 14020 goto done;
@@ -14165,11 +14163,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
14165 { 14163 {
14166 /* The function returns -1 if new fonts were loaded, 1 if 14164 /* The function returns -1 if new fonts were loaded, 1 if
14167 successful, 0 if not successful. */ 14165 successful, 0 if not successful. */
14168 int rc = try_scrolling (window, just_this_one_p, 14166 int ss = try_scrolling (window, just_this_one_p,
14169 scroll_conservatively, 14167 scroll_conservatively,
14170 emacs_scroll_step, 14168 emacs_scroll_step,
14171 temp_scroll_step, last_line_misfit); 14169 temp_scroll_step, last_line_misfit);
14172 switch (rc) 14170 switch (ss)
14173 { 14171 {
14174 case SCROLLING_SUCCESS: 14172 case SCROLLING_SUCCESS:
14175 goto done; 14173 goto done;
@@ -17231,14 +17229,16 @@ display_line (struct it *it)
17231 struct glyph_row *row = it->glyph_row; 17229 struct glyph_row *row = it->glyph_row;
17232 Lisp_Object overlay_arrow_string; 17230 Lisp_Object overlay_arrow_string;
17233 struct it wrap_it; 17231 struct it wrap_it;
17234 int may_wrap = 0, wrap_x; 17232 int may_wrap = 0, wrap_x IF_LINT (= 0);
17235 int wrap_row_used = -1, wrap_row_ascent, wrap_row_height; 17233 int wrap_row_used = -1;
17236 int wrap_row_phys_ascent, wrap_row_phys_height; 17234 int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0);
17237 int wrap_row_extra_line_spacing; 17235 int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0);
17238 EMACS_INT wrap_row_min_pos, wrap_row_min_bpos; 17236 int wrap_row_extra_line_spacing IF_LINT (= 0);
17239 EMACS_INT wrap_row_max_pos, wrap_row_max_bpos; 17237 EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0);
17238 EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0);
17240 int cvpos; 17239 int cvpos;
17241 EMACS_INT min_pos = ZV + 1, min_bpos, max_pos = 0, max_bpos; 17240 EMACS_INT min_pos = ZV + 1, max_pos = 0;
17241 EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
17242 17242
17243 /* We always start displaying at hpos zero even if hscrolled. */ 17243 /* We always start displaying at hpos zero even if hscrolled. */
17244 xassert (it->hpos == 0 && it->current_x == 0); 17244 xassert (it->hpos == 0 && it->current_x == 0);
@@ -17912,16 +17912,13 @@ paragraphs, text begins at the right margin and is read from right to left.
17912See also `bidi-paragraph-direction'. */) 17912See also `bidi-paragraph-direction'. */)
17913 (Lisp_Object buffer) 17913 (Lisp_Object buffer)
17914{ 17914{
17915 struct buffer *buf; 17915 struct buffer *buf = current_buffer;
17916 struct buffer *old; 17916 struct buffer *old = buf;
17917 17917
17918 if (NILP (buffer)) 17918 if (! NILP (buffer))
17919 buf = current_buffer;
17920 else
17921 { 17919 {
17922 CHECK_BUFFER (buffer); 17920 CHECK_BUFFER (buffer);
17923 buf = XBUFFER (buffer); 17921 buf = XBUFFER (buffer);
17924 old = current_buffer;
17925 } 17922 }
17926 17923
17927 if (NILP (BVAR (buf, bidi_display_reordering))) 17924 if (NILP (BVAR (buf, bidi_display_reordering)))
@@ -17938,8 +17935,7 @@ See also `bidi-paragraph-direction'. */)
17938 EMACS_INT bytepos = BUF_PT_BYTE (buf); 17935 EMACS_INT bytepos = BUF_PT_BYTE (buf);
17939 int c; 17936 int c;
17940 17937
17941 if (buf != current_buffer) 17938 set_buffer_temp (buf);
17942 set_buffer_temp (buf);
17943 /* bidi_paragraph_init finds the base direction of the paragraph 17939 /* bidi_paragraph_init finds the base direction of the paragraph
17944 by searching forward from paragraph start. We need the base 17940 by searching forward from paragraph start. We need the base
17945 direction of the current or _previous_ paragraph, so we need 17941 direction of the current or _previous_ paragraph, so we need
@@ -17967,8 +17963,7 @@ See also `bidi-paragraph-direction'. */)
17967 itb.paragraph_dir = NEUTRAL_DIR; 17963 itb.paragraph_dir = NEUTRAL_DIR;
17968 17964
17969 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1); 17965 bidi_paragraph_init (NEUTRAL_DIR, &itb, 1);
17970 if (buf != current_buffer) 17966 set_buffer_temp (old);
17971 set_buffer_temp (old);
17972 switch (itb.paragraph_dir) 17967 switch (itb.paragraph_dir)
17973 { 17968 {
17974 case L2R: 17969 case L2R:
@@ -21092,7 +21087,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
21092 int cmp_id = (row)->glyphs[area][START].u.cmp.id; \ 21087 int cmp_id = (row)->glyphs[area][START].u.cmp.id; \
21093 struct composition *cmp = composition_table[cmp_id]; \ 21088 struct composition *cmp = composition_table[cmp_id]; \
21094 XChar2b *char2b; \ 21089 XChar2b *char2b; \
21095 struct glyph_string *first_s; \ 21090 struct glyph_string *first_s IF_LINT (= NULL); \
21096 int n; \ 21091 int n; \
21097 \ 21092 \
21098 char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \ 21093 char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len); \
@@ -21296,7 +21291,8 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
21296 { 21291 {
21297 struct glyph_string *h, *t; 21292 struct glyph_string *h, *t;
21298 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 21293 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
21299 int mouse_beg_col, mouse_end_col, check_mouse_face = 0; 21294 int mouse_beg_col IF_LINT (= 0), mouse_end_col IF_LINT (= 0);
21295 int check_mouse_face = 0;
21300 int dummy_x = 0; 21296 int dummy_x = 0;
21301 21297
21302 /* If mouse highlighting is on, we may need to draw adjacent 21298 /* If mouse highlighting is on, we may need to draw adjacent
@@ -22292,7 +22288,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
22292 if (metrics_upper.width >= metrics_lower.width) 22288 if (metrics_upper.width >= metrics_lower.width)
22293 lower_xoff = (width - metrics_lower.width) / 2; 22289 lower_xoff = (width - metrics_lower.width) / 2;
22294 else 22290 else
22295 upper_xoff = (width - metrics_upper.width) / 2; 22291 {
22292 /* FIXME: This code doesn't look right. It formerly was
22293 missing the "lower_xoff = 0;", which couldn't have
22294 been right since it left lower_xoff uninitialized. */
22295 lower_xoff = 0;
22296 upper_xoff = (width - metrics_upper.width) / 2;
22297 }
22296 } 22298 }
22297 22299
22298 /* +5 is for horizontal bars of a box plus 1-pixel spaces at 22300 /* +5 is for horizontal bars of a box plus 1-pixel spaces at
@@ -25453,7 +25455,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
25453 { 25455 {
25454 /* The mouse-highlighting, if any, comes from an overlay 25456 /* The mouse-highlighting, if any, comes from an overlay
25455 or text property in the buffer. */ 25457 or text property in the buffer. */
25456 Lisp_Object buffer, cover_string; 25458 Lisp_Object buffer IF_LINT (= Qnil);
25459 Lisp_Object cover_string IF_LINT (= Qnil);
25457 25460
25458 if (STRINGP (object)) 25461 if (STRINGP (object))
25459 { 25462 {
diff --git a/src/xfaces.c b/src/xfaces.c
index 4cc47c85050..0fc5dd6f8a3 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -297,16 +297,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
297 297
298#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR)) 298#define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
299 299
300/* Make a copy of string S on the stack using alloca. Value is a pointer
301 to the copy. */
302
303#define STRDUPA(S) strcpy ((char *) alloca (strlen ((S)) + 1), (S))
304
305/* Make a copy of the contents of Lisp string S on the stack using
306 alloca. Value is a pointer to the copy. */
307
308#define LSTRDUPA(S) STRDUPA (SDATA ((S)))
309
310/* Size of hash table of realized faces in face caches (should be a 300/* Size of hash table of realized faces in face caches (should be a
311 prime number). */ 301 prime number). */
312 302
@@ -847,7 +837,6 @@ clear_face_cache (int clear_fonts_p)
847{ 837{
848#ifdef HAVE_WINDOW_SYSTEM 838#ifdef HAVE_WINDOW_SYSTEM
849 Lisp_Object tail, frame; 839 Lisp_Object tail, frame;
850 struct frame *f;
851 840
852 if (clear_fonts_p 841 if (clear_fonts_p
853 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT) 842 || ++clear_font_table_count == CLEAR_FONT_TABLE_COUNT)
@@ -875,7 +864,7 @@ clear_face_cache (int clear_fonts_p)
875 /* Clear GCs of realized faces. */ 864 /* Clear GCs of realized faces. */
876 FOR_EACH_FRAME (tail, frame) 865 FOR_EACH_FRAME (tail, frame)
877 { 866 {
878 f = XFRAME (frame); 867 struct frame *f = XFRAME (frame);
879 if (FRAME_WINDOW_P (f)) 868 if (FRAME_WINDOW_P (f))
880 clear_face_gcs (FRAME_FACE_CACHE (f)); 869 clear_face_gcs (FRAME_FACE_CACHE (f));
881 } 870 }
@@ -1113,7 +1102,7 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor
1113 1102
1114/* A version of defined_color for non-X frames. */ 1103/* A version of defined_color for non-X frames. */
1115 1104
1116int 1105static int
1117tty_defined_color (struct frame *f, const char *color_name, 1106tty_defined_color (struct frame *f, const char *color_name,
1118 XColor *color_def, int alloc) 1107 XColor *color_def, int alloc)
1119{ 1108{
@@ -1721,7 +1710,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1721 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width) 1710 (Lisp_Object pattern, Lisp_Object face, Lisp_Object frame, Lisp_Object maximum, Lisp_Object width)
1722{ 1711{
1723 struct frame *f; 1712 struct frame *f;
1724 int size, avgwidth; 1713 int size, avgwidth IF_LINT (= 0);
1725 1714
1726 check_x (); 1715 check_x ();
1727 CHECK_STRING (pattern); 1716 CHECK_STRING (pattern);
@@ -1754,14 +1743,14 @@ the WIDTH times as wide as FACE on FRAME. */)
1754 /* This is of limited utility since it works with character 1743 /* This is of limited utility since it works with character
1755 widths. Keep it for compatibility. --gerd. */ 1744 widths. Keep it for compatibility. --gerd. */
1756 int face_id = lookup_named_face (f, face, 0); 1745 int face_id = lookup_named_face (f, face, 0);
1757 struct face *face = (face_id < 0 1746 struct face *width_face = (face_id < 0
1758 ? NULL 1747 ? NULL
1759 : FACE_FROM_ID (f, face_id)); 1748 : FACE_FROM_ID (f, face_id));
1760 1749
1761 if (face && face->font) 1750 if (width_face && width_face->font)
1762 { 1751 {
1763 size = face->font->pixel_size; 1752 size = width_face->font->pixel_size;
1764 avgwidth = face->font->average_width; 1753 avgwidth = width_face->font->average_width;
1765 } 1754 }
1766 else 1755 else
1767 { 1756 {
@@ -1838,6 +1827,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1838#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX) 1827#define LFACE_INHERIT(LFACE) AREF ((LFACE), LFACE_INHERIT_INDEX)
1839#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX) 1828#define LFACE_FONTSET(LFACE) AREF ((LFACE), LFACE_FONTSET_INDEX)
1840 1829
1830#if XASSERTS
1841/* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size 1831/* Non-zero if LFACE is a Lisp face. A Lisp face is a vector of size
1842 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */ 1832 LFACE_VECTOR_SIZE which has the symbol `face' in slot 0. */
1843 1833
@@ -1845,6 +1835,7 @@ the WIDTH times as wide as FACE on FRAME. */)
1845 (VECTORP (LFACE) \ 1835 (VECTORP (LFACE) \
1846 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \ 1836 && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \
1847 && EQ (AREF (LFACE, 0), Qface)) 1837 && EQ (AREF (LFACE, 0), Qface))
1838#endif
1848 1839
1849 1840
1850#if GLYPH_DEBUG 1841#if GLYPH_DEBUG
@@ -2252,7 +2243,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object
2252 `relative' heights; the returned value is always an absolute height 2243 `relative' heights; the returned value is always an absolute height
2253 unless both FROM and TO are relative. */ 2244 unless both FROM and TO are relative. */
2254 2245
2255Lisp_Object 2246static Lisp_Object
2256merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) 2247merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2257{ 2248{
2258 Lisp_Object result = invalid; 2249 Lisp_Object result = invalid;
@@ -3869,19 +3860,19 @@ return the font name used for CHARACTER. */)
3869 { 3860 {
3870 struct frame *f = frame_or_selected_frame (frame, 1); 3861 struct frame *f = frame_or_selected_frame (frame, 1);
3871 int face_id = lookup_named_face (f, face, 1); 3862 int face_id = lookup_named_face (f, face, 1);
3872 struct face *face = FACE_FROM_ID (f, face_id); 3863 struct face *fface = FACE_FROM_ID (f, face_id);
3873 3864
3874 if (! face) 3865 if (! fface)
3875 return Qnil; 3866 return Qnil;
3876#ifdef HAVE_WINDOW_SYSTEM 3867#ifdef HAVE_WINDOW_SYSTEM
3877 if (FRAME_WINDOW_P (f) && !NILP (character)) 3868 if (FRAME_WINDOW_P (f) && !NILP (character))
3878 { 3869 {
3879 CHECK_CHARACTER (character); 3870 CHECK_CHARACTER (character);
3880 face_id = FACE_FOR_CHAR (f, face, XINT (character), -1, Qnil); 3871 face_id = FACE_FOR_CHAR (f, fface, XINT (character), -1, Qnil);
3881 face = FACE_FROM_ID (f, face_id); 3872 fface = FACE_FROM_ID (f, face_id);
3882 } 3873 }
3883 return (face->font 3874 return (fface->font
3884 ? face->font->props[FONT_NAME_INDEX] 3875 ? fface->font->props[FONT_NAME_INDEX]
3885 : Qnil); 3876 : Qnil);
3886#else /* !HAVE_WINDOW_SYSTEM */ 3877#else /* !HAVE_WINDOW_SYSTEM */
3887 return build_string (FRAME_MSDOS_P (f) 3878 return build_string (FRAME_MSDOS_P (f)
@@ -4313,45 +4304,6 @@ free_realized_faces (struct face_cache *c)
4313} 4304}
4314 4305
4315 4306
4316/* Free all realized faces that are using FONTSET on frame F. */
4317
4318void
4319free_realized_faces_for_fontset (struct frame *f, int fontset)
4320{
4321 struct face_cache *cache = FRAME_FACE_CACHE (f);
4322 struct face *face;
4323 int i;
4324
4325 /* We must block input here because we can't process X events safely
4326 while only some faces are freed, or when the frame's current
4327 matrix still references freed faces. */
4328 BLOCK_INPUT;
4329
4330 for (i = 0; i < cache->used; i++)
4331 {
4332 face = cache->faces_by_id[i];
4333 if (face
4334 && face->fontset == fontset)
4335 {
4336 uncache_face (cache, face);
4337 free_realized_face (f, face);
4338 }
4339 }
4340
4341 /* Must do a thorough redisplay the next time. Mark current
4342 matrices as invalid because they will reference faces freed
4343 above. This function is also called when a frame is destroyed.
4344 In this case, the root window of F is nil. */
4345 if (WINDOWP (f->root_window))
4346 {
4347 clear_current_matrices (f);
4348 ++windows_or_buffers_changed;
4349 }
4350
4351 UNBLOCK_INPUT;
4352}
4353
4354
4355/* Free all realized faces on FRAME or on all frames if FRAME is nil. 4307/* Free all realized faces on FRAME or on all frames if FRAME is nil.
4356 This is done after attributes of a named face have been changed, 4308 This is done after attributes of a named face have been changed,
4357 because we can't tell which realized faces depend on that face. */ 4309 because we can't tell which realized faces depend on that face. */
@@ -5287,10 +5239,6 @@ be found. Value is ALIST. */)
5287 5239
5288#ifdef HAVE_WINDOW_SYSTEM 5240#ifdef HAVE_WINDOW_SYSTEM
5289 5241
5290/* Ignore the difference of font point size less than this value. */
5291
5292#define FONT_POINT_SIZE_QUANTUM 5
5293
5294/* Return the fontset id of the base fontset name or alias name given 5242/* Return the fontset id of the base fontset name or alias name given
5295 by the fontset attribute of ATTRS. Value is -1 if the fontset 5243 by the fontset attribute of ATTRS. Value is -1 if the fontset
5296 attribute of ATTRS doesn't name a fontset. */ 5244 attribute of ATTRS doesn't name a fontset. */
@@ -6349,7 +6297,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
6349 CHECK_STRING (filename); 6297 CHECK_STRING (filename);
6350 abspath = Fexpand_file_name (filename, Qnil); 6298 abspath = Fexpand_file_name (filename, Qnil);
6351 6299
6352 fp = fopen (SDATA (filename), "rt"); 6300 fp = fopen (SDATA (abspath), "rt");
6353 if (fp) 6301 if (fp)
6354 { 6302 {
6355 char buf[512]; 6303 char buf[512];
diff --git a/src/xfns.c b/src/xfns.c
index deb0e192a54..e50d6887179 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -461,7 +461,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
461 Window win = f->output_data.x->parent_desc; 461 Window win = f->output_data.x->parent_desc;
462 Atom actual_type; 462 Atom actual_type;
463 unsigned long actual_size, bytes_remaining; 463 unsigned long actual_size, bytes_remaining;
464 int i, rc, actual_format; 464 int rc, actual_format;
465 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 465 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
466 long max_len = 400; 466 long max_len = 400;
467 Display *dpy = FRAME_X_DISPLAY (f); 467 Display *dpy = FRAME_X_DISPLAY (f);
@@ -648,7 +648,7 @@ x_defined_color (struct frame *f, const char *color_name,
648 is a monochrome frame, return MONO_COLOR regardless of what ARG says. 648 is a monochrome frame, return MONO_COLOR regardless of what ARG says.
649 Signal an error if color can't be allocated. */ 649 Signal an error if color can't be allocated. */
650 650
651int 651static int
652x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) 652x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color)
653{ 653{
654 XColor cdef; 654 XColor cdef;
@@ -746,7 +746,6 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
746int 746int
747xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) 747xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data)
748{ 748{
749 int result = 0;
750 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); 749 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
751 750
752 if (!pixbuf) 751 if (!pixbuf)
@@ -1635,7 +1634,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1635 suggesting a new name, which lisp code should override; if 1634 suggesting a new name, which lisp code should override; if
1636 F->explicit_name is set, ignore the new name; otherwise, set it. */ 1635 F->explicit_name is set, ignore the new name; otherwise, set it. */
1637 1636
1638void 1637static void
1639x_set_name (struct frame *f, Lisp_Object name, int explicit) 1638x_set_name (struct frame *f, Lisp_Object name, int explicit)
1640{ 1639{
1641 /* Make sure that requests from lisp code override requests from 1640 /* Make sure that requests from lisp code override requests from
@@ -2620,7 +2619,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2620 2619
2621#else /* not USE_X_TOOLKIT */ 2620#else /* not USE_X_TOOLKIT */
2622#ifdef USE_GTK 2621#ifdef USE_GTK
2623void 2622static void
2624x_window (FRAME_PTR f) 2623x_window (FRAME_PTR f)
2625{ 2624{
2626 if (! xg_create_frame_widgets (f)) 2625 if (! xg_create_frame_widgets (f))
@@ -2660,7 +2659,7 @@ x_window (FRAME_PTR f)
2660#else /*! USE_GTK */ 2659#else /*! USE_GTK */
2661/* Create and set up the X window for frame F. */ 2660/* Create and set up the X window for frame F. */
2662 2661
2663void 2662static void
2664x_window (struct frame *f) 2663x_window (struct frame *f)
2665{ 2664{
2666 XClassHint class_hints; 2665 XClassHint class_hints;
@@ -3184,7 +3183,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3184 to get the color reference counts right, so initialize them! */ 3183 to get the color reference counts right, so initialize them! */
3185 { 3184 {
3186 Lisp_Object black; 3185 Lisp_Object black;
3187 struct gcpro gcpro1; 3186 struct gcpro inner_gcpro1;
3188 3187
3189 /* Function x_decode_color can signal an error. Make 3188 /* Function x_decode_color can signal an error. Make
3190 sure to initialize color slots so that we won't try 3189 sure to initialize color slots so that we won't try
@@ -3197,7 +3196,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3197 f->output_data.x->mouse_pixel = -1; 3196 f->output_data.x->mouse_pixel = -1;
3198 3197
3199 black = build_string ("black"); 3198 black = build_string ("black");
3200 GCPRO1 (black); 3199 GCPRO1_VAR (black, inner_gcpro);
3201 FRAME_FOREGROUND_PIXEL (f) 3200 FRAME_FOREGROUND_PIXEL (f)
3202 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3201 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3203 FRAME_BACKGROUND_PIXEL (f) 3202 FRAME_BACKGROUND_PIXEL (f)
@@ -3210,7 +3209,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3210 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3209 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3211 f->output_data.x->mouse_pixel 3210 f->output_data.x->mouse_pixel
3212 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 3211 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
3213 UNGCPRO; 3212 UNGCPRO_VAR (inner_gcpro);
3214 } 3213 }
3215 3214
3216 /* Specify the parent under which to make this X window. */ 3215 /* Specify the parent under which to make this X window. */
@@ -3448,8 +3447,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3448 else if (! NILP (visibility)) 3447 else if (! NILP (visibility))
3449 x_make_frame_visible (f); 3448 x_make_frame_visible (f);
3450 else 3449 else
3451 /* Must have been Qnil. */ 3450 {
3452 ; 3451 /* Must have been Qnil. */
3452 }
3453 } 3453 }
3454 3454
3455 BLOCK_INPUT; 3455 BLOCK_INPUT;
@@ -4577,7 +4577,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4577 Lisp_Object text) 4577 Lisp_Object text)
4578{ 4578{
4579 struct frame *f; 4579 struct frame *f;
4580 Lisp_Object frame, tem; 4580 Lisp_Object frame;
4581 Lisp_Object name; 4581 Lisp_Object name;
4582 long window_prompting = 0; 4582 long window_prompting = 0;
4583 int width, height; 4583 int width, height;
@@ -4651,7 +4651,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4651 to get the color reference counts right, so initialize them! */ 4651 to get the color reference counts right, so initialize them! */
4652 { 4652 {
4653 Lisp_Object black; 4653 Lisp_Object black;
4654 struct gcpro gcpro1; 4654 struct gcpro inner_gcpro1;
4655 4655
4656 /* Function x_decode_color can signal an error. Make 4656 /* Function x_decode_color can signal an error. Make
4657 sure to initialize color slots so that we won't try 4657 sure to initialize color slots so that we won't try
@@ -4664,7 +4664,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4664 f->output_data.x->mouse_pixel = -1; 4664 f->output_data.x->mouse_pixel = -1;
4665 4665
4666 black = build_string ("black"); 4666 black = build_string ("black");
4667 GCPRO1 (black); 4667 GCPRO1_VAR (black, inner_gcpro);
4668 FRAME_FOREGROUND_PIXEL (f) 4668 FRAME_FOREGROUND_PIXEL (f)
4669 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4669 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4670 FRAME_BACKGROUND_PIXEL (f) 4670 FRAME_BACKGROUND_PIXEL (f)
@@ -4677,7 +4677,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4677 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4677 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4678 f->output_data.x->mouse_pixel 4678 f->output_data.x->mouse_pixel
4679 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f)); 4679 = x_decode_color (f, black, BLACK_PIX_DEFAULT (f));
4680 UNGCPRO; 4680 UNGCPRO_VAR (inner_gcpro);
4681 } 4681 }
4682 4682
4683 /* Set the name; the functions to which we pass f expect the name to 4683 /* Set the name; the functions to which we pass f expect the name to
@@ -5035,7 +5035,7 @@ Text larger than the specified size is clipped. */)
5035 && !NILP (Fequal (last_string, string)) 5035 && !NILP (Fequal (last_string, string))
5036 && !NILP (Fequal (last_parms, parms))) 5036 && !NILP (Fequal (last_parms, parms)))
5037 { 5037 {
5038 struct frame *f = XFRAME (tip_frame); 5038 struct frame *tip_f = XFRAME (tip_frame);
5039 5039
5040 /* Only DX and DY have changed. */ 5040 /* Only DX and DY have changed. */
5041 if (!NILP (tip_timer)) 5041 if (!NILP (tip_timer))
@@ -5046,9 +5046,9 @@ Text larger than the specified size is clipped. */)
5046 } 5046 }
5047 5047
5048 BLOCK_INPUT; 5048 BLOCK_INPUT;
5049 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), 5049 compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f),
5050 FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); 5050 FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y);
5051 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5051 XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
5052 root_x, root_y); 5052 root_x, root_y);
5053 UNBLOCK_INPUT; 5053 UNBLOCK_INPUT;
5054 goto start_timer; 5054 goto start_timer;
@@ -5565,11 +5565,11 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5565 BLOCK_INPUT; 5565 BLOCK_INPUT;
5566 5566
5567 if (STRINGP (default_filename)) 5567 if (STRINGP (default_filename))
5568 cdef_file = SDATA (default_filename); 5568 cdef_file = SSDATA (default_filename);
5569 else 5569 else
5570 cdef_file = SDATA (dir); 5570 cdef_file = SSDATA (dir);
5571 5571
5572 fn = xg_get_file_name (f, SDATA (prompt), cdef_file, 5572 fn = xg_get_file_name (f, SSDATA (prompt), cdef_file,
5573 ! NILP (mustmatch), 5573 ! NILP (mustmatch),
5574 ! NILP (only_dir_p)); 5574 ! NILP (only_dir_p));
5575 5575
@@ -5625,12 +5625,12 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
5625 XSETFONT (font, FRAME_FONT (f)); 5625 XSETFONT (font, FRAME_FONT (f));
5626 font_param = Ffont_get (font, intern (":name")); 5626 font_param = Ffont_get (font, intern (":name"));
5627 if (STRINGP (font_param)) 5627 if (STRINGP (font_param))
5628 default_name = xstrdup (SDATA (font_param)); 5628 default_name = xstrdup (SSDATA (font_param));
5629 else 5629 else
5630 { 5630 {
5631 font_param = Fframe_parameter (frame, Qfont_param); 5631 font_param = Fframe_parameter (frame, Qfont_param);
5632 if (STRINGP (font_param)) 5632 if (STRINGP (font_param))
5633 default_name = xstrdup (SDATA (font_param)); 5633 default_name = xstrdup (SSDATA (font_param));
5634 } 5634 }
5635 5635
5636 if (default_name == NULL && x_last_font_name != NULL) 5636 if (default_name == NULL && x_last_font_name != NULL)
@@ -5694,7 +5694,7 @@ present and mapped to the usual X keysyms. */)
5694 struct frame *f = check_x_frame (frame); 5694 struct frame *f = check_x_frame (frame);
5695 Display *dpy = FRAME_X_DISPLAY (f); 5695 Display *dpy = FRAME_X_DISPLAY (f);
5696 Lisp_Object have_keys; 5696 Lisp_Object have_keys;
5697 int major, minor, op, event, error; 5697 int major, minor, op, event, error_code;
5698 5698
5699 BLOCK_INPUT; 5699 BLOCK_INPUT;
5700 5700
@@ -5710,7 +5710,7 @@ present and mapped to the usual X keysyms. */)
5710 /* Check that the server supports XKB. */ 5710 /* Check that the server supports XKB. */
5711 major = XkbMajorVersion; 5711 major = XkbMajorVersion;
5712 minor = XkbMinorVersion; 5712 minor = XkbMinorVersion;
5713 if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) 5713 if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor))
5714 { 5714 {
5715 UNBLOCK_INPUT; 5715 UNBLOCK_INPUT;
5716 return Qlambda; 5716 return Qlambda;
diff --git a/src/xgselect.c b/src/xgselect.c
index 359a8fbc89b..96d763ff088 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -38,7 +38,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
38 GMainContext *context = g_main_context_default (); 38 GMainContext *context = g_main_context_default ();
39 int have_wfds = wfds != NULL; 39 int have_wfds = wfds != NULL;
40 int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0; 40 int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0;
41 int prio, i, nfds, tmo_in_millisec; 41 int i, nfds, tmo_in_millisec;
42 42
43 if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds)); 43 if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
44 else FD_ZERO (&all_rfds); 44 else FD_ZERO (&all_rfds);
@@ -49,9 +49,9 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
49 g_main_context_pending (context); 49 g_main_context_pending (context);
50 50
51 do { 51 do {
52 if (n_gfds > gfds_size) 52 if (n_gfds > gfds_size)
53 { 53 {
54 while (n_gfds > gfds_size) 54 while (n_gfds > gfds_size)
55 gfds_size *= 2; 55 gfds_size *= 2;
56 xfree (gfds); 56 xfree (gfds);
57 gfds = xmalloc (sizeof (*gfds) * gfds_size); 57 gfds = xmalloc (sizeof (*gfds) * gfds_size);
@@ -64,7 +64,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
64 gfds_size); 64 gfds_size);
65 } while (n_gfds > gfds_size); 65 } while (n_gfds > gfds_size);
66 66
67 for (i = 0; i < n_gfds; ++i) 67 for (i = 0; i < n_gfds; ++i)
68 { 68 {
69 if (gfds[i].events & G_IO_IN) 69 if (gfds[i].events & G_IO_IN)
70 { 70 {
@@ -87,7 +87,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
87 else 87 else
88 { 88 {
89 EMACS_TIME difference; 89 EMACS_TIME difference;
90 90
91 EMACS_SUB_TIME (difference, tmo, *timeout); 91 EMACS_SUB_TIME (difference, tmo, *timeout);
92 if (EMACS_TIME_NEG_P (difference)) our_tmo = 1; 92 if (EMACS_TIME_NEG_P (difference)) our_tmo = 1;
93 } 93 }
@@ -100,7 +100,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
100 100
101 if (nfds < 0) 101 if (nfds < 0)
102 retval = nfds; 102 retval = nfds;
103 else if (nfds > 0) 103 else if (nfds > 0)
104 { 104 {
105 for (i = 0; i < max_fds+1; ++i) 105 for (i = 0; i < max_fds+1; ++i)
106 { 106 {
@@ -127,7 +127,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
127 127
128 if (our_fds > 0 || (nfds == 0 && our_tmo)) 128 if (our_fds > 0 || (nfds == 0 && our_tmo))
129 { 129 {
130 130
131 /* If Gtk+ is in use eventually gtk_main_iteration will be called, 131 /* If Gtk+ is in use eventually gtk_main_iteration will be called,
132 unless retval is zero. */ 132 unless retval is zero. */
133#ifdef USE_GTK 133#ifdef USE_GTK
@@ -137,7 +137,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
137 g_main_context_dispatch (context); 137 g_main_context_dispatch (context);
138 138
139 /* To not have to recalculate timeout, return like this. */ 139 /* To not have to recalculate timeout, return like this. */
140 if (retval == 0) 140 if (retval == 0)
141 { 141 {
142 retval = -1; 142 retval = -1;
143 errno = EINTR; 143 errno = EINTR;
@@ -156,4 +156,3 @@ xgselect_initialize (void)
156 gfds = xmalloc (sizeof (*gfds)*gfds_size); 156 gfds = xmalloc (sizeof (*gfds)*gfds_size);
157#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */ 157#endif /* defined (USE_GTK) || defined (HAVE_GCONF) */
158} 158}
159
diff --git a/src/xmenu.c b/src/xmenu.c
index 934db0f0406..eab7bb03f20 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -124,11 +124,11 @@ static int update_frame_menubar (struct frame *);
124 Xt on behalf of one of the widget sets. */ 124 Xt on behalf of one of the widget sets. */
125static int popup_activated_flag; 125static int popup_activated_flag;
126 126
127static int next_menubar_widget_id;
128
129 127
130#ifdef USE_X_TOOLKIT 128#ifdef USE_X_TOOLKIT
131 129
130static int next_menubar_widget_id;
131
132/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */ 132/* Return the frame whose ->output_data.x->id equals ID, or 0 if none. */
133 133
134static struct frame * 134static struct frame *
@@ -723,7 +723,7 @@ show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help)
723 unhighlighting. */ 723 unhighlighting. */
724 724
725#ifdef USE_GTK 725#ifdef USE_GTK
726void 726static void
727menu_highlight_callback (GtkWidget *widget, gpointer call_data) 727menu_highlight_callback (GtkWidget *widget, gpointer call_data)
728{ 728{
729 xg_menu_item_cb_data *cb_data; 729 xg_menu_item_cb_data *cb_data;
@@ -742,7 +742,7 @@ menu_highlight_callback (GtkWidget *widget, gpointer call_data)
742 show_help_event (cb_data->cl_data->f, widget, help); 742 show_help_event (cb_data->cl_data->f, widget, help);
743} 743}
744#else 744#else
745void 745static void
746menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data) 746menu_highlight_callback (Widget widget, LWLIB_ID id, void *call_data)
747{ 747{
748 struct frame *f; 748 struct frame *f;
@@ -1175,8 +1175,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1175 } 1175 }
1176 else 1176 else
1177 { 1177 {
1178 GtkWidget *wvbox = f->output_data.x->vbox_widget;
1179
1180 menubar_widget 1178 menubar_widget
1181 = xg_create_widget ("menubar", "menubar", f, first_wv, 1179 = xg_create_widget ("menubar", "menubar", f, first_wv,
1182 G_CALLBACK (menubar_selection_callback), 1180 G_CALLBACK (menubar_selection_callback),
@@ -1390,7 +1388,7 @@ menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer
1390 1388
1391 /* Check if there is room for the menu. If not, adjust x/y so that 1389 /* Check if there is room for the menu. If not, adjust x/y so that
1392 the menu is fully visible. */ 1390 the menu is fully visible. */
1393 gtk_widget_size_request (GTK_WIDGET (menu), &req); 1391 gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req);
1394 if (data->x + req.width > disp_width) 1392 if (data->x + req.width > disp_width)
1395 *x -= data->x + req.width - disp_width; 1393 *x -= data->x + req.width - disp_width;
1396 if (data->y + req.height > disp_height) 1394 if (data->y + req.height > disp_height)
@@ -1600,7 +1598,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1600 1598
1601Lisp_Object 1599Lisp_Object
1602xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1600xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1603 Lisp_Object title, const char **error, EMACS_UINT timestamp) 1601 Lisp_Object title, const char **error_name, EMACS_UINT timestamp)
1604{ 1602{
1605 int i; 1603 int i;
1606 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; 1604 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
@@ -1615,11 +1613,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1615 if (! FRAME_X_P (f)) 1613 if (! FRAME_X_P (f))
1616 abort (); 1614 abort ();
1617 1615
1618 *error = NULL; 1616 *error_name = NULL;
1619 1617
1620 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH) 1618 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
1621 { 1619 {
1622 *error = "Empty menu"; 1620 *error_name = "Empty menu";
1623 return Qnil; 1621 return Qnil;
1624 } 1622 }
1625 1623
@@ -1664,7 +1662,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1664 { 1662 {
1665 /* Create a new pane. */ 1663 /* Create a new pane. */
1666 Lisp_Object pane_name, prefix; 1664 Lisp_Object pane_name, prefix;
1667 char *pane_string; 1665 const char *pane_string;
1668 1666
1669 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); 1667 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
1670 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX); 1668 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
@@ -2012,7 +2010,7 @@ xdialog_show (FRAME_PTR f,
2012 representing the text label and buttons. */ 2010 representing the text label and buttons. */
2013 { 2011 {
2014 Lisp_Object pane_name, prefix; 2012 Lisp_Object pane_name, prefix;
2015 char *pane_string; 2013 const char *pane_string;
2016 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME]; 2014 pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
2017 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX]; 2015 prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
2018 pane_string = (NILP (pane_name) 2016 pane_string = (NILP (pane_name)
@@ -2307,7 +2305,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2307 { 2305 {
2308 /* Create a new pane. */ 2306 /* Create a new pane. */
2309 Lisp_Object pane_name, prefix; 2307 Lisp_Object pane_name, prefix;
2310 char *pane_string; 2308 const char *pane_string;
2311 2309
2312 maxlines = max (maxlines, lines); 2310 maxlines = max (maxlines, lines);
2313 lines = 0; 2311 lines = 0;
diff --git a/src/xrdb.c b/src/xrdb.c
index 9fb3f3474fb..a79f453e5e1 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -28,6 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include <stdio.h> 28#include <stdio.h>
29#include <setjmp.h> 29#include <setjmp.h>
30 30
31#include "lisp.h"
32
33/* This may include sys/types.h, and that somehow loses
34 if this is not done before the other system files. */
35#include "xterm.h"
36
31#include <X11/Xlib.h> 37#include <X11/Xlib.h>
32#include <X11/Xatom.h> 38#include <X11/Xatom.h>
33#include <X11/X.h> 39#include <X11/X.h>
@@ -38,8 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#endif 44#endif
39#include <sys/stat.h> 45#include <sys/stat.h>
40 46
41#include "lisp.h"
42
43#ifdef USE_MOTIF 47#ifdef USE_MOTIF
44/* For Vdouble_click_time. */ 48/* For Vdouble_click_time. */
45#include "keyboard.h" 49#include "keyboard.h"
@@ -50,8 +54,6 @@ extern char *getenv (const char *);
50extern struct passwd *getpwuid (uid_t); 54extern struct passwd *getpwuid (uid_t);
51extern struct passwd *getpwnam (const char *); 55extern struct passwd *getpwnam (const char *);
52 56
53extern const char *get_system_name (void);
54
55char *x_get_string_resource (XrmDatabase rdb, const char *name, 57char *x_get_string_resource (XrmDatabase rdb, const char *name,
56 const char *class); 58 const char *class);
57static int file_p (const char *filename); 59static int file_p (const char *filename);
diff --git a/src/xselect.c b/src/xselect.c
index a502a74f904..5254fa96838 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -97,7 +97,6 @@ static Lisp_Object clean_local_selection_data (Lisp_Object);
97#define TRACE0(fmt) (void) 0 97#define TRACE0(fmt) (void) 0
98#define TRACE1(fmt, a0) (void) 0 98#define TRACE1(fmt, a0) (void) 0
99#define TRACE2(fmt, a0, a1) (void) 0 99#define TRACE2(fmt, a0, a1) (void) 0
100#define TRACE3(fmt, a0, a1) (void) 0
101#endif 100#endif
102 101
103 102
@@ -330,7 +329,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
330 struct frame *sf = SELECTED_FRAME (); 329 struct frame *sf = SELECTED_FRAME ();
331 Window selecting_window; 330 Window selecting_window;
332 Display *display; 331 Display *display;
333 Time time = last_event_timestamp; 332 Time timestamp = last_event_timestamp;
334 Atom selection_atom; 333 Atom selection_atom;
335 struct x_display_info *dpyinfo; 334 struct x_display_info *dpyinfo;
336 335
@@ -346,7 +345,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
346 345
347 BLOCK_INPUT; 346 BLOCK_INPUT;
348 x_catch_errors (display); 347 x_catch_errors (display);
349 XSetSelectionOwner (display, selection_atom, selecting_window, time); 348 XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
350 x_check_errors (display, "Can't set selection: %s"); 349 x_check_errors (display, "Can't set selection: %s");
351 x_uncatch_errors (); 350 x_uncatch_errors ();
352 UNBLOCK_INPUT; 351 UNBLOCK_INPUT;
@@ -357,7 +356,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
357 Lisp_Object selection_data; 356 Lisp_Object selection_data;
358 Lisp_Object prev_value; 357 Lisp_Object prev_value;
359 358
360 selection_time = long_to_cons ((unsigned long) time); 359 selection_time = long_to_cons ((unsigned long) timestamp);
361 selection_data = list4 (selection_name, selection_value, 360 selection_data = list4 (selection_name, selection_value,
362 selection_time, selected_frame); 361 selection_time, selected_frame);
363 prev_value = assq_no_quit (selection_name, Vselection_alist); 362 prev_value = assq_no_quit (selection_name, Vselection_alist);
@@ -2085,7 +2084,7 @@ DEFUN ("x-disown-selection-internal", Fx_disown_selection_internal,
2085 Sx_disown_selection_internal, 1, 2, 0, 2084 Sx_disown_selection_internal, 1, 2, 0,
2086 doc: /* If we own the selection SELECTION, disown it. 2085 doc: /* If we own the selection SELECTION, disown it.
2087Disowning it means there is no such selection. */) 2086Disowning it means there is no such selection. */)
2088 (Lisp_Object selection, Lisp_Object time) 2087 (Lisp_Object selection, Lisp_Object time_object)
2089{ 2088{
2090 Time timestamp; 2089 Time timestamp;
2091 Atom selection_atom; 2090 Atom selection_atom;
@@ -2104,10 +2103,10 @@ Disowning it means there is no such selection. */)
2104 display = FRAME_X_DISPLAY (sf); 2103 display = FRAME_X_DISPLAY (sf);
2105 dpyinfo = FRAME_X_DISPLAY_INFO (sf); 2104 dpyinfo = FRAME_X_DISPLAY_INFO (sf);
2106 CHECK_SYMBOL (selection); 2105 CHECK_SYMBOL (selection);
2107 if (NILP (time)) 2106 if (NILP (time_object))
2108 timestamp = last_event_timestamp; 2107 timestamp = last_event_timestamp;
2109 else 2108 else
2110 timestamp = cons_to_long (time); 2109 timestamp = cons_to_long (time_object);
2111 2110
2112 if (NILP (assq_no_quit (selection, Vselection_alist))) 2111 if (NILP (assq_no_quit (selection, Vselection_alist)))
2113 return Qnil; /* Don't disown the selection when we're not the owner. */ 2112 return Qnil; /* Don't disown the selection when we're not the owner. */
@@ -2131,26 +2130,6 @@ Disowning it means there is no such selection. */)
2131 return Qt; 2130 return Qt;
2132} 2131}
2133 2132
2134/* Get rid of all the selections in buffer BUFFER.
2135 This is used when we kill a buffer. */
2136
2137void
2138x_disown_buffer_selections (Lisp_Object buffer)
2139{
2140 Lisp_Object tail;
2141 struct buffer *buf = XBUFFER (buffer);
2142
2143 for (tail = Vselection_alist; CONSP (tail); tail = XCDR (tail))
2144 {
2145 Lisp_Object elt, value;
2146 elt = XCAR (tail);
2147 value = XCDR (elt);
2148 if (CONSP (value) && MARKERP (XCAR (value))
2149 && XMARKER (XCAR (value))->buffer == buf)
2150 Fx_disown_selection_internal (XCAR (elt), Qnil);
2151 }
2152}
2153
2154DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 2133DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
2155 0, 1, 0, 2134 0, 1, 0,
2156 doc: /* Whether the current Emacs process owns the given X Selection. 2135 doc: /* Whether the current Emacs process owns the given X Selection.
@@ -2455,7 +2434,6 @@ x_handle_dnd_message (struct frame *f, XClientMessageEvent *event, struct x_disp
2455 2434
2456 if (event->format == 32 && event->format < BITS_PER_LONG) 2435 if (event->format == 32 && event->format < BITS_PER_LONG)
2457 { 2436 {
2458 int i;
2459 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */ 2437 for (i = 0; i < 5; ++i) /* There are only 5 longs in a ClientMessage. */
2460 idata[i] = (int) event->data.l[i]; 2438 idata[i] = (int) event->data.l[i];
2461 data = (unsigned char *) idata; 2439 data = (unsigned char *) idata;
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 825cec451d9..f3879dbcec0 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -41,6 +41,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#include "process.h" 41#include "process.h"
42#include "keyboard.h" 42#include "keyboard.h"
43 43
44#ifndef HAVE_GTK3
45#define gdk_x11_set_sm_client_id(w) gdk_set_sm_client_id (w)
46#endif
47
44/* This is the event used when SAVE_SESSION_EVENT occurs. */ 48/* This is the event used when SAVE_SESSION_EVENT occurs. */
45 49
46static struct input_event emacs_event; 50static struct input_event emacs_event;
@@ -459,7 +463,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
459#ifdef USE_GTK 463#ifdef USE_GTK
460 /* GTK creats a leader window by itself, but we need to tell 464 /* GTK creats a leader window by itself, but we need to tell
461 it about our client_id. */ 465 it about our client_id. */
462 gdk_set_sm_client_id (client_id); 466 gdk_x11_set_sm_client_id (client_id);
463#else 467#else
464 create_client_leader_window (dpyinfo, client_id); 468 create_client_leader_window (dpyinfo, client_id);
465#endif 469#endif
diff --git a/src/xterm.c b/src/xterm.c
index 909b6978f5a..fd7ffd68e62 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -279,10 +279,6 @@ Lisp_Object Qx_gtk_map_stock;
279/* Some functions take this as char *, not const char *. */ 279/* Some functions take this as char *, not const char *. */
280static char emacs_class[] = EMACS_CLASS; 280static char emacs_class[] = EMACS_CLASS;
281 281
282/* XEmbed implementation. */
283
284#define XEMBED_VERSION 0
285
286enum xembed_info 282enum xembed_info
287 { 283 {
288 XEMBED_MAPPED = 1 << 0 284 XEMBED_MAPPED = 1 << 0
@@ -321,6 +317,7 @@ static void XTframe_up_to_date (struct frame *);
321static void XTset_terminal_modes (struct terminal *); 317static void XTset_terminal_modes (struct terminal *);
322static void XTreset_terminal_modes (struct terminal *); 318static void XTreset_terminal_modes (struct terminal *);
323static void x_clear_frame (struct frame *); 319static void x_clear_frame (struct frame *);
320static void x_ins_del_lines (struct frame *, int, int) NO_RETURN;
324static void frame_highlight (struct frame *); 321static void frame_highlight (struct frame *);
325static void frame_unhighlight (struct frame *); 322static void frame_unhighlight (struct frame *);
326static void x_new_focus_frame (struct x_display_info *, struct frame *); 323static void x_new_focus_frame (struct x_display_info *, struct frame *);
@@ -877,6 +874,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *);
877static void x_draw_composite_glyph_string_foreground (struct glyph_string *); 874static void x_draw_composite_glyph_string_foreground (struct glyph_string *);
878static void x_draw_glyph_string_box (struct glyph_string *); 875static void x_draw_glyph_string_box (struct glyph_string *);
879static void x_draw_glyph_string (struct glyph_string *); 876static void x_draw_glyph_string (struct glyph_string *);
877static void x_delete_glyphs (struct frame *, int) NO_RETURN;
880static void x_compute_glyph_string_overhangs (struct glyph_string *); 878static void x_compute_glyph_string_overhangs (struct glyph_string *);
881static void x_set_cursor_gc (struct glyph_string *); 879static void x_set_cursor_gc (struct glyph_string *);
882static void x_set_mode_line_face_gc (struct glyph_string *); 880static void x_set_mode_line_face_gc (struct glyph_string *);
@@ -1791,27 +1789,6 @@ x_copy_color (struct frame *f, long unsigned int pixel)
1791} 1789}
1792 1790
1793 1791
1794/* Allocate color PIXEL on display DPY. PIXEL must already be allocated.
1795 It's necessary to do this instead of just using PIXEL directly to
1796 get color reference counts right. */
1797
1798unsigned long
1799x_copy_dpy_color (Display *dpy, Colormap cmap, long unsigned int pixel)
1800{
1801 XColor color;
1802
1803 color.pixel = pixel;
1804 BLOCK_INPUT;
1805 XQueryColor (dpy, cmap, &color);
1806 XAllocColor (dpy, cmap, &color);
1807 UNBLOCK_INPUT;
1808#ifdef DEBUG_X_COLORS
1809 register_color (pixel);
1810#endif
1811 return color.pixel;
1812}
1813
1814
1815/* Brightness beyond which a color won't have its highlight brightness 1792/* Brightness beyond which a color won't have its highlight brightness
1816 boosted. 1793 boosted.
1817 1794
@@ -2260,12 +2237,12 @@ x_draw_image_foreground (struct glyph_string *s)
2260 nothing here for mouse-face. */ 2237 nothing here for mouse-face. */
2261 if (s->hl == DRAW_CURSOR) 2238 if (s->hl == DRAW_CURSOR)
2262 { 2239 {
2263 int r = s->img->relief; 2240 int relief = s->img->relief;
2264 if (r < 0) r = -r; 2241 if (relief < 0) relief = -relief;
2265 XDrawRectangle (s->display, s->window, s->gc, 2242 XDrawRectangle (s->display, s->window, s->gc,
2266 x - r, y - r, 2243 x - relief, y - relief,
2267 s->slice.width + r*2 - 1, 2244 s->slice.width + relief*2 - 1,
2268 s->slice.height + r*2 - 1); 2245 s->slice.height + relief*2 - 1);
2269 } 2246 }
2270 } 2247 }
2271 } 2248 }
@@ -2907,7 +2884,7 @@ x_draw_glyph_string (struct glyph_string *s)
2907 2884
2908/* Shift display to make room for inserted glyphs. */ 2885/* Shift display to make room for inserted glyphs. */
2909 2886
2910void 2887static void
2911x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) 2888x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by)
2912{ 2889{
2913 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), 2890 XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f),
@@ -3011,7 +2988,7 @@ timeval_subtract (struct timeval *result, struct timeval x, struct timeval y)
3011 return x.tv_sec < y.tv_sec; 2988 return x.tv_sec < y.tv_sec;
3012} 2989}
3013 2990
3014void 2991static void
3015XTflash (struct frame *f) 2992XTflash (struct frame *f)
3016{ 2993{
3017 BLOCK_INPUT; 2994 BLOCK_INPUT;
@@ -3021,6 +2998,17 @@ XTflash (struct frame *f)
3021 /* Use Gdk routines to draw. This way, we won't draw over scroll bars 2998 /* Use Gdk routines to draw. This way, we won't draw over scroll bars
3022 when the scroll bars and the edit widget share the same X window. */ 2999 when the scroll bars and the edit widget share the same X window. */
3023 GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f)); 3000 GdkWindow *window = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
3001#ifdef HAVE_GTK3
3002 cairo_t *cr = gdk_cairo_create (window);
3003 cairo_set_source_rgb (cr, 1, 1, 1);
3004 cairo_set_operator (cr, CAIRO_OPERATOR_DIFFERENCE);
3005#define XFillRectangle(d, win, gc, x, y, w, h) \
3006 do { \
3007 cairo_rectangle (cr, x, y, w, h); \
3008 cairo_fill (cr); \
3009 } \
3010 while (0)
3011#else /* ! HAVE_GTK3 */
3024 GdkGCValues vals; 3012 GdkGCValues vals;
3025 GdkGC *gc; 3013 GdkGC *gc;
3026 vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f) 3014 vals.foreground.pixel = (FRAME_FOREGROUND_PIXEL (f)
@@ -3030,7 +3018,8 @@ XTflash (struct frame *f)
3030 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND); 3018 &vals, GDK_GC_FUNCTION | GDK_GC_FOREGROUND);
3031#define XFillRectangle(d, win, gc, x, y, w, h) \ 3019#define XFillRectangle(d, win, gc, x, y, w, h) \
3032 gdk_draw_rectangle (window, gc, TRUE, x, y, w, h) 3020 gdk_draw_rectangle (window, gc, TRUE, x, y, w, h)
3033#else 3021#endif /* ! HAVE_GTK3 */
3022#else /* ! USE_GTK */
3034 GC gc; 3023 GC gc;
3035 3024
3036 /* Create a GC that will use the GXxor function to flip foreground 3025 /* Create a GC that will use the GXxor function to flip foreground
@@ -3151,7 +3140,11 @@ XTflash (struct frame *f)
3151 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); 3140 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3152 3141
3153#ifdef USE_GTK 3142#ifdef USE_GTK
3143#ifdef HAVE_GTK3
3144 cairo_destroy (cr);
3145#else
3154 g_object_unref (G_OBJECT (gc)); 3146 g_object_unref (G_OBJECT (gc));
3147#endif
3155#undef XFillRectangle 3148#undef XFillRectangle
3156#else 3149#else
3157 XFreeGC (FRAME_X_DISPLAY (f), gc); 3150 XFreeGC (FRAME_X_DISPLAY (f), gc);
@@ -3186,7 +3179,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
3186 3179
3187/* Make audible bell. */ 3180/* Make audible bell. */
3188 3181
3189void 3182static void
3190XTring_bell (struct frame *f) 3183XTring_bell (struct frame *f)
3191{ 3184{
3192 if (FRAME_X_DISPLAY (f)) 3185 if (FRAME_X_DISPLAY (f))
@@ -3800,7 +3793,7 @@ redo_mouse_highlight (void)
3800 mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell 3793 mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell
3801 the mouse is over. 3794 the mouse is over.
3802 3795
3803 Set *TIME to the server time-stamp for the time at which the mouse 3796 Set *TIMESTAMP to the server time-stamp for the time at which the mouse
3804 was at this position. 3797 was at this position.
3805 3798
3806 Don't store anything if we don't have a valid set of values to report. 3799 Don't store anything if we don't have a valid set of values to report.
@@ -3809,14 +3802,16 @@ redo_mouse_highlight (void)
3809 movement. */ 3802 movement. */
3810 3803
3811static void 3804static void
3812XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) 3805XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3806 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3807 long unsigned int *timestamp)
3813{ 3808{
3814 FRAME_PTR f1; 3809 FRAME_PTR f1;
3815 3810
3816 BLOCK_INPUT; 3811 BLOCK_INPUT;
3817 3812
3818 if (! NILP (last_mouse_scroll_bar) && insist == 0) 3813 if (! NILP (last_mouse_scroll_bar) && insist == 0)
3819 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); 3814 x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp);
3820 else 3815 else
3821 { 3816 {
3822 Window root; 3817 Window root;
@@ -3989,7 +3984,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol
3989 *fp = f1; 3984 *fp = f1;
3990 XSETINT (*x, win_x); 3985 XSETINT (*x, win_x);
3991 XSETINT (*y, win_y); 3986 XSETINT (*y, win_y);
3992 *time = last_mouse_movement_time; 3987 *timestamp = last_mouse_movement_time;
3993 } 3988 }
3994 } 3989 }
3995 } 3990 }
@@ -5541,7 +5536,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5541 on the scroll bar. */ 5536 on the scroll bar. */
5542 5537
5543static void 5538static void
5544x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) 5539x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5540 enum scroll_bar_part *part, Lisp_Object *x,
5541 Lisp_Object *y, long unsigned int *timestamp)
5545{ 5542{
5546 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 5543 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
5547 Window w = bar->x_window; 5544 Window w = bar->x_window;
@@ -5601,7 +5598,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_
5601 last_mouse_scroll_bar = Qnil; 5598 last_mouse_scroll_bar = Qnil;
5602 } 5599 }
5603 5600
5604 *time = last_mouse_movement_time; 5601 *timestamp = last_mouse_movement_time;
5605 5602
5606 UNBLOCK_INPUT; 5603 UNBLOCK_INPUT;
5607} 5604}
@@ -5775,7 +5772,8 @@ static void xembed_send_message (struct frame *f, Time time,
5775 We return the number of characters stored into the buffer. */ 5772 We return the number of characters stored into the buffer. */
5776 5773
5777static int 5774static int
5778handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) 5775handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
5776 int *finish, struct input_event *hold_quit)
5779{ 5777{
5780 union { 5778 union {
5781 struct input_event ie; 5779 struct input_event ie;
@@ -5786,7 +5784,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
5786 int nbytes = 0; 5784 int nbytes = 0;
5787 struct frame *f = NULL; 5785 struct frame *f = NULL;
5788 struct coding_system coding; 5786 struct coding_system coding;
5789 XEvent event = *eventp; 5787 XEvent event = *eventptr;
5790 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 5788 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
5791 5789
5792 *finish = X_EVENT_NORMAL; 5790 *finish = X_EVENT_NORMAL;
@@ -6486,7 +6484,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6486 6484
6487 { /* Raw bytes, not keysym. */ 6485 { /* Raw bytes, not keysym. */
6488 register int i; 6486 register int i;
6489 register int c;
6490 int nchars, len; 6487 int nchars, len;
6491 6488
6492 for (i = 0, nchars = 0; i < nbytes; i++) 6489 for (i = 0, nchars = 0; i < nbytes; i++)
@@ -6526,14 +6523,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6526 character events. */ 6523 character events. */
6527 for (i = 0; i < nbytes; i += len) 6524 for (i = 0; i < nbytes; i += len)
6528 { 6525 {
6526 int ch;
6529 if (nchars == nbytes) 6527 if (nchars == nbytes)
6530 c = copy_bufptr[i], len = 1; 6528 ch = copy_bufptr[i], len = 1;
6531 else 6529 else
6532 c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); 6530 ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len);
6533 inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) 6531 inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch)
6534 ? ASCII_KEYSTROKE_EVENT 6532 ? ASCII_KEYSTROKE_EVENT
6535 : MULTIBYTE_CHAR_KEYSTROKE_EVENT); 6533 : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
6536 inev.ie.code = c; 6534 inev.ie.code = ch;
6537 kbd_buffer_store_event_hold (&inev.ie, hold_quit); 6535 kbd_buffer_store_event_hold (&inev.ie, hold_quit);
6538 } 6536 }
6539 6537
@@ -6972,7 +6970,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
6972 count++; 6970 count++;
6973 } 6971 }
6974 6972
6975 *eventp = event; 6973 *eventptr = event;
6976 return count; 6974 return count;
6977} 6975}
6978 6976
@@ -7012,7 +7010,6 @@ static int
7012XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) 7010XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit)
7013{ 7011{
7014 int count = 0; 7012 int count = 0;
7015 XEvent event;
7016 int event_found = 0; 7013 int event_found = 0;
7017 7014
7018 if (interrupt_input_blocked) 7015 if (interrupt_input_blocked)
@@ -7046,6 +7043,7 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7046 while (XPending (terminal->display_info.x->display)) 7043 while (XPending (terminal->display_info.x->display))
7047 { 7044 {
7048 int finish; 7045 int finish;
7046 XEvent event;
7049 7047
7050 XNextEvent (terminal->display_info.x->display, &event); 7048 XNextEvent (terminal->display_info.x->display, &event);
7051 7049
@@ -7063,6 +7061,8 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7063 goto out; 7061 goto out;
7064 } 7062 }
7065 7063
7064 out:;
7065
7066#else /* USE_GTK */ 7066#else /* USE_GTK */
7067 7067
7068 /* For GTK we must use the GTK event loop. But XEvents gets passed 7068 /* For GTK we must use the GTK event loop. But XEvents gets passed
@@ -7089,8 +7089,6 @@ XTread_socket (struct terminal *terminal, int expected, struct input_event *hold
7089 } 7089 }
7090#endif /* USE_GTK */ 7090#endif /* USE_GTK */
7091 7091
7092 out:;
7093
7094 /* On some systems, an X bug causes Emacs to get no more events 7092 /* On some systems, an X bug causes Emacs to get no more events
7095 when the window is destroyed. Detect that. (1994.) */ 7093 when the window is destroyed. Detect that. (1994.) */
7096 if (! event_found) 7094 if (! event_found)
@@ -7226,9 +7224,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
7226 the bar might not be in the window. */ 7224 the bar might not be in the window. */
7227 if (cursor_glyph->type == IMAGE_GLYPH) 7225 if (cursor_glyph->type == IMAGE_GLYPH)
7228 { 7226 {
7229 struct glyph_row *row; 7227 struct glyph_row *r;
7230 row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); 7228 r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos);
7231 draw_phys_cursor_glyph (w, row, DRAW_CURSOR); 7229 draw_phys_cursor_glyph (w, r, DRAW_CURSOR);
7232 } 7230 }
7233 else 7231 else
7234 { 7232 {
@@ -7517,9 +7515,9 @@ static struct x_error_message_stack *x_error_message;
7517 x_catch_errors is in effect. */ 7515 x_catch_errors is in effect. */
7518 7516
7519static void 7517static void
7520x_error_catcher (Display *display, XErrorEvent *error) 7518x_error_catcher (Display *display, XErrorEvent *event)
7521{ 7519{
7522 XGetErrorText (display, error->error_code, 7520 XGetErrorText (display, event->error_code,
7523 x_error_message->string, 7521 x_error_message->string,
7524 X_ERROR_MESSAGE_SIZE); 7522 X_ERROR_MESSAGE_SIZE);
7525} 7523}
@@ -7668,17 +7666,6 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */
7668 7666
7669static char *error_msg; 7667static char *error_msg;
7670 7668
7671/* Function installed as fatal_error_signal_hook in
7672 x_connection_closed. Print the X error message, and exit normally,
7673 instead of dumping core when XtCloseDisplay fails. */
7674
7675static void
7676x_fatal_error_signal (void)
7677{
7678 fprintf (stderr, "%s\n", error_msg);
7679 exit (70);
7680}
7681
7682/* Handle the loss of connection to display DPY. ERROR_MESSAGE is 7669/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
7683 the text of an error message that lead to the connection loss. */ 7670 the text of an error message that lead to the connection loss. */
7684 7671
@@ -7687,7 +7674,7 @@ x_connection_closed (Display *dpy, const char *error_message)
7687{ 7674{
7688 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 7675 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
7689 Lisp_Object frame, tail; 7676 Lisp_Object frame, tail;
7690 int index = SPECPDL_INDEX (); 7677 int idx = SPECPDL_INDEX ();
7691 7678
7692 error_msg = (char *) alloca (strlen (error_message) + 1); 7679 error_msg = (char *) alloca (strlen (error_message) + 1);
7693 strcpy (error_msg, error_message); 7680 strcpy (error_msg, error_message);
@@ -7782,8 +7769,12 @@ For details, see etc/PROBLEMS.\n",
7782 sigunblock (sigmask (SIGALRM)); 7769 sigunblock (sigmask (SIGALRM));
7783 TOTALLY_UNBLOCK_INPUT; 7770 TOTALLY_UNBLOCK_INPUT;
7784 7771
7785 unbind_to (index, Qnil); 7772 unbind_to (idx, Qnil);
7786 clear_waiting_for_input (); 7773 clear_waiting_for_input ();
7774
7775 /* Tell GCC not to suggest attribute 'noreturn' for this function. */
7776 IF_LINT (if (! terminal_list) return; )
7777
7787 /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, 7778 /* Here, we absolutely have to use a non-local exit (e.g. signal, throw,
7788 longjmp), because returning from this function would get us back into 7779 longjmp), because returning from this function would get us back into
7789 Xlib's code which will directly call `exit'. */ 7780 Xlib's code which will directly call `exit'. */
@@ -7798,12 +7789,12 @@ static void x_error_quitter (Display *, XErrorEvent *);
7798 It calls x_error_quitter or x_error_catcher. */ 7789 It calls x_error_quitter or x_error_catcher. */
7799 7790
7800static int 7791static int
7801x_error_handler (Display *display, XErrorEvent *error) 7792x_error_handler (Display *display, XErrorEvent *event)
7802{ 7793{
7803 if (x_error_message) 7794 if (x_error_message)
7804 x_error_catcher (display, error); 7795 x_error_catcher (display, event);
7805 else 7796 else
7806 x_error_quitter (display, error); 7797 x_error_quitter (display, event);
7807 return 0; 7798 return 0;
7808} 7799}
7809 7800
@@ -7817,22 +7808,22 @@ x_error_handler (Display *display, XErrorEvent *error)
7817 after x_error_handler prevents inlining into the former. */ 7808 after x_error_handler prevents inlining into the former. */
7818 7809
7819static void NO_INLINE 7810static void NO_INLINE
7820x_error_quitter (Display *display, XErrorEvent *error) 7811x_error_quitter (Display *display, XErrorEvent *event)
7821{ 7812{
7822 char buf[256], buf1[356]; 7813 char buf[256], buf1[356];
7823 7814
7824 /* Ignore BadName errors. They can happen because of fonts 7815 /* Ignore BadName errors. They can happen because of fonts
7825 or colors that are not defined. */ 7816 or colors that are not defined. */
7826 7817
7827 if (error->error_code == BadName) 7818 if (event->error_code == BadName)
7828 return; 7819 return;
7829 7820
7830 /* Note that there is no real way portable across R3/R4 to get the 7821 /* Note that there is no real way portable across R3/R4 to get the
7831 original error handler. */ 7822 original error handler. */
7832 7823
7833 XGetErrorText (display, error->error_code, buf, sizeof (buf)); 7824 XGetErrorText (display, event->error_code, buf, sizeof (buf));
7834 sprintf (buf1, "X protocol error: %s on protocol request %d", 7825 sprintf (buf1, "X protocol error: %s on protocol request %d",
7835 buf, error->request_code); 7826 buf, event->request_code);
7836 x_connection_closed (display, buf1); 7827 x_connection_closed (display, buf1);
7837} 7828}
7838 7829
@@ -8119,7 +8110,7 @@ xim_close_dpy (struct x_display_info *dpyinfo)
8119/* Calculate the absolute position in frame F 8110/* Calculate the absolute position in frame F
8120 from its current recorded position values and gravity. */ 8111 from its current recorded position values and gravity. */
8121 8112
8122void 8113static void
8123x_calc_absolute_position (struct frame *f) 8114x_calc_absolute_position (struct frame *f)
8124{ 8115{
8125 int flags = f->size_hint_flags; 8116 int flags = f->size_hint_flags;
@@ -8862,31 +8853,6 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
8862 UNBLOCK_INPUT; 8853 UNBLOCK_INPUT;
8863} 8854}
8864 8855
8865/* focus shifting, raising and lowering. */
8866
8867void
8868x_focus_on_frame (struct frame *f)
8869{
8870#if 0
8871 /* I don't think that the ICCCM allows programs to do things like this
8872 without the interaction of the window manager. Whatever you end up
8873 doing with this code, do it to x_unfocus_frame too. */
8874 XSetInputFocus (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8875 RevertToPointerRoot, CurrentTime);
8876#endif /* ! 0 */
8877}
8878
8879void
8880x_unfocus_frame (struct frame *f)
8881{
8882#if 0
8883 /* Look at the remarks in x_focus_on_frame. */
8884 if (FRAME_X_DISPLAY_INFO (f)->x_focus_frame == f)
8885 XSetInputFocus (FRAME_X_DISPLAY (f), PointerRoot,
8886 RevertToPointerRoot, CurrentTime);
8887#endif /* ! 0 */
8888}
8889
8890/* Raise frame F. */ 8856/* Raise frame F. */
8891 8857
8892void 8858void
@@ -8947,6 +8913,12 @@ XTframe_raise_lower (FRAME_PTR f, int raise_flag)
8947 8913
8948/* XEmbed implementation. */ 8914/* XEmbed implementation. */
8949 8915
8916#if defined USE_X_TOOLKIT || ! defined USE_GTK
8917
8918/* XEmbed implementation. */
8919
8920#define XEMBED_VERSION 0
8921
8950static void 8922static void
8951xembed_set_info (struct frame *f, enum xembed_info flags) 8923xembed_set_info (struct frame *f, enum xembed_info flags)
8952{ 8924{
@@ -8960,9 +8932,11 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
8960 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO, 8932 dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO,
8961 32, PropModeReplace, (unsigned char *) data, 2); 8933 32, PropModeReplace, (unsigned char *) data, 2);
8962} 8934}
8935#endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */
8963 8936
8964static void 8937static void
8965xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) 8938xembed_send_message (struct frame *f, Time t, enum xembed_message msg,
8939 long int detail, long int data1, long int data2)
8966{ 8940{
8967 XEvent event; 8941 XEvent event;
8968 8942
@@ -8970,8 +8944,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo
8970 event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; 8944 event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc;
8971 event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; 8945 event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED;
8972 event.xclient.format = 32; 8946 event.xclient.format = 32;
8973 event.xclient.data.l[0] = time; 8947 event.xclient.data.l[0] = t;
8974 event.xclient.data.l[1] = message; 8948 event.xclient.data.l[1] = msg;
8975 event.xclient.data.l[2] = detail; 8949 event.xclient.data.l[2] = detail;
8976 event.xclient.data.l[3] = data1; 8950 event.xclient.data.l[3] = data1;
8977 event.xclient.data.l[4] = data2; 8951 event.xclient.data.l[4] = data2;
@@ -9212,7 +9186,9 @@ x_make_frame_invisible (struct frame *f)
9212void 9186void
9213x_iconify_frame (struct frame *f) 9187x_iconify_frame (struct frame *f)
9214{ 9188{
9189#ifdef USE_X_TOOLKIT
9215 int result; 9190 int result;
9191#endif
9216 Lisp_Object type; 9192 Lisp_Object type;
9217 9193
9218 /* Don't keep the highlight on an invisible frame. */ 9194 /* Don't keep the highlight on an invisible frame. */
@@ -9295,19 +9271,19 @@ x_iconify_frame (struct frame *f)
9295 /* X11R4: send a ClientMessage to the window manager using the 9271 /* X11R4: send a ClientMessage to the window manager using the
9296 WM_CHANGE_STATE type. */ 9272 WM_CHANGE_STATE type. */
9297 { 9273 {
9298 XEvent message; 9274 XEvent msg;
9299 9275
9300 message.xclient.window = FRAME_X_WINDOW (f); 9276 msg.xclient.window = FRAME_X_WINDOW (f);
9301 message.xclient.type = ClientMessage; 9277 msg.xclient.type = ClientMessage;
9302 message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; 9278 msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state;
9303 message.xclient.format = 32; 9279 msg.xclient.format = 32;
9304 message.xclient.data.l[0] = IconicState; 9280 msg.xclient.data.l[0] = IconicState;
9305 9281
9306 if (! XSendEvent (FRAME_X_DISPLAY (f), 9282 if (! XSendEvent (FRAME_X_DISPLAY (f),
9307 DefaultRootWindow (FRAME_X_DISPLAY (f)), 9283 DefaultRootWindow (FRAME_X_DISPLAY (f)),
9308 False, 9284 False,
9309 SubstructureRedirectMask | SubstructureNotifyMask, 9285 SubstructureRedirectMask | SubstructureNotifyMask,
9310 &message)) 9286 &msg))
9311 { 9287 {
9312 UNBLOCK_INPUT_RESIGNAL; 9288 UNBLOCK_INPUT_RESIGNAL;
9313 error ("Can't notify window manager of iconification"); 9289 error ("Can't notify window manager of iconification");
@@ -9339,9 +9315,11 @@ void
9339x_free_frame_resources (struct frame *f) 9315x_free_frame_resources (struct frame *f)
9340{ 9316{
9341 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 9317 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
9318 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
9319#ifdef USE_X_TOOLKIT
9342 Lisp_Object bar; 9320 Lisp_Object bar;
9343 struct scroll_bar *b; 9321 struct scroll_bar *b;
9344 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 9322#endif
9345 9323
9346 BLOCK_INPUT; 9324 BLOCK_INPUT;
9347 9325
@@ -9797,10 +9775,11 @@ x_display_ok (const char *display)
9797 9775
9798#ifdef USE_GTK 9776#ifdef USE_GTK
9799static void 9777static void
9800my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) 9778my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
9779 const gchar *msg, gpointer user_data)
9801{ 9780{
9802 if (!strstr (message, "g_set_prgname")) 9781 if (!strstr (msg, "g_set_prgname"))
9803 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); 9782 fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg);
9804} 9783}
9805#endif 9784#endif
9806 9785
@@ -9863,6 +9842,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9863 9842
9864 XSetLocaleModifiers (""); 9843 XSetLocaleModifiers ("");
9865 9844
9845 /* Emacs can only handle core input events, so make sure
9846 Gtk doesn't use Xinput or Xinput2 extensions. */
9847 {
9848 static char fix_events[] = "GDK_CORE_DEVICE_EVENTS=1";
9849 putenv (fix_events);
9850 }
9851
9866 /* Work around GLib bug that outputs a faulty warning. See 9852 /* Work around GLib bug that outputs a faulty warning. See
9867 https://bugzilla.gnome.org/show_bug.cgi?id=563627. */ 9853 https://bugzilla.gnome.org/show_bug.cgi?id=563627. */
9868 id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL 9854 id = g_log_set_handler ("GLib", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
@@ -9874,11 +9860,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9874 fixup_locale (); 9860 fixup_locale ();
9875 xg_initialize (); 9861 xg_initialize ();
9876 9862
9877 dpy = GDK_DISPLAY (); 9863 dpy = DEFAULT_GDK_DISPLAY ();
9878 9864
9879 /* NULL window -> events for all windows go to our function */ 9865 /* NULL window -> events for all windows go to our function */
9880 gdk_window_add_filter (NULL, event_handler_gdk, NULL); 9866 gdk_window_add_filter (NULL, event_handler_gdk, NULL);
9881 9867
9868#if GTK_MAJOR_VERSION <= 2 && GTK_MINOR_VERSION <= 90
9882 /* Load our own gtkrc if it exists. */ 9869 /* Load our own gtkrc if it exists. */
9883 { 9870 {
9884 const char *file = "~/.emacs.d/gtkrc"; 9871 const char *file = "~/.emacs.d/gtkrc";
@@ -9890,6 +9877,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9890 if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file))) 9877 if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file)))
9891 gtk_rc_parse (SSDATA (abs_file)); 9878 gtk_rc_parse (SSDATA (abs_file));
9892 } 9879 }
9880#endif
9893 9881
9894 XSetErrorHandler (x_error_handler); 9882 XSetErrorHandler (x_error_handler);
9895 XSetIOErrorHandler (x_io_error_quitter); 9883 XSetIOErrorHandler (x_io_error_quitter);
diff --git a/src/xterm.h b/src/xterm.h
index 48d68557796..15630e902e5 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -675,9 +675,20 @@ enum
675#define gtk_adjustment_get_upper(w) ((w)->upper) 675#define gtk_adjustment_get_upper(w) ((w)->upper)
676#endif 676#endif
677 677
678#ifdef HAVE_GTK3
679#define DEFAULT_GDK_DISPLAY() \
680 gdk_x11_display_get_xdisplay (gdk_display_get_default ())
681#else
682#undef GDK_WINDOW_XID
683#define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w)
684#define DEFAULT_GDK_DISPLAY() GDK_DISPLAY ()
685#define gtk_widget_get_preferred_size(a, ign, b) \
686 gtk_widget_size_request(a, b)
687#endif
688
678#define GTK_WIDGET_TO_X_WIN(w) \ 689#define GTK_WIDGET_TO_X_WIN(w) \
679 ((w) && gtk_widget_get_window (w) \ 690 ((w) && gtk_widget_get_window (w) \
680 ? GDK_WINDOW_XWINDOW (gtk_widget_get_window (w)) : 0) 691 ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0)
681 692
682#define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget) 693#define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
683#define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget) 694#define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
@@ -979,6 +990,7 @@ extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *);
979extern void x_query_colors (struct frame *f, XColor *, int); 990extern void x_query_colors (struct frame *f, XColor *, int);
980extern void x_query_color (struct frame *f, XColor *); 991extern void x_query_color (struct frame *f, XColor *);
981extern void x_clear_area (Display *, Window, int, int, int, int, int); 992extern void x_clear_area (Display *, Window, int, int, int, int, int);
993extern void x_mouse_leave (struct x_display_info *);
982extern void set_vertical_scroll_bar (struct window *); 994extern void set_vertical_scroll_bar (struct window *);
983 995
984extern int x_dispatch_event (XEvent *, Display *); 996extern int x_dispatch_event (XEvent *, Display *);