aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2010-10-15 17:55:33 -0400
committerStefan Monnier2010-10-15 17:55:33 -0400
commit0c747cb143fa227e78f350ac353d703f489209df (patch)
tree5b434055c797bd75eaa1e3d9d0773e586d44daee /src
parenta01a7932080e8a6e7bc8472c58cefabcc2c37df3 (diff)
parentaa095b2db98ae149737f8de00ee733b1d257ed33 (diff)
downloademacs-0c747cb143fa227e78f350ac353d703f489209df.tar.gz
emacs-0c747cb143fa227e78f350ac353d703f489209df.zip
Merge from trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog.28
-rw-r--r--src/ChangeLog.38
-rw-r--r--src/ChangeLog.74
-rw-r--r--src/ChangeLog.82
-rw-r--r--src/ChangeLog.trunk383
-rw-r--r--src/Makefile.in362
-rw-r--r--src/alloc.c6
-rw-r--r--src/bidi.c1
-rw-r--r--src/buffer.c10
-rw-r--r--src/callproc.c41
-rw-r--r--src/ccl.c4
-rw-r--r--src/character.c11
-rw-r--r--src/charset.c5
-rw-r--r--src/coding.c102
-rw-r--r--src/coding.h1
-rw-r--r--src/config.in30
-rw-r--r--src/dbusbind.c11
-rw-r--r--src/doc.c7
-rw-r--r--src/dosfns.c1
-rw-r--r--src/emacs.c48
-rw-r--r--src/eval.c8
-rw-r--r--src/fileio.c25
-rw-r--r--src/filelock.c3
-rw-r--r--src/font.c55
-rw-r--r--src/font.h7
-rw-r--r--src/ftfont.c43
-rw-r--r--src/gnutls.c232
-rw-r--r--src/gnutls.h2
-rw-r--r--src/gtkutil.c1
-rw-r--r--src/image.c143
-rw-r--r--src/keyboard.c32
-rw-r--r--src/lisp.h1
-rw-r--r--src/lread.c5
-rw-r--r--src/makefile.w32-in90
-rw-r--r--src/msdos.c4
-rw-r--r--src/nsfns.m2
-rw-r--r--src/nsmenu.m2
-rw-r--r--src/nsselect.m10
-rw-r--r--src/nsterm.m40
-rw-r--r--src/point.h8
-rw-r--r--src/print.c2
-rw-r--r--src/process.c70
-rw-r--r--src/regex.c2
-rw-r--r--src/scroll.c1
-rw-r--r--src/sound.c2
-rw-r--r--src/sysdep.c278
-rw-r--r--src/term.c4
-rw-r--r--src/termcap.c35
-rw-r--r--src/termhooks.h7
-rw-r--r--src/unexaix.c57
-rw-r--r--src/unexcoff.c67
-rw-r--r--src/unexcw.c3
-rw-r--r--src/unexelf.c40
-rw-r--r--src/unexhp9k800.c14
-rw-r--r--src/unexmacosx.c8
-rw-r--r--src/unexsol.c4
-rw-r--r--src/unexw32.c7
-rw-r--r--src/vm-limit.c3
-rw-r--r--src/w16select.c1
-rw-r--r--src/w32.c7
-rw-r--r--src/w32console.c24
-rw-r--r--src/w32fns.c11
-rw-r--r--src/w32font.c34
-rw-r--r--src/w32heap.c3
-rw-r--r--src/w32inevt.c3
-rw-r--r--src/w32menu.c7
-rw-r--r--src/w32proc.c26
-rw-r--r--src/w32reg.c1
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32term.c9
-rw-r--r--src/w32uniscribe.c2
-rw-r--r--src/w32xfns.c3
-rw-r--r--src/xdisp.c18
-rw-r--r--src/xfont.c3
-rw-r--r--src/xml.c62
-rw-r--r--src/xterm.c80
76 files changed, 1391 insertions, 1267 deletions
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index f087802e27d..0397478f09d 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -1563,10 +1563,10 @@
15631987-04-27 Richard Mlynarik (mly@prep) 15631987-04-27 Richard Mlynarik (mly@prep)
1564 1564
1565 * fileio.c (APOLLO from lnz): 1565 * fileio.c (APOLLO from lnz):
1566 Fcopy_file, Fset_file_modes: Don't use un*x modes if 1566 (Fcopy_file, Fset_file_modes): Don't use un*x modes if
1567 env var USE_DOMAIN_ACLS is set. 1567 env var USE_DOMAIN_ACLS is set.
1568 Fset_file_modes: utimes fix. 1568 (Fset_file_modes): utimes fix.
1569 Finsert_file_contents: Must do fstat after open for Apollo. 1569 (Finsert_file_contents): Must do fstat after open for Apollo.
1570 1570
1571 * emacs.c (main): (APOLLO from lnz): 1571 * emacs.c (main): (APOLLO from lnz):
1572 Don't use un*x modes if env var USE_DOMAIN_ACLS set. 1572 Don't use un*x modes if env var USE_DOMAIN_ACLS set.
@@ -2073,7 +2073,7 @@
2073 2073
2074 * xfns.c (Fx_get_default): Add (unsigned char *) cast. 2074 * xfns.c (Fx_get_default): Add (unsigned char *) cast.
2075 2075
2076 * window.c: typo. 2076 * window.c: Typo.
2077 2077
20781987-02-09 Richard M. Stallman (rms@prep) 20781987-02-09 Richard M. Stallman (rms@prep)
2079 2079
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index e3c5ab70f66..e3ba2b37ccd 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -5146,7 +5146,7 @@
5146 Change mouse movement events to be arranged like click events. 5146 Change mouse movement events to be arranged like click events.
5147 (format_modifiers): Note that the click modifier has no 5147 (format_modifiers): Note that the click modifier has no
5148 written representation. 5148 written representation.
5149 (modifier_names, modifer_symbols): New variables, used to 5149 (modifier_names, modifier_symbols): New variables, used to
5150 create the Qevent_symbol_elements property. 5150 create the Qevent_symbol_elements property.
5151 (modify_event_symbol): Change the format of the modified 5151 (modify_event_symbol): Change the format of the modified
5152 symbol cache; there are too many modifier bits now to use a 5152 symbol cache; there are too many modifier bits now to use a
@@ -5154,8 +5154,8 @@
5154 Document the format of the cache. 5154 Document the format of the cache.
5155 Put the Qevent_symbol_elements property on each new symbol, 5155 Put the Qevent_symbol_elements property on each new symbol,
5156 instead of a Qevent_unmodified property. 5156 instead of a Qevent_unmodified property.
5157 (symbols_of_keyboard): Put Qevent_symbol_elements properties on 5157 (symbols_of_keyboard): Put Qevent_symbol_elements properties on the
5158 the symbols specified in head_table, not Qevent_unmodifed properties. 5158 symbols specified in head_table, not Qevent_unmodified properties.
5159 Initialize and staticpro modifier_symbols, and staticpro the 5159 Initialize and staticpro modifier_symbols, and staticpro the
5160 window elements of button_down_location. 5160 window elements of button_down_location.
5161 5161
@@ -11207,7 +11207,7 @@
11207 events to send the function key number instead of a symbol. 11207 events to send the function key number instead of a symbol.
11208 * keyboard.c (modify_event_symbol): Re-arranged to work well 11208 * keyboard.c (modify_event_symbol): Re-arranged to work well
11209 with function key/mouse button numbers instead of symbols. 11209 with function key/mouse button numbers instead of symbols.
11210 And if (MODIFIERS & up_modifer), prepend "U-" to the name of the 11210 And if (MODIFIERS & up_modifier), prepend "U-" to the name of the
11211 symbol being constructed. 11211 symbol being constructed.
11212 (make_lispy_event): Use the new modify_event_symbol. 11212 (make_lispy_event): Use the new modify_event_symbol.
11213 11213
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index 7421aba4403..b5927108808 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -491,7 +491,7 @@
491 491
492 * xselect.c (selection_data_to_lisp_data): Set 492 * xselect.c (selection_data_to_lisp_data): Set
493 Vlast_coding_system_used. 493 Vlast_coding_system_used.
494 (lisp_data_to_selection_data): Likewize. 494 (lisp_data_to_selection_data): Likesize.
495 495
4961998-07-07 Richard Stallman <rms@psilocin.ai.mit.edu> 4961998-07-07 Richard Stallman <rms@psilocin.ai.mit.edu>
497 497
@@ -502,7 +502,7 @@
502 * editfns.c (Fformat): Replace explicit numeric constants with 502 * editfns.c (Fformat): Replace explicit numeric constants with
503 proper macros. 503 proper macros.
504 504
505 * fns.c (concat): Likewize. 505 * fns.c (concat): Likewise.
506 506
5071998-07-06 Kenichi Handa <handa@etl.go.jp> 5071998-07-06 Kenichi Handa <handa@etl.go.jp>
508 508
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index 5033a055576..9c38b29ff32 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -3686,7 +3686,7 @@
3686 * lread.c (read_escape): For Control modifier, pay attention to 3686 * lread.c (read_escape): For Control modifier, pay attention to
3687 multibyte character. 3687 multibyte character.
3688 (read1): Likewise. Signal error or a multibyte character which 3688 (read1): Likewise. Signal error or a multibyte character which
3689 has a modifer bit. Check validity of Shift modifer. 3689 has a modifier bit. Check validity of Shift modifier.
3690 3690
3691 * charset.c (non_ascii_char_to_string): Handle modifier bits as 3691 * charset.c (non_ascii_char_to_string): Handle modifier bits as
3692 the same as Lisp reader. 3692 the same as Lisp reader.
diff --git a/src/ChangeLog.trunk b/src/ChangeLog.trunk
index de4ba68bdc0..567bf2868e7 100644
--- a/src/ChangeLog.trunk
+++ b/src/ChangeLog.trunk
@@ -1,3 +1,386 @@
12010-10-15 Eli Zaretskii <eliz@gnu.org>
2
3 * image.c (tiff_load): Cast 3rd argument to avoid compiler warning.
4
52010-10-15 Tassilo Horn <tassilo@member.fsf.org>
6
7 * Makefile.in (really-oldXMenu): Fix typo in variable name that
8 made building the X menu fail.
9 (really-oldXMenu): Fix my previous fix.
10
112010-10-14 Damyan Pepper <damyanp@gmail.com>
12
13 Fix handling of font properties on Windows (bug#6303).
14 * font.c (font_filter_properties): New function, refactored from
15 ftfont_filter_properties.
16 * font.h (font_filter_properties): Declare.
17 * ftfont.c (ftfont_filter_properties): Use font_filter_properties.
18 * w32font.c (w32font_booleans, w32font_non_booleans): New variables.
19 (w32font_filter_properties): New function.
20 (w32font_driver): Add w32font_filter_properties.
21
222010-10-14 Juanma Barranquero <lekktu@gmail.com>
23
24 * font.c (Ffont_variation_glyphs):
25 * ccl.c (Fccl_execute_on_string): Fix typo in docstring.
26
272010-10-14 Juanma Barranquero <lekktu@gmail.com>
28
29 * w32fns.c (w32_wnd_proc, file_dialog_callback):
30 * w32font.c (w32_generic_family):
31 * w32inevt.c (key_event):
32 * w32menu.c (fill_in_menu):
33 * w32proc.c (reader_thread, w32_executable_type, compare_env)
34 (merge_and_sort_env, int_from_hex, enum_locale_fn, enum_codepage_fn):
35 * w32term.c (w32_read_socket): Make static.
36
372010-10-13 Juanma Barranquero <lekktu@gmail.com>
38
39 * image.c (DEF_IMGLIB_FN): Add argument to adapt to strict
40 prototypes; all callers changed.
41
422010-10-13 Juanma Barranquero <lekktu@gmail.com>
43
44 * makefile.w32-in (TLIB2): Rename from TLIBW32.
45 (OBJ2): New macro.
46 (WIN32OBJ, FONTOBJ): Remove.
47 (OBJ1): Redistribute object files with OBJ2.
48 (LIBS, $(TEMACS)): Use TLIB2.
49 (make-buildobj-CMD, make-buildobj-SH): Use OBJ2.
50 ($(TLIB2), TAGS, TAGS-LISP, TAGS-gmake): Depend on OBJ2.
51
522010-10-13 Juanma Barranquero <lekktu@gmail.com>
53
54 * emacs.c (Vdynamic_library_alist)
55 (syms_of_emacs) <dynamic-library-alist>: Move from image.c and rename.
56 Doc fix.
57
58 * lisp.h (Vdynamic_library_alist): Declare extern.
59
60 * image.c (Vimage_library_alist)
61 (syms_of_image) <image-library-alist>: Move to emacs.c and rename.
62 (lookup_image_type): Use Vdynamic_library_alist.
63 (Finit_image_library): Doc fix.
64
652010-10-12 Dan Nicolaescu <dann@ics.uci.edu>
66
67 * Makefile.in (lispsource, libsrc, etc, oldxmenudir, lwlibdir)
68 (lispdir): Remove trailing /, update all uses.
69
702010-10-12 Jan Djärv <jan.h.d@swipnet.se>
71
72 * nsterm.m (Qleft): Declare.
73 (ns_right_alternate_modifier): New variable
74 (NSRightAlternateKeyMask): New define.
75 (EV_MODIFIERS): Parse NSRightAlternateKeyMask if
76 ns_right_alternate_modifier isn't Qleft.
77 (keyDown): If ns_right_alternate_modifier isn't Qleft, use it
78 as emacs modifier for NSRightAlternateKeyMask.
79 (syms_of_nsterm): DEFVAR_LISP ns-right-alternate-modifier.
80
812010-10-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
82
83 * gnutls.c (emacs_gnutls_write): If we're trying to write before
84 gnutls is ready, return EAGAIN as the errno.
85
862010-10-10 Dan Nicolaescu <dann@ics.uci.edu>
87
88 * vm-limit.c:
89 * unexhp9k800.c:
90 * unexelf.c:
91 * unexaix.c:
92 * termcap.c: Remove #ifdef emacs / #ifndef emacs code, unused.
93
94 * Makefile.in (temacs): Use $(ALL_CFLAGS) on the link line.
95 (PROFILING_LDFLAGS): Remove, not needed anymore.
96
97 * Makefile.in: Use $(...) everywhere instead of ${...}
98 (CRT_DIR): Move near potential user.
99 (START_FILE): Move near CRT_DIR, it might use it.
100
101 * sysdep.c (LPASS8): Remove, unused.
102 (emacs_ospeed): Change from being a global to a local in the only
103 user: init_baud_rate.
104
1052010-10-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
106
107 * gnutls.c (syms_of_gnutls): All the bootprops are keywords.
108 (emacs_gnutls_write): Remove the debuggin fsync call.
109 (emacs_gnutls_read): Return -1 if we got an error from
110 gnutls_read. This allows us to actually read lots of data from
111 the GnuTLS stream.
112 (emacs_gnutls_write): Check for GNUTLS_E_AGAIN and not EINTR.
113 According to the documentation, this is correct, and it seems to
114 make things work.
115
1162010-10-09 Chong Yidong <cyd@stupidchicken.com>
117
118 * xterm.c (x_draw_relief_rect): Clear corner pixels.
119
1202010-10-08 Michael Albinus <michael.albinus@gmx.de>
121
122 * keyboard.c: Revert last change; it was not intended to be
123 synchronized with the trunk.
124
1252010-10-08 Kenichi Handa <handa@m17n.org>
126
127 * coding.c (complement_process_encoding_system): Fix previous change.
128
1292010-10-08 Michael Albinus <michael.albinus@gmx.de>
130
131 * dbusbind.c (syms_of_dbusbind): Move putenv call ...
132 (Fdbus_init_bus): ... here. (Bug#7113)
133
1342010-10-08 Glenn Morris <rgm@gnu.org>
135
136 * buffer.c (before-change-functions, after-change-functions):
137 Three-year overdue doc fix following 2007-08-13 change.
138
1392010-10-08 Kenichi Handa <handa@m17n.org>
140
141 * coding.c (coding_inherit_eol_type): If parent doesn't specify
142 eol-format, inherit from the system's default.
143 (complement_process_encoding_system): Make a new coding system
144 inherit the original eol-format.
145
1462010-10-08 Kenichi Handa <handa@m17n.org>
147
148 * coding.c (complement_process_encoding_system): New function.
149
150 * coding.h (complement_process_encoding_system): Extern it.
151
152 * callproc.c (Fcall_process): Complement the coding system for
153 encoding arguments.
154 (Fcall_process_region): Complement the coding system for encoding
155 the input to the process.
156
157 * process.c (Fstart_process): Complement the coding system for
158 encoding arguments.
159 (send_process): Complement the coding system for encoding what
160 sent to the process.
161
1622010-10-08 Kenichi Handa <handa@m17n.org>
163
164 * xfont.c (xfont_open): Fix setting of font->average_width from
165 :avgwidth property (Bug#7123).
166
1672010-10-08 Michael Albinus <michael.albinus@gmx.de>
168
169 * dbusbind.c (syms_of_dbusbind): Use putenv instead of setenv, it
170 is more portable.
171
172 * keyboard.c (gobble_input): Move call of xd_read_queued_messages ...
173 (kbd_buffer_get_event): ... here. This is needed for cygwin, which
174 has not defined SIGIO.
175
1762010-10-08 Chong Yidong <cyd@stupidchicken.com>
177
178 * xterm.c (x_draw_relief_rect): If box width is larger than 1,
179 draw the outermost line using the black relief, for legibility.
180 Omit drawing the four corner pixels.
181
1822010-10-04 Chong Yidong <cyd@stupidchicken.com>
183
184 * keyboard.c (echo_prompt): Function moved into read_key_sequence.
185 (read_key_sequence): Inline echo_prompt.
186 (echo_dash): Add a dash only if key is continued (Bug#7137).
187
1882010-10-04 Dan Nicolaescu <dann@ics.uci.edu>
189
190 Remove O_RDONLY, O_WRONLY definitions, not needed.
191 * unexcoff.c:
192 * lread.c:
193 * fileio.c:
194 * doc.c:
195 * callproc.c:
196 * alloc.c:
197 * termcap.c: Remove O_RDONLY O_WRONLY definitions.
198
1992010-10-03 Teodor Zlatanov <tzz@lifelogs.com>
200
201 * gnutls.h (GNUTLS_LOG2): Convenience macro.
202
203 * gnutls.c: Add property list symbol holders.
204 (emacs_gnutls_handshake): Clarify how sockets are passed to
205 GnuTLS.
206 (gnutls_log_function2): Convenience function using GNUTLS_LOG2.
207 (Fgnutls_boot): Get all parameters from a plist. Require trustfiles
208 and keyfiles to be a list of file names. Default to "NORMAL" for
209 the priority string. Improve logging.
210
2112010-10-03 Glenn Morris <rgm@gnu.org>
212
213 * fileio.c (Vdirectory_sep_char): Remove.
214
2152010-10-03 Dan Nicolaescu <dann@ics.uci.edu>
216
217 * termhooks.h: Remove #ifdef CONSP.
218
219 * xterm.c (NO_INLINE, noinline): Move definitions to ../configure.in.
220
221 Include <fcntl.h> unconditionally.
222 * termcap.c:
223 * sysdep.c:
224 * lread.c:
225 * keyboard.c:
226 * filelock.c:
227 * fileio.c:
228 * doc.c:
229 * callproc.c:
230 * alloc.c: Remove include guards for <fcntl.h>, process.c already
231 does it.
232
233 * process.c: Do not include <sys/wait.h>, syswait.h does it.
234
235 * sysdep.c (flush_pending_output): Remove code, does not do
236 anything on any platform.
237
238 Remove unused code.
239 * sysdep.c (select_alarm, sys_select, read_input_waiting): Remove
240 select emulation, all systems support select.
241 (set_exclusive_use): Remove, the only user is in an #if 0 block.
242 * process.c (create_process): Remove #if 0 code.
243
244 Remove unused arguments for unexec.
245 The third one is never used, and the last two are always passed as zero.
246 * emacs.c (unexec): Add declaration.
247 (Fdump_emacs): Only pass the first two arguments to unexec.
248 Simplify #ifdef.
249 * unexw32.c (unexec):
250 * unexsol.c (unexec):
251 * unexhp9k800.c (unexec):
252 * unexcw.c (unexec): Remove the last 3 arguments, unused.
253 * unexelf.c (unexec): Remove the last 3 arguments, unused.
254 (find_section): Use const.
255 * unexmacosx.c (unexec): Remove the last 3 arguments, unused.
256 (unexec_error): Declare it NO_RETURN.
257 * unexcoff.c (make_hdr): Assume bss_start is always zero, remove
258 it as an argument, remove data_start and entry_address arguments, unused.
259 (unexec): Remove bss_start, data_start and
260 entry_address arguments.
261 * unexaix.c (make_hdr): Assume bss_start is always zero, remove
262 it as an argument, remove data_start and entry_address arguments, unused.
263 (unexec): Remove bss_start, data_start and
264 entry_address arguments.
265
2662010-10-03 Juanma Barranquero <lekktu@gmail.com>
267
268 * makefile.w32-in (TAGS, TAGS-LISP, TAGS-gmake): Add $(FONTOBJ).
269
270 * gnutls.c (emacs_gnutls_handshake, gnutls_make_error)
271 (gnutls_emacs_global_init, gnutls_emacs_global_deinit): Make static.
272 (Fgnutls_get_initstage, Fgnutls_deinit, Fgnutls_boot, Fgnutls_bye):
273 Fix typos in docstrings.
274 (Fgnutls_error_fatalp, Fgnutls_error_string): Doc fixes.
275 (Fgnutls_errorp): Doc fix; use ERR for the argument name.
276
2772010-10-03 Chong Yidong <cyd@stupidchicken.com>
278
279 * keyboard.c (command_loop_1): Make sure the mark is really alive
280 before using it (Bug#7044).
281
2822010-10-02 Juanma Barranquero <lekktu@gmail.com>
283
284 * makefile.w32-in (tags): Rename target to full-tags.
285
2862010-10-02 Eli Zaretskii <eliz@gnu.org>
287
288 * emacs.c (main): Remove !WINDOWSNT conditional.
289 (Fkill_emacs): Don't mention exemption on MS-Windows.
290
2912010-10-02 Glenn Morris <rgm@gnu.org>
292
293 * character.c (Fchar_bytes): Remove obsolete function.
294 (syms_of_character): Remove Schar_bytes.
295
296 * emacs.c (fatal_error_signal): Also run Fkill_emacs on SIGINT.
297 (main) [!WINDOWSNT]: Handle SIGINT with fatal_error_signal
298 in batch-mode.
299 (Fkill_emacs): Doc fix. Also run the hook in batch mode.
300 (kill-emacs-hook): Doc fix.
301
3022010-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
303
304 * xml.c (Flibxml_parse_xml_region, Flibxml_parse_html_region)
305 (parse_region): Reworked to take regions instead of strings, and
306 renamed to reflect that these are the libxml functions.
307
3082010-10-01 Eli Zaretskii <eliz@gnu.org>
309
310 * term.c (init_tty) [DOS_NT]: Don't call Wcm_clear after setting
311 screen dimensions in tty->Wcm.
312
313 * xdisp.c (set_cursor_from_row): When the row is truncated and
314 point is outside the range of displayed characters, position the
315 cursor inside the scroll margin. (Bug#6349)
316
3172010-10-01 Dan Nicolaescu <dann@ics.uci.edu>
318
319 Do not include stdlib.h and string.h, config.h does it.
320 * xfont.c:
321 * w32term.c:
322 * w32reg.c:
323 * w32inevt.c:
324 * w32heap.c:
325 * w32console.c:
326 * w16select.c:
327 * unexsol.c:
328 * term.c:
329 * sound.c:
330 * scroll.c (m):
331 * gtkutil.c:
332 * font.c:
333 * filelock.c:
334 * fileio.c:
335 * dosfns.c:
336 * dbusbind.c:
337 * bidi.c:
338 * callproc.c:
339 * process.c:
340 * msdos.c:
341 * charset.c: Do not include stdlib.h and string.h, config.h does it.
342
343 * callproc.c (SIGCHLD): Remove conditional definition, syssignal.h defines it.
344
345 * process.c: Move #include <pty.h> earlier.
346 (SIGCHLD): Remove conditional definition, syssignal.h defines it.
347 (pty_name): Move definition later.
348
349 * nsselect.m (syms_of_nsselect):
350 * nsmenu.m (syms_of_nsmenu):
351 * nsfns.m (syms_of_nsfns):
352 * msdos.c (syms_of_msdos):
353
354 * image.c (syms_of_image):
355 * charset.c (syms_of_charset): Use intern_c_string instead of intern.
356
357 * point.h: Remove, unused.
358
3592010-10-01 Eli Zaretskii <eliz@gnu.org>
360
361 * makefile.w32-in (TAGS, frc, TAGS-LISP, ../nt/TAGS, tags)
362 (TAGS-gmake, TAGS-nmake, TAGS-LISP-gmake, TAGS-LISP-nmake)
363 (nt-TAGS-gmake, nt-TAGS-nmake): New targets.
364
3652010-09-30 Dan Nicolaescu <dann@ics.uci.edu>
366
367 * xml.c (parse_string): Use const.
368
3692010-09-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
370
371 * eval.c (Fbacktrace): Don't overwrite print-level on exit. Also
372 only override Vprint_level if it isn't already bound, and increase
373 the level to 8 to produce more useful backtraces for bug reports.
374
3752010-09-30 Dan Nicolaescu <dann@ics.uci.edu>
376
377 * Makefile.in: ecrt0.c does not exist anymore, do not mention it.
378
3792010-09-30 Juanma Barranquero <lekktu@gmail.com>
380
381 * w32console.c (vga_stdcolor_name): Remove unused function;
382 presumed dead after 2007-11-30T13:57:21Z!jasonr@gnu.org.
383
12010-09-29 Lars Magne Ingebrigtsen <larsi@gnus.org> 3842010-09-29 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 385
3 * gnutls.c (emacs_gnutls_handshake): Made into internal function. 386 * gnutls.c (emacs_gnutls_handshake): Made into internal function.
diff --git a/src/Makefile.in b/src/Makefile.in
index 00706460d25..0d496aea73a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -46,28 +46,25 @@ version = @version@
46# LIBS = @LIBS@ 46# LIBS = @LIBS@
47LIBOBJS = @LIBOBJS@ 47LIBOBJS = @LIBOBJS@
48 48
49lispsource = ${srcdir}/../lisp/ 49lispsource = $(srcdir)/../lisp
50libsrc = ../lib-src/ 50libsrc = ../lib-src
51etc = ../etc/ 51etc = ../etc
52oldXMenudir = ../oldXMenu/ 52oldXMenudir = ../oldXMenu
53lwlibdir = ../lwlib/ 53lwlibdir = ../lwlib
54lispdir = ../lisp/ 54lispdir = ../lisp
55 55
56# Configuration files for .o files to depend on. 56# Configuration files for .o files to depend on.
57M_FILE = ${srcdir}/@machfile@ 57M_FILE = $(srcdir)/@machfile@
58S_FILE = ${srcdir}/@opsysfile@ 58S_FILE = $(srcdir)/@opsysfile@
59config_h = config.h $(M_FILE) $(S_FILE) 59config_h = config.h $(M_FILE) $(S_FILE)
60 60
61bootstrap_exe = ${abs_builddir}/bootstrap-emacs${EXEEXT} 61bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT)
62 62
63## ns-app if HAVE_NS, else empty. 63## ns-app if HAVE_NS, else empty.
64OTHER_FILES = @OTHER_FILES@ 64OTHER_FILES = @OTHER_FILES@
65 65
66CRT_DIR=@CRT_DIR@
67
68## Flags to pass for profiling builds 66## Flags to pass for profiling builds
69PROFILING_CFLAGS = @PROFILING_CFLAGS@ 67PROFILING_CFLAGS = @PROFILING_CFLAGS@
70PROFILING_LDFLAGS = @PROFILING_LDFLAGS@
71 68
72## Flags to pass to the compiler to enable build warnings 69## Flags to pass to the compiler to enable build warnings
73C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ 70C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
@@ -116,7 +113,7 @@ LD_SWITCH_SYSTEM_TEMACS=@LD_SWITCH_SYSTEM_TEMACS@
116## Flags to pass to ld only for temacs. 113## Flags to pass to ld only for temacs.
117TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS) 114TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
118 115
119## $LDFLAGS $PROFILING_LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason). 116## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason).
120TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@ 117TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
121 118
122## Some systems define this to request special libraries. 119## Some systems define this to request special libraries.
@@ -125,8 +122,10 @@ LIBS_SYSTEM=@LIBS_SYSTEM@
125## Where to find libgcc.a, if using gcc and necessary. 122## Where to find libgcc.a, if using gcc and necessary.
126LIB_GCC=@LIB_GCC@ 123LIB_GCC=@LIB_GCC@
127 124
125CRT_DIR=@CRT_DIR@
128## May use $CRT_DIR. 126## May use $CRT_DIR.
129LIB_STANDARD=@LIB_STANDARD@ 127LIB_STANDARD=@LIB_STANDARD@
128START_FILES = @START_FILES@
130 129
131## -lm, or empty. 130## -lm, or empty.
132LIB_MATH=@LIB_MATH@ 131LIB_MATH=@LIB_MATH@
@@ -177,8 +176,8 @@ LIBXT_OTHER=@LIBXT_OTHER@
177OLDXMENU_TARGET=@OLDXMENU_TARGET@ 176OLDXMENU_TARGET=@OLDXMENU_TARGET@
178 177
179## If !HAVE_X11 || USE_GTK, empty. 178## If !HAVE_X11 || USE_GTK, empty.
180## Else if USE_X_TOOLKIT, ${lwlibdir}liblw.a. 179## Else if USE_X_TOOLKIT, $(lwlibdir)/liblw.a.
181## Else ${oldXMenudir}libXMenu11.a. 180## Else $(oldxmenudir)/libXMenu11.a.
182## (Actually, rather than being empty, it is set to "nothing". 181## (Actually, rather than being empty, it is set to "nothing".
183## It is never actually used for anything in this case. 182## It is never actually used for anything in this case.
184## This is done because there is a rule with target $(OLDXMENU) below, 183## This is done because there is a rule with target $(OLDXMENU) below,
@@ -188,7 +187,7 @@ OLDXMENU_TARGET=@OLDXMENU_TARGET@
188## The alternative would be to put that rule in a makefile fragment.) 187## The alternative would be to put that rule in a makefile fragment.)
189OLDXMENU=@OLDXMENU@ 188OLDXMENU=@OLDXMENU@
190 189
191## If HAVE_X11 && !USE_GTK, ${OLDXMENU} ../src/${OLDXMENU}; else empty. 190## If HAVE_X11 && !USE_GTK, $(OLDXMENU) ../src/$(OLDXMENU); else empty.
192## We use stamp-xmenu with these two deps to both ensure that lwlib 191## We use stamp-xmenu with these two deps to both ensure that lwlib
193## gets remade based on its dependencies in its own makefile, 192## gets remade based on its dependencies in its own makefile,
194## and remake temacs if lwlib gets changed by this. 193## and remake temacs if lwlib gets changed by this.
@@ -238,9 +237,9 @@ CYGWIN_OBJ=@CYGWIN_OBJ@
238MSDOS_OBJ = 237MSDOS_OBJ =
239## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. 238## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS.
240MSDOS_X_OBJ = 239MSDOS_X_OBJ =
241MSDOS_SUPPORT_REAL = ${lispsource}ls-lisp.elc ${lispsource}disp-table.elc \ 240MSDOS_SUPPORT_REAL = $(lispsource)/ls-lisp.elc $(lispsource)/disp-table.elc \
242 ${lispsource}dos-fns.elc ${lispsource}dos-w32.elc ${lispsource}dos-vars.elc \ 241 $(lispsource)/dos-fns.elc $(lispsource)/dos-w32.elc $(lispsource)/dos-vars.elc \
243 ${lispsource}term/internal.elc ${lispsource}term/pc-win.elc 242 $(lispsource)/term/internal.elc $(lispsource)/term/pc-win.elc
244## $MSDOS_SUPPORT_REAL if MSDOS. 243## $MSDOS_SUPPORT_REAL if MSDOS.
245MSDOS_SUPPORT = 244MSDOS_SUPPORT =
246 245
@@ -259,23 +258,23 @@ GNU_OBJC_CFLAGS=@GNU_OBJC_CFLAGS@
259FONT_OBJ=@FONT_OBJ@ 258FONT_OBJ=@FONT_OBJ@
260 259
261## Used if HAVE_MOUSE. 260## Used if HAVE_MOUSE.
262REAL_MOUSE_SUPPORT=${lispsource}mouse.elc ${lispsource}select.elc \ 261REAL_MOUSE_SUPPORT=$(lispsource)/mouse.elc $(lispsource)/select.elc \
263 ${lispsource}scroll-bar.elc 262 $(lispsource)/scroll-bar.elc
264## Used if HAVE_GPM && !HAVE_MOUSE 263## Used if HAVE_GPM && !HAVE_MOUSE
265GPM_MOUSE_SUPPORT=${lispsource}mouse.elc 264GPM_MOUSE_SUPPORT=$(lispsource)/mouse.elc
266LIBGPM = @LIBGPM@ 265LIBGPM = @LIBGPM@
267## Either of the two preceding options, or empty. 266## Either of the two preceding options, or empty.
268MOUSE_SUPPORT=@MOUSE_SUPPORT@ 267MOUSE_SUPPORT=@MOUSE_SUPPORT@
269 268
270## ${lispsource}tooltip.elc if HAVE_WINDOW_SYSTEM, else empty. 269## $(lispsource)/tooltip.elc if HAVE_WINDOW_SYSTEM, else empty.
271TOOLTIP_SUPPORT=@TOOLTIP_SUPPORT@ 270TOOLTIP_SUPPORT=@TOOLTIP_SUPPORT@
272 271
273BASE_WINDOW_SUPPORT=${lispsource}fringe.elc ${lispsource}image.elc \ 272BASE_WINDOW_SUPPORT=$(lispsource)/fringe.elc $(lispsource)/image.elc \
274 ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ 273 $(lispsource)/international/fontset.elc $(lispsource)/dnd.elc \
275 ${lispsource}tool-bar.elc ${lispsource}mwheel.elc 274 $(lispsource)/tool-bar.elc $(lispsource)/mwheel.elc
276 275
277X_WINDOW_SUPPORT=${lispsource}x-dnd.elc ${lispsource}term/common-win.elc \ 276X_WINDOW_SUPPORT=$(lispsource)/x-dnd.elc $(lispsource)/term/common-win.elc \
278 ${lispsource}term/x-win.elc ${lispsource}dynamic-setting.elc 277 $(lispsource)/term/x-win.elc $(lispsource)/dynamic-setting.elc
279 278
280## If HAVE_X_WINDOWS, both the above 279## If HAVE_X_WINDOWS, both the above
281## else if HAVE_WINDOW_SYSTEM (ie, HAVE_NS) just the former; else empty. 280## else if HAVE_WINDOW_SYSTEM (ie, HAVE_NS) just the former; else empty.
@@ -295,16 +294,14 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
295 294
296RUN_TEMACS = `/bin/pwd`/temacs 295RUN_TEMACS = `/bin/pwd`/temacs
297 296
298START_FILES = @START_FILES@
299
300UNEXEC_OBJ = @UNEXEC_OBJ@ 297UNEXEC_OBJ = @UNEXEC_OBJ@
301 298
302CANNOT_DUMP=@CANNOT_DUMP@ 299CANNOT_DUMP=@CANNOT_DUMP@
303 300
304DEPDIR=deps 301DEPDIR=deps
305## -MMD -MF ${DEPDIR}/$*.d if AUTO_DEPEND; else empty. 302## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty.
306DEPFLAGS=@DEPFLAGS@ 303DEPFLAGS=@DEPFLAGS@
307## test -d ${DEPDIR} || mkdir ${DEPDIR} (if AUTO_DEPEND); else ':'. 304## test -d $(DEPDIR) || mkdir $(DEPDIR) (if AUTO_DEPEND); else ':'.
308MKDEPDIR=@MKDEPDIR@ 305MKDEPDIR=@MKDEPDIR@
309 306
310## DO NOT use -R. There is a special hack described in lastfile.c 307## DO NOT use -R. There is a special hack described in lastfile.c
@@ -322,14 +319,14 @@ MKDEPDIR=@MKDEPDIR@
322## since it may have -I options that should override those. 319## since it may have -I options that should override those.
323## 320##
324## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. 321## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
325ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ 322ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \
326 ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ 323 $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
327 ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} \ 324 $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
328 ${LIBXML2_CFLAGS} ${DBUS_CFLAGS} \ 325 $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
329 ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ 326 $(GCONF_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
330 ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ 327 $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \
331 $(LIBGNUTLS_CFLAGS) \ 328 $(LIBGNUTLS_CFLAGS) \
332 ${C_WARNINGS_SWITCH} ${CFLAGS} 329 $(C_WARNINGS_SWITCH) $(CFLAGS)
333ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) 330ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
334 331
335.SUFFIXES: .m 332.SUFFIXES: .m
@@ -400,93 +397,93 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
400## Place loaddefs.el first, so it gets generated first, since it is on 397## Place loaddefs.el first, so it gets generated first, since it is on
401## the critical path (relevant in parallel compilations). 398## the critical path (relevant in parallel compilations).
402lisp= \ 399lisp= \
403 ${lispsource}loaddefs.el \ 400 $(lispsource)/loaddefs.el \
404 ${lispsource}abbrev.elc \ 401 $(lispsource)/abbrev.elc \
405 ${lispsource}buff-menu.elc \ 402 $(lispsource)/buff-menu.elc \
406 ${lispsource}button.elc \ 403 $(lispsource)/button.elc \
407 ${lispsource}emacs-lisp/byte-run.elc \ 404 $(lispsource)/emacs-lisp/byte-run.elc \
408 ${lispsource}composite.elc \ 405 $(lispsource)/composite.elc \
409 ${lispsource}cus-face.elc \ 406 $(lispsource)/cus-face.elc \
410 ${lispsource}cus-start.elc \ 407 $(lispsource)/cus-start.elc \
411 ${lispsource}custom.elc \ 408 $(lispsource)/custom.elc \
412 ${lispsource}emacs-lisp/backquote.elc \ 409 $(lispsource)/emacs-lisp/backquote.elc \
413 ${lispsource}emacs-lisp/lisp-mode.elc \ 410 $(lispsource)/emacs-lisp/lisp-mode.elc \
414 ${lispsource}emacs-lisp/lisp.elc \ 411 $(lispsource)/emacs-lisp/lisp.elc \
415 ${lispsource}env.elc \ 412 $(lispsource)/env.elc \
416 ${lispsource}faces.elc \ 413 $(lispsource)/faces.elc \
417 ${lispsource}files.elc \ 414 $(lispsource)/files.elc \
418 ${lispsource}format.elc \ 415 $(lispsource)/format.elc \
419 ${lispsource}facemenu.elc \ 416 $(lispsource)/facemenu.elc \
420 ${MOUSE_SUPPORT} \ 417 $(MOUSE_SUPPORT) \
421 ${lispsource}emacs-lisp/float-sup.elc \ 418 $(lispsource)/emacs-lisp/float-sup.elc \
422 ${lispsource}frame.elc \ 419 $(lispsource)/frame.elc \
423 ${lispsource}help.elc \ 420 $(lispsource)/help.elc \
424 ${lispsource}indent.elc \ 421 $(lispsource)/indent.elc \
425 ${lispsource}isearch.elc \ 422 $(lispsource)/isearch.elc \
426 ${lispsource}rfn-eshadow.elc \ 423 $(lispsource)/rfn-eshadow.elc \
427 ${lispsource}loadup.el \ 424 $(lispsource)/loadup.el \
428 ${lispsource}bindings.elc \ 425 $(lispsource)/bindings.elc \
429 ${lispsource}emacs-lisp/map-ynp.elc \ 426 $(lispsource)/emacs-lisp/map-ynp.elc \
430 ${lispsource}menu-bar.elc \ 427 $(lispsource)/menu-bar.elc \
431 ${lispsource}international/mule.elc \ 428 $(lispsource)/international/mule.elc \
432 ${lispsource}international/mule-conf.elc \ 429 $(lispsource)/international/mule-conf.elc \
433 ${lispsource}international/mule-cmds.elc \ 430 $(lispsource)/international/mule-cmds.elc \
434 ${lispsource}international/characters.elc \ 431 $(lispsource)/international/characters.elc \
435 ${lispsource}international/charprop.el \ 432 $(lispsource)/international/charprop.el \
436 ${lispsource}case-table.elc \ 433 $(lispsource)/case-table.elc \
437 ${lispsource}language/chinese.elc \ 434 $(lispsource)/language/chinese.elc \
438 ${lispsource}language/cyrillic.elc \ 435 $(lispsource)/language/cyrillic.elc \
439 ${lispsource}language/indian.elc \ 436 $(lispsource)/language/indian.elc \
440 ${lispsource}language/sinhala.el \ 437 $(lispsource)/language/sinhala.el \
441 ${lispsource}language/english.el \ 438 $(lispsource)/language/english.el \
442 ${lispsource}language/ethiopic.elc \ 439 $(lispsource)/language/ethiopic.elc \
443 ${lispsource}language/european.elc \ 440 $(lispsource)/language/european.elc \
444 ${lispsource}language/czech.el \ 441 $(lispsource)/language/czech.el \
445 ${lispsource}language/slovak.el \ 442 $(lispsource)/language/slovak.el \
446 ${lispsource}language/romanian.el \ 443 $(lispsource)/language/romanian.el \
447 ${lispsource}language/greek.el \ 444 $(lispsource)/language/greek.el \
448 ${lispsource}language/hebrew.elc \ 445 $(lispsource)/language/hebrew.elc \
449 ${lispsource}language/japanese.el \ 446 $(lispsource)/language/japanese.el \
450 ${lispsource}language/korean.el \ 447 $(lispsource)/language/korean.el \
451 ${lispsource}language/lao.el \ 448 $(lispsource)/language/lao.el \
452 ${lispsource}language/cham.el \ 449 $(lispsource)/language/cham.el \
453 ${lispsource}language/tai-viet.el \ 450 $(lispsource)/language/tai-viet.el \
454 ${lispsource}language/thai.el \ 451 $(lispsource)/language/thai.el \
455 ${lispsource}language/tibetan.elc \ 452 $(lispsource)/language/tibetan.elc \
456 ${lispsource}language/vietnamese.elc \ 453 $(lispsource)/language/vietnamese.elc \
457 ${lispsource}language/misc-lang.el \ 454 $(lispsource)/language/misc-lang.el \
458 ${lispsource}language/utf-8-lang.el \ 455 $(lispsource)/language/utf-8-lang.el \
459 ${lispsource}language/georgian.el \ 456 $(lispsource)/language/georgian.el \
460 ${lispsource}language/khmer.el \ 457 $(lispsource)/language/khmer.el \
461 ${lispsource}language/burmese.el \ 458 $(lispsource)/language/burmese.el \
462 ${lispsource}paths.el \ 459 $(lispsource)/paths.el \
463 ${lispsource}register.elc \ 460 $(lispsource)/register.elc \
464 ${lispsource}replace.elc \ 461 $(lispsource)/replace.elc \
465 ${lispsource}simple.elc \ 462 $(lispsource)/simple.elc \
466 ${lispsource}minibuffer.elc \ 463 $(lispsource)/minibuffer.elc \
467 ${lispsource}startup.elc \ 464 $(lispsource)/startup.elc \
468 ${lispsource}subr.elc \ 465 $(lispsource)/subr.elc \
469 ${lispsource}term/tty-colors.elc \ 466 $(lispsource)/term/tty-colors.elc \
470 ${lispsource}font-core.elc \ 467 $(lispsource)/font-core.elc \
471 ${lispsource}emacs-lisp/syntax.elc \ 468 $(lispsource)/emacs-lisp/syntax.elc \
472 ${lispsource}font-lock.elc \ 469 $(lispsource)/font-lock.elc \
473 ${lispsource}jit-lock.elc \ 470 $(lispsource)/jit-lock.elc \
474 ${lispsource}textmodes/fill.elc \ 471 $(lispsource)/textmodes/fill.elc \
475 ${lispsource}textmodes/page.elc \ 472 $(lispsource)/textmodes/page.elc \
476 ${lispsource}textmodes/paragraphs.elc \ 473 $(lispsource)/textmodes/paragraphs.elc \
477 ${lispsource}textmodes/text-mode.elc \ 474 $(lispsource)/textmodes/text-mode.elc \
478 ${lispsource}emacs-lisp/timer.elc \ 475 $(lispsource)/emacs-lisp/timer.elc \
479 ${lispsource}jka-cmpr-hook.elc \ 476 $(lispsource)/jka-cmpr-hook.elc \
480 ${lispsource}vc/vc-hooks.elc \ 477 $(lispsource)/vc/vc-hooks.elc \
481 ${lispsource}vc/ediff-hook.elc \ 478 $(lispsource)/vc/ediff-hook.elc \
482 ${lispsource}epa-hook.elc \ 479 $(lispsource)/epa-hook.elc \
483 ${TOOLTIP_SUPPORT} \ 480 $(TOOLTIP_SUPPORT) \
484 ${MSDOS_SUPPORT} \ 481 $(MSDOS_SUPPORT) \
485 ${WINDOW_SUPPORT} \ 482 $(WINDOW_SUPPORT) \
486 ${NS_SUPPORT} \ 483 $(NS_SUPPORT) \
487 ${lispsource}widget.elc \ 484 $(lispsource)/widget.elc \
488 ${lispsource}window.elc \ 485 $(lispsource)/window.elc \
489 ${lispsource}version.el 486 $(lispsource)/version.el
490 487
491## List of relative names for those files from $lisp that are loaded 488## List of relative names for those files from $lisp that are loaded
492## unconditionally (i.e. on all platforms). Files from $lisp that 489## unconditionally (i.e. on all platforms). Files from $lisp that
@@ -601,80 +598,80 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
601## duplicated symbols. If the standard libraries were compiled 598## duplicated symbols. If the standard libraries were compiled
602## with GCC, we might need LIB_GCC again after them. 599## with GCC, we might need LIB_GCC again after them.
603LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ 600LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
604 $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) \ 601 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \
605 ${LIBXML2_LIBS} $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 602 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
606 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ 603 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(GCONF_LIBS) $(LIBSELINUX_LIBS) \
607 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 604 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
608 $(LIBGNUTLS_LIBS) \ 605 $(LIBGNUTLS_LIBS) \
609 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 606 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
610 607
611all: emacs${EXEEXT} $(OTHER_FILES) 608all: emacs$(EXEEXT) $(OTHER_FILES)
612 609
613## Does anyone ever pay attention to the load-path-shadows output here? 610## Does anyone ever pay attention to the load-path-shadows output here?
614## The dumped Emacs is as functional and more efficient than 611## The dumped Emacs is as functional and more efficient than
615## bootstrap-emacs, so we replace the latter with the former. 612## bootstrap-emacs, so we replace the latter with the former.
616emacs${EXEEXT}: temacs${EXEEXT} ${etc}DOC ${lisp} 613emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp)
617 if test "${CANNOT_DUMP}" = "yes"; then \ 614 if test "$(CANNOT_DUMP)" = "yes"; then \
618 ln -f temacs${EXEEXT} emacs${EXEEXT}; \ 615 ln -f temacs$(EXEEXT) emacs$(EXEEXT); \
619 EMACSLOADPATH=${lispsource} ./emacs -q -batch \ 616 EMACSLOADPATH=$(lispsource) ./emacs -q -batch \
620 -f list-load-path-shadows || true; \ 617 -f list-load-path-shadows || true; \
621 else \ 618 else \
622 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ 619 LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
623 ln -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ 620 ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
624 ./emacs -q -batch -f list-load-path-shadows || true; \ 621 ./emacs -q -batch -f list-load-path-shadows || true; \
625 fi 622 fi
626 623
627## We run make-docfile twice because the command line may get too long 624## We run make-docfile twice because the command line may get too long
628## on some systems. 625## on some systems.
629## ${SOME_MACHINE_OBJECTS} comes before ${obj} because some files may 626## $(SOME_MACHINE_OBJECTS) comes before $(obj) because some files may
630## or may not be included in ${obj}, but they are always included in 627## or may not be included in $(obj), but they are always included in
631## ${SOME_MACHINE_OBJECTS}. Since a file is processed when it is mentioned 628## $(SOME_MACHINE_OBJECTS). Since a file is processed when it is mentioned
632## for the first time, this prevents any variation between configurations 629## for the first time, this prevents any variation between configurations
633## in the contents of the DOC file. 630## in the contents of the DOC file.
634## Likewise for ${SOME_MACHINE_LISP}. 631## Likewise for $(SOME_MACHINE_LISP).
635## Most of this Makefile refers to Lisp files via ${lispsource}, so 632## Most of this Makefile refers to Lisp files via $(lispsource), so
636## we also use ${lisp} rather than ${shortlisp} for the dependency since 633## we also use $(lisp) rather than $(shortlisp) for the dependency since
637## the Makefile uses string equality to decide when we talk about identical 634## the Makefile uses string equality to decide when we talk about identical
638## files. Apparently we pass ${shortlisp} rather than ${lisp} to make-docfile 635## files. Apparently we pass $(shortlisp) rather than $(lisp) to make-docfile
639## only in order to reduce the command line length. --Stef 636## only in order to reduce the command line length. --Stef
640${etc}DOC: ${libsrc}make-docfile${EXEEXT} ${obj} ${lisp} ${SOME_MACHINE_LISP} 637$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(obj) $(lisp) $(SOME_MACHINE_LISP)
641 -rm -f ${etc}DOC 638 -rm -f $(etc)/DOC
642 ${libsrc}make-docfile -d ${srcdir} ${SOME_MACHINE_OBJECTS} ${obj} > ${etc}DOC 639 $(libsrc)/make-docfile -d $(srcdir) $(SOME_MACHINE_OBJECTS) $(obj) > $(etc)/DOC
643 ${libsrc}make-docfile -a ${etc}DOC -d ${srcdir} ${SOME_MACHINE_LISP} ${shortlisp} 640 $(libsrc)/make-docfile -a $(etc)/DOC -d $(srcdir) $(SOME_MACHINE_LISP) $(shortlisp)
644 641
645${libsrc}make-docfile${EXEEXT}: 642$(libsrc)/make-docfile$(EXEEXT):
646 cd ${libsrc}; ${MAKE} ${MFLAGS} make-docfile${EXEEXT} 643 cd $(libsrc); $(MAKE) $(MFLAGS) make-docfile$(EXEEXT)
647 644
648buildobj.h: Makefile 645buildobj.h: Makefile
649 echo "#define BUILDOBJ \"${obj} ${otherobj} " "\"" > buildobj.h 646 echo "#define BUILDOBJ \"$(obj) $(otherobj) " "\"" > buildobj.h
650 647
651 648
652temacs${EXEEXT}: $(START_FILES) stamp-oldxmenu ${obj} ${otherobj} 649temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj)
653 $(CC) $(LD_FIRSTFLAG) ${TEMACS_LDFLAGS} ${TEMACS_LDFLAGS2} \ 650 $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \
654 -o temacs ${START_FILES} ${obj} ${otherobj} ${LIBES} 651 -o temacs $(START_FILES) $(obj) $(otherobj) $(LIBES)
655 652
656## The following oldxmenu-related rules are only (possibly) used if 653## The following oldxmenu-related rules are only (possibly) used if
657## HAVE_X11 && !USE_GTK, but there is no harm in always defining them 654## HAVE_X11 && !USE_GTK, but there is no harm in always defining them
658## (provided we take a little care that OLDXMENU is never empty). 655## (provided we take a little care that OLDXMENU is never empty).
659really-lwlib: 656really-lwlib:
660 cd ${lwlibdir}; ${MAKE} ${MFLAGS} \ 657 cd $(lwlibdir); $(MAKE) $(MFLAGS) \
661 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' 658 CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)'
662 @true # make -t should not create really-lwlib. 659 @true # make -t should not create really-lwlib.
663.PHONY: really-lwlib 660.PHONY: really-lwlib
664 661
665really-oldXMenu: 662really-oldXMenu:
666 cd ${oldXMenudir}; ${MAKE} ${MFLAGS} \ 663 cd $(oldXMenudir); $(MAKE) $(MFLAGS) \
667 CC='${CC}' CFLAGS='${CFLAGS}' MAKE='${MAKE}' 664 CC='$(CC)' CFLAGS='$(CFLAGS)' MAKE='$(MAKE)'
668 @true # make -t should not create really-oldXMenu. 665 @true # make -t should not create really-oldXMenu.
669.PHONY: really-oldXMenu 666.PHONY: really-oldXMenu
670 667
671## We do not really need this when OLDXMENU_DEPS is empty, but as 668## We do not really need this when OLDXMENU_DEPS is empty, but as
672## things stand we need something to satisfy the temacs dependency. 669## things stand we need something to satisfy the temacs dependency.
673stamp-oldxmenu: ${OLDXMENU_DEPS} 670stamp-oldxmenu: $(OLDXMENU_DEPS)
674 touch stamp-oldxmenu 671 touch stamp-oldxmenu
675 672
676## Supply an ordering for parallel make. 673## Supply an ordering for parallel make.
677../src/$(OLDXMENU): ${OLDXMENU} 674../src/$(OLDXMENU): $(OLDXMENU)
678 675
679$(OLDXMENU): $(OLDXMENU_TARGET) 676$(OLDXMENU): $(OLDXMENU_TARGET)
680 677
@@ -688,9 +685,6 @@ $(OLDXMENU): $(OLDXMENU_TARGET)
688 @echo "Please run the `configure' script again." 685 @echo "Please run the `configure' script again."
689 exit 1 686 exit 1
690 687
691ecrt0.o: ecrt0.c $(config_h)
692 @$(MKDEPDIR)
693 $(CC) -c $(ALL_CFLAGS) ${srcdir}/ecrt0.c
694doc.o: buildobj.h 688doc.o: buildobj.h
695 689
696 690
@@ -699,14 +693,14 @@ doc.o: buildobj.h
699 693
700 694
701mostlyclean: 695mostlyclean:
702 rm -f temacs${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a 696 rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a
703 rm -f ../etc/DOC 697 rm -f ../etc/DOC
704 rm -f bootstrap-emacs${EXEEXT} emacs-${version}${EXEEXT} 698 rm -f bootstrap-emacs$(EXEEXT) emacs-$(version)$(EXEEXT)
705 rm -f buildobj.h 699 rm -f buildobj.h
706clean: mostlyclean 700clean: mostlyclean
707 rm -f emacs-*.*.*${EXEEXT} emacs${EXEEXT} 701 rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT)
708 -rm -rf ${DEPDIR} 702 -rm -rf $(DEPDIR)
709 test "X${ns_appdir}" = "X" || rm -rf ${ns_appdir} 703 test "X$(ns_appdir)" = "X" || rm -rf $(ns_appdir)
710 704
711## bootstrap-clean is used to clean up just before a bootstrap. 705## bootstrap-clean is used to clean up just before a bootstrap.
712## It should remove all files generated during a compilation/bootstrap, 706## It should remove all files generated during a compilation/bootstrap,
@@ -715,7 +709,7 @@ bootstrap-clean: clean
715 rm -f epaths.h config.h config.stamp stamp-oldxmenu ../etc/DOC-* 709 rm -f epaths.h config.h config.stamp stamp-oldxmenu ../etc/DOC-*
716 if test -f ./.gdbinit; then \ 710 if test -f ./.gdbinit; then \
717 mv ./.gdbinit ./.gdbinit.save; \ 711 mv ./.gdbinit ./.gdbinit.save; \
718 if test -f "${srcdir}/.gdbinit"; then rm -f ./.gdbinit.save; \ 712 if test -f "$(srcdir)/.gdbinit"; then rm -f ./.gdbinit.save; \
719 else mv ./.gdbinit.save ./.gdbinit; fi; \ 713 else mv ./.gdbinit.save ./.gdbinit; fi; \
720 fi 714 fi
721## This is used in making a distribution. 715## This is used in making a distribution.
@@ -727,7 +721,7 @@ maintainer-clean: distclean
727 @echo "it deletes files that may require special tools to rebuild." 721 @echo "it deletes files that may require special tools to rebuild."
728 rm -f TAGS 722 rm -f TAGS
729versionclean: 723versionclean:
730 -rm -f emacs${EXEEXT} emacs-*.*.*${EXEEXT} ../etc/DOC* 724 -rm -f emacs$(EXEEXT) emacs-*.*.*$(EXEEXT) ../etc/DOC*
731extraclean: distclean 725extraclean: distclean
732 -rm -f *~ \#* m/?*~ s/?*~ 726 -rm -f *~ \#* m/?*~ s/?*~
733 727
@@ -738,17 +732,17 @@ ctagsfiles1 = [xyzXYZ]*.[hcm]
738ctagsfiles2 = [a-wA-W]*.[hcm] 732ctagsfiles2 = [a-wA-W]*.[hcm]
739 733
740TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) 734TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2)
741 ../lib-src/etags --include=TAGS-LISP --include=${lwlibdir}/TAGS \ 735 ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \
742 --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \ 736 --regex='/[ ]*DEFVAR_[A-Z_ (]+"\([^"]+\)"/' \
743 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) 737 $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2)
744frc: 738frc:
745TAGS-LISP: frc 739TAGS-LISP: frc
746 $(MAKE) -f ${lispdir}Makefile TAGS-LISP ETAGS=../lib-src/etags 740 $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags
747 741
748$(lwlibdir)TAGS: 742$(lwlibdir)/TAGS:
749 (cd $(lwlibdir); $(MAKE) -f $(lwlibdir)Makefile tags ETAGS=../lib-src/etags) 743 (cd $(lwlibdir); $(MAKE) -f $(lwlibdir)/Makefile tags ETAGS=../lib-src/etags)
750 744
751tags: TAGS TAGS-LISP $(lwlibdir)TAGS 745tags: TAGS TAGS-LISP $(lwlibdir)/TAGS
752.PHONY: tags 746.PHONY: tags
753 747
754 748
@@ -770,10 +764,10 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
770## it), so it was compiled in parallel, leading typically to having 2 764## it), so it was compiled in parallel, leading typically to having 2
771## processes dumping bootstrap-emacs at the same time). 765## processes dumping bootstrap-emacs at the same time).
772## So instead, we replace the witness-emacs dependencies by conditional 766## So instead, we replace the witness-emacs dependencies by conditional
773## bootstrap-dependencies (via ${BOOTSTRAPEMACS}). Of course, since we do 767## bootstrap-dependencies (via $(BOOTSTRAPEMACS)). Of course, since we do
774## not want to rely on GNU Make features, we have to rely on an external 768## not want to rely on GNU Make features, we have to rely on an external
775## script to do the conditional part of the dependency 769## script to do the conditional part of the dependency
776## (i.e. see the ${SUBDIR} rule ../Makefile.in). 770## (i.e. see the $(SUBDIR) rule ../Makefile.in).
777 771
778.SUFFIXES: .elc .el 772.SUFFIXES: .elc .el
779 773
@@ -783,28 +777,28 @@ tags: TAGS TAGS-LISP $(lwlibdir)TAGS
783## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" 777## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"
784.el.elc: 778.el.elc:
785 @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \ 779 @cd ../lisp; $(MAKE) $(MFLAGS) compile-onefile \
786 THEFILE=$< EMACS=${bootstrap_exe} 780 THEFILE=$< EMACS=$(bootstrap_exe)
787 781
788## Since the .el.elc rule cannot specify an extra dependency, we do it here. 782## Since the .el.elc rule cannot specify an extra dependency, we do it here.
789${lisp} ${SOME_MACHINE_LISP}: $(BOOTSTRAPEMACS) 783$(lisp) $(SOME_MACHINE_LISP): $(BOOTSTRAPEMACS)
790 784
791## VCSWITNESS points to the file that holds info about the current checkout. 785## VCSWITNESS points to the file that holds info about the current checkout.
792## We use it as a heuristic to decide when to rebuild loaddefs.el. 786## We use it as a heuristic to decide when to rebuild loaddefs.el.
793${lispsource}loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) 787$(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
794 cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=${bootstrap_exe} 788 cd ../lisp; $(MAKE) $(MFLAGS) autoloads EMACS=$(bootstrap_exe)
795 789
796## Dump an Emacs executable named bootstrap-emacs containing the 790## Dump an Emacs executable named bootstrap-emacs containing the
797## files from loadup.el in source form. 791## files from loadup.el in source form.
798bootstrap-emacs${EXEEXT}: temacs${EXEEXT} 792bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
799 cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs 793 cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs
800 if test "${CANNOT_DUMP}" = "yes"; then \ 794 if test "$(CANNOT_DUMP)" = "yes"; then \
801 ln -f temacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ 795 ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
802 else \ 796 else \
803 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ 797 $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
804 mv -f emacs${EXEEXT} bootstrap-emacs${EXEEXT}; \ 798 mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
805 fi 799 fi
806 @: Compile some files earlier to speed up further compilation. 800 @: Compile some files earlier to speed up further compilation.
807 cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=${bootstrap_exe} 801 cd ../lisp; $(MAKE) $(MFLAGS) compile-first EMACS=$(bootstrap_exe)
808 802
809## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk. 803## Insert either autodeps.mk (if AUTO_DEPEND), else deps.mk.
810@deps_frag@ 804@deps_frag@
diff --git a/src/alloc.c b/src/alloc.c
index f2bb28e2d96..0f83f375d40 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -65,15 +65,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65extern POINTER_TYPE *sbrk (); 65extern POINTER_TYPE *sbrk ();
66#endif 66#endif
67 67
68#ifdef HAVE_FCNTL_H
69#include <fcntl.h> 68#include <fcntl.h>
70#endif
71#ifndef O_WRONLY
72#define O_WRONLY 1
73#endif
74 69
75#ifdef WINDOWSNT 70#ifdef WINDOWSNT
76#include <fcntl.h>
77#include "w32.h" 71#include "w32.h"
78#endif 72#endif
79 73
diff --git a/src/bidi.c b/src/bidi.c
index b7c6fdc2ddd..1f14f6ab840 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -51,7 +51,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51 51
52#include <config.h> 52#include <config.h>
53#include <stdio.h> 53#include <stdio.h>
54#include <string.h>
55#include <setjmp.h> 54#include <setjmp.h>
56 55
57#include "lisp.h" 56#include "lisp.h"
diff --git a/src/buffer.c b/src/buffer.c
index 6b6b6efc633..3eb96beeb0f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5958,10 +5958,7 @@ No information is given about the length of the text after the change.
5958 5958
5959Buffer changes made while executing the `before-change-functions' 5959Buffer changes made while executing the `before-change-functions'
5960don't call any before-change or after-change functions. 5960don't call any before-change or after-change functions.
5961That's because these variables are temporarily set to nil. 5961That's because `inhibit-modification-hooks' is temporarily set non-nil.
5962As a result, a hook function cannot straightforwardly alter the
5963value of these variables. See the Emacs Lisp manual for a way of
5964accomplishing an equivalent result by using other variables.
5965 5962
5966If an unhandled error happens in running these functions, 5963If an unhandled error happens in running these functions,
5967the variable's value remains nil. That prevents the error 5964the variable's value remains nil. That prevents the error
@@ -5979,10 +5976,7 @@ and the post-change beginning and end are at the same place.)
5979 5976
5980Buffer changes made while executing the `after-change-functions' 5977Buffer changes made while executing the `after-change-functions'
5981don't call any before-change or after-change functions. 5978don't call any before-change or after-change functions.
5982That's because these variables are temporarily set to nil. 5979That's because `inhibit-modification-hooks' is temporarily set non-nil.
5983As a result, a hook function cannot straightforwardly alter the
5984value of these variables. See the Emacs Lisp manual for a way of
5985accomplishing an equivalent result by using other variables.
5986 5980
5987If an unhandled error happens in running these functions, 5981If an unhandled error happens in running these functions,
5988the variable's value remains nil. That prevents the error 5982the variable's value remains nil. That prevents the error
diff --git a/src/callproc.c b/src/callproc.c
index 6f70631a484..ee0872b5562 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -24,13 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#include <errno.h> 24#include <errno.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <setjmp.h> 26#include <setjmp.h>
27
28/* Define SIGCHLD as an alias for SIGCLD. */
29
30#if !defined (SIGCHLD) && defined (SIGCLD)
31#define SIGCHLD SIGCLD
32#endif /* SIGCLD */
33
34#include <sys/types.h> 27#include <sys/types.h>
35 28
36#ifdef HAVE_UNISTD_H 29#ifdef HAVE_UNISTD_H
@@ -38,33 +31,20 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#endif 31#endif
39 32
40#include <sys/file.h> 33#include <sys/file.h>
41#ifdef HAVE_FCNTL_H
42#include <fcntl.h> 34#include <fcntl.h>
43#endif
44 35
45#ifdef WINDOWSNT 36#ifdef WINDOWSNT
46#define NOMINMAX 37#define NOMINMAX
47#include <windows.h> 38#include <windows.h>
48#include <stdlib.h> /* for proper declaration of environ */
49#include <fcntl.h>
50#include "w32.h" 39#include "w32.h"
51#define _P_NOWAIT 1 /* from process.h */ 40#define _P_NOWAIT 1 /* from process.h */
52#endif 41#endif
53 42
54#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ 43#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
55#include <fcntl.h>
56#include <sys/stat.h> 44#include <sys/stat.h>
57#include <sys/param.h> 45#include <sys/param.h>
58#endif /* MSDOS */ 46#endif /* MSDOS */
59 47
60#ifndef O_RDONLY
61#define O_RDONLY 0
62#endif
63
64#ifndef O_WRONLY
65#define O_WRONLY 1
66#endif
67
68#include "lisp.h" 48#include "lisp.h"
69#include "commands.h" 49#include "commands.h"
70#include "buffer.h" 50#include "buffer.h"
@@ -274,21 +254,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
274 if (!NILP (Vcoding_system_for_write)) 254 if (!NILP (Vcoding_system_for_write))
275 val = Vcoding_system_for_write; 255 val = Vcoding_system_for_write;
276 else if (! must_encode) 256 else if (! must_encode)
277 val = Qnil; 257 val = Qraw_text;
278 else 258 else
279 { 259 {
280 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 260 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
281 args2[0] = Qcall_process; 261 args2[0] = Qcall_process;
282 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 262 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
283 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 263 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
284 if (CONSP (coding_systems)) 264 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
285 val = XCDR (coding_systems);
286 else if (CONSP (Vdefault_process_coding_system))
287 val = XCDR (Vdefault_process_coding_system);
288 else
289 val = Qnil;
290 } 265 }
291 val = coding_inherit_eol_type (val, Qnil); 266 val = complement_process_encoding_system (val);
292 setup_coding_system (Fcheck_coding_system (val), &argument_coding); 267 setup_coding_system (Fcheck_coding_system (val), &argument_coding);
293 coding_attrs = CODING_ID_ATTRS (argument_coding.id); 268 coding_attrs = CODING_ID_ATTRS (argument_coding.id);
294 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs))) 269 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs)))
@@ -932,20 +907,16 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
932 if (!NILP (Vcoding_system_for_write)) 907 if (!NILP (Vcoding_system_for_write))
933 val = Vcoding_system_for_write; 908 val = Vcoding_system_for_write;
934 else if (NILP (current_buffer->enable_multibyte_characters)) 909 else if (NILP (current_buffer->enable_multibyte_characters))
935 val = Qnil; 910 val = Qraw_text;
936 else 911 else
937 { 912 {
938 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 913 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
939 args2[0] = Qcall_process_region; 914 args2[0] = Qcall_process_region;
940 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 915 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
941 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 916 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
942 if (CONSP (coding_systems)) 917 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
943 val = XCDR (coding_systems);
944 else if (CONSP (Vdefault_process_coding_system))
945 val = XCDR (Vdefault_process_coding_system);
946 else
947 val = Qnil;
948 } 918 }
919 val = complement_process_encoding_system (val);
949 920
950 { 921 {
951 int count1 = SPECPDL_INDEX (); 922 int count1 = SPECPDL_INDEX ();
diff --git a/src/ccl.c b/src/ccl.c
index f98897b51fa..ca4a1479091 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -448,7 +448,7 @@ Lisp_Object Vtranslation_hash_table_vector;
448 Therefore, the instruction code range is 0..16384(0x3fff). 448 Therefore, the instruction code range is 0..16384(0x3fff).
449 */ 449 */
450 450
451/* Read a multibyte characeter. 451/* Read a multibyte character.
452 A code point is stored into reg[rrr]. A charset ID is stored into 452 A code point is stored into reg[rrr]. A charset ID is stored into
453 reg[RRR]. */ 453 reg[RRR]. */
454 454
@@ -2044,7 +2044,7 @@ If R0..R7 are nil, they are initialized to 0.
2044If IC is nil, it is initialized to head of the CCL program. 2044If IC is nil, it is initialized to head of the CCL program.
2045 2045
2046If optional 4th arg CONTINUE is non-nil, keep IC on read operation 2046If optional 4th arg CONTINUE is non-nil, keep IC on read operation
2047when read buffer is exausted, else, IC is always set to the end of 2047when read buffer is exhausted, else, IC is always set to the end of
2048CCL-PROGRAM on exit. 2048CCL-PROGRAM on exit.
2049 2049
2050It returns the contents of write buffer as a string, 2050It returns the contents of write buffer as a string,
diff --git a/src/character.c b/src/character.c
index d80f8139486..1c8fae88176 100644
--- a/src/character.c
+++ b/src/character.c
@@ -336,16 +336,6 @@ If the multibyte character does not represent a byte, return -1. */)
336 } 336 }
337} 337}
338 338
339DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
340 doc: /* Return 1 regardless of the argument CHAR.
341This is now an obsolete function. We keep it just for backward compatibility.
342usage: (char-bytes CHAR) */)
343 (Lisp_Object ch)
344{
345 CHECK_CHARACTER (ch);
346 return make_number (1);
347}
348
349DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, 339DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0,
350 doc: /* Return width of CHAR when displayed in the current buffer. 340 doc: /* Return width of CHAR when displayed in the current buffer.
351The width is measured by how many columns it occupies on the screen. 341The width is measured by how many columns it occupies on the screen.
@@ -1073,7 +1063,6 @@ syms_of_character (void)
1073 defsubr (&Scharacterp); 1063 defsubr (&Scharacterp);
1074 defsubr (&Sunibyte_char_to_multibyte); 1064 defsubr (&Sunibyte_char_to_multibyte);
1075 defsubr (&Smultibyte_char_to_unibyte); 1065 defsubr (&Smultibyte_char_to_unibyte);
1076 defsubr (&Schar_bytes);
1077 defsubr (&Schar_width); 1066 defsubr (&Schar_width);
1078 defsubr (&Sstring_width); 1067 defsubr (&Sstring_width);
1079 defsubr (&Schar_direction); 1068 defsubr (&Schar_direction);
diff --git a/src/charset.c b/src/charset.c
index 8051b11330e..0ab776b6914 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include <config.h> 28#include <config.h>
29 29
30#include <stdio.h> 30#include <stdio.h>
31#include <stdlib.h>
32#include <unistd.h> 31#include <unistd.h>
33#include <ctype.h> 32#include <ctype.h>
34#include <sys/types.h> 33#include <sys/types.h>
@@ -2365,8 +2364,8 @@ syms_of_charset (void)
2365 Vemacs_mule_charset_list = Qnil; 2364 Vemacs_mule_charset_list = Qnil;
2366 2365
2367 /* Don't staticpro them here. It's done in syms_of_fns. */ 2366 /* Don't staticpro them here. It's done in syms_of_fns. */
2368 QCtest = intern (":test"); 2367 QCtest = intern_c_string (":test");
2369 Qeq = intern ("eq"); 2368 Qeq = intern_c_string ("eq");
2370 2369
2371 staticpro (&Vcharset_hash_table); 2370 staticpro (&Vcharset_hash_table);
2372 { 2371 {
diff --git a/src/coding.c b/src/coding.c
index d6285ed9245..7a3bc40b9c7 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -166,7 +166,7 @@ detect_coding_XXX (struct coding_system *coding,
166 166
167 while (1) 167 while (1)
168 { 168 {
169 /* Get one byte from the source. If the souce is exausted, jump 169 /* Get one byte from the source. If the source is exhausted, jump
170 to no_more_source:. */ 170 to no_more_source:. */
171 ONE_MORE_BYTE (c); 171 ONE_MORE_BYTE (c);
172 172
@@ -180,7 +180,7 @@ detect_coding_XXX (struct coding_system *coding,
180 return 0; 180 return 0;
181 181
182 no_more_source: 182 no_more_source:
183 /* The source exausted successfully. */ 183 /* The source exhausted successfully. */
184 detect_info->found |= found; 184 detect_info->found |= found;
185 return 1; 185 return 1;
186} 186}
@@ -530,7 +530,7 @@ enum iso_code_class_type
530 on output. */ 530 on output. */
531#define CODING_ISO_FLAG_DESIGNATE_AT_BOL 0x0400 531#define CODING_ISO_FLAG_DESIGNATE_AT_BOL 0x0400
532 532
533/* If set, do not encode unsafe charactes on output. */ 533/* If set, do not encode unsafe characters on output. */
534#define CODING_ISO_FLAG_SAFE 0x0800 534#define CODING_ISO_FLAG_SAFE 0x0800
535 535
536/* If set, extra latin codes (128..159) are accepted as a valid code 536/* If set, extra latin codes (128..159) are accepted as a valid code
@@ -686,7 +686,7 @@ enum coding_category
686static Lisp_Object Vcoding_category_list; 686static Lisp_Object Vcoding_category_list;
687 687
688/* Table of coding categories (Lisp symbols). This variable is for 688/* Table of coding categories (Lisp symbols). This variable is for
689 internal use oly. */ 689 internal use only. */
690static Lisp_Object Vcoding_category_table; 690static Lisp_Object Vcoding_category_table;
691 691
692/* Table of coding-categories ordered by priority. */ 692/* Table of coding-categories ordered by priority. */
@@ -818,7 +818,7 @@ static struct coding_system coding_categories[coding_category_max];
818 } while (0) 818 } while (0)
819 819
820 820
821/* Like EMIT_ONE_ASCII_BYTE byt store two bytes; C1 and C2. */ 821/* Like EMIT_ONE_ASCII_BYTE but store two bytes; C1 and C2. */
822 822
823#define EMIT_TWO_ASCII_BYTES(c1, c2) \ 823#define EMIT_TWO_ASCII_BYTES(c1, c2) \
824 do { \ 824 do { \
@@ -1227,7 +1227,7 @@ alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
1227 1227
1228 METHOD is one of enum composition_method. 1228 METHOD is one of enum composition_method.
1229 1229
1230 Optionnal COMPOSITION-COMPONENTS are characters and composition 1230 Optional COMPOSITION-COMPONENTS are characters and composition
1231 rules. 1231 rules.
1232 1232
1233 In the case of CODING_ANNOTATE_CHARSET_MASK, one element CHARSET-ID 1233 In the case of CODING_ANNOTATE_CHARSET_MASK, one element CHARSET-ID
@@ -1932,7 +1932,7 @@ encode_coding_utf_16 (struct coding_system *coding)
1932 CHARS is 0xA0 plus a number of characters composed by this 1932 CHARS is 0xA0 plus a number of characters composed by this
1933 data, 1933 data,
1934 1934
1935 COMPONENTs are characters of multibye form or composition 1935 COMPONENTs are characters of multibyte form or composition
1936 rules encoded by two-byte of ASCII codes. 1936 rules encoded by two-byte of ASCII codes.
1937 1937
1938 In addition, for backward compatibility, the following formats are 1938 In addition, for backward compatibility, the following formats are
@@ -2428,8 +2428,8 @@ decode_coding_emacs_mule (struct coding_system *coding)
2428 const unsigned char *src_end = coding->source + coding->src_bytes; 2428 const unsigned char *src_end = coding->source + coding->src_bytes;
2429 const unsigned char *src_base; 2429 const unsigned char *src_base;
2430 int *charbuf = coding->charbuf + coding->charbuf_used; 2430 int *charbuf = coding->charbuf + coding->charbuf_used;
2431 /* We may produce two annocations (charset and composition) in one 2431 /* We may produce two annotations (charset and composition) in one
2432 loop and one more charset annocation at the end. */ 2432 loop and one more charset annotation at the end. */
2433 int *charbuf_end 2433 int *charbuf_end
2434 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); 2434 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
2435 int consumed_chars = 0, consumed_chars_base; 2435 int consumed_chars = 0, consumed_chars_base;
@@ -2505,7 +2505,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2505 /* emacs_mule_char can load a charset map from a file, which 2505 /* emacs_mule_char can load a charset map from a file, which
2506 allocates a large structure and might cause buffer text 2506 allocates a large structure and might cause buffer text
2507 to be relocated as result. Thus, we need to remember the 2507 to be relocated as result. Thus, we need to remember the
2508 original pointer to buffer text, and fixup all related 2508 original pointer to buffer text, and fix up all related
2509 pointers after the call. */ 2509 pointers after the call. */
2510 const unsigned char *orig = coding->source; 2510 const unsigned char *orig = coding->source;
2511 EMACS_INT offset; 2511 EMACS_INT offset;
@@ -2532,7 +2532,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2532 cmp_status->ncomps -= nchars; 2532 cmp_status->ncomps -= nchars;
2533 } 2533 }
2534 2534
2535 /* Now if C >= 0, we found a normally encoded characer, if C < 2535 /* Now if C >= 0, we found a normally encoded character, if C <
2536 0, we found an old-style composition component character or 2536 0, we found an old-style composition component character or
2537 rule. */ 2537 rule. */
2538 2538
@@ -3043,7 +3043,7 @@ setup_iso_safe_charsets (Lisp_Object attrs)
3043 3043
3044 3044
3045/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions". 3045/* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
3046 Check if a text is encoded in one of ISO-2022 based codig systems. 3046 Check if a text is encoded in one of ISO-2022 based coding systems.
3047 If it is, return 1, else return 0. */ 3047 If it is, return 1, else return 0. */
3048 3048
3049static int 3049static int
@@ -3452,7 +3452,7 @@ finish_composition (int *charbuf, struct composition_status *cmp_status)
3452 return new_chars; 3452 return new_chars;
3453} 3453}
3454 3454
3455/* If characers are under composition, finish the composition. */ 3455/* If characters are under composition, finish the composition. */
3456#define MAYBE_FINISH_COMPOSITION() \ 3456#define MAYBE_FINISH_COMPOSITION() \
3457 do { \ 3457 do { \
3458 if (cmp_status->state != COMPOSING_NO) \ 3458 if (cmp_status->state != COMPOSING_NO) \
@@ -3558,8 +3558,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
3558 const unsigned char *src_end = coding->source + coding->src_bytes; 3558 const unsigned char *src_end = coding->source + coding->src_bytes;
3559 const unsigned char *src_base; 3559 const unsigned char *src_base;
3560 int *charbuf = coding->charbuf + coding->charbuf_used; 3560 int *charbuf = coding->charbuf + coding->charbuf_used;
3561 /* We may produce two annocations (charset and composition) in one 3561 /* We may produce two annotations (charset and composition) in one
3562 loop and one more charset annocation at the end. */ 3562 loop and one more charset annotation at the end. */
3563 int *charbuf_end 3563 int *charbuf_end
3564 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); 3564 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
3565 int consumed_chars = 0, consumed_chars_base; 3565 int consumed_chars = 0, consumed_chars_base;
@@ -3861,7 +3861,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3861 goto invalid_code; 3861 goto invalid_code;
3862 /* For the moment, nested direction is not supported. 3862 /* For the moment, nested direction is not supported.
3863 So, `coding->mode & CODING_MODE_DIRECTION' zero means 3863 So, `coding->mode & CODING_MODE_DIRECTION' zero means
3864 left-to-right, and nozero means right-to-left. */ 3864 left-to-right, and nonzero means right-to-left. */
3865 ONE_MORE_BYTE (c1); 3865 ONE_MORE_BYTE (c1);
3866 switch (c1) 3866 switch (c1)
3867 { 3867 {
@@ -4766,7 +4766,7 @@ decode_coding_sjis (struct coding_system *coding)
4766 const unsigned char *src_end = coding->source + coding->src_bytes; 4766 const unsigned char *src_end = coding->source + coding->src_bytes;
4767 const unsigned char *src_base; 4767 const unsigned char *src_base;
4768 int *charbuf = coding->charbuf + coding->charbuf_used; 4768 int *charbuf = coding->charbuf + coding->charbuf_used;
4769 /* We may produce one charset annocation in one loop and one more at 4769 /* We may produce one charset annotation in one loop and one more at
4770 the end. */ 4770 the end. */
4771 int *charbuf_end 4771 int *charbuf_end
4772 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); 4772 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
@@ -4884,7 +4884,7 @@ decode_coding_big5 (struct coding_system *coding)
4884 const unsigned char *src_end = coding->source + coding->src_bytes; 4884 const unsigned char *src_end = coding->source + coding->src_bytes;
4885 const unsigned char *src_base; 4885 const unsigned char *src_base;
4886 int *charbuf = coding->charbuf + coding->charbuf_used; 4886 int *charbuf = coding->charbuf + coding->charbuf_used;
4887 /* We may produce one charset annocation in one loop and one more at 4887 /* We may produce one charset annotation in one loop and one more at
4888 the end. */ 4888 the end. */
4889 int *charbuf_end 4889 int *charbuf_end
4890 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); 4890 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
@@ -5541,7 +5541,7 @@ decode_coding_charset (struct coding_system *coding)
5541 const unsigned char *src_end = coding->source + coding->src_bytes; 5541 const unsigned char *src_end = coding->source + coding->src_bytes;
5542 const unsigned char *src_base; 5542 const unsigned char *src_base;
5543 int *charbuf = coding->charbuf + coding->charbuf_used; 5543 int *charbuf = coding->charbuf + coding->charbuf_used;
5544 /* We may produce one charset annocation in one loop and one more at 5544 /* We may produce one charset annotation in one loop and one more at
5545 the end. */ 5545 the end. */
5546 int *charbuf_end 5546 int *charbuf_end
5547 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); 5547 = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
@@ -6016,10 +6016,9 @@ raw_text_coding_system (Lisp_Object coding_system)
6016} 6016}
6017 6017
6018 6018
6019/* If CODING_SYSTEM doesn't specify end-of-line format but PARENT 6019/* If CODING_SYSTEM doesn't specify end-of-line format, return one of
6020 does, return one of the subsidiary that has the same eol-spec as 6020 the subsidiary that has the same eol-spec as PARENT (if it is not
6021 PARENT. Otherwise, return CODING_SYSTEM. If PARENT is nil, 6021 nil and specifies end-of-line format) or the system's setting
6022 inherit end-of-line format from the system's setting
6023 (system_eol_type). */ 6022 (system_eol_type). */
6024 6023
6025Lisp_Object 6024Lisp_Object
@@ -6041,6 +6040,8 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
6041 6040
6042 parent_spec = CODING_SYSTEM_SPEC (parent); 6041 parent_spec = CODING_SYSTEM_SPEC (parent);
6043 parent_eol_type = AREF (parent_spec, 2); 6042 parent_eol_type = AREF (parent_spec, 2);
6043 if (VECTORP (parent_eol_type))
6044 parent_eol_type = system_eol_type;
6044 } 6045 }
6045 else 6046 else
6046 parent_eol_type = system_eol_type; 6047 parent_eol_type = system_eol_type;
@@ -6054,6 +6055,45 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
6054 return coding_system; 6055 return coding_system;
6055} 6056}
6056 6057
6058
6059/* Check if text-conversion and eol-conversion of CODING_SYSTEM are
6060 decided for writing to a process. If not, complement them, and
6061 return a new coding system. */
6062
6063Lisp_Object
6064complement_process_encoding_system (Lisp_Object coding_system)
6065{
6066 Lisp_Object coding_base = Qnil, eol_base = Qnil;
6067 Lisp_Object spec, attrs;
6068 int i;
6069
6070 for (i = 0; i < 3; i++)
6071 {
6072 if (i == 1)
6073 coding_system = CDR_SAFE (Vdefault_process_coding_system);
6074 else if (i == 2)
6075 coding_system = preferred_coding_system ();
6076 spec = CODING_SYSTEM_SPEC (coding_system);
6077 if (NILP (spec))
6078 continue;
6079 attrs = AREF (spec, 0);
6080 if (NILP (coding_base) && ! EQ (CODING_ATTR_TYPE (attrs), Qundecided))
6081 coding_base = CODING_ATTR_BASE_NAME (attrs);
6082 if (NILP (eol_base) && ! VECTORP (AREF (spec, 2)))
6083 eol_base = coding_system;
6084 if (! NILP (coding_base) && ! NILP (eol_base))
6085 break;
6086 }
6087
6088 if (i > 0)
6089 /* The original CODING_SYSTEM didn't specify text-conversion or
6090 eol-conversion. Be sure that we return a fully complemented
6091 coding system. */
6092 coding_system = coding_inherit_eol_type (coding_base, eol_base);
6093 return coding_system;
6094}
6095
6096
6057/* Emacs has a mechanism to automatically detect a coding system if it 6097/* Emacs has a mechanism to automatically detect a coding system if it
6058 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But, 6098 is one of Emacs' internal format, ISO2022, SJIS, and BIG5. But,
6059 it's impossible to distinguish some coding systems accurately 6099 it's impossible to distinguish some coding systems accurately
@@ -6104,14 +6144,14 @@ coding_inherit_eol_type (Lisp_Object coding_system, Lisp_Object parent)
6104 o coding-category-iso-7-else 6144 o coding-category-iso-7-else
6105 6145
6106 The category for a coding system which has the same code range 6146 The category for a coding system which has the same code range
6107 as ISO2022 of 7-bit environemnt but uses locking shift or 6147 as ISO2022 of 7-bit environment but uses locking shift or
6108 single shift functions. Assigned the coding-system (Lisp 6148 single shift functions. Assigned the coding-system (Lisp
6109 symbol) `iso-2022-7bit-lock' by default. 6149 symbol) `iso-2022-7bit-lock' by default.
6110 6150
6111 o coding-category-iso-8-else 6151 o coding-category-iso-8-else
6112 6152
6113 The category for a coding system which has the same code range 6153 The category for a coding system which has the same code range
6114 as ISO2022 of 8-bit environemnt but uses locking shift or 6154 as ISO2022 of 8-bit environment but uses locking shift or
6115 single shift functions. Assigned the coding-system (Lisp 6155 single shift functions. Assigned the coding-system (Lisp
6116 symbol) `iso-2022-8bit-ss2' by default. 6156 symbol) `iso-2022-8bit-ss2' by default.
6117 6157
@@ -7508,7 +7548,7 @@ static Lisp_Object Vcode_conversion_reused_workbuf;
7508static int reused_workbuf_in_use; 7548static int reused_workbuf_in_use;
7509 7549
7510 7550
7511/* Return a working buffer of code convesion. MULTIBYTE specifies the 7551/* Return a working buffer of code conversion. MULTIBYTE specifies the
7512 multibyteness of returning buffer. */ 7552 multibyteness of returning buffer. */
7513 7553
7514static Lisp_Object 7554static Lisp_Object
@@ -8160,7 +8200,7 @@ function `define-coding-system'. */)
8160 8200
8161/* Detect how the bytes at SRC of length SRC_BYTES are encoded. If 8201/* Detect how the bytes at SRC of length SRC_BYTES are encoded. If
8162 HIGHEST is nonzero, return the coding system of the highest 8202 HIGHEST is nonzero, return the coding system of the highest
8163 priority among the detected coding systems. Otherwize return a 8203 priority among the detected coding systems. Otherwise return a
8164 list of detected coding systems sorted by their priorities. If 8204 list of detected coding systems sorted by their priorities. If
8165 MULTIBYTEP is nonzero, it is assumed that the bytes are in correct 8205 MULTIBYTEP is nonzero, it is assumed that the bytes are in correct
8166 multibyte form but contains only ASCII and eight-bit chars. 8206 multibyte form but contains only ASCII and eight-bit chars.
@@ -9262,7 +9302,7 @@ DEFUN ("set-terminal-coding-system-internal", Fset_terminal_coding_system_intern
9262 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding); 9302 setup_coding_system (Fcheck_coding_system (coding_system), terminal_coding);
9263 /* We had better not send unsafe characters to terminal. */ 9303 /* We had better not send unsafe characters to terminal. */
9264 terminal_coding->mode |= CODING_MODE_SAFE_ENCODING; 9304 terminal_coding->mode |= CODING_MODE_SAFE_ENCODING;
9265 /* Characer composition should be disabled. */ 9305 /* Character composition should be disabled. */
9266 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9306 terminal_coding->common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9267 terminal_coding->src_multibyte = 1; 9307 terminal_coding->src_multibyte = 1;
9268 terminal_coding->dst_multibyte = 0; 9308 terminal_coding->dst_multibyte = 0;
@@ -9278,7 +9318,7 @@ DEFUN ("set-safe-terminal-coding-system-internal",
9278 CHECK_SYMBOL (coding_system); 9318 CHECK_SYMBOL (coding_system);
9279 setup_coding_system (Fcheck_coding_system (coding_system), 9319 setup_coding_system (Fcheck_coding_system (coding_system),
9280 &safe_terminal_coding); 9320 &safe_terminal_coding);
9281 /* Characer composition should be disabled. */ 9321 /* Character composition should be disabled. */
9282 safe_terminal_coding.common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9322 safe_terminal_coding.common_flags &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9283 safe_terminal_coding.src_multibyte = 1; 9323 safe_terminal_coding.src_multibyte = 1;
9284 safe_terminal_coding.dst_multibyte = 0; 9324 safe_terminal_coding.dst_multibyte = 0;
@@ -9312,7 +9352,7 @@ DEFUN ("set-keyboard-coding-system-internal", Fset_keyboard_coding_system_intern
9312 else 9352 else
9313 Fcheck_coding_system (coding_system); 9353 Fcheck_coding_system (coding_system);
9314 setup_coding_system (coding_system, TERMINAL_KEYBOARD_CODING (t)); 9354 setup_coding_system (coding_system, TERMINAL_KEYBOARD_CODING (t));
9315 /* Characer composition should be disabled. */ 9355 /* Character composition should be disabled. */
9316 TERMINAL_KEYBOARD_CODING (t)->common_flags 9356 TERMINAL_KEYBOARD_CODING (t)->common_flags
9317 &= ~CODING_ANNOTATE_COMPOSITION_MASK; 9357 &= ~CODING_ANNOTATE_COMPOSITION_MASK;
9318 return Qnil; 9358 return Qnil;
@@ -9680,7 +9720,7 @@ usage: (define-coding-system-internal ...) */)
9680 9720
9681 If Nth element is a list of charset IDs, N is the first byte 9721 If Nth element is a list of charset IDs, N is the first byte
9682 of one of them. The list is sorted by dimensions of the 9722 of one of them. The list is sorted by dimensions of the
9683 charsets. A charset of smaller dimension comes firtst. */ 9723 charsets. A charset of smaller dimension comes first. */
9684 val = Fmake_vector (make_number (256), Qnil); 9724 val = Fmake_vector (make_number (256), Qnil);
9685 9725
9686 for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) 9726 for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
diff --git a/src/coding.h b/src/coding.h
index 0caa5b2f96f..7233726a250 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -707,6 +707,7 @@ extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
707 int); 707 int);
708extern Lisp_Object raw_text_coding_system (Lisp_Object); 708extern Lisp_Object raw_text_coding_system (Lisp_Object);
709extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); 709extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
710extern Lisp_Object complement_process_encoding_system (Lisp_Object);
710 711
711extern int decode_coding_gap (struct coding_system *, 712extern int decode_coding_gap (struct coding_system *,
712 EMACS_INT, EMACS_INT); 713 EMACS_INT, EMACS_INT);
diff --git a/src/config.in b/src/config.in
index 43ebb756215..add2ac73d55 100644
--- a/src/config.in
+++ b/src/config.in
@@ -255,7 +255,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
255/* Define to 1 if you have a gif (or ungif) library. */ 255/* Define to 1 if you have a gif (or ungif) library. */
256#undef HAVE_GIF 256#undef HAVE_GIF
257 257
258/* Define if we have the GNU TLS library. */ 258/* Define if using GnuTLS. */
259#undef HAVE_GNUTLS 259#undef HAVE_GNUTLS
260 260
261/* Define to 1 if you have the gpm library (-lgpm). */ 261/* Define to 1 if you have the gpm library (-lgpm). */
@@ -408,6 +408,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
408/* Define to 1 if you have the `Xext' library (-lXext). */ 408/* Define to 1 if you have the `Xext' library (-lXext). */
409#undef HAVE_LIBXEXT 409#undef HAVE_LIBXEXT
410 410
411/* Define to 1 if you have the libxml library (-lxml2). */
412#undef HAVE_LIBXML2
413
411/* Define to 1 if you have the `Xmu' library (-lXmu). */ 414/* Define to 1 if you have the `Xmu' library (-lXmu). */
412#undef HAVE_LIBXMU 415#undef HAVE_LIBXMU
413 416
@@ -816,9 +819,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
816/* Define to 1 if you have the SM library (-lSM). */ 819/* Define to 1 if you have the SM library (-lSM). */
817#undef HAVE_X_SM 820#undef HAVE_X_SM
818 821
819/* Define to 1 if you have the libxml2 library (-lxml2). */
820#undef HAVE_LIBXML2
821
822/* Define to 1 if you want to use the X window system. */ 822/* Define to 1 if you want to use the X window system. */
823#undef HAVE_X_WINDOWS 823#undef HAVE_X_WINDOWS
824 824
@@ -1097,12 +1097,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1097#include config_opsysfile 1097#include config_opsysfile
1098#include config_machfile 1098#include config_machfile
1099 1099
1100#if HAVE_GNUTLS
1101#define LIBGNUTLS $(LIBGNUTLS_LIBS)
1102#else /* not HAVE_GNUTLS */
1103#define LIBGNUTLS
1104#endif /* not HAVE_GNUTLS */
1105
1106/* Set up some defines, C and LD flags for NeXTstep interface on GNUstep. 1100/* Set up some defines, C and LD flags for NeXTstep interface on GNUstep.
1107 (There is probably a better place to do this, but right now the Cocoa 1101 (There is probably a better place to do this, but right now the Cocoa
1108 side does this in s/darwin.h and we cannot 1102 side does this in s/darwin.h and we cannot
@@ -1170,13 +1164,8 @@ SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems. */
1170 not define __STDC__ (e.g. DEC C by default) or may define it as zero. */ 1164 not define __STDC__ (e.g. DEC C by default) or may define it as zero. */
1171#undef PROTOTYPES 1165#undef PROTOTYPES
1172 1166
1173#ifdef HAVE_STRING_H
1174#include <string.h> 1167#include <string.h>
1175#endif
1176
1177#ifdef HAVE_STDLIB_H
1178#include <stdlib.h> 1168#include <stdlib.h>
1179#endif
1180 1169
1181#ifdef HAVE_ALLOCA_H 1170#ifdef HAVE_ALLOCA_H
1182# include <alloca.h> 1171# include <alloca.h>
@@ -1211,6 +1200,17 @@ typedef unsigned size_t;
1211#define NO_RETURN /* nothing */ 1200#define NO_RETURN /* nothing */
1212#endif 1201#endif
1213 1202
1203#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
1204#define NO_INLINE __attribute__((noinline))
1205#else
1206#define NO_INLINE
1207#endif
1208
1209/* Some versions of GNU/Linux define noinline in their headers. */
1210#ifdef noinline
1211#undef noinline
1212#endif
1213
1214/* These won't be used automatically yet. We also need to know, at least, 1214/* These won't be used automatically yet. We also need to know, at least,
1215 that the stack is continuous. */ 1215 that the stack is continuous. */
1216#ifdef __GNUC__ 1216#ifdef __GNUC__
diff --git a/src/dbusbind.c b/src/dbusbind.c
index ffa02e8e9c9..683b7cb583b 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -19,7 +19,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#include <config.h> 19#include <config.h>
20 20
21#ifdef HAVE_DBUS 21#ifdef HAVE_DBUS
22#include <stdlib.h>
23#include <stdio.h> 22#include <stdio.h>
24#include <dbus/dbus.h> 23#include <dbus/dbus.h>
25#include <setjmp.h> 24#include <setjmp.h>
@@ -901,6 +900,9 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
901 /* Add bus to list of registered buses. */ 900 /* Add bus to list of registered buses. */
902 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses); 901 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses);
903 902
903 /* We do not want to abort. */
904 putenv ("DBUS_FATAL_WARNINGS=0");
905
904 /* Return. */ 906 /* Return. */
905 return Qnil; 907 return Qnil;
906} 908}
@@ -2161,12 +2163,11 @@ be called when the D-Bus reply message arrives. */);
2161 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); 2163 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */);
2162#ifdef DBUS_DEBUG 2164#ifdef DBUS_DEBUG
2163 Vdbus_debug = Qt; 2165 Vdbus_debug = Qt;
2164 /* We can also set environment DBUS_VERBOSE=1 in order to see more 2166 /* We can also set environment variable DBUS_VERBOSE=1 in order to
2165 traces. */ 2167 see more traces. This requires libdbus-1 to be configured with
2168 --enable-verbose-mode. */
2166#else 2169#else
2167 Vdbus_debug = Qnil; 2170 Vdbus_debug = Qnil;
2168 /* We do not want to abort. */
2169 setenv ("DBUS_FATAL_WARNINGS", "0", 1);
2170#endif 2171#endif
2171 2172
2172 Fprovide (intern_c_string ("dbusbind"), Qnil); 2173 Fprovide (intern_c_string ("dbusbind"), Qnil);
diff --git a/src/doc.c b/src/doc.c
index 8ec94f9836c..b887b3149bc 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -25,19 +25,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25#include <sys/file.h> /* Must be after sys/types.h for USG*/ 25#include <sys/file.h> /* Must be after sys/types.h for USG*/
26#include <ctype.h> 26#include <ctype.h>
27#include <setjmp.h> 27#include <setjmp.h>
28
29#ifdef HAVE_FCNTL_H
30#include <fcntl.h> 28#include <fcntl.h>
31#endif
32 29
33#ifdef HAVE_UNISTD_H 30#ifdef HAVE_UNISTD_H
34#include <unistd.h> 31#include <unistd.h>
35#endif 32#endif
36 33
37#ifndef O_RDONLY
38#define O_RDONLY 0
39#endif
40
41#include "lisp.h" 34#include "lisp.h"
42#include "buffer.h" 35#include "buffer.h"
43#include "keyboard.h" 36#include "keyboard.h"
diff --git a/src/dosfns.c b/src/dosfns.c
index e66b50ed3ff..fea70386f18 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -24,7 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24/* The entire file is within this conditional */ 24/* The entire file is within this conditional */
25 25
26#include <stdio.h> 26#include <stdio.h>
27#include <string.h>
28#include <dos.h> 27#include <dos.h>
29#include <setjmp.h> 28#include <setjmp.h>
30#include "lisp.h" 29#include "lisp.h"
diff --git a/src/emacs.c b/src/emacs.c
index 397b6d1ce88..70a0fae4ebf 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -187,6 +187,9 @@ Lisp_Object Vprevious_system_time_locale;
187 Lisp code. */ 187 Lisp code. */
188Lisp_Object Vemacs_copyright, Vemacs_version; 188Lisp_Object Vemacs_copyright, Vemacs_version;
189 189
190/* Alist of external libraries and files implementing them. */
191Lisp_Object Vdynamic_library_alist;
192
190/* If non-zero, emacs should not attempt to use a window-specific code, 193/* If non-zero, emacs should not attempt to use a window-specific code,
191 but instead should use the virtual terminal under which it was started. */ 194 but instead should use the virtual terminal under which it was started. */
192int inhibit_window_system; 195int inhibit_window_system;
@@ -378,7 +381,7 @@ fatal_error_signal (int sig)
378 { 381 {
379 fatal_error_in_progress = 1; 382 fatal_error_in_progress = 1;
380 383
381 if (sig == SIGTERM || sig == SIGHUP) 384 if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT)
382 Fkill_emacs (make_number (sig)); 385 Fkill_emacs (make_number (sig));
383 386
384 shut_down_emacs (sig, 0, Qnil); 387 shut_down_emacs (sig, 0, Qnil);
@@ -1240,6 +1243,12 @@ main (int argc, char **argv)
1240#ifdef SIGSYS 1243#ifdef SIGSYS
1241 signal (SIGSYS, fatal_error_signal); 1244 signal (SIGSYS, fatal_error_signal);
1242#endif 1245#endif
1246 /* May need special treatment on MS-Windows. See
1247 http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
1248 Please update the doc of kill-emacs, kill-emacs-hook, and
1249 NEWS if you change this.
1250 */
1251 if (noninteractive) signal (SIGINT, fatal_error_signal);
1243 signal (SIGTERM, fatal_error_signal); 1252 signal (SIGTERM, fatal_error_signal);
1244#ifdef SIGXCPU 1253#ifdef SIGXCPU
1245 signal (SIGXCPU, fatal_error_signal); 1254 signal (SIGXCPU, fatal_error_signal);
@@ -1988,6 +1997,9 @@ DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
1988If ARG is an integer, return ARG as the exit program code. 1997If ARG is an integer, return ARG as the exit program code.
1989If ARG is a string, stuff it as keyboard input. 1998If ARG is a string, stuff it as keyboard input.
1990 1999
2000This function is called upon receipt of the signals SIGTERM
2001or SIGHUP, and upon SIGINT in batch mode.
2002
1991The value of `kill-emacs-hook', if not void, 2003The value of `kill-emacs-hook', if not void,
1992is a list of functions (of no args), 2004is a list of functions (of no args),
1993all of which are called before Emacs is actually killed. */) 2005all of which are called before Emacs is actually killed. */)
@@ -2000,7 +2012,7 @@ all of which are called before Emacs is actually killed. */)
2000 if (feof (stdin)) 2012 if (feof (stdin))
2001 arg = Qt; 2013 arg = Qt;
2002 2014
2003 if (!NILP (Vrun_hooks) && !noninteractive) 2015 if (!NILP (Vrun_hooks))
2004 call1 (Vrun_hooks, intern ("kill-emacs-hook")); 2016 call1 (Vrun_hooks, intern ("kill-emacs-hook"));
2005 2017
2006 UNGCPRO; 2018 UNGCPRO;
@@ -2109,6 +2121,10 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
2109 2121
2110#ifndef CANNOT_DUMP 2122#ifndef CANNOT_DUMP
2111 2123
2124/* FIXME: maybe this should go into header file, config.h seems the
2125 only one appropriate. */
2126extern int unexec (const char *, const char *);
2127
2112DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0, 2128DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0,
2113 doc: /* Dump current state of Emacs into executable file FILENAME. 2129 doc: /* Dump current state of Emacs into executable file FILENAME.
2114Take symbols from SYMFILE (presumably the file you executed to run Emacs). 2130Take symbols from SYMFILE (presumably the file you executed to run Emacs).
@@ -2176,13 +2192,13 @@ You must run Emacs in batch mode in order to dump it. */)
2176 Meanwhile, my_edata is not valid on Windows. */ 2192 Meanwhile, my_edata is not valid on Windows. */
2177 memory_warnings (my_edata, malloc_warning); 2193 memory_warnings (my_edata, malloc_warning);
2178#endif /* not WINDOWSNT */ 2194#endif /* not WINDOWSNT */
2179#endif 2195#if defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
2180#if !defined (SYSTEM_MALLOC) && defined (HAVE_GTK_AND_PTHREAD) && !defined SYNC_INPUT
2181 /* Pthread may call malloc before main, and then we will get an endless 2196 /* Pthread may call malloc before main, and then we will get an endless
2182 loop, because pthread_self (see alloc.c) calls malloc the first time 2197 loop, because pthread_self (see alloc.c) calls malloc the first time
2183 it is called on some systems. */ 2198 it is called on some systems. */
2184 reset_malloc_hooks (); 2199 reset_malloc_hooks ();
2185#endif 2200#endif
2201#endif /* not SYSTEM_MALLOC */
2186#ifdef DOUG_LEA_MALLOC 2202#ifdef DOUG_LEA_MALLOC
2187 malloc_state_ptr = malloc_get_state (); 2203 malloc_state_ptr = malloc_get_state ();
2188#endif 2204#endif
@@ -2190,8 +2206,7 @@ You must run Emacs in batch mode in order to dump it. */)
2190#ifdef USE_MMAP_FOR_BUFFERS 2206#ifdef USE_MMAP_FOR_BUFFERS
2191 mmap_set_vars (0); 2207 mmap_set_vars (0);
2192#endif 2208#endif
2193 unexec (SDATA (filename), 2209 unexec (SDATA (filename), !NILP (symfile) ? SDATA (symfile) : 0);
2194 !NILP (symfile) ? SDATA (symfile) : 0, my_edata, 0, 0);
2195#ifdef USE_MMAP_FOR_BUFFERS 2210#ifdef USE_MMAP_FOR_BUFFERS
2196 mmap_set_vars (1); 2211 mmap_set_vars (1);
2197#endif 2212#endif
@@ -2421,7 +2436,8 @@ in other similar situations), functions placed on this hook should not
2421expect to be able to interact with the user. To ask for confirmation, 2436expect to be able to interact with the user. To ask for confirmation,
2422see `kill-emacs-query-functions' instead. 2437see `kill-emacs-query-functions' instead.
2423 2438
2424The hook is not run in batch mode, i.e., if `noninteractive' is non-nil. */); 2439Before Emacs 24.1, the hook was not run in batch mode, i.e., if
2440`noninteractive' was non-nil. */);
2425 Vkill_emacs_hook = Qnil; 2441 Vkill_emacs_hook = Qnil;
2426 2442
2427 DEFVAR_INT ("emacs-priority", &emacs_priority, 2443 DEFVAR_INT ("emacs-priority", &emacs_priority,
@@ -2494,6 +2510,24 @@ This is nil during initialization. */);
2494 doc: /* Version numbers of this version of Emacs. */); 2510 doc: /* Version numbers of this version of Emacs. */);
2495 Vemacs_version = build_string (emacs_version); 2511 Vemacs_version = build_string (emacs_version);
2496 2512
2513 DEFVAR_LISP ("dynamic-library-alist", &Vdynamic_library_alist,
2514 doc: /* Alist of dynamic libraries vs external files implementing them.
2515Each element is a list (LIBRARY FILE...), where the car is a symbol
2516representing a supported external library, and the rest are strings giving
2517alternate filenames for that library.
2518
2519Emacs tries to load the library from the files in the order they appear on
2520the list; if none is loaded, the running session of Emacs won't have access
2521to that library.
2522
2523Note that image types `pbm' and `xbm' do not need entries in this variable
2524because they do not depend on external libraries and are always available.
2525
2526Also note that this is not a generic facility for accessing external
2527libraries; only those already known by Emacs will be loaded. */);
2528 Vdynamic_library_alist = Qnil;
2529 Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt);
2530
2497 /* Make sure IS_DAEMON starts up as false. */ 2531 /* Make sure IS_DAEMON starts up as false. */
2498 daemon_pipe[1] = 0; 2532 daemon_pipe[1] = 0;
2499} 2533}
diff --git a/src/eval.c b/src/eval.c
index 6383a672ae3..c07e7a37323 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -186,7 +186,7 @@ init_eval_once (void)
186 specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding)); 186 specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding));
187 specpdl_ptr = specpdl; 187 specpdl_ptr = specpdl;
188 /* Don't forget to update docs (lispref node "Local Variables"). */ 188 /* Don't forget to update docs (lispref node "Local Variables"). */
189 max_specpdl_size = 1000; 189 max_specpdl_size = 1200; /* 1000 is not enough for CEDET's c-by.el. */
190 max_lisp_eval_depth = 500; 190 max_lisp_eval_depth = 500;
191 191
192 Vrun_hooks = Qnil; 192 Vrun_hooks = Qnil;
@@ -3717,8 +3717,10 @@ Output stream used is value of `standard-output'. */)
3717 Lisp_Object tail; 3717 Lisp_Object tail;
3718 Lisp_Object tem; 3718 Lisp_Object tem;
3719 struct gcpro gcpro1; 3719 struct gcpro gcpro1;
3720 Lisp_Object old_print_level = Vprint_level;
3720 3721
3721 XSETFASTINT (Vprint_level, 3); 3722 if (NILP (Vprint_level))
3723 XSETFASTINT (Vprint_level, 8);
3722 3724
3723 tail = Qnil; 3725 tail = Qnil;
3724 GCPRO1 (tail); 3726 GCPRO1 (tail);
@@ -3759,7 +3761,7 @@ Output stream used is value of `standard-output'. */)
3759 backlist = backlist->next; 3761 backlist = backlist->next;
3760 } 3762 }
3761 3763
3762 Vprint_level = Qnil; 3764 Vprint_level = old_print_level;
3763 UNGCPRO; 3765 UNGCPRO;
3764 return Qnil; 3766 return Qnil;
3765} 3767}
diff --git a/src/fileio.c b/src/fileio.c
index 3d08e881e8f..36b6cc3ca8b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,7 +1,8 @@
1/* File IO for GNU Emacs. 1/* File IO for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 2
3 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997,
4 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 4 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5 2009, 2010 Free Software Foundation, Inc.
5 6
6This file is part of GNU Emacs. 7This file is part of GNU Emacs.
7 8
@@ -20,11 +21,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 21
21#include <config.h> 22#include <config.h>
22#include <limits.h> 23#include <limits.h>
23
24#ifdef HAVE_FCNTL_H
25#include <fcntl.h> 24#include <fcntl.h>
26#endif
27
28#include <stdio.h> 25#include <stdio.h>
29#include <sys/types.h> 26#include <sys/types.h>
30#include <sys/stat.h> 27#include <sys/stat.h>
@@ -71,7 +68,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
71#ifdef WINDOWSNT 68#ifdef WINDOWSNT
72#define NOMINMAX 1 69#define NOMINMAX 1
73#include <windows.h> 70#include <windows.h>
74#include <stdlib.h>
75#include <fcntl.h> 71#include <fcntl.h>
76#endif /* not WINDOWSNT */ 72#endif /* not WINDOWSNT */
77 73
@@ -79,7 +75,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
79#include "msdos.h" 75#include "msdos.h"
80#include <sys/param.h> 76#include <sys/param.h>
81#include <fcntl.h> 77#include <fcntl.h>
82#include <string.h>
83#endif 78#endif
84 79
85#ifdef DOS_NT 80#ifdef DOS_NT
@@ -105,14 +100,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
105 100
106#include "commands.h" 101#include "commands.h"
107 102
108#ifndef O_WRONLY
109#define O_WRONLY 1
110#endif
111
112#ifndef O_RDONLY
113#define O_RDONLY 0
114#endif
115
116#ifndef S_ISLNK 103#ifndef S_ISLNK
117# define lstat stat 104# define lstat stat
118#endif 105#endif
@@ -188,10 +175,6 @@ Lisp_Object Vauto_save_visited_file_name;
188/* Whether or not to continue auto-saving after a large deletion. */ 175/* Whether or not to continue auto-saving after a large deletion. */
189Lisp_Object Vauto_save_include_big_deletions; 176Lisp_Object Vauto_save_include_big_deletions;
190 177
191/* On NT, specifies the directory separator character, used (eg.) when
192 expanding file names. This can be bound to / or \. */
193Lisp_Object Vdirectory_sep_char;
194
195#ifdef HAVE_FSYNC 178#ifdef HAVE_FSYNC
196/* Nonzero means skip the call to fsync in Fwrite-region. */ 179/* Nonzero means skip the call to fsync in Fwrite-region. */
197int write_region_inhibit_fsync; 180int write_region_inhibit_fsync;
diff --git a/src/filelock.c b/src/filelock.c
index 15ed546bc50..acca7234419 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -31,10 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#endif 31#endif
32 32
33#include <sys/file.h> 33#include <sys/file.h>
34#ifdef HAVE_FCNTL_H
35#include <fcntl.h> 34#include <fcntl.h>
36#endif
37#include <string.h>
38 35
39#ifdef HAVE_UNISTD_H 36#ifdef HAVE_UNISTD_H
40#include <unistd.h> 37#include <unistd.h>
diff --git a/src/font.c b/src/font.c
index dee55d1e976..aee6b483353 100644
--- a/src/font.c
+++ b/src/font.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <stdlib.h>
25#include <ctype.h> 24#include <ctype.h>
26#include <setjmp.h> 25#include <setjmp.h>
27 26
@@ -3724,6 +3723,58 @@ font_get_frame_data (FRAME_PTR f, struct font_driver *driver)
3724} 3723}
3725 3724
3726 3725
3726/* Sets attributes on a font. Any properties that appear in ALIST and
3727 BOOLEAN_PROPERTIES or NON_BOOLEAN_PROPERTIES are set on the font.
3728 BOOLEAN_PROPERTIES and NON_BOOLEAN_PROPERTIES are NULL-terminated
3729 arrays of strings. This function is intended for use by the font
3730 drivers to implement their specific font_filter_properties. */
3731void
3732font_filter_properties (Lisp_Object font,
3733 Lisp_Object alist,
3734 const char *boolean_properties[],
3735 const char *non_boolean_properties[])
3736{
3737 Lisp_Object it;
3738 int i;
3739
3740 /* Set boolean values to Qt or Qnil */
3741 for (i = 0; boolean_properties[i] != NULL; ++i)
3742 for (it = alist; ! NILP (it); it = XCDR (it))
3743 {
3744 Lisp_Object key = XCAR (XCAR (it));
3745 Lisp_Object val = XCDR (XCAR (it));
3746 char *keystr = SDATA (SYMBOL_NAME (key));
3747
3748 if (strcmp (boolean_properties[i], keystr) == 0)
3749 {
3750 const char *str = INTEGERP (val) ? (XINT (val) ? "true" : "false")
3751 : SYMBOLP (val) ? (const char *) SDATA (SYMBOL_NAME (val))
3752 : "true";
3753
3754 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0
3755 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0
3756 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0
3757 || strcmp ("Off", str) == 0)
3758 val = Qnil;
3759 else
3760 val = Qt;
3761
3762 Ffont_put (font, key, val);
3763 }
3764 }
3765
3766 for (i = 0; non_boolean_properties[i] != NULL; ++i)
3767 for (it = alist; ! NILP (it); it = XCDR (it))
3768 {
3769 Lisp_Object key = XCAR (XCAR (it));
3770 Lisp_Object val = XCDR (XCAR (it));
3771 char *keystr = SDATA (SYMBOL_NAME (key));
3772 if (strcmp (non_boolean_properties[i], keystr) == 0)
3773 Ffont_put (font, key, val);
3774 }
3775}
3776
3777
3727/* Return the font used to draw character C by FACE at buffer position 3778/* Return the font used to draw character C by FACE at buffer position
3728 POS in window W. If STRING is non-nil, it is a string containing C 3779 POS in window W. If STRING is non-nil, it is a string containing C
3729 at index POS. If C is negative, get C from the current buffer or 3780 at index POS. If C is negative, get C from the current buffer or
@@ -4487,7 +4538,7 @@ DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs,
4487 doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. 4538 doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT.
4488Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), 4539Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID),
4489where 4540where
4490 VARIATION-SELECTOR is a chracter code of variation selection 4541 VARIATION-SELECTOR is a character code of variation selection
4491 (#xFE00..#xFE0F or #xE0100..#xE01EF) 4542 (#xFE00..#xFE0F or #xE0100..#xE01EF)
4492 GLYPH-ID is a glyph code of the corresponding variation glyph. */) 4543 GLYPH-ID is a glyph code of the corresponding variation glyph. */)
4493 (Lisp_Object font_object, Lisp_Object character) 4544 (Lisp_Object font_object, Lisp_Object character)
diff --git a/src/font.h b/src/font.h
index c322b8e590f..b2d7e49fa29 100644
--- a/src/font.h
+++ b/src/font.h
@@ -581,7 +581,7 @@ struct font_driver
581 FONT-ENTITY and it must be opened to check it, return -1. */ 581 FONT-ENTITY and it must be opened to check it, return -1. */
582 int (*has_char) (Lisp_Object font, int c); 582 int (*has_char) (Lisp_Object font, int c);
583 583
584 /* Return a glyph code of FONT for characer C (Unicode code point). 584 /* Return a glyph code of FONT for character C (Unicode code point).
585 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ 585 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */
586 unsigned (*encode_char) (struct font *font, int c); 586 unsigned (*encode_char) (struct font *font, int c);
587 587
@@ -821,6 +821,11 @@ extern int font_put_frame_data (FRAME_PTR f,
821extern void *font_get_frame_data (FRAME_PTR f, 821extern void *font_get_frame_data (FRAME_PTR f,
822 struct font_driver *driver); 822 struct font_driver *driver);
823 823
824extern void font_filter_properties (Lisp_Object font,
825 Lisp_Object alist,
826 const char *boolean_properties[],
827 const char *non_boolean_properties[]);
828
824#ifdef HAVE_FREETYPE 829#ifdef HAVE_FREETYPE
825extern struct font_driver ftfont_driver; 830extern struct font_driver ftfont_driver;
826extern void syms_of_ftfont (void); 831extern void syms_of_ftfont (void);
diff --git a/src/ftfont.c b/src/ftfont.c
index 97bf265a84c..b0d10791379 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -88,7 +88,7 @@ static Lisp_Object ftfont_lookup_cache (Lisp_Object,
88 enum ftfont_cache_for); 88 enum ftfont_cache_for);
89 89
90static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); 90static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist);
91 91
92Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); 92Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
93 93
94#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) 94#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
@@ -260,7 +260,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
260 else 260 else
261 { 261 {
262 /* As this font is not scalable, parhaps this is a BDF or PCF 262 /* As this font is not scalable, parhaps this is a BDF or PCF
263 font. */ 263 font. */
264 FT_Face ft_face; 264 FT_Face ft_face;
265 265
266 ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); 266 ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p));
@@ -2093,7 +2093,7 @@ ftfont_drive_otf (font, spec, in, from, to, out, adjustment)
2093 return to; 2093 return to;
2094} 2094}
2095 2095
2096static int 2096static int
2097ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec, 2097ftfont_try_otf (MFLTFont *font, MFLTOtfSpec *spec,
2098 MFLTGlyphString *in, int from, int to) 2098 MFLTGlyphString *in, int from, int to)
2099{ 2099{
@@ -2645,42 +2645,7 @@ static const char *ftfont_non_booleans [] = {
2645static void 2645static void
2646ftfont_filter_properties (Lisp_Object font, Lisp_Object alist) 2646ftfont_filter_properties (Lisp_Object font, Lisp_Object alist)
2647{ 2647{
2648 Lisp_Object it; 2648 font_filter_properties (font, alist, ftfont_booleans, ftfont_non_booleans);
2649 int i;
2650
2651 /* Set boolean values to Qt or Qnil */
2652 for (i = 0; ftfont_booleans[i] != NULL; ++i)
2653 for (it = alist; ! NILP (it); it = XCDR (it))
2654 {
2655 Lisp_Object key = XCAR (XCAR (it));
2656 Lisp_Object val = XCDR (XCAR (it));
2657 char *keystr = SDATA (SYMBOL_NAME (key));
2658
2659 if (strcmp (ftfont_booleans[i], keystr) == 0)
2660 {
2661 const char *str = SYMBOLP (val) ? SDATA (SYMBOL_NAME (val)) : NULL;
2662 if (INTEGERP (val)) str = XINT (val) != 0 ? "true" : "false";
2663 if (str == NULL) str = "true";
2664
2665 val = Qt;
2666 if (strcmp ("false", str) == 0 || strcmp ("False", str) == 0
2667 || strcmp ("FALSE", str) == 0 || strcmp ("FcFalse", str) == 0
2668 || strcmp ("off", str) == 0 || strcmp ("OFF", str) == 0
2669 || strcmp ("Off", str) == 0)
2670 val = Qnil;
2671 Ffont_put (font, key, val);
2672 }
2673 }
2674
2675 for (i = 0; ftfont_non_booleans[i] != NULL; ++i)
2676 for (it = alist; ! NILP (it); it = XCDR (it))
2677 {
2678 Lisp_Object key = XCAR (XCAR (it));
2679 Lisp_Object val = XCDR (XCAR (it));
2680 char *keystr = SDATA (SYMBOL_NAME (key));
2681 if (strcmp (ftfont_non_booleans[i], keystr) == 0)
2682 Ffont_put (font, key, val);
2683 }
2684} 2649}
2685 2650
2686 2651
diff --git a/src/gnutls.c b/src/gnutls.c
index 37b4341d184..577cca247ee 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -32,7 +32,14 @@ Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again,
32 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; 32 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
33int global_initialized; 33int global_initialized;
34 34
35void 35/* The following are for the property list of `gnutls-boot'. */
36Lisp_Object Qgnutls_bootprop_priority;
37Lisp_Object Qgnutls_bootprop_trustfiles;
38Lisp_Object Qgnutls_bootprop_keyfiles;
39Lisp_Object Qgnutls_bootprop_callbacks;
40Lisp_Object Qgnutls_bootprop_loglevel;
41
42static void
36emacs_gnutls_handshake (struct Lisp_Process *proc) 43emacs_gnutls_handshake (struct Lisp_Process *proc)
37{ 44{
38 gnutls_session_t state = proc->gnutls_state; 45 gnutls_session_t state = proc->gnutls_state;
@@ -43,6 +50,9 @@ emacs_gnutls_handshake (struct Lisp_Process *proc)
43 50
44 if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET) 51 if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET)
45 { 52 {
53 /* This is how GnuTLS takes sockets: as file descriptors passed
54 in. For an Emacs process socket, infd and outfd are the
55 same but we use this two-argument version for clarity. */
46 gnutls_transport_set_ptr2 (state, 56 gnutls_transport_set_ptr2 (state,
47 (gnutls_transport_ptr_t) (long) proc->infd, 57 (gnutls_transport_ptr_t) (long) proc->infd,
48 (gnutls_transport_ptr_t) (long) proc->outfd); 58 (gnutls_transport_ptr_t) (long) proc->outfd);
@@ -67,8 +77,15 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
67 register int rtnval, bytes_written; 77 register int rtnval, bytes_written;
68 gnutls_session_t state = proc->gnutls_state; 78 gnutls_session_t state = proc->gnutls_state;
69 79
70 if (proc->gnutls_initstage != GNUTLS_STAGE_READY) 80 if (proc->gnutls_initstage != GNUTLS_STAGE_READY) {
81#ifdef EWOULDBLOCK
82 errno = EWOULDBLOCK;
83#endif
84#ifdef EAGAIN
85 errno = EAGAIN;
86#endif
71 return -1; 87 return -1;
88 }
72 89
73 bytes_written = 0; 90 bytes_written = 0;
74 91
@@ -76,9 +93,9 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
76 { 93 {
77 rtnval = gnutls_write (state, buf, nbyte); 94 rtnval = gnutls_write (state, buf, nbyte);
78 95
79 if (rtnval == -1) 96 if (rtnval < 0)
80 { 97 {
81 if (errno == EINTR) 98 if (rtnval == GNUTLS_E_AGAIN || rtnval == GNUTLS_E_INTERRUPTED)
82 continue; 99 continue;
83 else 100 else
84 return (bytes_written ? bytes_written : -1); 101 return (bytes_written ? bytes_written : -1);
@@ -88,7 +105,6 @@ emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
88 nbyte -= rtnval; 105 nbyte -= rtnval;
89 bytes_written += rtnval; 106 bytes_written += rtnval;
90 } 107 }
91 fsync (STDOUT_FILENO);
92 108
93 return (bytes_written); 109 return (bytes_written);
94} 110}
@@ -110,14 +126,15 @@ emacs_gnutls_read (int fildes, struct Lisp_Process *proc, char *buf,
110 if (rtnval >= 0) 126 if (rtnval >= 0)
111 return rtnval; 127 return rtnval;
112 else 128 else
113 return 0; 129 return -1;
114} 130}
115 131
116/* convert an integer error to a Lisp_Object; it will be either a 132/* convert an integer error to a Lisp_Object; it will be either a
117 known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or 133 known symbol like `gnutls_e_interrupted' and `gnutls_e_again' or
118 simply the integer value of the error. GNUTLS_E_SUCCESS is mapped 134 simply the integer value of the error. GNUTLS_E_SUCCESS is mapped
119 to Qt. */ 135 to Qt. */
120Lisp_Object gnutls_make_error (int error) 136static Lisp_Object
137gnutls_make_error (int error)
121{ 138{
122 switch (error) 139 switch (error)
123 { 140 {
@@ -135,9 +152,9 @@ Lisp_Object gnutls_make_error (int error)
135} 152}
136 153
137DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0, 154DEFUN ("gnutls-get-initstage", Fgnutls_get_initstage, Sgnutls_get_initstage, 1, 1, 0,
138 doc: /* Return the GnuTLS init stage of PROCESS. 155 doc: /* Return the GnuTLS init stage of process PROC.
139See also `gnutls-boot'. */) 156See also `gnutls-boot'. */)
140 (Lisp_Object proc) 157 (Lisp_Object proc)
141{ 158{
142 CHECK_PROCESS (proc); 159 CHECK_PROCESS (proc);
143 160
@@ -145,19 +162,21 @@ See also `gnutls-boot'. */)
145} 162}
146 163
147DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0, 164DEFUN ("gnutls-errorp", Fgnutls_errorp, Sgnutls_errorp, 1, 1, 0,
148 doc: /* Returns t if ERROR (as generated by gnutls_make_error) 165 doc: /* Return t if ERROR indicates a GnuTLS problem.
149indicates a GnuTLS problem. */) 166ERROR is an integer or a symbol with an integer `gnutls-code' property.
150 (Lisp_Object error) 167usage: (gnutls-errorp ERROR) */)
168 (Lisp_Object err)
151{ 169{
152 if (EQ (error, Qt)) return Qnil; 170 if (EQ (err, Qt)) return Qnil;
153 171
154 return Qt; 172 return Qt;
155} 173}
156 174
157DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0, 175DEFUN ("gnutls-error-fatalp", Fgnutls_error_fatalp, Sgnutls_error_fatalp, 1, 1, 0,
158 doc: /* Checks if ERROR is fatal. 176 doc: /* Check if ERROR is fatal.
159ERROR is an integer or a symbol with an integer `gnutls-code' property. */) 177ERROR is an integer or a symbol with an integer `gnutls-code' property.
160 (Lisp_Object err) 178usage: (gnutls-error-fatalp ERROR) */)
179 (Lisp_Object err)
161{ 180{
162 Lisp_Object code; 181 Lisp_Object code;
163 182
@@ -186,9 +205,10 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
186} 205}
187 206
188DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0, 207DEFUN ("gnutls-error-string", Fgnutls_error_string, Sgnutls_error_string, 1, 1, 0,
189 doc: /* Returns a description of ERROR. 208 doc: /* Return a description of ERROR.
190ERROR is an integer or a symbol with an integer `gnutls-code' property. */) 209ERROR is an integer or a symbol with an integer `gnutls-code' property.
191 (Lisp_Object err) 210usage: (gnutls-error-string ERROR) */)
211 (Lisp_Object err)
192{ 212{
193 Lisp_Object code; 213 Lisp_Object code;
194 214
@@ -214,9 +234,9 @@ ERROR is an integer or a symbol with an integer `gnutls-code' property. */)
214} 234}
215 235
216DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0, 236DEFUN ("gnutls-deinit", Fgnutls_deinit, Sgnutls_deinit, 1, 1, 0,
217 doc: /* Deallocate GNU TLS resources associated with PROCESS. 237 doc: /* Deallocate GnuTLS resources associated with process PROC.
218See also `gnutls-init'. */) 238See also `gnutls-init'. */)
219 (Lisp_Object proc) 239 (Lisp_Object proc)
220{ 240{
221 gnutls_session_t state; 241 gnutls_session_t state;
222 242
@@ -232,10 +252,11 @@ See also `gnutls-init'. */)
232 return Qt; 252 return Qt;
233} 253}
234 254
235/* Initializes global GNU TLS state to defaults. 255/* Initializes global GnuTLS state to defaults.
236Call `gnutls-global-deinit' when GNU TLS usage is no longer needed. 256Call `gnutls-global-deinit' when GnuTLS usage is no longer needed.
237Returns zero on success. */ 257Returns zero on success. */
238Lisp_Object gnutls_emacs_global_init (void) 258static Lisp_Object
259gnutls_emacs_global_init (void)
239{ 260{
240 int ret = GNUTLS_E_SUCCESS; 261 int ret = GNUTLS_E_SUCCESS;
241 262
@@ -247,9 +268,10 @@ Lisp_Object gnutls_emacs_global_init (void)
247 return gnutls_make_error (ret); 268 return gnutls_make_error (ret);
248} 269}
249 270
250/* Deinitializes global GNU TLS state. 271/* Deinitializes global GnuTLS state.
251See also `gnutls-global-init'. */ 272See also `gnutls-global-init'. */
252Lisp_Object gnutls_emacs_global_deinit (void) 273static Lisp_Object
274gnutls_emacs_global_deinit (void)
253{ 275{
254 if (global_initialized) 276 if (global_initialized)
255 gnutls_global_deinit (); 277 gnutls_global_deinit ();
@@ -259,40 +281,48 @@ Lisp_Object gnutls_emacs_global_deinit (void)
259 return gnutls_make_error (GNUTLS_E_SUCCESS); 281 return gnutls_make_error (GNUTLS_E_SUCCESS);
260} 282}
261 283
262static void gnutls_log_function (int level, const char* string) 284static void
285gnutls_log_function (int level, const char* string)
286{
287 message ("gnutls.c: [%d] %s", level, string);
288}
289
290static void
291gnutls_log_function2 (int level, const char* string, const char* extra)
263{ 292{
264 message("gnutls.c: [%d] %s", level, string); 293 message ("gnutls.c: [%d] %s %s", level, string, extra);
265} 294}
266 295
267DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 7, 0, 296DEFUN ("gnutls-boot", Fgnutls_boot, Sgnutls_boot, 3, 3, 0,
268 doc: /* Initializes client-mode GnuTLS for process PROC. 297 doc: /* Initialize GnuTLS client for process PROC with TYPE+PROPLIST.
269Currently only client mode is supported. Returns a success/failure 298Currently only client mode is supported. Returns a success/failure
270value you can check with `gnutls-errorp'. 299value you can check with `gnutls-errorp'.
271 300
272PRIORITY_STRING is a string describing the priority. 301TYPE is a symbol, either `gnutls-anon' or `gnutls-x509pki'.
273TYPE is either `gnutls-anon' or `gnutls-x509pki'. 302PROPLIST is a property list with the following keys:
274TRUSTFILE is a PEM encoded trust file for `gnutls-x509pki'.
275KEYFILE is ... for `gnutls-x509pki' (TODO).
276CALLBACK is ... for `gnutls-x509pki' (TODO).
277LOGLEVEL is the debug level requested from GnuTLS, try 4.
278 303
279LOGLEVEL will be set for this process AND globally for GnuTLS. So if 304:priority is a GnuTLS priority string, defaults to "NORMAL".
280you set it higher or lower at any point, it affects global debugging. 305:trustfiles is a list of PEM-encoded trust files for `gnutls-x509pki'.
306:keyfiles is a list of PEM-encoded key files for `gnutls-x509pki'.
307:callbacks is an alist of callback functions (TODO).
308:loglevel is the debug level requested from GnuTLS, try 4.
309
310The debug level will be set for this process AND globally for GnuTLS.
311So if you set it higher or lower at any point, it affects global
312debugging.
281 313
282Note that the priority is set on the client. The server does not use 314Note that the priority is set on the client. The server does not use
283the protocols's priority except for disabling protocols that were not 315the protocols's priority except for disabling protocols that were not
284specified. 316specified.
285 317
286Processes must be initialized with this function before other GNU TLS 318Processes must be initialized with this function before other GnuTLS
287functions are used. This function allocates resources which can only 319functions are used. This function allocates resources which can only
288be deallocated by calling `gnutls-deinit' or by calling it again. 320be deallocated by calling `gnutls-deinit' or by calling it again.
289 321
290Each authentication type may need additional information in order to 322Each authentication type may need additional information in order to
291work. For X.509 PKI (`gnutls-x509pki'), you need TRUSTFILE and 323work. For X.509 PKI (`gnutls-x509pki'), you probably need at least
292KEYFILE and optionally CALLBACK. */) 324one trustfile (usually a CA bundle). */)
293 (Lisp_Object proc, Lisp_Object priority_string, Lisp_Object type, 325 (Lisp_Object proc, Lisp_Object type, Lisp_Object proplist)
294 Lisp_Object trustfile, Lisp_Object keyfile, Lisp_Object callback,
295 Lisp_Object loglevel)
296{ 326{
297 int ret = GNUTLS_E_SUCCESS; 327 int ret = GNUTLS_E_SUCCESS;
298 328
@@ -305,10 +335,25 @@ KEYFILE and optionally CALLBACK. */)
305 gnutls_certificate_credentials_t x509_cred; 335 gnutls_certificate_credentials_t x509_cred;
306 gnutls_anon_client_credentials_t anon_cred; 336 gnutls_anon_client_credentials_t anon_cred;
307 Lisp_Object global_init; 337 Lisp_Object global_init;
338 char* priority_string_ptr = "NORMAL"; /* default priority string. */
339 Lisp_Object tail;
340
341 /* Placeholders for the property list elements. */
342 Lisp_Object priority_string;
343 Lisp_Object trustfiles;
344 Lisp_Object keyfiles;
345 Lisp_Object callbacks;
346 Lisp_Object loglevel;
308 347
309 CHECK_PROCESS (proc); 348 CHECK_PROCESS (proc);
310 CHECK_SYMBOL (type); 349 CHECK_SYMBOL (type);
311 CHECK_STRING (priority_string); 350 CHECK_LIST (proplist);
351
352 priority_string = Fplist_get (proplist, Qgnutls_bootprop_priority);
353 trustfiles = Fplist_get (proplist, Qgnutls_bootprop_trustfiles);
354 keyfiles = Fplist_get (proplist, Qgnutls_bootprop_keyfiles);
355 callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks);
356 loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel);
312 357
313 state = XPROCESS (proc)->gnutls_state; 358 state = XPROCESS (proc)->gnutls_state;
314 XPROCESS (proc)->gnutls_p = 1; 359 XPROCESS (proc)->gnutls_p = 1;
@@ -387,29 +432,49 @@ KEYFILE and optionally CALLBACK. */)
387 432
388 if (EQ (type, Qgnutls_x509pki)) 433 if (EQ (type, Qgnutls_x509pki))
389 { 434 {
390 if (STRINGP (trustfile)) 435 for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail))
391 { 436 {
392 GNUTLS_LOG (1, max_log_level, "setting the trustfile"); 437 Lisp_Object trustfile = Fcar (tail);
393 ret = gnutls_certificate_set_x509_trust_file 438 if (STRINGP (trustfile))
394 (x509_cred, 439 {
395 SDATA (trustfile), 440 GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ",
396 file_format); 441 SDATA (trustfile));
397 442 ret = gnutls_certificate_set_x509_trust_file
398 if (ret < GNUTLS_E_SUCCESS) 443 (x509_cred,
399 return gnutls_make_error (ret); 444 SDATA (trustfile),
400 } 445 file_format);
446
447 if (ret < GNUTLS_E_SUCCESS)
448 return gnutls_make_error (ret);
449 }
450 else
451 {
452 error ("Sorry, GnuTLS can't use non-string trustfile %s",
453 trustfile);
454 }
455 }
401 456
402 if (STRINGP (keyfile)) 457 for (tail = keyfiles; !NILP (tail); tail = Fcdr (tail))
403 { 458 {
404 GNUTLS_LOG (1, max_log_level, "setting the keyfile"); 459 Lisp_Object keyfile = Fcar (tail);
405 ret = gnutls_certificate_set_x509_crl_file 460 if (STRINGP (keyfile))
406 (x509_cred, 461 {
407 SDATA (keyfile), 462 GNUTLS_LOG2 (1, max_log_level, "setting the keyfile: ",
408 file_format); 463 SDATA (keyfile));
409 464 ret = gnutls_certificate_set_x509_crl_file
410 if (ret < GNUTLS_E_SUCCESS) 465 (x509_cred,
411 return gnutls_make_error (ret); 466 SDATA (keyfile),
412 } 467 file_format);
468
469 if (ret < GNUTLS_E_SUCCESS)
470 return gnutls_make_error (ret);
471 }
472 else
473 {
474 error ("Sorry, GnuTLS can't use non-string keyfile %s",
475 keyfile);
476 }
477 }
413 } 478 }
414 479
415 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_FILES; 480 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_FILES;
@@ -425,11 +490,23 @@ KEYFILE and optionally CALLBACK. */)
425 490
426 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_INIT; 491 GNUTLS_INITSTAGE (proc) = GNUTLS_STAGE_INIT;
427 492
493 if (STRINGP (priority_string))
494 {
495 priority_string_ptr = (char*) SDATA (priority_string);
496 GNUTLS_LOG2 (1, max_log_level, "got non-default priority string:",
497 priority_string_ptr);
498 }
499 else
500 {
501 GNUTLS_LOG2 (1, max_log_level, "using default priority string:",
502 priority_string_ptr);
503 }
504
428 GNUTLS_LOG (1, max_log_level, "setting the priority string"); 505 GNUTLS_LOG (1, max_log_level, "setting the priority string");
429 506
430 ret = gnutls_priority_set_direct(state, 507 ret = gnutls_priority_set_direct (state,
431 (char*) SDATA (priority_string), 508 priority_string_ptr,
432 NULL); 509 NULL);
433 510
434 if (ret < GNUTLS_E_SUCCESS) 511 if (ret < GNUTLS_E_SUCCESS)
435 return gnutls_make_error (ret); 512 return gnutls_make_error (ret);
@@ -466,11 +543,11 @@ KEYFILE and optionally CALLBACK. */)
466 543
467DEFUN ("gnutls-bye", Fgnutls_bye, 544DEFUN ("gnutls-bye", Fgnutls_bye,
468 Sgnutls_bye, 2, 2, 0, 545 Sgnutls_bye, 2, 2, 0,
469 doc: /* Terminate current GNU TLS connection for PROCESS. 546 doc: /* Terminate current GnuTLS connection for process PROC.
470The connection should have been initiated using `gnutls-handshake'. 547The connection should have been initiated using `gnutls-handshake'.
471 548
472If CONT is not nil the TLS connection gets terminated and further 549If CONT is not nil the TLS connection gets terminated and further
473receives and sends will be disallowed. If the return value is zero you 550receives and sends will be disallowed. If the return value is zero you
474may continue using the connection. If CONT is nil, GnuTLS actually 551may continue using the connection. If CONT is nil, GnuTLS actually
475sends an alert containing a close request and waits for the peer to 552sends an alert containing a close request and waits for the peer to
476reply with the same message. In order to reuse the connection you 553reply with the same message. In order to reuse the connection you
@@ -507,6 +584,21 @@ syms_of_gnutls (void)
507 Qgnutls_x509pki = intern_c_string ("gnutls-x509pki"); 584 Qgnutls_x509pki = intern_c_string ("gnutls-x509pki");
508 staticpro (&Qgnutls_x509pki); 585 staticpro (&Qgnutls_x509pki);
509 586
587 Qgnutls_bootprop_priority = intern_c_string (":priority");
588 staticpro (&Qgnutls_bootprop_priority);
589
590 Qgnutls_bootprop_trustfiles = intern_c_string (":trustfiles");
591 staticpro (&Qgnutls_bootprop_trustfiles);
592
593 Qgnutls_bootprop_keyfiles = intern_c_string (":keyfiles");
594 staticpro (&Qgnutls_bootprop_keyfiles);
595
596 Qgnutls_bootprop_callbacks = intern_c_string (":callbacks");
597 staticpro (&Qgnutls_bootprop_callbacks);
598
599 Qgnutls_bootprop_loglevel = intern_c_string (":loglevel");
600 staticpro (&Qgnutls_bootprop_loglevel);
601
510 Qgnutls_e_interrupted = intern_c_string ("gnutls-e-interrupted"); 602 Qgnutls_e_interrupted = intern_c_string ("gnutls-e-interrupted");
511 staticpro (&Qgnutls_e_interrupted); 603 staticpro (&Qgnutls_e_interrupted);
512 Fput (Qgnutls_e_interrupted, Qgnutls_code, 604 Fput (Qgnutls_e_interrupted, Qgnutls_code,
diff --git a/src/gnutls.h b/src/gnutls.h
index bcf9776963f..2669317e97a 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -48,6 +48,8 @@ typedef enum
48 48
49#define GNUTLS_LOG(level, max, string) if (level <= max) { gnutls_log_function (level, "(Emacs) " string); } 49#define GNUTLS_LOG(level, max, string) if (level <= max) { gnutls_log_function (level, "(Emacs) " string); }
50 50
51#define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); }
52
51int 53int
52emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf, 54emacs_gnutls_write (int fildes, struct Lisp_Process *proc, char *buf,
53 unsigned int nbyte); 55 unsigned int nbyte);
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f82be62965d..3b7e6888753 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21 21
22#ifdef USE_GTK 22#ifdef USE_GTK
23#include <string.h>
24#include <signal.h> 23#include <signal.h>
25#include <stdio.h> 24#include <stdio.h>
26#include <setjmp.h> 25#include <setjmp.h>
diff --git a/src/image.c b/src/image.c
index 3c74c516d3f..4cdd7f2bbab 100644
--- a/src/image.c
+++ b/src/image.c
@@ -567,10 +567,6 @@ static struct image_type *image_types;
567 567
568Lisp_Object Vimage_types; 568Lisp_Object Vimage_types;
569 569
570/* An alist of image types and libraries that implement the type. */
571
572Lisp_Object Vimage_library_alist;
573
574/* Cache for delayed-loading image types. */ 570/* Cache for delayed-loading image types. */
575 571
576static Lisp_Object Vimage_type_cache; 572static Lisp_Object Vimage_type_cache;
@@ -645,7 +641,7 @@ lookup_image_type (Lisp_Object symbol)
645 struct image_type *type; 641 struct image_type *type;
646 642
647 /* We must initialize the image-type if it hasn't been already. */ 643 /* We must initialize the image-type if it hasn't been already. */
648 if (NILP (Finit_image_library (symbol, Vimage_library_alist))) 644 if (NILP (Finit_image_library (symbol, Vdynamic_library_alist)))
649 return 0; /* unimplemented */ 645 return 0; /* unimplemented */
650 646
651 for (type = image_types; type; type = type->next) 647 for (type = image_types; type; type = type->next)
@@ -1914,7 +1910,7 @@ mark_image_cache (struct image_cache *c)
1914#ifdef HAVE_NTGUI 1910#ifdef HAVE_NTGUI
1915 1911
1916/* Macro for defining functions that will be loaded from image DLLs. */ 1912/* Macro for defining functions that will be loaded from image DLLs. */
1917#define DEF_IMGLIB_FN(func) int (FAR CDECL *fn_##func)() 1913#define DEF_IMGLIB_FN(func,args) int (FAR CDECL *fn_##func)args
1918 1914
1919/* Macro for loading those image functions from the library. */ 1915/* Macro for loading those image functions from the library. */
1920#define LOAD_IMGLIB_FN(lib,func) { \ 1916#define LOAD_IMGLIB_FN(lib,func) { \
@@ -1923,10 +1919,11 @@ mark_image_cache (struct image_cache *c)
1923 } 1919 }
1924 1920
1925/* Load a DLL implementing an image type. 1921/* Load a DLL implementing an image type.
1926 The `image-library-alist' variable associates a symbol, 1922 The argument LIBRARIES is usually the variable
1927 identifying an image type, to a list of possible filenames. 1923 `dynamic-library-alist', which associates a symbol, identifying
1924 an external DLL library, to a list of possible filenames.
1928 The function returns NULL if no library could be loaded for 1925 The function returns NULL if no library could be loaded for
1929 the given image type, or if the library was previously loaded; 1926 the given symbol, or if the library was previously loaded;
1930 else the handle of the DLL. */ 1927 else the handle of the DLL. */
1931static HMODULE 1928static HMODULE
1932w32_delayed_load (Lisp_Object libraries, Lisp_Object type) 1929w32_delayed_load (Lisp_Object libraries, Lisp_Object type)
@@ -3268,10 +3265,12 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *
3268 3265
3269/* XPM library details. */ 3266/* XPM library details. */
3270 3267
3271DEF_IMGLIB_FN (XpmFreeAttributes); 3268DEF_IMGLIB_FN (XpmFreeAttributes, (XpmAttributes *));
3272DEF_IMGLIB_FN (XpmCreateImageFromBuffer); 3269DEF_IMGLIB_FN (XpmCreateImageFromBuffer, (Display *, char *, xpm_XImage **,
3273DEF_IMGLIB_FN (XpmReadFileToImage); 3270 xpm_XImage **, XpmAttributes *));
3274DEF_IMGLIB_FN (XImageFree); 3271DEF_IMGLIB_FN (XpmReadFileToImage, (Display *, char *, xpm_XImage **,
3272 xpm_XImage **, XpmAttributes *));
3273DEF_IMGLIB_FN (XImageFree, (xpm_XImage *));
3275 3274
3276static int 3275static int
3277init_xpm_functions (Lisp_Object libraries) 3276init_xpm_functions (Lisp_Object libraries)
@@ -5439,27 +5438,31 @@ png_image_p (Lisp_Object object)
5439#ifdef HAVE_NTGUI 5438#ifdef HAVE_NTGUI
5440/* PNG library details. */ 5439/* PNG library details. */
5441 5440
5442DEF_IMGLIB_FN (png_get_io_ptr); 5441DEF_IMGLIB_FN (png_get_io_ptr, (png_structp));
5443DEF_IMGLIB_FN (png_sig_cmp); 5442DEF_IMGLIB_FN (png_sig_cmp, (png_bytep, png_size_t, png_size_t));
5444DEF_IMGLIB_FN (png_create_read_struct); 5443DEF_IMGLIB_FN (png_create_read_struct, (png_const_charp, png_voidp,
5445DEF_IMGLIB_FN (png_create_info_struct); 5444 png_error_ptr, png_error_ptr));
5446DEF_IMGLIB_FN (png_destroy_read_struct); 5445DEF_IMGLIB_FN (png_create_info_struct, (png_structp));
5447DEF_IMGLIB_FN (png_set_read_fn); 5446DEF_IMGLIB_FN (png_destroy_read_struct, (png_structpp, png_infopp, png_infopp));
5448DEF_IMGLIB_FN (png_set_sig_bytes); 5447DEF_IMGLIB_FN (png_set_read_fn, (png_structp, png_voidp, png_rw_ptr));
5449DEF_IMGLIB_FN (png_read_info); 5448DEF_IMGLIB_FN (png_set_sig_bytes, (png_structp, int));
5450DEF_IMGLIB_FN (png_get_IHDR); 5449DEF_IMGLIB_FN (png_read_info, (png_structp, png_infop));
5451DEF_IMGLIB_FN (png_get_valid); 5450DEF_IMGLIB_FN (png_get_IHDR, (png_structp, png_infop,
5452DEF_IMGLIB_FN (png_set_strip_16); 5451 png_uint_32 *, png_uint_32 *,
5453DEF_IMGLIB_FN (png_set_expand); 5452 int *, int *, int *, int *, int *));
5454DEF_IMGLIB_FN (png_set_gray_to_rgb); 5453DEF_IMGLIB_FN (png_get_valid, (png_structp, png_infop, png_uint_32));
5455DEF_IMGLIB_FN (png_set_background); 5454DEF_IMGLIB_FN (png_set_strip_16, (png_structp));
5456DEF_IMGLIB_FN (png_get_bKGD); 5455DEF_IMGLIB_FN (png_set_expand, (png_structp));
5457DEF_IMGLIB_FN (png_read_update_info); 5456DEF_IMGLIB_FN (png_set_gray_to_rgb, (png_structp));
5458DEF_IMGLIB_FN (png_get_channels); 5457DEF_IMGLIB_FN (png_set_background, (png_structp, png_color_16p,
5459DEF_IMGLIB_FN (png_get_rowbytes); 5458 int, int, double));
5460DEF_IMGLIB_FN (png_read_image); 5459DEF_IMGLIB_FN (png_get_bKGD, (png_structp, png_infop, png_color_16p *));
5461DEF_IMGLIB_FN (png_read_end); 5460DEF_IMGLIB_FN (png_read_update_info, (png_structp, png_infop));
5462DEF_IMGLIB_FN (png_error); 5461DEF_IMGLIB_FN (png_get_channels, (png_structp, png_infop));
5462DEF_IMGLIB_FN (png_get_rowbytes, (png_structp, png_infop));
5463DEF_IMGLIB_FN (png_read_image, (png_structp, png_bytepp));
5464DEF_IMGLIB_FN (png_read_end, (png_structp, png_infop));
5465DEF_IMGLIB_FN (png_error, (png_structp, png_const_charp));
5463 5466
5464static int 5467static int
5465init_png_functions (Lisp_Object libraries) 5468init_png_functions (Lisp_Object libraries)
@@ -6042,14 +6045,14 @@ jpeg_image_p (Lisp_Object object)
6042#ifdef HAVE_NTGUI 6045#ifdef HAVE_NTGUI
6043 6046
6044/* JPEG library details. */ 6047/* JPEG library details. */
6045DEF_IMGLIB_FN (jpeg_CreateDecompress); 6048DEF_IMGLIB_FN (jpeg_CreateDecompress, (j_decompress_ptr, int, size_t));
6046DEF_IMGLIB_FN (jpeg_start_decompress); 6049DEF_IMGLIB_FN (jpeg_start_decompress, (j_decompress_ptr));
6047DEF_IMGLIB_FN (jpeg_finish_decompress); 6050DEF_IMGLIB_FN (jpeg_finish_decompress, (j_decompress_ptr));
6048DEF_IMGLIB_FN (jpeg_destroy_decompress); 6051DEF_IMGLIB_FN (jpeg_destroy_decompress, (j_decompress_ptr));
6049DEF_IMGLIB_FN (jpeg_read_header); 6052DEF_IMGLIB_FN (jpeg_read_header, (j_decompress_ptr, boolean));
6050DEF_IMGLIB_FN (jpeg_read_scanlines); 6053DEF_IMGLIB_FN (jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, JDIMENSION));
6051DEF_IMGLIB_FN (jpeg_std_error); 6054DEF_IMGLIB_FN (jpeg_std_error, (struct jpeg_error_mgr *));
6052DEF_IMGLIB_FN (jpeg_resync_to_restart); 6055DEF_IMGLIB_FN (jpeg_resync_to_restart, (j_decompress_ptr, int));
6053 6056
6054static int 6057static int
6055init_jpeg_functions (Lisp_Object libraries) 6058init_jpeg_functions (Lisp_Object libraries)
@@ -6575,14 +6578,17 @@ tiff_image_p (Lisp_Object object)
6575#ifdef HAVE_NTGUI 6578#ifdef HAVE_NTGUI
6576 6579
6577/* TIFF library details. */ 6580/* TIFF library details. */
6578DEF_IMGLIB_FN (TIFFSetErrorHandler); 6581DEF_IMGLIB_FN (TIFFSetErrorHandler, (TIFFErrorHandler));
6579DEF_IMGLIB_FN (TIFFSetWarningHandler); 6582DEF_IMGLIB_FN (TIFFSetWarningHandler, (TIFFErrorHandler));
6580DEF_IMGLIB_FN (TIFFOpen); 6583DEF_IMGLIB_FN (TIFFOpen, (const char *, const char *));
6581DEF_IMGLIB_FN (TIFFClientOpen); 6584DEF_IMGLIB_FN (TIFFClientOpen, (const char *, const char *, thandle_t,
6582DEF_IMGLIB_FN (TIFFGetField); 6585 TIFFReadWriteProc, TIFFReadWriteProc,
6583DEF_IMGLIB_FN (TIFFReadRGBAImage); 6586 TIFFSeekProc, TIFFCloseProc, TIFFSizeProc,
6584DEF_IMGLIB_FN (TIFFClose); 6587 TIFFMapFileProc, TIFFUnmapFileProc));
6585DEF_IMGLIB_FN (TIFFSetDirectory); 6588DEF_IMGLIB_FN (TIFFGetField, (TIFF *, ttag_t, ...));
6589DEF_IMGLIB_FN (TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int));
6590DEF_IMGLIB_FN (TIFFClose, (TIFF *));
6591DEF_IMGLIB_FN (TIFFSetDirectory, (TIFF *, tdir_t));
6586 6592
6587static int 6593static int
6588init_tiff_functions (Lisp_Object libraries) 6594init_tiff_functions (Lisp_Object libraries)
@@ -6787,8 +6793,9 @@ tiff_load (struct frame *f, struct image *img)
6787 memsrc.len = SBYTES (specified_data); 6793 memsrc.len = SBYTES (specified_data);
6788 memsrc.index = 0; 6794 memsrc.index = 0;
6789 6795
6790 /* Casting return value avoids a GCC warning on W32. */ 6796 /* Casting arguments return value avoids a GCC warning on W32. */
6791 tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", &memsrc, 6797 tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r",
6798 (thandle_t) &memsrc,
6792 (TIFFReadWriteProc) tiff_read_from_memory, 6799 (TIFFReadWriteProc) tiff_read_from_memory,
6793 (TIFFReadWriteProc) tiff_write_from_memory, 6800 (TIFFReadWriteProc) tiff_write_from_memory,
6794 tiff_seek_in_memory, 6801 tiff_seek_in_memory,
@@ -7024,10 +7031,10 @@ gif_image_p (Lisp_Object object)
7024#ifdef HAVE_NTGUI 7031#ifdef HAVE_NTGUI
7025 7032
7026/* GIF library details. */ 7033/* GIF library details. */
7027DEF_IMGLIB_FN (DGifCloseFile); 7034DEF_IMGLIB_FN (DGifCloseFile, (GifFileType *));
7028DEF_IMGLIB_FN (DGifSlurp); 7035DEF_IMGLIB_FN (DGifSlurp, (GifFileType *));
7029DEF_IMGLIB_FN (DGifOpen); 7036DEF_IMGLIB_FN (DGifOpen, (void *, InputFunc));
7030DEF_IMGLIB_FN (DGifOpenFileName); 7037DEF_IMGLIB_FN (DGifOpenFileName, (const char *));
7031 7038
7032static int 7039static int
7033init_gif_functions (Lisp_Object libraries) 7040init_gif_functions (Lisp_Object libraries)
@@ -8583,7 +8590,7 @@ Return non-nil if TYPE is a supported image type.
8583 8590
8584Image types pbm and xbm are prebuilt; other types are loaded here. 8591Image types pbm and xbm are prebuilt; other types are loaded here.
8585Libraries to load are specified in alist LIBRARIES (usually, the value 8592Libraries to load are specified in alist LIBRARIES (usually, the value
8586of `image-library-alist', which see). */) 8593of `dynamic-library-alist', which see). */)
8587 (Lisp_Object type, Lisp_Object libraries) 8594 (Lisp_Object type, Lisp_Object libraries)
8588{ 8595{
8589 Lisp_Object tested; 8596 Lisp_Object tested;
@@ -8659,20 +8666,6 @@ Each element of the list is a symbol for an image type, like 'jpeg or 'png.
8659To check whether it is really supported, use `image-type-available-p'. */); 8666To check whether it is really supported, use `image-type-available-p'. */);
8660 Vimage_types = Qnil; 8667 Vimage_types = Qnil;
8661 8668
8662 DEFVAR_LISP ("image-library-alist", &Vimage_library_alist,
8663 doc: /* Alist of image types vs external libraries needed to display them.
8664
8665Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol
8666representing a supported image type, and the rest are strings giving
8667alternate filenames for the corresponding external libraries.
8668
8669Emacs tries to load the libraries in the order they appear on the
8670list; if none is loaded, the running session of Emacs won't
8671support the image type. Types 'pbm and 'xbm don't need to be
8672listed; they are always supported. */);
8673 Vimage_library_alist = Qnil;
8674 Fput (intern_c_string ("image-library-alist"), Qrisky_local_variable, Qt);
8675
8676 DEFVAR_LISP ("max-image-size", &Vmax_image_size, 8669 DEFVAR_LISP ("max-image-size", &Vmax_image_size,
8677 doc: /* Maximum size of images. 8670 doc: /* Maximum size of images.
8678Emacs will not load an image into memory if its pixel width or 8671Emacs will not load an image into memory if its pixel width or
@@ -8718,11 +8711,11 @@ non-numeric, there is no explicit limit on the size of images. */);
8718 staticpro (&QCheuristic_mask); 8711 staticpro (&QCheuristic_mask);
8719 QCindex = intern_c_string (":index"); 8712 QCindex = intern_c_string (":index");
8720 staticpro (&QCindex); 8713 staticpro (&QCindex);
8721 QCgeometry = intern (":geometry"); 8714 QCgeometry = intern_c_string (":geometry");
8722 staticpro (&QCgeometry); 8715 staticpro (&QCgeometry);
8723 QCcrop = intern (":crop"); 8716 QCcrop = intern_c_string (":crop");
8724 staticpro (&QCcrop); 8717 staticpro (&QCcrop);
8725 QCrotation = intern (":rotation"); 8718 QCrotation = intern_c_string (":rotation");
8726 staticpro (&QCrotation); 8719 staticpro (&QCrotation);
8727 QCmatrix = intern_c_string (":matrix"); 8720 QCmatrix = intern_c_string (":matrix");
8728 staticpro (&QCmatrix); 8721 staticpro (&QCmatrix);
@@ -8785,7 +8778,7 @@ non-numeric, there is no explicit limit on the size of images. */);
8785#endif 8778#endif
8786 8779
8787#if defined (HAVE_IMAGEMAGICK) 8780#if defined (HAVE_IMAGEMAGICK)
8788 Qimagemagick = intern ("imagemagick"); 8781 Qimagemagick = intern_c_string ("imagemagick");
8789 staticpro (&Qimagemagick); 8782 staticpro (&Qimagemagick);
8790 ADD_IMAGE_TYPE (Qimagemagick); 8783 ADD_IMAGE_TYPE (Qimagemagick);
8791#endif 8784#endif
diff --git a/src/keyboard.c b/src/keyboard.c
index b77689bde06..7f770ae4df1 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -62,9 +62,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
62#include <unistd.h> 62#include <unistd.h>
63#endif 63#endif
64 64
65#ifdef HAVE_FCNTL_H
66#include <fcntl.h> 65#include <fcntl.h>
67#endif
68 66
69/* This is to get the definitions of the XK_ symbols. */ 67/* This is to get the definitions of the XK_ symbols. */
70#ifdef HAVE_X_WINDOWS 68#ifdef HAVE_X_WINDOWS
@@ -647,18 +645,6 @@ static int store_user_signal_events (void);
647static int cannot_suspend; 645static int cannot_suspend;
648 646
649 647
650/* Install the string STR as the beginning of the string of echoing,
651 so that it serves as a prompt for the next character.
652 Also start echoing. */
653
654void
655echo_prompt (Lisp_Object str)
656{
657 current_kboard->echo_string = str;
658 current_kboard->echo_after_prompt = SCHARS (str);
659 echo_now ();
660}
661
662/* Add C to the echo string, if echoing is going on. 648/* Add C to the echo string, if echoing is going on.
663 C can be a character, which is printed prettily ("M-C-x" and all that 649 C can be a character, which is printed prettily ("M-C-x" and all that
664 jazz), or a symbol, whose name is printed. */ 650 jazz), or a symbol, whose name is printed. */
@@ -757,6 +743,9 @@ echo_dash (void)
757 if (NILP (current_kboard->echo_string)) 743 if (NILP (current_kboard->echo_string))
758 return; 744 return;
759 745
746 if (this_command_key_count == 0)
747 return;
748
760 if (!current_kboard->immediate_echo 749 if (!current_kboard->immediate_echo
761 && SCHARS (current_kboard->echo_string) == 0) 750 && SCHARS (current_kboard->echo_string) == 0)
762 return; 751 return;
@@ -1786,7 +1775,8 @@ command_loop_1 (void)
1786 this_single_command_key_start = 0; 1775 this_single_command_key_start = 0;
1787 } 1776 }
1788 1777
1789 if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) 1778 if (!NILP (current_buffer->mark_active)
1779 && !NILP (Vrun_hooks))
1790 { 1780 {
1791 /* In Emacs 22, setting transient-mark-mode to `only' was a 1781 /* In Emacs 22, setting transient-mark-mode to `only' was a
1792 way of turning it on for just one command. This usage is 1782 way of turning it on for just one command. This usage is
@@ -1805,6 +1795,9 @@ command_loop_1 (void)
1805 /* Even if not deactivating the mark, set PRIMARY if 1795 /* Even if not deactivating the mark, set PRIMARY if
1806 `select-active-regions' is non-nil. */ 1796 `select-active-regions' is non-nil. */
1807 if (!NILP (Fwindow_system (Qnil)) 1797 if (!NILP (Fwindow_system (Qnil))
1798 /* Even if mark_active is non-nil, the actual buffer
1799 marker may not have been set yet (Bug#7044). */
1800 && XMARKER (current_buffer->mark)->buffer
1808 && (EQ (Vselect_active_regions, Qonly) 1801 && (EQ (Vselect_active_regions, Qonly)
1809 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 1802 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
1810 : (!NILP (Vselect_active_regions) 1803 : (!NILP (Vselect_active_regions)
@@ -9123,7 +9116,14 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9123 if (INTERACTIVE) 9116 if (INTERACTIVE)
9124 { 9117 {
9125 if (!NILP (prompt)) 9118 if (!NILP (prompt))
9126 echo_prompt (prompt); 9119 {
9120 /* Install the string STR as the beginning of the string of
9121 echoing, so that it serves as a prompt for the next
9122 character. */
9123 current_kboard->echo_string = prompt;
9124 current_kboard->echo_after_prompt = SCHARS (prompt);
9125 echo_now ();
9126 }
9127 else if (cursor_in_echo_area 9127 else if (cursor_in_echo_area
9128 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes)) 9128 && (FLOATP (Vecho_keystrokes) || INTEGERP (Vecho_keystrokes))
9129 && NILP (Fzerop (Vecho_keystrokes))) 9129 && NILP (Fzerop (Vecho_keystrokes)))
diff --git a/src/lisp.h b/src/lisp.h
index d942e792957..89d01ec6872 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3328,6 +3328,7 @@ extern Lisp_Object Vbefore_init_time, Vafter_init_time;
3328extern Lisp_Object Vinstallation_directory; 3328extern Lisp_Object Vinstallation_directory;
3329extern Lisp_Object empty_unibyte_string, empty_multibyte_string; 3329extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
3330extern Lisp_Object Qfile_name_handler_alist; 3330extern Lisp_Object Qfile_name_handler_alist;
3331extern Lisp_Object Vdynamic_library_alist;
3331extern void (*fatal_error_signal_hook) (void); 3332extern void (*fatal_error_signal_hook) (void);
3332EXFUN (Fkill_emacs, 1) NO_RETURN; 3333EXFUN (Fkill_emacs, 1) NO_RETURN;
3333#if HAVE_SETLOCALE 3334#if HAVE_SETLOCALE
diff --git a/src/lread.c b/src/lread.c
index 64633a6e442..e150078f6e2 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -54,12 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54#include <locale.h> 54#include <locale.h>
55#endif /* HAVE_SETLOCALE */ 55#endif /* HAVE_SETLOCALE */
56 56
57#ifdef HAVE_FCNTL_H
58#include <fcntl.h> 57#include <fcntl.h>
59#endif
60#ifndef O_RDONLY
61#define O_RDONLY 0
62#endif
63 58
64#ifdef HAVE_FSEEKO 59#ifdef HAVE_FSEEKO
65#define file_offset off_t 60#define file_offset off_t
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 752a3c211b3..21bdeb8443f 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -37,7 +37,7 @@ TEMACS = $(BLD)/temacs.exe
37TEMACS_TMP = $(BLD)/temacs.bin 37TEMACS_TMP = $(BLD)/temacs.bin
38TLIB0 = $(BLD)/temacs0.$(A) 38TLIB0 = $(BLD)/temacs0.$(A)
39TLIB1 = $(BLD)/temacs1.$(A) 39TLIB1 = $(BLD)/temacs1.$(A)
40TLIBW32 = $(BLD)/temacw32.$(A) 40TLIB2 = $(BLD)/temacs2.$(A)
41TOBJ = $(BLD)/firstfile.$(O) 41TOBJ = $(BLD)/firstfile.$(O)
42TRES = $(BLD)/emacs.res 42TRES = $(BLD)/emacs.res
43TLASTLIB = $(BLD)/lastfile.$(A) 43TLASTLIB = $(BLD)/lastfile.$(A)
@@ -94,8 +94,9 @@ OBJ1 = $(BLD)/alloc.$(O) \
94 $(BLD)/scroll.$(O) \ 94 $(BLD)/scroll.$(O) \
95 $(BLD)/search.$(O) \ 95 $(BLD)/search.$(O) \
96 $(BLD)/sound.$(O) \ 96 $(BLD)/sound.$(O) \
97 $(BLD)/syntax.$(O) \ 97 $(BLD)/syntax.$(O)
98 $(BLD)/sysdep.$(O) \ 98
99OBJ2 = $(BLD)/sysdep.$(O) \
99 $(BLD)/term.$(O) \ 100 $(BLD)/term.$(O) \
100 $(BLD)/tparam.$(O) \ 101 $(BLD)/tparam.$(O) \
101 $(BLD)/undo.$(O) \ 102 $(BLD)/undo.$(O) \
@@ -125,28 +126,27 @@ OBJ1 = $(BLD)/alloc.$(O) \
125 $(BLD)/fringe.$(O) \ 126 $(BLD)/fringe.$(O) \
126 $(BLD)/image.$(O) \ 127 $(BLD)/image.$(O) \
127 $(BLD)/terminal.$(O) \ 128 $(BLD)/terminal.$(O) \
128 $(BLD)/menu.$(O) 129 $(BLD)/menu.$(O) \
129 130 $(BLD)/w32term.$(O) \
130WIN32OBJ = $(BLD)/w32term.$(O) \ 131 $(BLD)/w32xfns.$(O) \
131 $(BLD)/w32xfns.$(O) \ 132 $(BLD)/w32fns.$(O) \
132 $(BLD)/w32fns.$(O) \ 133 $(BLD)/xfaces.$(O) \
133 $(BLD)/xfaces.$(O) \ 134 $(BLD)/w32select.$(O) \
134 $(BLD)/w32select.$(O) \ 135 $(BLD)/w32menu.$(O) \
135 $(BLD)/w32menu.$(O) \ 136 $(BLD)/w32reg.$(O) \
136 $(BLD)/w32reg.$(O) 137 $(BLD)/w32font.$(O) \
137 138 $(BLD)/w32uniscribe.$(O)
138FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
139 139
140LIBS = $(TLIB0) \ 140LIBS = $(TLIB0) \
141 $(TLIB1) \ 141 $(TLIB1) \
142 $(TLIBW32) \ 142 $(TLIB2) \
143 $(TLASTLIB) \ 143 $(TLASTLIB) \
144 $(WINMM) \ 144 $(WINMM) \
145 $(ADVAPI32) \ 145 $(ADVAPI32) \
146 $(GDI32) \ 146 $(GDI32) \
147 $(COMDLG32) \ 147 $(COMDLG32) \
148 $(USER32) \ 148 $(USER32) \
149 $(MPR) \ 149 $(MPR) \
150 $(SHELL32) \ 150 $(SHELL32) \
151 $(WINSPOOL) \ 151 $(WINSPOOL) \
152 $(OLE32) \ 152 $(OLE32) \
@@ -174,7 +174,7 @@ $(EMACS): $(DOC) $(TEMACS)
174# (it is the preload heap size in MB). 174# (it is the preload heap size in MB).
175# 175#
176temacs: stamp_BLD $(TEMACS) 176temacs: stamp_BLD $(TEMACS)
177$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \ 177$(TEMACS): $(TLIB0) $(TLIB1) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
178 ../nt/$(BLD)/addsection.exe 178 ../nt/$(BLD)/addsection.exe
179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
180 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21 180 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
@@ -190,16 +190,14 @@ make-buildobj-CMD:
190 echo #define BUILDOBJ ^"\> buildobj.h 190 echo #define BUILDOBJ ^"\> buildobj.h
191 echo $(OBJ0) \>> buildobj.h 191 echo $(OBJ0) \>> buildobj.h
192 echo $(OBJ1) \>> buildobj.h 192 echo $(OBJ1) \>> buildobj.h
193 echo $(WIN32OBJ) \>> buildobj.h 193 echo $(OBJ2) \>> buildobj.h
194 echo $(FONTOBJ) \>> buildobj.h
195 echo ^">> buildobj.h 194 echo ^">> buildobj.h
196 195
197make-buildobj-SH: 196make-buildobj-SH:
198 echo '#define BUILDOBJ $(DQUOTE)\' > buildobj.h 197 echo '#define BUILDOBJ $(DQUOTE)\' > buildobj.h
199 echo $(OBJ0) '\' >> buildobj.h 198 echo $(OBJ0) '\' >> buildobj.h
200 echo $(OBJ1) '\' >> buildobj.h 199 echo $(OBJ1) '\' >> buildobj.h
201 echo $(WIN32OBJ) '\' >> buildobj.h 200 echo $(OBJ2) '\' >> buildobj.h
202 echo $(FONTOBJ) '\' >> buildobj.h
203 echo '$(DQUOTE)' >> buildobj.h 201 echo '$(DQUOTE)' >> buildobj.h
204 202
205bootstrap: bootstrap-emacs 203bootstrap: bootstrap-emacs
@@ -249,7 +247,7 @@ $(TLIB0): $(OBJ0)
249$(TLIB1): $(OBJ1) 247$(TLIB1): $(OBJ1)
250 - $(DEL) $@ 248 - $(DEL) $@
251 $(AR) $(AR_OUT)$@ $(ALL_DEPS) 249 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
252$(TLIBW32): $(WIN32OBJ) $(FONTOBJ) 250$(TLIB2): $(OBJ2)
253 - $(DEL) $@ 251 - $(DEL) $@
254 $(AR) $(AR_OUT)$@ $(ALL_DEPS) 252 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
255 253
@@ -293,6 +291,52 @@ cleanall: clean
293 - $(DEL_TREE) oo 291 - $(DEL_TREE) oo
294 - $(DEL_TREE) oo-spd 292 - $(DEL_TREE) oo-spd
295 293
294## Arrange to make a tags table TAGS-LISP for ../lisp,
295## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
296##
297## This works only with GNU Make.
298
299TAGS: $(OBJ0) $(OBJ1) $(OBJ2)
300 $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE)
301
302TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
303 $(MAKE) $(MFLAGS) TAGS-LISP-$(MAKETYPE)
304
305TAGS-gmake:
306 ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
307 --regex=@../nt/emacs-src.tags \
308 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
309 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
310 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
311 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
312 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \
313 $(CURDIR)/*.h
314
315TAGS-nmake:
316 echo This target is not supported with NMake
317 exit -1
318
319frc:
320TAGS-LISP-gmake: frc
321 $(MAKE) $(MFLAGS) -C ../lisp TAGS-LISP DEST=../src
322
323TAGS-LISP-nmake:
324 echo This target is not supported with NMake
325 exit -1
326
327../nt/TAGS: frc
328 $(MAKE) $(MFLAGS) nt-TAGS-$(MAKETYPE)
329
330nt-TAGS-gmake:
331 $(MAKE) $(MFLAGS) -C ../nt TAGS
332
333nt-TAGS-nmake:
334 echo This target is not supported with NMake
335 exit -1
336
337full-tags: TAGS TAGS-LISP ../nt/TAGS
338.PHONY: full-tags
339
296### DEPENDENCIES ### 340### DEPENDENCIES ###
297 341
298EMACS_ROOT = .. 342EMACS_ROOT = ..
@@ -1705,4 +1749,4 @@ $(BLD)/w32uniscribe.$(O) : \
1705# Each object file depends on stamp_BLD, because in parallel builds we must 1749# Each object file depends on stamp_BLD, because in parallel builds we must
1706# make sure $(BLD) exists before starting compilations. 1750# make sure $(BLD) exists before starting compilations.
1707# 1751#
1708$(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD 1752$(OBJ0) $(OBJ1) $(OBJ2) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD
diff --git a/src/msdos.c b/src/msdos.c
index 086cad2ff84..0957221f597 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -29,13 +29,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <setjmp.h> 29#include <setjmp.h>
30#include "lisp.h" 30#include "lisp.h"
31#include <stdio.h> 31#include <stdio.h>
32#include <stdlib.h>
33#include <time.h> 32#include <time.h>
34#include <sys/param.h> 33#include <sys/param.h>
35#include <sys/time.h> 34#include <sys/time.h>
36#include <dos.h> 35#include <dos.h>
37#include <errno.h> 36#include <errno.h>
38#include <string.h> /* for memset and string functions */
39#include <sys/stat.h> /* for _fixpath */ 37#include <sys/stat.h> /* for _fixpath */
40#include <unistd.h> /* for chdir, dup, dup2, etc. */ 38#include <unistd.h> /* for chdir, dup, dup2, etc. */
41#include <dir.h> /* for getdisk */ 39#include <dir.h> /* for getdisk */
@@ -4706,7 +4704,7 @@ syms_of_msdos (void)
4706#ifndef HAVE_X_WINDOWS 4704#ifndef HAVE_X_WINDOWS
4707 4705
4708 /* The following two are from xfns.c: */ 4706 /* The following two are from xfns.c: */
4709 Qreverse = intern ("reverse"); 4707 Qreverse = intern_c_string ("reverse");
4710 staticpro (&Qreverse); 4708 staticpro (&Qreverse);
4711 4709
4712 DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph, 4710 DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph,
diff --git a/src/nsfns.m b/src/nsfns.m
index 576131e0bdf..db8bbeb5f76 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -2598,7 +2598,7 @@ syms_of_nsfns (void)
2598{ 2598{
2599 int i; 2599 int i;
2600 2600
2601 Qfontsize = intern ("fontsize"); 2601 Qfontsize = intern_c_string ("fontsize");
2602 staticpro (&Qfontsize); 2602 staticpro (&Qfontsize);
2603 2603
2604 DEFVAR_LISP ("ns-icon-type-alist", &Vns_icon_type_alist, 2604 DEFVAR_LISP ("ns-icon-type-alist", &Vns_icon_type_alist,
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9534aec8f2b..d0276c50bf7 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1808,7 +1808,7 @@ syms_of_nsmenu (void)
1808 defsubr (&Sns_reset_menu); 1808 defsubr (&Sns_reset_menu);
1809 defsubr (&Smenu_or_popup_active_p); 1809 defsubr (&Smenu_or_popup_active_p);
1810 1810
1811 Qdebug_on_next_call = intern ("debug-on-next-call"); 1811 Qdebug_on_next_call = intern_c_string ("debug-on-next-call");
1812 staticpro (&Qdebug_on_next_call); 1812 staticpro (&Qdebug_on_next_call);
1813} 1813}
1814 1814
diff --git a/src/nsselect.m b/src/nsselect.m
index 9e434515edf..786ca36069c 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -549,10 +549,10 @@ nxatoms_of_nsselect (void)
549void 549void
550syms_of_nsselect (void) 550syms_of_nsselect (void)
551{ 551{
552 QCLIPBOARD = intern ("CLIPBOARD"); staticpro (&QCLIPBOARD); 552 QCLIPBOARD = intern_c_string ("CLIPBOARD"); staticpro (&QCLIPBOARD);
553 QSECONDARY = intern ("SECONDARY"); staticpro (&QSECONDARY); 553 QSECONDARY = intern_c_string ("SECONDARY"); staticpro (&QSECONDARY);
554 QTEXT = intern ("TEXT"); staticpro (&QTEXT); 554 QTEXT = intern_c_string ("TEXT"); staticpro (&QTEXT);
555 QFILE_NAME = intern ("FILE_NAME"); staticpro (&QFILE_NAME); 555 QFILE_NAME = intern_c_string ("FILE_NAME"); staticpro (&QFILE_NAME);
556 556
557 defsubr (&Sx_disown_selection_internal); 557 defsubr (&Sx_disown_selection_internal);
558 defsubr (&Sx_get_selection_internal); 558 defsubr (&Sx_get_selection_internal);
@@ -605,7 +605,7 @@ The functions are called with one argument, the selection type\n\
605\(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD')."); 605\(a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD').");
606 Vns_lost_selection_hooks = Qnil; 606 Vns_lost_selection_hooks = Qnil;
607 607
608 Qforeign_selection = intern ("foreign-selection"); 608 Qforeign_selection = intern_c_string ("foreign-selection");
609 staticpro (&Qforeign_selection); 609 staticpro (&Qforeign_selection);
610} 610}
611 611
diff --git a/src/nsterm.m b/src/nsterm.m
index f0efb948ab9..247ef4dd40c 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -142,22 +142,27 @@ Lisp_Object ns_input_spi_name, ns_input_spi_arg;
142Lisp_Object Vx_toolkit_scroll_bars; 142Lisp_Object Vx_toolkit_scroll_bars;
143static Lisp_Object Qmodifier_value; 143static Lisp_Object Qmodifier_value;
144Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone; 144Lisp_Object Qalt, Qcontrol, Qhyper, Qmeta, Qsuper, Qnone;
145extern Lisp_Object Qcursor_color, Qcursor_type, Qns; 145extern Lisp_Object Qcursor_color, Qcursor_type, Qns, Qleft;
146 146
147/* Specifies which emacs modifier should be generated when NS receives 147/* Specifies which emacs modifier should be generated when NS receives
148 the Alternate modifer. May be Qnone or any of the modifier lisp symbols. */ 148 the Alternate modifier. May be Qnone or any of the modifier lisp symbols. */
149Lisp_Object ns_alternate_modifier; 149Lisp_Object ns_alternate_modifier;
150 150
151/* Specifies which emacs modifier should be generated when NS receives 151/* Specifies which emacs modifier should be generated when NS receives
152 the Command modifer. May be any of the modifier lisp symbols. */ 152 the right Alternate modifier. Has same values as ns_alternate_modifier plus
153 the value Qleft which means whatever value ns_alternate_modifier has. */
154Lisp_Object ns_right_alternate_modifier;
155
156/* Specifies which emacs modifier should be generated when NS receives
157 the Command modifier. May be any of the modifier lisp symbols. */
153Lisp_Object ns_command_modifier; 158Lisp_Object ns_command_modifier;
154 159
155/* Specifies which emacs modifier should be generated when NS receives 160/* Specifies which emacs modifier should be generated when NS receives
156 the Control modifer. May be any of the modifier lisp symbols. */ 161 the Control modifier. May be any of the modifier lisp symbols. */
157Lisp_Object ns_control_modifier; 162Lisp_Object ns_control_modifier;
158 163
159/* Specifies which emacs modifier should be generated when NS receives 164/* Specifies which emacs modifier should be generated when NS receives
160 the Function modifer (laptops). May be any of the modifier lisp symbols. */ 165 the Function modifier (laptops). May be any of the modifier lisp symbols. */
161Lisp_Object ns_function_modifier; 166Lisp_Object ns_function_modifier;
162 167
163/* Control via default 'GSFontAntiAlias' on OS X and GNUstep. */ 168/* Control via default 'GSFontAntiAlias' on OS X and GNUstep. */
@@ -218,12 +223,17 @@ static BOOL inNsSelect = 0;
218 223
219/* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */ 224/* Convert modifiers in a NeXTSTEP event to emacs style modifiers. */
220#define NS_FUNCTION_KEY_MASK 0x800000 225#define NS_FUNCTION_KEY_MASK 0x800000
226#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask)
221#define EV_MODIFIERS(e) \ 227#define EV_MODIFIERS(e) \
222 ((([e modifierFlags] & NSHelpKeyMask) ? \ 228 ((([e modifierFlags] & NSHelpKeyMask) ? \
223 hyper_modifier : 0) \ 229 hyper_modifier : 0) \
224 | (([e modifierFlags] & NSAlternateKeyMask) ? \ 230 | (!EQ (ns_right_alternate_modifier, Qleft) && \
231 (([e modifierFlags] & NSRightAlternateKeyMask) \
232 == NSRightAlternateKeyMask) ? \
233 parse_solitary_modifier (ns_right_alternate_modifier) : 0) \
234 | (([e modifierFlags] & NSAlternateKeyMask) ? \
225 parse_solitary_modifier (ns_alternate_modifier) : 0) \ 235 parse_solitary_modifier (ns_alternate_modifier) : 0) \
226 | (([e modifierFlags] & NSShiftKeyMask) ? \ 236 | (([e modifierFlags] & NSShiftKeyMask) ? \
227 shift_modifier : 0) \ 237 shift_modifier : 0) \
228 | (([e modifierFlags] & NSControlKeyMask) ? \ 238 | (([e modifierFlags] & NSControlKeyMask) ? \
229 parse_solitary_modifier (ns_control_modifier) : 0) \ 239 parse_solitary_modifier (ns_control_modifier) : 0) \
@@ -4440,7 +4450,13 @@ ns_term_shutdown (int sig)
4440 emacs_event->modifiers |= 4450 emacs_event->modifiers |=
4441 parse_solitary_modifier (ns_function_modifier); 4451 parse_solitary_modifier (ns_function_modifier);
4442 4452
4443 if (flags & NSAlternateKeyMask) /* default = meta */ 4453 if (!EQ (ns_right_alternate_modifier, Qleft)
4454 && ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask))
4455 {
4456 emacs_event->modifiers |= parse_solitary_modifier
4457 (ns_right_alternate_modifier);
4458 }
4459 else if (flags & NSAlternateKeyMask) /* default = meta */
4444 { 4460 {
4445 if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone)) 4461 if ((NILP (ns_alternate_modifier) || EQ (ns_alternate_modifier, Qnone))
4446 && !fnKeysym) 4462 && !fnKeysym)
@@ -6203,6 +6219,14 @@ Set to none means that the alternate / option key is not interpreted by Emacs\n\
6203at all, allowing it to be used at a lower level for accented character entry."); 6219at all, allowing it to be used at a lower level for accented character entry.");
6204 ns_alternate_modifier = Qmeta; 6220 ns_alternate_modifier = Qmeta;
6205 6221
6222 DEFVAR_LISP ("ns-right-alternate-modifier", &ns_right_alternate_modifier,
6223 "This variable describes the behavior of the right alternate or option key.\n\
6224Set to control, meta, alt, super, or hyper means it is taken to be that key.\n\
6225Set to left means be the same key as `ns-alternate-modifier'.\n\
6226Set to none means that the alternate / option key is not interpreted by Emacs\n\
6227at all, allowing it to be used at a lower level for accented character entry.");
6228 ns_right_alternate_modifier = Qleft;
6229
6206 DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier, 6230 DEFVAR_LISP ("ns-command-modifier", &ns_command_modifier,
6207 "This variable describes the behavior of the command key.\n\ 6231 "This variable describes the behavior of the command key.\n\
6208Set to control, meta, alt, super, or hyper means it is taken to be that key."); 6232Set to control, meta, alt, super, or hyper means it is taken to be that key.");
diff --git a/src/point.h b/src/point.h
deleted file mode 100644
index 0156e1baed2..00000000000
--- a/src/point.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#define point_width 5
2#define point_height 19
3static char point_bits[] = {
4 0x1f, 0x0e, 0x0e, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5 0x00, 0x00, 0x04, 0x04, 0x0e, 0x0e, 0x1f};
6
7/* arch-tag: a8dad510-7254-4964-b71e-bb6f81cce572
8 (do not change this comment) */
diff --git a/src/print.c b/src/print.c
index d4cbc2ac24a..0f8718877d2 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1401,7 +1401,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri
1401#define PRINT_STRING_NON_CHARSET_FOUND 1 1401#define PRINT_STRING_NON_CHARSET_FOUND 1
1402#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2 1402#define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
1403 1403
1404/* Bitwize or of the abobe macros. */ 1404/* Bitwise or of the above macros. */
1405static int print_check_string_result; 1405static int print_check_string_result;
1406 1406
1407static void 1407static void
diff --git a/src/process.c b/src/process.c
index a698e56fe39..e1515065957 100644
--- a/src/process.c
+++ b/src/process.c
@@ -31,7 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#ifdef HAVE_INTTYPES_H 31#ifdef HAVE_INTTYPES_H
32#include <inttypes.h> 32#include <inttypes.h>
33#endif 33#endif
34#include <stdlib.h>
35 34
36#ifdef HAVE_UNISTD_H 35#ifdef HAVE_UNISTD_H
37#include <unistd.h> 36#include <unistd.h>
@@ -68,10 +67,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
68#include <bsdtty.h> 67#include <bsdtty.h>
69#endif 68#endif
70 69
71#ifdef HAVE_SYS_WAIT
72#include <sys/wait.h>
73#endif
74
75#ifdef HAVE_RES_INIT 70#ifdef HAVE_RES_INIT
76#include <netinet/in.h> 71#include <netinet/in.h>
77#include <arpa/nameser.h> 72#include <arpa/nameser.h>
@@ -82,6 +77,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
82#include <util.h> 77#include <util.h>
83#endif 78#endif
84 79
80#ifdef HAVE_PTY_H
81#include <pty.h>
82#endif
83
85#endif /* subprocesses */ 84#endif /* subprocesses */
86 85
87#include "lisp.h" 86#include "lisp.h"
@@ -115,6 +114,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
115#ifdef HAVE_NS 114#ifdef HAVE_NS
116#include "nsterm.h" 115#include "nsterm.h"
117#endif 116#endif
117
118extern int timers_run; 118extern int timers_run;
119 119
120Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid; 120Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
@@ -171,13 +171,6 @@ extern Lisp_Object QCfilter;
171/* Define first descriptor number available for subprocesses. */ 171/* Define first descriptor number available for subprocesses. */
172#define FIRST_PROC_DESC 3 172#define FIRST_PROC_DESC 3
173 173
174/* Define SIGCHLD as an alias for SIGCLD. There are many conditionals
175 testing SIGCHLD. */
176
177#if !defined (SIGCHLD) && defined (SIGCLD)
178#define SIGCHLD SIGCLD
179#endif /* SIGCLD */
180
181extern const char *get_operating_system_release (void); 174extern const char *get_operating_system_release (void);
182 175
183/* From sysdep.c or w32.c */ 176/* From sysdep.c or w32.c */
@@ -356,14 +349,6 @@ struct sockaddr_and_len {
356/* Maximum number of bytes to send to a pty without an eof. */ 349/* Maximum number of bytes to send to a pty without an eof. */
357static int pty_max_bytes; 350static int pty_max_bytes;
358 351
359#ifdef HAVE_PTYS
360#ifdef HAVE_PTY_H
361#include <pty.h>
362#endif
363/* The file name of the pty opened by allocate_pty. */
364
365static char pty_name[24];
366#endif
367 352
368 353
369struct fd_callback_data 354struct fd_callback_data
@@ -563,6 +548,9 @@ status_message (struct Lisp_Process *p)
563 548
564#ifdef HAVE_PTYS 549#ifdef HAVE_PTYS
565 550
551/* The file name of the pty opened by allocate_pty. */
552static char pty_name[24];
553
566/* Open an available pty, returning a file descriptor. 554/* Open an available pty, returning a file descriptor.
567 Return -1 on failure. 555 Return -1 on failure.
568 The file name of the terminal corresponding to the pty 556 The file name of the terminal corresponding to the pty
@@ -1682,6 +1670,11 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1682 val = XCDR (Vdefault_process_coding_system); 1670 val = XCDR (Vdefault_process_coding_system);
1683 } 1671 }
1684 XPROCESS (proc)->encode_coding_system = val; 1672 XPROCESS (proc)->encode_coding_system = val;
1673 /* Note: At this momemnt, the above coding system may leave
1674 text-conversion or eol-conversion unspecified. They will be
1675 decided after we read output from the process and decode it by
1676 some coding system, or just before we actually send a text to
1677 the process. */
1685 } 1678 }
1686 1679
1687 1680
@@ -1724,6 +1717,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1724 tem = Fsubstring (tem, make_number (2), Qnil); 1717 tem = Fsubstring (tem, make_number (2), Qnil);
1725 1718
1726 { 1719 {
1720 Lisp_Object arg_encoding = Qnil;
1727 struct gcpro gcpro1; 1721 struct gcpro gcpro1;
1728 GCPRO1 (tem); 1722 GCPRO1 (tem);
1729 1723
@@ -1741,9 +1735,14 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1741 tem = Fcons (args[i], tem); 1735 tem = Fcons (args[i], tem);
1742 CHECK_STRING (XCAR (tem)); 1736 CHECK_STRING (XCAR (tem));
1743 if (STRING_MULTIBYTE (XCAR (tem))) 1737 if (STRING_MULTIBYTE (XCAR (tem)))
1744 XSETCAR (tem, 1738 {
1745 code_convert_string_norecord 1739 if (NILP (arg_encoding))
1746 (XCAR (tem), XPROCESS (proc)->encode_coding_system, 1)); 1740 arg_encoding = (complement_process_encoding_system
1741 (XPROCESS (proc)->encode_coding_system));
1742 XSETCAR (tem,
1743 code_convert_string_norecord
1744 (XCAR (tem), arg_encoding, 1));
1745 }
1747 } 1746 }
1748 1747
1749 UNGCPRO; 1748 UNGCPRO;
@@ -1879,12 +1878,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1879 } 1878 }
1880#endif 1879#endif
1881 1880
1882#if 0
1883 /* Replaced by close_process_descs */
1884 set_exclusive_use (inchannel);
1885 set_exclusive_use (outchannel);
1886#endif
1887
1888#ifdef O_NONBLOCK 1881#ifdef O_NONBLOCK
1889 fcntl (inchannel, F_SETFL, O_NONBLOCK); 1882 fcntl (inchannel, F_SETFL, O_NONBLOCK);
1890 fcntl (outchannel, F_SETFL, O_NONBLOCK); 1883 fcntl (outchannel, F_SETFL, O_NONBLOCK);
@@ -5547,12 +5540,21 @@ send_process (volatile Lisp_Object proc, const unsigned char *volatile buf,
5547 && !NILP (XBUFFER (object)->enable_multibyte_characters)) 5540 && !NILP (XBUFFER (object)->enable_multibyte_characters))
5548 || EQ (object, Qt)) 5541 || EQ (object, Qt))
5549 { 5542 {
5543 p->encode_coding_system
5544 = complement_process_encoding_system (p->encode_coding_system);
5550 if (!EQ (Vlast_coding_system_used, p->encode_coding_system)) 5545 if (!EQ (Vlast_coding_system_used, p->encode_coding_system))
5551 /* The coding system for encoding was changed to raw-text 5546 {
5552 because we sent a unibyte text previously. Now we are 5547 /* The coding system for encoding was changed to raw-text
5553 sending a multibyte text, thus we must encode it by the 5548 because we sent a unibyte text previously. Now we are
5554 original coding system specified for the current process. */ 5549 sending a multibyte text, thus we must encode it by the
5555 setup_coding_system (p->encode_coding_system, coding); 5550 original coding system specified for the current process.
5551
5552 Another reason we comming here is that the coding system
5553 was just complemented and new one was returned by
5554 complement_process_encoding_system. */
5555 setup_coding_system (p->encode_coding_system, coding);
5556 Vlast_coding_system_used = p->encode_coding_system;
5557 }
5556 coding->src_multibyte = 1; 5558 coding->src_multibyte = 1;
5557 } 5559 }
5558 else 5560 else
diff --git a/src/regex.c b/src/regex.c
index b563d93fe29..17158552a95 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -4089,7 +4089,7 @@ analyse_first (const re_char *p, const re_char *pend, char *fastmap, const int m
4089 && match_any_multibyte_characters == false) 4089 && match_any_multibyte_characters == false)
4090 { 4090 {
4091 /* Set fastmap[I] to 1 where I is a leading code of each 4091 /* Set fastmap[I] to 1 where I is a leading code of each
4092 multibyte characer in the range table. */ 4092 multibyte character in the range table. */
4093 int c, count; 4093 int c, count;
4094 unsigned char lc1, lc2; 4094 unsigned char lc1, lc2;
4095 4095
diff --git a/src/scroll.c b/src/scroll.c
index ce26acbce64..4d1c4045bd4 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -20,7 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22#include <stdio.h> 22#include <stdio.h>
23#include <string.h>
24#include <setjmp.h> 23#include <setjmp.h>
25#include "lisp.h" 24#include "lisp.h"
26#include "termchar.h" 25#include "termchar.h"
diff --git a/src/sound.c b/src/sound.c
index b93099283da..3869f3a57ff 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -86,8 +86,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
86 86
87/* BEGIN: Windows Specific Includes */ 87/* BEGIN: Windows Specific Includes */
88#include <stdio.h> 88#include <stdio.h>
89#include <stdlib.h>
90#include <string.h>
91#include <limits.h> 89#include <limits.h>
92#include <windows.h> 90#include <windows.h>
93#include <mmsystem.h> 91#include <mmsystem.h>
diff --git a/src/sysdep.c b/src/sysdep.c
index e7d35d46bf7..f68d475d22c 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -71,10 +71,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
71#endif 71#endif
72 72
73#include <sys/file.h> 73#include <sys/file.h>
74
75#ifdef HAVE_FCNTL_H
76#include <fcntl.h> 74#include <fcntl.h>
77#endif
78 75
79#include "systty.h" 76#include "systty.h"
80#include "syswait.h" 77#include "syswait.h"
@@ -126,19 +123,12 @@ struct utimbuf {
126#endif 123#endif
127#endif 124#endif
128 125
129/* LPASS8 is new in 4.3, and makes cbreak mode provide all 8 bits. */
130#ifndef LPASS8
131#define LPASS8 0
132#endif
133
134static const int baud_convert[] = 126static const int baud_convert[] =
135 { 127 {
136 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200, 128 0, 50, 75, 110, 135, 150, 200, 300, 600, 1200,
137 1800, 2400, 4800, 9600, 19200, 38400 129 1800, 2400, 4800, 9600, 19200, 38400
138 }; 130 };
139 131
140int emacs_ospeed;
141
142void croak (char *) NO_RETURN; 132void croak (char *) NO_RETURN;
143 133
144/* Temporary used by `sigblock' when defined in terms of signprocmask. */ 134/* Temporary used by `sigblock' when defined in terms of signprocmask. */
@@ -278,6 +268,8 @@ stuff_char (char c)
278void 268void
279init_baud_rate (int fd) 269init_baud_rate (int fd)
280{ 270{
271 int emacs_ospeed;
272
281 if (noninteractive) 273 if (noninteractive)
282 emacs_ospeed = 0; 274 emacs_ospeed = 0;
283 else 275 else
@@ -300,16 +292,6 @@ init_baud_rate (int fd)
300} 292}
301 293
302 294
303/*ARGSUSED*/
304void
305set_exclusive_use (int fd)
306{
307#ifdef FIOCLEX
308 ioctl (fd, FIOCLEX, 0);
309#endif
310 /* Ok to do nothing if this feature does not exist */
311}
312
313 295
314int wait_debugging; /* Set nonzero to make following function work under dbx 296int wait_debugging; /* Set nonzero to make following function work under dbx
315 (at least for bsd). */ 297 (at least for bsd). */
@@ -373,22 +355,7 @@ wait_for_termination (int pid)
373void 355void
374flush_pending_output (int channel) 356flush_pending_output (int channel)
375{ 357{
376#ifndef DOS_NT 358 /* FIXME: maybe this function should be removed */
377 /* If we try this, we get hit with SIGTTIN, because
378 the child's tty belongs to the child's pgrp. */
379#else
380#ifdef TCFLSH
381 ioctl (channel, TCFLSH, 1);
382#else
383#ifdef TIOCFLUSH
384 int zero = 0;
385 /* 3rd arg should be ignored
386 but some 4.2 kernels actually want the address of an int
387 and nonzero means something different. */
388 ioctl (channel, TIOCFLUSH, &zero);
389#endif
390#endif
391#endif
392} 359}
393 360
394/* Set up the terminal at the other end of a pseudo-terminal that 361/* Set up the terminal at the other end of a pseudo-terminal that
@@ -483,7 +450,7 @@ child_setup_tty (int out)
483 EMACS_SET_TTY (out, &s, 0); 450 EMACS_SET_TTY (out, &s, 0);
484#endif /* not WINDOWSNT */ 451#endif /* not WINDOWSNT */
485} 452}
486#endif /* MSDOS */ 453#endif /* not MSDOS */
487 454
488 455
489/* Record a signal code and the handler for it. */ 456/* Record a signal code and the handler for it. */
@@ -1486,242 +1453,6 @@ init_system_name (void)
1486 } 1453 }
1487} 1454}
1488 1455
1489#ifndef MSDOS
1490#if !defined (HAVE_SELECT)
1491
1492#include "sysselect.h"
1493#undef select
1494
1495#if defined (HAVE_X_WINDOWS) && !defined (HAVE_SELECT)
1496/* Cause explanatory error message at compile time,
1497 since the select emulation is not good enough for X. */
1498int *x = &x_windows_lose_if_no_select_system_call;
1499#endif
1500
1501/* Emulate as much as select as is possible under 4.1 and needed by Gnu Emacs
1502 * Only checks read descriptors.
1503 */
1504/* How long to wait between checking fds in select */
1505#define SELECT_PAUSE 1
1506int select_alarmed;
1507
1508/* For longjmp'ing back to read_input_waiting. */
1509
1510jmp_buf read_alarm_throw;
1511
1512/* Nonzero if the alarm signal should throw back to read_input_waiting.
1513 The read_socket_hook function sets this to 1 while it is waiting. */
1514
1515int read_alarm_should_throw;
1516
1517void
1518select_alarm (int ignore)
1519{
1520 select_alarmed = 1;
1521 signal (SIGALRM, SIG_IGN);
1522 SIGNAL_THREAD_CHECK (SIGALRM);
1523 if (read_alarm_should_throw)
1524 longjmp (read_alarm_throw, 1);
1525}
1526
1527#ifndef WINDOWSNT
1528/* Only rfds are checked. */
1529int
1530sys_select (int nfds,
1531 SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1532 EMACS_TIME *timeout)
1533{
1534 /* XXX This needs to be updated for multi-tty support. Is there
1535 anybody who needs to emulate select these days? */
1536 int ravail = 0;
1537 SELECT_TYPE orfds;
1538 int timeoutval;
1539 int *local_timeout;
1540 extern int proc_buffered_char[];
1541 extern int process_tick, update_tick;
1542 unsigned char buf;
1543
1544#if defined (HAVE_SELECT) && defined (HAVE_X_WINDOWS)
1545 /* If we're using X, then the native select will work; we only need the
1546 emulation for non-X usage. */
1547 if (!NILP (Vinitial_window_system))
1548 return select (nfds, rfds, wfds, efds, timeout);
1549#endif
1550 timeoutval = timeout ? EMACS_SECS (*timeout) : 100000;
1551 local_timeout = &timeoutval;
1552 FD_ZERO (&orfds);
1553 if (rfds)
1554 {
1555 orfds = *rfds;
1556 FD_ZERO (rfds);
1557 }
1558 if (wfds)
1559 FD_ZERO (wfds);
1560 if (efds)
1561 FD_ZERO (efds);
1562
1563 /* If we are looking only for the terminal, with no timeout,
1564 just read it and wait -- that's more efficient. */
1565 if (*local_timeout == 100000 && process_tick == update_tick
1566 && FD_ISSET (0, &orfds))
1567 {
1568 int fd;
1569 for (fd = 1; fd < nfds; ++fd)
1570 if (FD_ISSET (fd, &orfds))
1571 goto hardway;
1572 if (! detect_input_pending ())
1573 read_input_waiting ();
1574 FD_SET (0, rfds);
1575 return 1;
1576 }
1577
1578 hardway:
1579 /* Once a second, till the timer expires, check all the flagged read
1580 * descriptors to see if any input is available. If there is some then
1581 * set the corresponding bit in the return copy of rfds.
1582 */
1583 while (1)
1584 {
1585 register int to_check, fd;
1586
1587 if (rfds)
1588 {
1589 for (to_check = nfds, fd = 0; --to_check >= 0; fd++)
1590 {
1591 if (FD_ISSET (fd, &orfds))
1592 {
1593 int avail = 0, status = 0;
1594
1595 if (fd == 0)
1596 avail = detect_input_pending (); /* Special keyboard handler */
1597 else
1598 {
1599#ifdef FIONREAD
1600 status = ioctl (fd, FIONREAD, &avail);
1601#else /* no FIONREAD */
1602 /* Hoping it will return -1 if nothing available
1603 or 0 if all 0 chars requested are read. */
1604 if (proc_buffered_char[fd] >= 0)
1605 avail = 1;
1606 else
1607 {
1608 avail = read (fd, &buf, 1);
1609 if (avail > 0)
1610 proc_buffered_char[fd] = buf;
1611 }
1612#endif /* no FIONREAD */
1613 }
1614 if (status >= 0 && avail > 0)
1615 {
1616 FD_SET (fd, rfds);
1617 ravail++;
1618 }
1619 }
1620 }
1621 }
1622 if (*local_timeout == 0 || ravail != 0 || process_tick != update_tick)
1623 break;
1624
1625 turn_on_atimers (0);
1626 signal (SIGALRM, select_alarm);
1627 select_alarmed = 0;
1628 alarm (SELECT_PAUSE);
1629
1630 /* Wait for a SIGALRM (or maybe a SIGTINT) */
1631 while (select_alarmed == 0 && *local_timeout != 0
1632 && process_tick == update_tick)
1633 {
1634 /* If we are interested in terminal input,
1635 wait by reading the terminal.
1636 That makes instant wakeup for terminal input at least. */
1637 if (FD_ISSET (0, &orfds))
1638 {
1639 read_input_waiting ();
1640 if (detect_input_pending ())
1641 select_alarmed = 1;
1642 }
1643 else
1644 pause ();
1645 }
1646 (*local_timeout) -= SELECT_PAUSE;
1647
1648 /* Reset the old alarm if there was one. */
1649 turn_on_atimers (1);
1650
1651 if (*local_timeout == 0) /* Stop on timer being cleared */
1652 break;
1653 }
1654 return ravail;
1655}
1656#endif /* not WINDOWSNT */
1657
1658/* Read keyboard input into the standard buffer,
1659 waiting for at least one character. */
1660
1661void
1662read_input_waiting (void)
1663{
1664 /* XXX This needs to be updated for multi-tty support. Is there
1665 anybody who needs to emulate select these days? */
1666 int nread, i;
1667
1668 if (read_socket_hook)
1669 {
1670 struct input_event hold_quit;
1671
1672 EVENT_INIT (hold_quit);
1673 hold_quit.kind = NO_EVENT;
1674
1675 read_alarm_should_throw = 0;
1676 if (! setjmp (read_alarm_throw))
1677 nread = (*read_socket_hook) (0, 1, &hold_quit);
1678 else
1679 nread = -1;
1680
1681 if (hold_quit.kind != NO_EVENT)
1682 kbd_buffer_store_event (&hold_quit);
1683 }
1684 else
1685 {
1686 struct input_event e;
1687 char buf[3];
1688 nread = read (fileno (stdin), buf, 1);
1689 EVENT_INIT (e);
1690
1691 /* Scan the chars for C-g and store them in kbd_buffer. */
1692 e.kind = ASCII_KEYSTROKE_EVENT;
1693 e.frame_or_window = selected_frame;
1694 e.modifiers = 0;
1695 for (i = 0; i < nread; i++)
1696 {
1697 /* Convert chars > 0177 to meta events if desired.
1698 We do this under the same conditions that read_avail_input does. */
1699 if (read_socket_hook == 0)
1700 {
1701 /* If the user says she has a meta key, then believe her. */
1702 if (meta_key == 1 && (buf[i] & 0x80))
1703 e.modifiers = meta_modifier;
1704 if (meta_key != 2)
1705 buf[i] &= ~0x80;
1706 }
1707
1708 XSETINT (e.code, buf[i]);
1709 kbd_buffer_store_event (&e);
1710 /* Don't look at input that follows a C-g too closely.
1711 This reduces lossage due to autorepeat on C-g. */
1712 if (buf[i] == quit_char)
1713 break;
1714 }
1715 }
1716}
1717
1718#if !defined (HAVE_SELECT)
1719#define select sys_select
1720#endif
1721
1722#endif /* not HAVE_SELECT */
1723#endif /* not MSDOS */
1724
1725/* POSIX signals support - DJB */ 1456/* POSIX signals support - DJB */
1726/* Anyone with POSIX signals should have ANSI C declarations */ 1457/* Anyone with POSIX signals should have ANSI C declarations */
1727 1458
@@ -2271,7 +2002,6 @@ dup2 (int oldd, int newd)
2271#ifndef HAVE_GETTIMEOFDAY 2002#ifndef HAVE_GETTIMEOFDAY
2272#ifdef HAVE_TIMEVAL 2003#ifdef HAVE_TIMEVAL
2273 2004
2274/* ARGSUSED */
2275int 2005int
2276gettimeofday (struct timeval *tp, struct timezone *tzp) 2006gettimeofday (struct timeval *tp, struct timezone *tzp)
2277{ 2007{
diff --git a/src/term.c b/src/term.c
index a2f7a9cbabe..4baea231de3 100644
--- a/src/term.c
+++ b/src/term.c
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <config.h> 23#include <config.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <ctype.h> 25#include <ctype.h>
26#include <string.h>
27#include <errno.h> 26#include <errno.h>
28#include <sys/file.h> 27#include <sys/file.h>
29 28
@@ -3658,9 +3657,6 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3658 3657
3659 add_keyboard_wait_descriptor (0); 3658 add_keyboard_wait_descriptor (0);
3660 3659
3661 /* FIXME: this should be removed, done earlier. */
3662 Wcm_clear (tty);
3663
3664 tty->delete_in_insert_mode = 1; 3660 tty->delete_in_insert_mode = 1;
3665 3661
3666 UseTabs (tty) = 0; 3662 UseTabs (tty) = 0;
diff --git a/src/termcap.c b/src/termcap.c
index ea4ef244f64..4ad0cee6264 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -20,24 +20,18 @@ Boston, MA 02110-1301, USA. */
20/* Emacs config.h may rename various library functions such as malloc. */ 20/* Emacs config.h may rename various library functions such as malloc. */
21#include <config.h> 21#include <config.h>
22#include <setjmp.h> 22#include <setjmp.h>
23#include <lisp.h> /* xmalloc is here */
24/* Get the O_* definitions for open et al. */
25#include <sys/file.h> 23#include <sys/file.h>
26#ifdef HAVE_FCNTL_H
27#include <fcntl.h> 24#include <fcntl.h>
28#endif
29#ifdef HAVE_UNISTD_H 25#ifdef HAVE_UNISTD_H
30#include <unistd.h> 26#include <unistd.h>
31#endif 27#endif
32 28
29#include "lisp.h"
30
33#ifndef NULL 31#ifndef NULL
34#define NULL (char *) 0 32#define NULL (char *) 0
35#endif 33#endif
36 34
37#ifndef O_RDONLY
38#define O_RDONLY 0
39#endif
40
41/* BUFSIZE is the initial size allocated for the buffer 35/* BUFSIZE is the initial size allocated for the buffer
42 for reading the termcap file. 36 for reading the termcap file.
43 It is not a limit. 37 It is not a limit.
@@ -268,45 +262,20 @@ tgetst1 (char *ptr, char **area)
268 262
269/* Outputting a string with padding. */ 263/* Outputting a string with padding. */
270 264
271#ifndef emacs
272short ospeed;
273/* If OSPEED is 0, we use this as the actual baud rate. */
274int tputs_baud_rate;
275#endif
276
277char PC; 265char PC;
278 266
279#ifndef emacs
280/* Actual baud rate if positive;
281 - baud rate / 100 if negative. */
282
283static const int speeds[] =
284 {
285 0, 50, 75, 110, 135, 150, -2, -3, -6, -12,
286 -18, -24, -48, -96, -192, -288, -384, -576, -1152
287 };
288
289#endif /* not emacs */
290
291void 267void
292tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) 268tputs (register char *str, int nlines, register int (*outfun) (/* ??? */))
293{ 269{
294 register int padcount = 0; 270 register int padcount = 0;
295 register int speed; 271 register int speed;
296 272
297#ifdef emacs
298 extern EMACS_INT baud_rate; 273 extern EMACS_INT baud_rate;
299 speed = baud_rate; 274 speed = baud_rate;
300 /* For quite high speeds, convert to the smaller 275 /* For quite high speeds, convert to the smaller
301 units to avoid overflow. */ 276 units to avoid overflow. */
302 if (speed > 10000) 277 if (speed > 10000)
303 speed = - speed / 100; 278 speed = - speed / 100;
304#else
305 if (ospeed == 0)
306 speed = tputs_baud_rate;
307 else
308 speed = speeds[ospeed];
309#endif
310 279
311 if (!str) 280 if (!str)
312 return; 281 return;
diff --git a/src/termhooks.h b/src/termhooks.h
index b16c36f9551..b9358896bae 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -44,11 +44,6 @@ extern void (*fullscreen_hook) (struct frame *f);
44 44
45/* Input queue declarations and hooks. */ 45/* Input queue declarations and hooks. */
46 46
47/* Expedient hack: only provide the below definitions to files that
48 are prepared to handle lispy things. CONSP is defined if lisp.h
49 has been included before this file. */
50#ifdef CONSP
51
52enum event_kind 47enum event_kind
53{ 48{
54 NO_EVENT, /* nothing happened. This should never 49 NO_EVENT, /* nothing happened. This should never
@@ -317,8 +312,6 @@ extern void term_mouse_moveto (int, int);
317extern struct tty_display_info *gpm_tty; 312extern struct tty_display_info *gpm_tty;
318#endif 313#endif
319 314
320#endif /* CONSP */
321
322 315
323struct ns_display_info; 316struct ns_display_info;
324struct x_display_info; 317struct x_display_info;
diff --git a/src/unexaix.c b/src/unexaix.c
index 949616d5e31..2d128bc6806 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -31,33 +31,17 @@ what you give them. Help stamp out software-hoarding! */
31 * Mike Sperber <sperber@informatik.uni-tuebingen.de> 31 * Mike Sperber <sperber@informatik.uni-tuebingen.de>
32 * 32 *
33 * Synopsis: 33 * Synopsis:
34 * unexec (new_name, a_name, data_start, bss_start, entry_address) 34 * unexec (const char *new_name, const *old_name);
35 * char *new_name, *a_name;
36 * unsigned data_start, bss_start, entry_address;
37 * 35 *
38 * Takes a snapshot of the program and makes an a.out format file in the 36 * Takes a snapshot of the program and makes an a.out format file in the
39 * file named by the string argument new_name. 37 * file named by the string argument new_name.
40 * If a_name is non-NULL, the symbol table will be taken from the given file. 38 * If a_name is non-NULL, the symbol table will be taken from the given file.
41 * On some machines, an existing a_name file is required. 39 * On some machines, an existing a_name file is required.
42 * 40 *
43 * data_start and entry_address are ignored.
44 *
45 * bss_start indicates how much of the data segment is to be saved in the
46 * a.out file and restored when the program is executed. It gives the lowest
47 * unsaved address, and is rounded up to a page boundary. The default when 0
48 * is given assumes that the entire data segment is to be stored, including
49 * the previous data and bss as well as any additional storage allocated with
50 * sbrk(2).
51 *
52 */ 41 */
53 42
54#ifndef emacs
55#define PERROR(arg) perror (arg); return -1
56#else
57#include <config.h> 43#include <config.h>
58#define PERROR(file) report_error (file, new) 44#define PERROR(file) report_error (file, new)
59#endif
60
61#include <a.out.h> 45#include <a.out.h>
62/* Define getpagesize () if the system does not. 46/* Define getpagesize () if the system does not.
63 Note that this may depend on symbols defined in a.out.h 47 Note that this may depend on symbols defined in a.out.h
@@ -103,7 +87,6 @@ static int adjust_lnnoptrs (int, int, char *);
103 87
104static int pagemask; 88static int pagemask;
105 89
106#ifdef emacs
107#include <setjmp.h> 90#include <setjmp.h>
108#include "lisp.h" 91#include "lisp.h"
109 92
@@ -114,7 +97,6 @@ report_error (char *file, int fd)
114 close (fd); 97 close (fd);
115 report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil)); 98 report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
116} 99}
117#endif /* emacs */
118 100
119#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1 101#define ERROR0(msg) report_error_1 (new, msg, 0, 0); return -1
120#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 102#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
@@ -124,12 +106,7 @@ static void
124report_error_1 (int fd, char *msg, int a1, int a2) 106report_error_1 (int fd, char *msg, int a1, int a2)
125{ 107{
126 close (fd); 108 close (fd);
127#ifdef emacs
128 error (msg, a1, a2); 109 error (msg, a1, a2);
129#else
130 fprintf (stderr, msg, a1, a2);
131 fprintf (stderr, "\n");
132#endif
133} 110}
134 111
135static int make_hdr (int, int, unsigned, unsigned, unsigned, char *, char *); 112static int make_hdr (int, int, unsigned, unsigned, unsigned, char *, char *);
@@ -143,10 +120,7 @@ static void write_segment (int, char *, char *);
143 * 120 *
144 * driving logic. 121 * driving logic.
145 */ 122 */
146int unexec (char *new_name, char *a_name, 123int unexec (const char *new_name, const char *a_name)
147 unsigned data_start,
148 unsigned bss_start,
149 unsigned entry_address)
150{ 124{
151 int new = -1, a_out = -1; 125 int new = -1, a_out = -1;
152 126
@@ -159,8 +133,6 @@ int unexec (char *new_name, char *a_name,
159 PERROR (new_name); 133 PERROR (new_name);
160 } 134 }
161 if (make_hdr (new, a_out, 135 if (make_hdr (new, a_out,
162 data_start, bss_start,
163 entry_address,
164 a_name, new_name) < 0 136 a_name, new_name) < 0
165 || copy_text_and_data (new) < 0 137 || copy_text_and_data (new) < 0
166 || copy_sym (new, a_out, a_name, new_name) < 0 138 || copy_sym (new, a_out, a_name, new_name) < 0
@@ -186,12 +158,11 @@ int unexec (char *new_name, char *a_name,
186 */ 158 */
187static int 159static int
188make_hdr (int new, int a_out, 160make_hdr (int new, int a_out,
189 unsigned data_start, unsigned bss_start,
190 unsigned entry_address,
191 char *a_name, char *new_name) 161 char *a_name, char *new_name)
192{ 162{
193 int scns; 163 int scns;
194 unsigned int bss_end; 164 unsigned int bss_start;
165 unsigned int data_start;
195 166
196 struct scnhdr section[MAX_SECTIONS]; 167 struct scnhdr section[MAX_SECTIONS];
197 struct scnhdr * f_thdr; /* Text section header */ 168 struct scnhdr * f_thdr; /* Text section header */
@@ -211,22 +182,8 @@ make_hdr (int new, int a_out,
211 182
212 data_start = data_start & ~pagemask; /* (Down) to page boundary. */ 183 data_start = data_start & ~pagemask; /* (Down) to page boundary. */
213 184
214 bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; 185 bss_start = ADDR_CORRECT (sbrk (0)) + pagemask;
215 bss_end &= ~ pagemask; 186 bss_start &= ~ pagemask;
216 /* Adjust data/bss boundary. */
217 if (bss_start != 0)
218 {
219 bss_start = (ADDR_CORRECT (bss_start) + pagemask);
220 /* (Up) to page bdry. */
221 bss_start &= ~ pagemask;
222 if (bss_start > bss_end)
223 {
224 ERROR1 ("unexec: Specified bss_start (%u) is past end of program",
225 bss_start);
226 }
227 }
228 else
229 bss_start = bss_end;
230 187
231 if (data_start > bss_start) /* Can't have negative data size. */ 188 if (data_start > bss_start) /* Can't have negative data size. */
232 { 189 {
@@ -311,7 +268,7 @@ make_hdr (int new, int a_out,
311 f_hdr.f_flags |= (F_RELFLG | F_EXEC); 268 f_hdr.f_flags |= (F_RELFLG | F_EXEC);
312 269
313 f_ohdr.dsize = bss_start - f_ohdr.data_start; 270 f_ohdr.dsize = bss_start - f_ohdr.data_start;
314 f_ohdr.bsize = bss_end - bss_start; 271 f_ohdr.bsize = 0;
315 272
316 f_dhdr->s_size = f_ohdr.dsize; 273 f_dhdr->s_size = f_ohdr.dsize;
317 f_bhdr->s_size = f_ohdr.bsize; 274 f_bhdr->s_size = f_ohdr.bsize;
diff --git a/src/unexcoff.c b/src/unexcoff.c
index cb4b8d603b5..0c6af414d82 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -34,37 +34,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34 * Modified heavily since then. 34 * Modified heavily since then.
35 * 35 *
36 * Synopsis: 36 * Synopsis:
37 * unexec (new_name, a_name, data_start, bss_start, entry_address) 37 * unexec (const char *new_name, const char *old_name);
38 * char *new_name, *a_name;
39 * unsigned data_start, bss_start, entry_address;
40 * 38 *
41 * Takes a snapshot of the program and makes an a.out format file in the 39 * Takes a snapshot of the program and makes an a.out format file in the
42 * file named by the string argument new_name. 40 * file named by the string argument new_name.
43 * If a_name is non-NULL, the symbol table will be taken from the given file. 41 * If a_name is non-NULL, the symbol table will be taken from the given file.
44 * On some machines, an existing a_name file is required. 42 * On some machines, an existing a_name file is required.
45 * 43 *
46 * The boundaries within the a.out file may be adjusted with the data_start
47 * and bss_start arguments. Either or both may be given as 0 for defaults.
48 *
49 * Data_start gives the boundary between the text segment and the data
50 * segment of the program. The text segment can contain shared, read-only
51 * program code and literal data, while the data segment is always unshared
52 * and unprotected. Data_start gives the lowest unprotected address.
53 * The value you specify may be rounded down to a suitable boundary
54 * as required by the machine you are using.
55 *
56 * Specifying zero for data_start means the boundary between text and data
57 * should not be the same as when the program was loaded.
58 *
59 * Bss_start indicates how much of the data segment is to be saved in the
60 * a.out file and restored when the program is executed. It gives the lowest
61 * unsaved address, and is rounded up to a page boundary. The default when 0
62 * is given assumes that the entire data segment is to be stored, including
63 * the previous data and bss as well as any additional storage allocated with
64 * break (2).
65 *
66 * The new file is set up to start at entry_address.
67 *
68 * If you make improvements I'd like to get them too. 44 * If you make improvements I'd like to get them too.
69 * harpo!utah-cs!thomas, thomas@Utah-20 45 * harpo!utah-cs!thomas, thomas@Utah-20
70 * 46 *
@@ -121,14 +97,6 @@ struct aouthdr
121 97
122#include <sys/file.h> 98#include <sys/file.h>
123 99
124#ifndef O_RDONLY
125#define O_RDONLY 0
126#endif
127#ifndef O_RDWR
128#define O_RDWR 2
129#endif
130
131
132extern char *start_of_data (void); /* Start of initialized data */ 100extern char *start_of_data (void); /* Start of initialized data */
133 101
134static long block_copy_start; /* Old executable start point */ 102static long block_copy_start; /* Old executable start point */
@@ -186,15 +154,16 @@ static void mark_x (const char *);
186 * Modify the text and data sizes. 154 * Modify the text and data sizes.
187 */ 155 */
188static int 156static int
189make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start, 157make_hdr (int new, int a_out,
190 unsigned entry_address, const char *a_name, const char *new_name) 158 const char *a_name, const char *new_name)
191{ 159{
192 auto struct scnhdr f_thdr; /* Text section header */ 160 auto struct scnhdr f_thdr; /* Text section header */
193 auto struct scnhdr f_dhdr; /* Data section header */ 161 auto struct scnhdr f_dhdr; /* Data section header */
194 auto struct scnhdr f_bhdr; /* Bss section header */ 162 auto struct scnhdr f_bhdr; /* Bss section header */
195 auto struct scnhdr scntemp; /* Temporary section header */ 163 auto struct scnhdr scntemp; /* Temporary section header */
196 register int scns; 164 register int scns;
197 unsigned int bss_end; 165 unsigned int bss_start;
166 unsigned int data_start;
198 167
199 pagemask = getpagesize () - 1; 168 pagemask = getpagesize () - 1;
200 169
@@ -203,23 +172,8 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
203 data_start = ADDR_CORRECT (data_start); 172 data_start = ADDR_CORRECT (data_start);
204 data_start = data_start & ~pagemask; /* (Down) to page boundary. */ 173 data_start = data_start & ~pagemask; /* (Down) to page boundary. */
205 174
206 bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; 175 bss_start = ADDR_CORRECT (sbrk (0)) + pagemask;
207 bss_end &= ~ pagemask; 176 bss_start &= ~ pagemask;
208
209 /* Adjust data/bss boundary. */
210 if (bss_start != 0)
211 {
212 bss_start = (ADDR_CORRECT (bss_start) + pagemask);
213 /* (Up) to page bdry. */
214 bss_start &= ~ pagemask;
215 if (bss_start > bss_end)
216 {
217 ERROR1 ("unexec: Specified bss_start (%u) is past end of program",
218 bss_start);
219 }
220 }
221 else
222 bss_start = bss_end;
223 177
224 if (data_start > bss_start) /* Can't have negative data size. */ 178 if (data_start > bss_start) /* Can't have negative data size. */
225 { 179 {
@@ -300,7 +254,7 @@ make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
300 254
301 f_hdr.f_flags |= (F_RELFLG | F_EXEC); 255 f_hdr.f_flags |= (F_RELFLG | F_EXEC);
302 f_ohdr.dsize = bss_start - f_ohdr.data_start; 256 f_ohdr.dsize = bss_start - f_ohdr.data_start;
303 f_ohdr.bsize = bss_end - bss_start; 257 f_ohdr.bsize = 0;
304 f_thdr.s_size = f_ohdr.tsize; 258 f_thdr.s_size = f_ohdr.tsize;
305 f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); 259 f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr);
306 f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); 260 f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr));
@@ -571,8 +525,7 @@ adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
571 * driving logic. 525 * driving logic.
572 */ 526 */
573int 527int
574unexec (const char *new_name, const char *a_name, 528unexec (const char *new_name, const char *a_name)
575 unsigned data_start, unsigned bss_start, unsigned entry_address)
576{ 529{
577 int new = -1, a_out = -1; 530 int new = -1, a_out = -1;
578 531
@@ -585,7 +538,7 @@ unexec (const char *new_name, const char *a_name,
585 PERROR (new_name); 538 PERROR (new_name);
586 } 539 }
587 540
588 if (make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) < 0 541 if (make_hdr (new, a_out, a_name, new_name) < 0
589 || copy_text_and_data (new, a_out) < 0 542 || copy_text_and_data (new, a_out) < 0
590 || copy_sym (new, a_out, a_name, new_name) < 0 543 || copy_sym (new, a_out, a_name, new_name) < 0
591 || adjust_lnnoptrs (new, a_out, new_name) < 0 544 || adjust_lnnoptrs (new, a_out, new_name) < 0
diff --git a/src/unexcw.c b/src/unexcw.c
index 4930eb46315..c33d9d90215 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -248,8 +248,7 @@ add_exe_suffix_if_necessary (const char *name, char *modified)
248} 248}
249 249
250int 250int
251unexec (char *outfile, char *infile, unsigned start_data, unsigned d1, 251unexec (const char *outfile, const char *infile)
252 unsigned d2)
253{ 252{
254 char infile_buffer[FILENAME_MAX]; 253 char infile_buffer[FILENAME_MAX];
255 char outfile_buffer[FILENAME_MAX]; 254 char outfile_buffer[FILENAME_MAX];
diff --git a/src/unexelf.c b/src/unexelf.c
index 0de69a4cabc..605b9f75ac0 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -33,34 +33,13 @@ what you give them. Help stamp out software-hoarding! */
33 * Modified heavily since then. 33 * Modified heavily since then.
34 * 34 *
35 * Synopsis: 35 * Synopsis:
36 * unexec (new_name, old_name, data_start, bss_start, entry_address) 36 * unexec (const char *new_name, const char *old_name);
37 * char *new_name, *old_name;
38 * unsigned data_start, bss_start, entry_address;
39 * 37 *
40 * Takes a snapshot of the program and makes an a.out format file in the 38 * Takes a snapshot of the program and makes an a.out format file in the
41 * file named by the string argument new_name. 39 * file named by the string argument new_name.
42 * If old_name is non-NULL, the symbol table will be taken from the given file. 40 * If old_name is non-NULL, the symbol table will be taken from the given file.
43 * On some machines, an existing old_name file is required. 41 * On some machines, an existing old_name file is required.
44 * 42 *
45 * The boundaries within the a.out file may be adjusted with the data_start
46 * and bss_start arguments. Either or both may be given as 0 for defaults.
47 *
48 * Data_start gives the boundary between the text segment and the data
49 * segment of the program. The text segment can contain shared, read-only
50 * program code and literal data, while the data segment is always unshared
51 * and unprotected. Data_start gives the lowest unprotected address.
52 * The value you specify may be rounded down to a suitable boundary
53 * as required by the machine you are using.
54 *
55 * Bss_start indicates how much of the data segment is to be saved in the
56 * a.out file and restored when the program is executed. It gives the lowest
57 * unsaved address, and is rounded up to a page boundary. The default when 0
58 * is given assumes that the entire data segment is to be stored, including
59 * the previous data and bss as well as any additional storage allocated with
60 * break (2).
61 *
62 * The new file is set up to start at entry_address.
63 *
64 */ 43 */
65 44
66/* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co. 45/* Even more heavily modified by james@bigtex.cactus.org of Dell Computer Co.
@@ -407,13 +386,8 @@ temacs:
407/* We do not use mmap because that fails with NFS. 386/* We do not use mmap because that fails with NFS.
408 Instead we read the whole file, modify it, and write it out. */ 387 Instead we read the whole file, modify it, and write it out. */
409 388
410#ifndef emacs
411#define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
412#include <string.h>
413#else
414#include <config.h> 389#include <config.h>
415extern void fatal (const char *msgid, ...); 390extern void fatal (const char *msgid, ...);
416#endif
417 391
418#include <sys/types.h> 392#include <sys/types.h>
419#include <stdio.h> 393#include <stdio.h>
@@ -424,7 +398,7 @@ extern void fatal (const char *msgid, ...);
424#include <fcntl.h> 398#include <fcntl.h>
425#if !defined (__NetBSD__) && !defined (__OpenBSD__) 399#if !defined (__NetBSD__) && !defined (__OpenBSD__)
426#include <elf.h> 400#include <elf.h>
427#endif 401#endif /* not __NetBSD__ and not __OpenBSD__ */
428#include <sys/mman.h> 402#include <sys/mman.h>
429#if defined (_SYSTYPE_SYSV) 403#if defined (_SYSTYPE_SYSV)
430#include <sys/elf_mips.h> 404#include <sys/elf_mips.h>
@@ -610,7 +584,7 @@ round_up (ElfW(Addr) x, ElfW(Addr) y)
610 if NOERROR is 0; we return -1 if NOERROR is nonzero. */ 584 if NOERROR is 0; we return -1 if NOERROR is nonzero. */
611 585
612static int 586static int
613find_section (const char *name, char *section_names, char *file_name, 587find_section (const char *name, const char *section_names, const char *file_name,
614 ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror) 588 ElfW(Ehdr) *old_file_h, ElfW(Shdr) *old_section_h, int noerror)
615{ 589{
616 int idx; 590 int idx;
@@ -646,8 +620,7 @@ find_section (const char *name, char *section_names, char *file_name,
646 * 620 *
647 */ 621 */
648void 622void
649unexec (char *new_name, char *old_name, unsigned int data_start, 623unexec (const char *new_name, const char *old_name)
650 unsigned int bss_start, unsigned int entry_address)
651{ 624{
652 int new_file, old_file, new_file_size; 625 int new_file, old_file, new_file_size;
653 626
@@ -1309,13 +1282,8 @@ temacs:
1309 /* Write out new_file, and free the buffers. */ 1282 /* Write out new_file, and free the buffers. */
1310 1283
1311 if (write (new_file, new_base, new_file_size) != new_file_size) 1284 if (write (new_file, new_base, new_file_size) != new_file_size)
1312#ifndef emacs
1313 fatal ("Didn't write %d bytes: errno %d\n",
1314 new_file_size, errno);
1315#else
1316 fatal ("Didn't write %d bytes to %s: errno %d\n", 1285 fatal ("Didn't write %d bytes to %s: errno %d\n",
1317 new_file_size, new_name, errno); 1286 new_file_size, new_name, errno);
1318#endif
1319 munmap (old_base, old_file_size); 1287 munmap (old_base, old_file_size);
1320 munmap (new_base, new_file_size); 1288 munmap (new_base, new_file_size);
1321 1289
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c
index cad2a5025ab..b9edd4f3a84 100644
--- a/src/unexhp9k800.c
+++ b/src/unexhp9k800.c
@@ -49,16 +49,11 @@
49 sigsetreturn (_sigreturn); 49 sigsetreturn (_sigreturn);
50*/ 50*/
51 51
52#ifdef emacs
53#include <config.h> 52#include <config.h>
54#endif
55
56#include <stdio.h> 53#include <stdio.h>
57#include <fcntl.h> 54#include <fcntl.h>
58#include <errno.h> 55#include <errno.h>
59
60#include <a.out.h> 56#include <a.out.h>
61
62#include <dl.h> 57#include <dl.h>
63 58
64/* brk value to restore, stored as a global. 59/* brk value to restore, stored as a global.
@@ -79,12 +74,9 @@ run_time_remap (ignored)
79 74
80 75
81/* Create a new a.out file, same as old but with current data space */ 76/* Create a new a.out file, same as old but with current data space */
82 77int
83unexec (new_name, old_name, new_end_of_text, dummy1, dummy2) 78unexec (const char *new_name, /* name of the new a.out file to be created */
84 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 */
85 char old_name[]; /* name of the old a.out file */
86 char *new_end_of_text; /* ptr to new edata/etext; NOT USED YET */
87 int dummy1, dummy2; /* not used by emacs */
88{ 80{
89 int old, new; 81 int old, new;
90 int old_size, new_size; 82 int old_size, new_size;
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 5c450e062c6..f48c8d7dfa6 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -190,6 +190,8 @@ static off_t data_segment_old_fileoff = 0;
190 190
191static struct segment_command *data_segment_scp; 191static struct segment_command *data_segment_scp;
192 192
193static void unexec_error (const char *format, ...) NO_RETURN;
194
193/* Read N bytes from infd into memory starting at address DEST. 195/* Read N bytes from infd into memory starting at address DEST.
194 Return true if successful, false otherwise. */ 196 Return true if successful, false otherwise. */
195static int 197static int
@@ -1217,9 +1219,8 @@ dump_it (void)
1217 from it. The file names of the output and input files are outfile 1219 from it. The file names of the output and input files are outfile
1218 and infile, respectively. The three other parameters are 1220 and infile, respectively. The three other parameters are
1219 ignored. */ 1221 ignored. */
1220void 1222int
1221unexec (char *outfile, char *infile, void *start_data, void *start_bss, 1223unexec (const char *outfile, const char *infile)
1222 void *entry_address)
1223{ 1224{
1224 if (in_dumped_exec) 1225 if (in_dumped_exec)
1225 unexec_error ("Unexec from a dumped executable is not supported."); 1226 unexec_error ("Unexec from a dumped executable is not supported.");
@@ -1249,6 +1250,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss,
1249 dump_it (); 1250 dump_it ();
1250 1251
1251 close (outfd); 1252 close (outfd);
1253 return 0;
1252} 1254}
1253 1255
1254 1256
diff --git a/src/unexsol.c b/src/unexsol.c
index 04e3f40799c..1d58ed46d4b 100644
--- a/src/unexsol.c
+++ b/src/unexsol.c
@@ -1,7 +1,6 @@
1/* Trivial unexec for Solaris. */ 1/* Trivial unexec for Solaris. */
2 2
3#include <config.h> 3#include <config.h>
4#include <stdlib.h>
5#include <dlfcn.h> 4#include <dlfcn.h>
6#include <setjmp.h> 5#include <setjmp.h>
7 6
@@ -11,8 +10,7 @@
11#include "coding.h" 10#include "coding.h"
12 11
13int 12int
14unexec (char *new_name, char *old_name, unsigned int data_start, 13unexec (const char *new_name, const char *old_name)
15 unsigned int bss_start, unsigned int entry_address)
16{ 14{
17 Lisp_Object data; 15 Lisp_Object data;
18 Lisp_Object errstring; 16 Lisp_Object errstring;
diff --git a/src/unexw32.c b/src/unexw32.c
index d3e4e812480..a4dba647f53 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -724,9 +724,8 @@ copy_executable_and_dump_data (file_data *p_infile,
724 724
725 725
726/* Dump out .data and .bss sections into a new executable. */ 726/* Dump out .data and .bss sections into a new executable. */
727void 727int
728unexec (char *new_name, char *old_name, void *start_data, void *start_bss, 728unexec (const char *new_name, const char *old_name)
729 void *entry_address)
730{ 729{
731 file_data in_file, out_file; 730 file_data in_file, out_file;
732 char out_filename[MAX_PATH], in_filename[MAX_PATH]; 731 char out_filename[MAX_PATH], in_filename[MAX_PATH];
@@ -821,6 +820,8 @@ unexec (char *new_name, char *old_name, void *start_data, void *start_bss,
821 820
822 close_file_data (&in_file); 821 close_file_data (&in_file);
823 close_file_data (&out_file); 822 close_file_data (&out_file);
823
824 return 0;
824} 825}
825 826
826/* eof */ 827/* eof */
diff --git a/src/vm-limit.c b/src/vm-limit.c
index 63f0f47e2d0..813ee6163c9 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -17,12 +17,9 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#ifdef emacs
21#include <config.h> 20#include <config.h>
22#include <setjmp.h> 21#include <setjmp.h>
23#include "lisp.h" 22#include "lisp.h"
24#endif
25
26#include "mem-limits.h" 23#include "mem-limits.h"
27 24
28/* 25/*
diff --git a/src/w16select.c b/src/w16select.c
index ef1b974752b..4d471e97911 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#ifdef MSDOS 28#ifdef MSDOS
29 29
30#include <config.h> 30#include <config.h>
31#include <string.h>
32#include <dpmi.h> 31#include <dpmi.h>
33#include <go32.h> 32#include <go32.h>
34#include <sys/farptr.h> 33#include <sys/farptr.h>
diff --git a/src/w32.c b/src/w32.c
index 4ccda449b47..ae34ac6aadb 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -2970,7 +2970,7 @@ convert_time (FILETIME ft)
2970 2970
2971 if (!init) 2971 if (!init)
2972 { 2972 {
2973 initialize_utc_base(); 2973 initialize_utc_base ();
2974 init = 1; 2974 init = 1;
2975 } 2975 }
2976 2976
@@ -5037,7 +5037,7 @@ fcntl (int s, int cmd, int options)
5037 unsigned long nblock = 1; 5037 unsigned long nblock = 1;
5038 int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock); 5038 int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock);
5039 if (rc == SOCKET_ERROR) 5039 if (rc == SOCKET_ERROR)
5040 set_errno(); 5040 set_errno ();
5041 /* Keep track of the fact that we set this to non-blocking. */ 5041 /* Keep track of the fact that we set this to non-blocking. */
5042 fd_info[s].flags |= FILE_NDELAY; 5042 fd_info[s].flags |= FILE_NDELAY;
5043 return rc; 5043 return rc;
@@ -5935,8 +5935,7 @@ serial_open (char *port)
5935 5935
5936/* For serial-process-configure */ 5936/* For serial-process-configure */
5937void 5937void
5938serial_configure (struct Lisp_Process *p, 5938serial_configure (struct Lisp_Process *p, Lisp_Object contact)
5939 Lisp_Object contact)
5940{ 5939{
5941 Lisp_Object childp2 = Qnil; 5940 Lisp_Object childp2 = Qnil;
5942 Lisp_Object tem = Qnil; 5941 Lisp_Object tem = Qnil;
diff --git a/src/w32console.c b/src/w32console.c
index 26fa544d670..35f0fc195f7 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -25,10 +25,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#include <config.h> 26#include <config.h>
27 27
28#include <stdlib.h>
29#include <stdio.h> 28#include <stdio.h>
30#include <windows.h> 29#include <windows.h>
31#include <string.h>
32#include <setjmp.h> 30#include <setjmp.h>
33 31
34#include "lisp.h" 32#include "lisp.h"
@@ -585,28 +583,6 @@ w32_face_attributes (struct frame *f, int face_id)
585 return char_attr; 583 return char_attr;
586} 584}
587 585
588
589
590/* Given a color index, return its standard name. */
591Lisp_Object
592vga_stdcolor_name (int idx)
593{
594 /* Standard VGA colors, in the order of their standard numbering
595 in the default VGA palette. */
596 static char *vga_colors[16] = {
597 "black", "blue", "green", "cyan", "red", "magenta", "brown",
598 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
599 "lightred", "lightmagenta", "yellow", "white"
600 };
601
602 extern Lisp_Object Qunspecified;
603
604 if (idx >= 0 && idx < sizeof (vga_colors) / sizeof (vga_colors[0]))
605 return build_string (vga_colors[idx]);
606 else
607 return Qunspecified; /* meaning the default */
608}
609
610void 586void
611initialize_w32_display (struct terminal *term) 587initialize_w32_display (struct terminal *term)
612{ 588{
diff --git a/src/w32fns.c b/src/w32fns.c
index 5e5f11c813d..808503547f1 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -245,7 +245,7 @@ struct MONITOR_INFO
245}; 245};
246 246
247/* Reportedly, VS 6 does not have this in its headers. */ 247/* Reportedly, VS 6 does not have this in its headers. */
248#if defined(_MSC_VER) && _MSC_VER < 1300 248#if defined (_MSC_VER) && _MSC_VER < 1300
249DECLARE_HANDLE(HMONITOR); 249DECLARE_HANDLE(HMONITOR);
250#endif 250#endif
251 251
@@ -1870,7 +1870,6 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1870 } 1870 }
1871} 1871}
1872 1872
1873
1874void 1873void
1875x_set_scroll_bar_default_width (struct frame *f) 1874x_set_scroll_bar_default_width (struct frame *f)
1876{ 1875{
@@ -1900,7 +1899,7 @@ w32_load_cursor (LPCTSTR name)
1900 return cursor; 1899 return cursor;
1901} 1900}
1902 1901
1903extern LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM); 1902static LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM);
1904 1903
1905static BOOL 1904static BOOL
1906w32_init_class (HINSTANCE hinst) 1905w32_init_class (HINSTANCE hinst)
@@ -2672,7 +2671,7 @@ post_character_message (HWND hwnd, UINT msg,
2672 2671
2673/* Main window procedure */ 2672/* Main window procedure */
2674 2673
2675LRESULT CALLBACK 2674static LRESULT CALLBACK
2676w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 2675w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
2677{ 2676{
2678 struct frame *f; 2677 struct frame *f;
@@ -3918,7 +3917,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3918 return DefWindowProc (hwnd, msg, wParam, lParam); 3917 return DefWindowProc (hwnd, msg, wParam, lParam);
3919 } 3918 }
3920 3919
3921
3922 /* The most common default return code for handled messages is 0. */ 3920 /* The most common default return code for handled messages is 0. */
3923 return 0; 3921 return 0;
3924} 3922}
@@ -4359,7 +4357,6 @@ This function is an internal primitive--use `make-frame' instead. */)
4359 x_default_parameter (f, parameters, Qright_fringe, Qnil, 4357 x_default_parameter (f, parameters, Qright_fringe, Qnil,
4360 "rightFringe", "RightFringe", RES_TYPE_NUMBER); 4358 "rightFringe", "RightFringe", RES_TYPE_NUMBER);
4361 4359
4362
4363 /* Init faces before x_default_parameter is called for scroll-bar 4360 /* Init faces before x_default_parameter is called for scroll-bar
4364 parameters because that function calls x_set_scroll_bar_width, 4361 parameters because that function calls x_set_scroll_bar_width,
4365 which calls change_frame_size, which calls Fset_window_buffer, 4362 which calls change_frame_size, which calls Fset_window_buffer,
@@ -5903,7 +5900,7 @@ extern Lisp_Object Qfile_name_history;
5903 read-only when "Directories" is selected in the filter. This 5900 read-only when "Directories" is selected in the filter. This
5904 allows us to work around the fact that the standard Open File 5901 allows us to work around the fact that the standard Open File
5905 dialog does not support directories. */ 5902 dialog does not support directories. */
5906UINT CALLBACK 5903static UINT CALLBACK
5907file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) 5904file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
5908{ 5905{
5909 if (msg == WM_NOTIFY) 5906 if (msg == WM_NOTIFY)
diff --git a/src/w32font.c b/src/w32font.c
index 46fca5d78d5..f489fe2d763 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -333,7 +333,7 @@ w32font_has_char (Lisp_Object entity, int c)
333} 333}
334 334
335/* w32 implementation of encode_char for font backend. 335/* w32 implementation of encode_char for font backend.
336 Return a glyph code of FONT for characer C (Unicode code point). 336 Return a glyph code of FONT for character C (Unicode code point).
337 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. 337 If FONT doesn't have such a glyph, return FONT_INVALID_CODE.
338 338
339 For speed, the gdi backend uses unicode (Emacs calls encode_char 339 For speed, the gdi backend uses unicode (Emacs calls encode_char
@@ -1058,7 +1058,7 @@ w32_enumfont_pattern_entity (Lisp_Object frame,
1058 1058
1059 1059
1060/* Convert generic families to the family portion of lfPitchAndFamily. */ 1060/* Convert generic families to the family portion of lfPitchAndFamily. */
1061BYTE 1061static BYTE
1062w32_generic_family (Lisp_Object name) 1062w32_generic_family (Lisp_Object name)
1063{ 1063{
1064 /* Generic families. */ 1064 /* Generic families. */
@@ -1798,7 +1798,7 @@ w32_decode_weight (int fnweight)
1798 if (fnweight >= FW_NORMAL) return 100; 1798 if (fnweight >= FW_NORMAL) return 100;
1799 if (fnweight >= FW_LIGHT) return 50; 1799 if (fnweight >= FW_LIGHT) return 50;
1800 if (fnweight >= FW_EXTRALIGHT) return 40; 1800 if (fnweight >= FW_EXTRALIGHT) return 40;
1801 if (fnweight > FW_THIN) return 20; 1801 if (fnweight > FW_THIN) return 20;
1802 return 0; 1802 return 0;
1803} 1803}
1804 1804
@@ -1812,7 +1812,7 @@ w32_encode_weight (int n)
1812 if (n >= 100) return FW_NORMAL; 1812 if (n >= 100) return FW_NORMAL;
1813 if (n >= 50) return FW_LIGHT; 1813 if (n >= 50) return FW_LIGHT;
1814 if (n >= 40) return FW_EXTRALIGHT; 1814 if (n >= 40) return FW_EXTRALIGHT;
1815 if (n >= 20) return FW_THIN; 1815 if (n >= 20) return FW_THIN;
1816 return 0; 1816 return 0;
1817} 1817}
1818 1818
@@ -1822,9 +1822,9 @@ static Lisp_Object
1822w32_to_fc_weight (int n) 1822w32_to_fc_weight (int n)
1823{ 1823{
1824 if (n >= FW_EXTRABOLD) return intern ("black"); 1824 if (n >= FW_EXTRABOLD) return intern ("black");
1825 if (n >= FW_BOLD) return intern ("bold"); 1825 if (n >= FW_BOLD) return intern ("bold");
1826 if (n >= FW_SEMIBOLD) return intern ("demibold"); 1826 if (n >= FW_SEMIBOLD) return intern ("demibold");
1827 if (n >= FW_NORMAL) return intern ("medium"); 1827 if (n >= FW_NORMAL) return intern ("medium");
1828 return intern ("light"); 1828 return intern ("light");
1829} 1829}
1830 1830
@@ -1912,7 +1912,6 @@ fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec)
1912 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; 1912 logfont->lfPitchAndFamily = family | DEFAULT_PITCH;
1913 } 1913 }
1914 1914
1915
1916 /* Set pitch based on the spacing property. */ 1915 /* Set pitch based on the spacing property. */
1917 tmp = AREF (font_spec, FONT_SPACING_INDEX); 1916 tmp = AREF (font_spec, FONT_SPACING_INDEX);
1918 if (INTEGERP (tmp)) 1917 if (INTEGERP (tmp))
@@ -2378,6 +2377,23 @@ in the font selection dialog. */)
2378 return DECODE_SYSTEM (build_string (buf)); 2377 return DECODE_SYSTEM (build_string (buf));
2379} 2378}
2380 2379
2380static const char *w32font_booleans [] = {
2381 NULL,
2382};
2383
2384static const char *w32font_non_booleans [] = {
2385 ":script",
2386 ":antialias",
2387 ":style",
2388 NULL,
2389};
2390
2391static void
2392w32font_filter_properties (Lisp_Object font, Lisp_Object alist)
2393{
2394 font_filter_properties (font, alist, w32font_booleans, w32font_non_booleans);
2395}
2396
2381struct font_driver w32font_driver = 2397struct font_driver w32font_driver =
2382 { 2398 {
2383 0, /* Qgdi */ 2399 0, /* Qgdi */
@@ -2407,7 +2423,7 @@ struct font_driver w32font_driver =
2407 NULL, /* shape */ 2423 NULL, /* shape */
2408 NULL, /* check */ 2424 NULL, /* check */
2409 NULL, /* get_variation_glyphs */ 2425 NULL, /* get_variation_glyphs */
2410 NULL, /* filter_properties */ 2426 w32font_filter_properties,
2411 }; 2427 };
2412 2428
2413 2429
diff --git a/src/w32heap.c b/src/w32heap.c
index e307694a563..285325e3f8b 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25#include <config.h> 25#include <config.h>
26#endif 26#endif
27 27
28#include <stdlib.h>
29#include <stdio.h> 28#include <stdio.h>
30#include <setjmp.h> 29#include <setjmp.h>
31 30
@@ -279,7 +278,7 @@ round_heap (unsigned long align)
279 sbrk (need_to_alloc); 278 sbrk (need_to_alloc);
280} 279}
281 280
282#if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined(USE_CRT_DLL)) 281#if (_MSC_VER >= 1000 && _MSC_VER < 1300 && !defined (USE_CRT_DLL))
283 282
284/* MSVC 4.2 invokes these functions from mainCRTStartup to initialize 283/* MSVC 4.2 invokes these functions from mainCRTStartup to initialize
285 a heap via HeapCreate. They are normally defined by the runtime, 284 a heap via HeapCreate. They are normally defined by the runtime,
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 1ab0546d44f..1111f8dfa44 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include <config.h> 27#include <config.h>
28#endif 28#endif
29 29
30#include <stdlib.h>
31#include <stdio.h> 30#include <stdio.h>
32#include <windows.h> 31#include <windows.h>
33#include <setjmp.h> 32#include <setjmp.h>
@@ -289,7 +288,7 @@ static int faked_key = 0;
289 288
290/* return code -1 means that event_queue_ptr won't be incremented. 289/* return code -1 means that event_queue_ptr won't be incremented.
291 In other word, this event makes two key codes. (by himi) */ 290 In other word, this event makes two key codes. (by himi) */
292int 291static int
293key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead) 292key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
294{ 293{
295 static int mod_key_state = 0; 294 static int mod_key_state = 0;
diff --git a/src/w32menu.c b/src/w32menu.c
index 0ed9bffe70c..ff6bd977bea 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -106,6 +106,7 @@ static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object);
106#endif 106#endif
107 107
108static void utf8to16 (unsigned char *, int, WCHAR *); 108static void utf8to16 (unsigned char *, int, WCHAR *);
109static int fill_in_menu (HMENU, widget_value *);
109 110
110void w32_free_menu_strings (HWND); 111void w32_free_menu_strings (HWND);
111 112
@@ -996,7 +997,7 @@ w32_dialog_show (FRAME_PTR f, int keymaps,
996 Lisp_Object title, Lisp_Object header, 997 Lisp_Object title, Lisp_Object header,
997 char **error) 998 char **error)
998{ 999{
999 int i, nb_buttons=0; 1000 int i, nb_buttons = 0;
1000 char dialog_name[6]; 1001 char dialog_name[6];
1001 int menu_item_selection; 1002 int menu_item_selection;
1002 1003
@@ -1568,7 +1569,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
1568} 1569}
1569 1570
1570/* Construct native Windows menu(bar) based on widget_value tree. */ 1571/* Construct native Windows menu(bar) based on widget_value tree. */
1571int 1572static int
1572fill_in_menu (HMENU menu, widget_value *wv) 1573fill_in_menu (HMENU menu, widget_value *wv)
1573{ 1574{
1574 int items_added = 0; 1575 int items_added = 0;
@@ -1739,7 +1740,7 @@ syms_of_w32menu (void)
1739void 1740void
1740globals_of_w32menu (void) 1741globals_of_w32menu (void)
1741{ 1742{
1742 /* See if Get/SetMenuItemInfo functions are available. */ 1743 /* See if Get/SetMenuItemInfo functions are available. */
1743 HMODULE user32 = GetModuleHandle ("user32.dll"); 1744 HMODULE user32 = GetModuleHandle ("user32.dll");
1744 get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA"); 1745 get_menu_item_info = (GetMenuItemInfoA_Proc) GetProcAddress (user32, "GetMenuItemInfoA");
1745 set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA"); 1746 set_menu_item_info = (SetMenuItemInfoA_Proc) GetProcAddress (user32, "SetMenuItemInfoA");
diff --git a/src/w32proc.c b/src/w32proc.c
index ae4e725b6ef..49687574472 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -159,7 +159,7 @@ int child_proc_count = 0;
159child_process child_procs[ MAX_CHILDREN ]; 159child_process child_procs[ MAX_CHILDREN ];
160child_process *dead_child = NULL; 160child_process *dead_child = NULL;
161 161
162DWORD WINAPI reader_thread (void *arg); 162static DWORD WINAPI reader_thread (void *arg);
163 163
164/* Find an unused process slot. */ 164/* Find an unused process slot. */
165child_process * 165child_process *
@@ -168,7 +168,7 @@ new_child (void)
168 child_process *cp; 168 child_process *cp;
169 DWORD id; 169 DWORD id;
170 170
171 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) 171 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
172 if (!CHILD_ACTIVE (cp)) 172 if (!CHILD_ACTIVE (cp))
173 goto Initialise; 173 goto Initialise;
174 if (child_proc_count == MAX_CHILDREN) 174 if (child_proc_count == MAX_CHILDREN)
@@ -268,7 +268,7 @@ find_child_pid (DWORD pid)
268{ 268{
269 child_process *cp; 269 child_process *cp;
270 270
271 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) 271 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
272 if (CHILD_ACTIVE (cp) && pid == cp->pid) 272 if (CHILD_ACTIVE (cp) && pid == cp->pid)
273 return cp; 273 return cp;
274 return NULL; 274 return NULL;
@@ -279,7 +279,7 @@ find_child_pid (DWORD pid)
279 is normally blocked until woken by select() to check for input by 279 is normally blocked until woken by select() to check for input by
280 reading one char. When the read completes, char_avail is signaled 280 reading one char. When the read completes, char_avail is signaled
281 to wake up the select emulator and the thread blocks itself again. */ 281 to wake up the select emulator and the thread blocks itself again. */
282DWORD WINAPI 282static DWORD WINAPI
283reader_thread (void *arg) 283reader_thread (void *arg)
284{ 284{
285 child_process *cp; 285 child_process *cp;
@@ -495,7 +495,7 @@ sys_wait (int *status)
495 } 495 }
496 else 496 else
497 { 497 {
498 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) 498 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
499 /* some child_procs might be sockets; ignore them */ 499 /* some child_procs might be sockets; ignore them */
500 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess 500 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess
501 && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0)) 501 && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0))
@@ -608,7 +608,7 @@ get_result:
608# define IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER 608# define IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
609#endif 609#endif
610 610
611void 611static void
612w32_executable_type (char * filename, 612w32_executable_type (char * filename,
613 int * is_dos_app, 613 int * is_dos_app,
614 int * is_cygnus_app, 614 int * is_cygnus_app,
@@ -726,7 +726,7 @@ unwind:
726 close_file_data (&executable); 726 close_file_data (&executable);
727} 727}
728 728
729int 729static int
730compare_env (const void *strp1, const void *strp2) 730compare_env (const void *strp1, const void *strp2)
731{ 731{
732 const char *str1 = *(const char **)strp1, *str2 = *(const char **)strp2; 732 const char *str1 = *(const char **)strp1, *str2 = *(const char **)strp2;
@@ -750,7 +750,7 @@ compare_env (const void *strp1, const void *strp2)
750 return 1; 750 return 1;
751} 751}
752 752
753void 753static void
754merge_and_sort_env (char **envp1, char **envp2, char **new_envp) 754merge_and_sort_env (char **envp1, char **envp2, char **new_envp)
755{ 755{
756 char **optr, **nptr; 756 char **optr, **nptr;
@@ -895,7 +895,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
895 escape_char = is_cygnus_app ? '"' : '\\'; 895 escape_char = is_cygnus_app ? '"' : '\\';
896 } 896 }
897 897
898 /* Cygwin apps needs quoting a bit more often */ 898 /* Cygwin apps needs quoting a bit more often. */
899 if (escape_char == '"') 899 if (escape_char == '"')
900 sepchars = "\r\n\t\f '"; 900 sepchars = "\r\n\t\f '";
901 901
@@ -1245,7 +1245,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
1245count_children: 1245count_children:
1246 /* Add handles of child processes. */ 1246 /* Add handles of child processes. */
1247 nc = 0; 1247 nc = 0;
1248 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) 1248 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
1249 /* Some child_procs might be sockets; ignore them. Also some 1249 /* Some child_procs might be sockets; ignore them. Also some
1250 children may have died already, but we haven't finished reading 1250 children may have died already, but we haven't finished reading
1251 the process output; ignore them too. */ 1251 the process output; ignore them too. */
@@ -1999,7 +1999,7 @@ human-readable form. */)
1999 return make_number (GetThreadLocale ()); 1999 return make_number (GetThreadLocale ());
2000} 2000}
2001 2001
2002DWORD 2002static DWORD
2003int_from_hex (char * s) 2003int_from_hex (char * s)
2004{ 2004{
2005 DWORD val = 0; 2005 DWORD val = 0;
@@ -2021,7 +2021,7 @@ int_from_hex (char * s)
2021 function isn't given a context pointer. */ 2021 function isn't given a context pointer. */
2022Lisp_Object Vw32_valid_locale_ids; 2022Lisp_Object Vw32_valid_locale_ids;
2023 2023
2024BOOL CALLBACK 2024static BOOL CALLBACK
2025enum_locale_fn (LPTSTR localeNum) 2025enum_locale_fn (LPTSTR localeNum)
2026{ 2026{
2027 DWORD id = int_from_hex (localeNum); 2027 DWORD id = int_from_hex (localeNum);
@@ -2085,7 +2085,7 @@ If successful, the new locale id is returned, otherwise nil. */)
2085 function isn't given a context pointer. */ 2085 function isn't given a context pointer. */
2086Lisp_Object Vw32_valid_codepages; 2086Lisp_Object Vw32_valid_codepages;
2087 2087
2088BOOL CALLBACK 2088static BOOL CALLBACK
2089enum_codepage_fn (LPTSTR codepageNum) 2089enum_codepage_fn (LPTSTR codepageNum)
2090{ 2090{
2091 DWORD id = atoi (codepageNum); 2091 DWORD id = atoi (codepageNum);
diff --git a/src/w32reg.c b/src/w32reg.c
index 77667eb7dc9..5c02dd376c7 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include "blockinput.h" 26#include "blockinput.h"
27 27
28#include <stdio.h> 28#include <stdio.h>
29#include <string.h>
30 29
31#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 30#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
32 31
diff --git a/src/w32select.c b/src/w32select.c
index bd013a5ece9..f9bab384062 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1072,7 +1072,7 @@ syms_of_w32select (void)
1072When sending or receiving text via cut_buffer, selection, and 1072When sending or receiving text via cut_buffer, selection, and
1073clipboard, the text is encoded or decoded by this coding system. 1073clipboard, the text is encoded or decoded by this coding system.
1074The default value is the current system default encoding on 9x/Me and 1074The default value is the current system default encoding on 9x/Me and
1075`utf-16le-dos' (Unicode) on NT/W2K/XP. */); 1075`utf-16le-dos' (Unicode) on NT/W2K/XP. */);
1076 /* The actual value is set dynamically in the dumped Emacs, see 1076 /* The actual value is set dynamically in the dumped Emacs, see
1077 below. */ 1077 below. */
1078 Vselection_coding_system = Qnil; 1078 Vselection_coding_system = Qnil;
diff --git a/src/w32term.c b/src/w32term.c
index 992538e0e88..1f53860de2e 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21#include <config.h> 21#include <config.h>
22#include <signal.h> 22#include <signal.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <stdlib.h>
25#include <setjmp.h> 24#include <setjmp.h>
26#include "lisp.h" 25#include "lisp.h"
27#include "blockinput.h" 26#include "blockinput.h"
@@ -894,7 +893,7 @@ w32_set_terminal_modes (struct terminal *term)
894{ 893{
895} 894}
896 895
897/* This is called when exiting or suspending Emacs. Exiting will make 896/* This is called when exiting or suspending Emacs. Exiting will make
898 the W32 windows go away, and suspending requires no action. */ 897 the W32 windows go away, and suspending requires no action. */
899 898
900static void 899static void
@@ -3955,7 +3954,7 @@ static char dbcs_lead = 0;
3955 recursively with different messages by the system. 3954 recursively with different messages by the system.
3956*/ 3955*/
3957 3956
3958int 3957static int
3959w32_read_socket (struct terminal *terminal, int expected, 3958w32_read_socket (struct terminal *terminal, int expected,
3960 struct input_event *hold_quit) 3959 struct input_event *hold_quit)
3961{ 3960{
@@ -4240,7 +4239,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4240 inev.frame_or_window = window; 4239 inev.frame_or_window = window;
4241 } 4240 }
4242 4241
4243 last_window=window; 4242 last_window = window;
4244 } 4243 }
4245 if (!note_mouse_movement (f, &msg.msg)) 4244 if (!note_mouse_movement (f, &msg.msg))
4246 help_echo_string = previous_help_echo_string; 4245 help_echo_string = previous_help_echo_string;
@@ -5602,7 +5601,7 @@ x_make_frame_visible (struct frame *f)
5602 /* Adjust vertical window position in order to avoid being 5601 /* Adjust vertical window position in order to avoid being
5603 covered by a task bar placed at the bottom of the desktop. */ 5602 covered by a task bar placed at the bottom of the desktop. */
5604 SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0); 5603 SystemParametersInfo (SPI_GETWORKAREA, 0, &workarea_rect, 0);
5605 GetWindowRect (FRAME_W32_WINDOW(f), &window_rect); 5604 GetWindowRect (FRAME_W32_WINDOW (f), &window_rect);
5606 if (window_rect.bottom > workarea_rect.bottom 5605 if (window_rect.bottom > workarea_rect.bottom
5607 && window_rect.top > workarea_rect.top) 5606 && window_rect.top > workarea_rect.top)
5608 f->top_pos = max (window_rect.top 5607 f->top_pos = max (window_rect.top
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 05cc8346a50..6c29e6ee2d0 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -439,7 +439,7 @@ uniscribe_shape (Lisp_Object lgstring)
439} 439}
440 440
441/* Uniscribe implementation of encode_char for font backend. 441/* Uniscribe implementation of encode_char for font backend.
442 Return a glyph code of FONT for characer C (Unicode code point). 442 Return a glyph code of FONT for character C (Unicode code point).
443 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ 443 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */
444static unsigned 444static unsigned
445uniscribe_encode_char (struct font *font, int c) 445uniscribe_encode_char (struct font *font, int c)
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 8fee42dae48..4cbd812ec0f 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -408,7 +408,6 @@ XParseGeometry (char *string,
408 return (0); 408 return (0);
409 strind = nextCharacter; 409 strind = nextCharacter;
410 mask |= YNegative; 410 mask |= YNegative;
411
412 } 411 }
413 else 412 else
414 { 413 {
@@ -422,7 +421,7 @@ XParseGeometry (char *string,
422 } 421 }
423 } 422 }
424 423
425 /* If strind isn't at the end of the string the it's an invalid 424 /* If strind isn't at the end of the string then it's an invalid
426 geometry specification. */ 425 geometry specification. */
427 426
428 if (*strind != '\0') return (0); 427 if (*strind != '\0') return (0);
diff --git a/src/xdisp.c b/src/xdisp.c
index 9b0f94ef657..4c007e572ce 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12494,8 +12494,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12494 /* Non-zero means we've seen at least one glyph that came from a 12494 /* Non-zero means we've seen at least one glyph that came from a
12495 display string. */ 12495 display string. */
12496 int string_seen = 0; 12496 int string_seen = 0;
12497 /* Largest buffer position seen so far during scan of glyph row. */ 12497 /* Largest and smalles buffer positions seen so far during scan of
12498 EMACS_INT bpos_max = last_pos; 12498 glyph row. */
12499 EMACS_INT bpos_max = pos_before;
12500 EMACS_INT bpos_min = pos_after;
12499 /* Last buffer position covered by an overlay string with an integer 12501 /* Last buffer position covered by an overlay string with an integer
12500 `cursor' property. */ 12502 `cursor' property. */
12501 EMACS_INT bpos_covered = 0; 12503 EMACS_INT bpos_covered = 0;
@@ -12585,6 +12587,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12585 12587
12586 if (glyph->charpos > bpos_max) 12588 if (glyph->charpos > bpos_max)
12587 bpos_max = glyph->charpos; 12589 bpos_max = glyph->charpos;
12590 if (glyph->charpos < bpos_min)
12591 bpos_min = glyph->charpos;
12588 if (!glyph->avoid_cursor_p) 12592 if (!glyph->avoid_cursor_p)
12589 { 12593 {
12590 /* If we hit point, we've found the glyph on which to 12594 /* If we hit point, we've found the glyph on which to
@@ -12659,6 +12663,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12659 12663
12660 if (glyph->charpos > bpos_max) 12664 if (glyph->charpos > bpos_max)
12661 bpos_max = glyph->charpos; 12665 bpos_max = glyph->charpos;
12666 if (glyph->charpos < bpos_min)
12667 bpos_min = glyph->charpos;
12662 if (!glyph->avoid_cursor_p) 12668 if (!glyph->avoid_cursor_p)
12663 { 12669 {
12664 if (dpos == 0) 12670 if (dpos == 0)
@@ -12745,7 +12751,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
12745 } 12751 }
12746 } 12752 }
12747 else if (match_with_avoid_cursor 12753 else if (match_with_avoid_cursor
12748 /* zero-width characters produce no glyphs */ 12754 /* A truncated row may not include PT among its
12755 character positions. Setting the cursor inside the
12756 scroll margin will trigger recalculation of hscroll
12757 in hscroll_window_tree. */
12758 || (row->truncated_on_left_p && pt_old < bpos_min)
12759 || (row->truncated_on_right_p && pt_old > bpos_max)
12760 /* Zero-width characters produce no glyphs. */
12749 || ((row->reversed_p 12761 || ((row->reversed_p
12750 ? glyph_after > glyphs_end 12762 ? glyph_after > glyphs_end
12751 : glyph_after < glyphs_end) 12763 : glyph_after < glyphs_end)
diff --git a/src/xfont.c b/src/xfont.c
index 368587de6d8..d4c6af17c49 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h> 23#include <stdio.h>
24#include <stdlib.h>
25#include <setjmp.h> 24#include <setjmp.h>
26#include <X11/Xlib.h> 25#include <X11/Xlib.h>
27 26
@@ -842,7 +841,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
842 841
843 val = Ffont_get (font_object, QCavgwidth); 842 val = Ffont_get (font_object, QCavgwidth);
844 if (INTEGERP (val)) 843 if (INTEGERP (val))
845 font->average_width = XINT (val); 844 font->average_width = XINT (val) / 10;
846 if (font->average_width < 0) 845 if (font->average_width < 0)
847 font->average_width = - font->average_width; 846 font->average_width = - font->average_width;
848 if (font->average_width == 0 847 if (font->average_width == 0
diff --git a/src/xml.c b/src/xml.c
index 5829f1da538..a686e55f0b0 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -74,17 +74,24 @@ Lisp_Object make_dom (xmlNode *node)
74} 74}
75 75
76static Lisp_Object 76static Lisp_Object
77parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp) 77parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int htmlp)
78{ 78{
79 xmlDoc *doc; 79 xmlDoc *doc;
80 xmlNode *node; 80 xmlNode *node;
81 Lisp_Object result = Qnil; 81 Lisp_Object result = Qnil;
82 int ibeg, iend; 82 const char *burl = "";
83 char *burl = ""; 83 EMACS_INT bytes;
84 EMACS_INT istart, iend;
84 85
85 LIBXML_TEST_VERSION; 86 LIBXML_TEST_VERSION;
86 87
87 CHECK_STRING (string); 88 validate_region (&start, &end);
89
90 istart = XINT (start);
91 iend = XINT (end);
92
93 if (istart < GPT && GPT < iend)
94 move_gap (iend);
88 95
89 if (! NILP (base_url)) 96 if (! NILP (base_url))
90 { 97 {
@@ -92,13 +99,18 @@ parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp)
92 burl = SDATA (base_url); 99 burl = SDATA (base_url);
93 } 100 }
94 101
95 doc = htmlp 102 bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
96 ? htmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", 103
97 HTML_PARSE_RECOVER|HTML_PARSE_NONET| 104 if (htmlp)
98 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR) 105 doc = htmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
99 : xmlReadMemory (SDATA (string), SBYTES (string), burl, "utf-8", 106 bytes, burl, "utf-8",
100 XML_PARSE_NONET|XML_PARSE_NOWARNING| 107 HTML_PARSE_RECOVER|HTML_PARSE_NONET|
101 XML_PARSE_NOERROR); 108 HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR);
109 else
110 doc = xmlReadMemory (BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
111 bytes, burl, "utf-8",
112 XML_PARSE_NONET|XML_PARSE_NOWARNING|
113 XML_PARSE_NOERROR);
102 114
103 if (doc != NULL) 115 if (doc != NULL)
104 { 116 {
@@ -112,24 +124,24 @@ parse_string (Lisp_Object string, Lisp_Object base_url, int htmlp)
112 return result; 124 return result;
113} 125}
114 126
115DEFUN ("xml-parse-html-string-internal", Fxml_parse_html_string_internal, 127DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
116 Sxml_parse_html_string_internal, 128 Slibxml_parse_html_region,
117 1, 2, 0, 129 2, 3, 0,
118 doc: /* Parse STRING as an HTML document and return the parse tree. 130 doc: /* Parse the region as an HTML document and return the parse tree.
119If BASE-URL is non-nil, it is used to expand relative URLs. */) 131If BASE-URL is non-nil, it is used to expand relative URLs. */)
120 (Lisp_Object string, Lisp_Object base_url) 132 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
121{ 133{
122 return parse_string (string, base_url, 1); 134 return parse_region (start, end, base_url, 1);
123} 135}
124 136
125DEFUN ("xml-parse-string-internal", Fxml_parse_string_internal, 137DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
126 Sxml_parse_string_internal, 138 Slibxml_parse_xml_region,
127 1, 2, 0, 139 2, 3, 0,
128 doc: /* Parse STRING as an XML document and return the parse tree. 140 doc: /* Parse the region as an XML document and return the parse tree.
129If BASE-URL is non-nil, it is used to expand relative URLs. */) 141If BASE-URL is non-nil, it is used to expand relative URLs. */)
130 (Lisp_Object string, Lisp_Object base_url) 142 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
131{ 143{
132 return parse_string (string, base_url, 0); 144 return parse_region (start, end, base_url, 0);
133} 145}
134 146
135 147
@@ -139,8 +151,8 @@ If BASE-URL is non-nil, it is used to expand relative URLs. */)
139void 151void
140syms_of_xml (void) 152syms_of_xml (void)
141{ 153{
142 defsubr (&Sxml_parse_html_string_internal); 154 defsubr (&Slibxml_parse_html_region);
143 defsubr (&Sxml_parse_string_internal); 155 defsubr (&Slibxml_parse_xml_region);
144} 156}
145 157
146#endif /* HAVE_LIBXML2 */ 158#endif /* HAVE_LIBXML2 */
diff --git a/src/xterm.c b/src/xterm.c
index f9dd21c87fe..d9d908d4396 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1942,18 +1942,38 @@ x_draw_relief_rect (struct frame *f,
1942 gc = f->output_data.x->black_relief.gc; 1942 gc = f->output_data.x->black_relief.gc;
1943 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted); 1943 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
1944 1944
1945 /* This code is more complicated than it has to be, because of two
1946 minor hacks to make the boxes look nicer: (i) if width > 1, draw
1947 the outermost line using the black relief. (ii) Omit the four
1948 corner pixels. */
1949
1945 /* Top. */ 1950 /* Top. */
1946 if (top_p) 1951 if (top_p)
1947 for (i = 0; i < width; ++i) 1952 {
1948 XDrawLine (dpy, window, gc, 1953 if (width == 1)
1949 left_x + i * left_p, top_y + i, 1954 XDrawLine (dpy, window, gc,
1950 right_x + 1 - i * right_p, top_y + i); 1955 left_x + (left_p ? 1 : 0), top_y,
1956 right_x + (right_p ? 0 : 1), top_y);
1957
1958 for (i = 1; i < width; ++i)
1959 XDrawLine (dpy, window, gc,
1960 left_x + i * left_p, top_y + i,
1961 right_x + 1 - i * right_p, top_y + i);
1962 }
1951 1963
1952 /* Left. */ 1964 /* Left. */
1953 if (left_p) 1965 if (left_p)
1954 for (i = 0; i < width; ++i) 1966 {
1955 XDrawLine (dpy, window, gc, 1967 if (width == 1)
1956 left_x + i, top_y + i, left_x + i, bottom_y - i + 1); 1968 XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y);
1969
1970 XClearArea (dpy, window, left_x, top_y, 1, 1, False);
1971 XClearArea (dpy, window, left_x, bottom_y, 1, 1, False);
1972
1973 for (i = (width > 1 ? 1 : 0); i < width; ++i)
1974 XDrawLine (dpy, window, gc,
1975 left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
1976 }
1957 1977
1958 XSetClipMask (dpy, gc, None); 1978 XSetClipMask (dpy, gc, None);
1959 if (raised_p) 1979 if (raised_p)
@@ -1962,18 +1982,40 @@ x_draw_relief_rect (struct frame *f,
1962 gc = f->output_data.x->white_relief.gc; 1982 gc = f->output_data.x->white_relief.gc;
1963 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted); 1983 XSetClipRectangles (dpy, gc, 0, 0, clip_rect, 1, Unsorted);
1964 1984
1985 if (width > 1)
1986 {
1987 /* Outermost top line. */
1988 if (top_p)
1989 XDrawLine (dpy, window, gc,
1990 left_x + (left_p ? 1 : 0), top_y,
1991 right_x + (right_p ? 0 : 1), top_y);
1992
1993 /* Outermost left line. */
1994 if (left_p)
1995 XDrawLine (dpy, window, gc, left_x, top_y + 1, left_x, bottom_y);
1996 }
1997
1965 /* Bottom. */ 1998 /* Bottom. */
1966 if (bot_p) 1999 if (bot_p)
1967 for (i = 0; i < width; ++i) 2000 {
1968 XDrawLine (dpy, window, gc, 2001 XDrawLine (dpy, window, gc,
1969 left_x + i * left_p, bottom_y - i, 2002 left_x + (left_p ? 1 : 0), bottom_y,
1970 right_x + 1 - i * right_p, bottom_y - i); 2003 right_x + (right_p ? 0 : 1), bottom_y);
2004 for (i = 1; i < width; ++i)
2005 XDrawLine (dpy, window, gc,
2006 left_x + i * left_p, bottom_y - i,
2007 right_x + 1 - i * right_p, bottom_y - i);
2008 }
1971 2009
1972 /* Right. */ 2010 /* Right. */
1973 if (right_p) 2011 if (right_p)
1974 for (i = 0; i < width; ++i) 2012 {
1975 XDrawLine (dpy, window, gc, 2013 XClearArea (dpy, window, right_x, top_y, 1, 1, False);
1976 right_x - i, top_y + i + 1, right_x - i, bottom_y - i); 2014 XClearArea (dpy, window, right_x, bottom_y, 1, 1, False);
2015 for (i = 0; i < width; ++i)
2016 XDrawLine (dpy, window, gc,
2017 right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
2018 }
1977 2019
1978 XSetClipMask (dpy, gc, None); 2020 XSetClipMask (dpy, gc, None);
1979} 2021}
@@ -7729,18 +7771,6 @@ x_error_handler (Display *display, XErrorEvent *error)
7729 7771
7730/* .gdbinit puts a breakpoint here, so make sure it is not inlined. */ 7772/* .gdbinit puts a breakpoint here, so make sure it is not inlined. */
7731 7773
7732#if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */
7733#define NO_INLINE __attribute__((noinline))
7734#else
7735#define NO_INLINE
7736#endif
7737
7738/* Some versions of GNU/Linux define noinline in their headers. */
7739
7740#ifdef noinline
7741#undef noinline
7742#endif
7743
7744/* On older GCC versions, just putting x_error_quitter 7774/* On older GCC versions, just putting x_error_quitter
7745 after x_error_handler prevents inlining into the former. */ 7775 after x_error_handler prevents inlining into the former. */
7746 7776