aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-12-03 15:03:30 +0000
committerKaroly Lorentey2006-12-03 15:03:30 +0000
commit974b73e83842d63b14512aa225cc53983a9b5d14 (patch)
tree462170d38cbb7057e98f08e8c612a9d30eeea0fd /src
parentd0104e754a241cf83811fef30195d41201de533c (diff)
parentf5be22a273892218aad1db32c43ba562a08f3925 (diff)
downloademacs-974b73e83842d63b14512aa225cc53983a9b5d14.tar.gz
emacs-974b73e83842d63b14512aa225cc53983a9b5d14.zip
Merged from emacs@sv.gnu.org. Last-minute emacsclient rewrites be damned!
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-490 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-491 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-492 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-493 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-494 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-495 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-496 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-497 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-498 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-499 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-500 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-501 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-502 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-503 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-504 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-505 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-506 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-507 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-508 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-509 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-510 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-511 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-512 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-513 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-514 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-515 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-516 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-517 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-518 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-519 Update from CVS: etc/TUTORIAL.cn: Updated. * emacs@sv.gnu.org/emacs--devo--0--patch-520 Merge from erc--emacs--22 * emacs@sv.gnu.org/emacs--devo--0--patch-521 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-522 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-523 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-524 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-525 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-526 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-527 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-528 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-529 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-530 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-531 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-532 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-533 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-534 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-535 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-161 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-162 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-163 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-164 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-165 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-166 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-167 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-168 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-169 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-170 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-588
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog417
-rw-r--r--src/alloc.c22
-rw-r--r--src/buffer.c4
-rw-r--r--src/bytecode.c2
-rw-r--r--src/category.c3
-rw-r--r--src/coding.c9
-rw-r--r--src/config.in6
-rw-r--r--src/data.c4
-rw-r--r--src/dosfns.c2
-rw-r--r--src/editfns.c3
-rw-r--r--src/emacs.c2
-rw-r--r--src/eval.c2
-rw-r--r--src/fileio.c42
-rw-r--r--src/fns.c94
-rw-r--r--src/frame.c7
-rw-r--r--src/gtkutil.c7
-rw-r--r--src/image.c59
-rw-r--r--src/indent.c11
-rw-r--r--src/keyboard.c6
-rw-r--r--src/lread.c4
-rw-r--r--src/m/amdx86-64.h8
-rw-r--r--src/m/ibmrs6000.h6
-rw-r--r--src/m/pfa50.h2
-rw-r--r--src/mac.c32
-rw-r--r--src/macfns.c60
-rw-r--r--src/macmenu.c35
-rw-r--r--src/macselect.c9
-rw-r--r--src/macterm.c232
-rw-r--r--src/macterm.h13
-rw-r--r--src/minibuf.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/process.c2
-rw-r--r--src/regex.c190
-rw-r--r--src/s/aix4-2.h14
-rw-r--r--src/s/gnu-linux.h2
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/s/netbsd.h5
-rw-r--r--src/s/openbsd.h11
-rw-r--r--src/search.c2
-rw-r--r--src/sound.c16
-rw-r--r--src/strftime.c6
-rw-r--r--src/syntax.c2
-rw-r--r--src/sysdep.c2
-rw-r--r--src/term.c1
-rw-r--r--src/termhooks.h10
-rw-r--r--src/unexcw.c2
-rw-r--r--src/unexmacosx.c223
-rw-r--r--src/w16select.c2
-rw-r--r--src/w32fns.c72
-rw-r--r--src/w32menu.c28
-rw-r--r--src/w32proc.c3
-rw-r--r--src/w32term.c8
-rw-r--r--src/window.c13
-rw-r--r--src/xdisp.c11
-rw-r--r--src/xfaces.c18
-rw-r--r--src/xfns.c44
-rw-r--r--src/xmenu.c41
-rw-r--r--src/xselect.c16
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c145
-rw-r--r--src/xterm.h10
61 files changed, 1394 insertions, 616 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 27a229b0f68..506ee83c8cb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,406 @@
12006-10-29 Mark Davies <mark@mcs.vuw.ac.nz> (tiny change) 12006-12-01 Eli Zaretskii <eliz@gnu.org>
2
3 * w32fns.c (Fw32_shell_execute): Doc fix.
4
52006-11-30 Chong Yidong <cyd@stupidchicken.com>
6
7 * xdisp.c (move_it_to): Correctly count tab glyphs for continued
8 lines ending in tab.
9
102006-11-30 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
11
12 * xterm.c (x_raise_frame): Move setting of _NET_ACTIVE_WINDOW
13 property ...
14 (XTframe_raise_lower): ... to here.
15
162006-11-30 Kenichi Handa <handa@m17n.org>
17
18 * regex.c (regex_compile): Fix previous change.
19
202006-11-29 Juanma Barranquero <lekktu@gmail.com>
21
22 * sound.c (Fplay_sound_internal): Remove spurious newline in docstring.
23
242006-11-28 Chong Yidong <cyd@stupidchicken.com>
25
26 * config.in: Regenerate.
27
282006-11-28 Kenichi Handa <handa@m17n.org>
29
30 * regex.c (regex_compile): Don't call SET_LIST_BIT with a
31 multibyte character.
32
332006-11-27 Chong Yidong <cyd@stupidchicken.com>
34
35 * s/aix4-2.h: Undefine _NO_PROTO. Suggested by Joe Buehler.
36
372006-11-27 Kim F. Storm <storm@cua.dk>
38
39 * window.c (set_window_buffer): Refactor recent changes.
40
412006-11-27 Jason Rumney <jasonr@gnu.org>
42
43 * w32term.c (w32_msg_worker): Declare correctly.
44 (w32_initialize): Don't cast w32_msg_worker.
45
46 * w32fns.c (w32_msg_worker): Define as WINAPI and arg as void pointer.
47
482006-11-26 Chong Yidong <cyd@stupidchicken.com>
49
50 * m/amdx86-64.h: Look for standard libs in /usr/lib64 only if that
51 directory exists.
52
532006-11-25 Eli Zaretskii <eliz@gnu.org>
54
55 * w16select.c (Fw16_set_clipboard_data): Fix the call to sit_for
56 as per the calling sequence change on 2006-07-11.
57
582006-11-25 Chong Yidong <cyd@stupidchicken.com>
59
60 * window.c (set_window_buffer): Use BLOCK_INPUT.
61
622006-11-24 Juanma Barranquero <lekktu@gmail.com>
63
64 * fns.c (substring_both): Add missing address operator.
65
662006-11-24 Stefan Monnier <monnier@iro.umontreal.ca>
67
68 * fns.c: Use AREF/ASIZE macros.
69 (concat): Provide the full ANSI prototype.
70
712006-11-24 Juanma Barranquero <lekktu@gmail.com>
72
73 * buffer.c (syms_of_buffer) <buffer-undo-list>: Doc fix.
74
752006-11-23 William Smith <William.Smith@global360.com> (tiny change)
76
77 * strftime.c (HAVE_SYS__MBSTATE_T_H): Fix typo.
78
792006-11-02 Alfred M. Szmidt <ams@gnu.org> (tiny change)
80
81 * s/openbsd.h (LD_SWITCH_SYSTEM): Remove /usr/pkg/lib and
82 /usr/pkg/lib from the library search path.
83 (LD_SWITCH_X_DEFAULT): New macro.
84
852006-11-22 Chong Yidong <cyd@stupidchicken.com>
86
87 * window.c (set_window_buffer): Clear mouse highlight if it is in
88 this window.
89
902006-11-21 Chong Yidong <cyd@stupidchicken.com>
91
92 * xfaces.c (realize_default_face): Check if the default font name
93 exists on this display before trying to use it.
94
952006-11-21 Richard Stallman <rms@gnu.org>
96
97 * fileio.c: Break line before &&, not after.
98
992006-11-20 Eli Zaretskii <eliz@gnu.org>
100
101 * fns.c (concat) [!__GNUC__]: Add prototype.
102
1032006-11-20 Kenichi Handa <handa@m17n.org>
104
105 * fileio.c (Fread_file_name_internal): Use SBYTES (not SCHARS) to
106 check the tailing slash of a filename.
107
1082006-11-20 KOBAYASHI Yasuhiro <kobayays@otsukakj.co.jp> (tiny change)
109
110 * indent.c (Fvertical_motion): Include composition in the case of
111 overshoot expected.
112
1132006-11-19 Andreas Schwab <schwab@gnu.org>
114
115 * xfaces.c (Fdisplay_supports_face_attributes_p): Initialize supports.
116
117 * xmenu.c (Fx_popup_menu): Initialize selection.
118
1192006-11-18 Andreas Schwab <schwab@suse.de>
120
121 * s/gnu-linux.h (GC_MARK_SECONDARY_STACK): Update call to mark_memory.
122
1232006-11-17 Tetsurou Okazaki <okazaki@be.to> (tiny change)
124
125 * xterm.c (do_ewmh_fullscreen): Declare variable before XSETFRAME
126 to avoid gcc 2.96 error.
127
1282006-11-17 NIIMI Satoshi <sa2c@sa2c.net> (tiny change)
129
130 * search.c (simple_search): In the loop of backward searching,
131 check also the byte position against the limit.
132
1332006-11-14 Romain Francoise <romain@orebokech.com>
134
135 * minibuf.c (Fcompleting_read): Fix typo in docstring.
136
1372006-11-14 Kenichi Handa <handa@m17n.org>
138
139 * coding.c (code_convert_region): Initialize coding->heading_ascii.
140 (decode_coding_string, code_convert_region): Likewise.
141
1422006-11-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
143
144 * config.in: Regenerate.
145
146 * macfns.c (Fx_display_mm_height, Fx_display_mm_width)
147 [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
148 && MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if
149 CGDisplayScreenSize is available.
150
151 * macmenu.c (menu_quit_handler, install_menu_quit_handler):
152 Replace `#ifdef HAVE_CANCELMENUTRACKING' with
153 `#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030'.
154 (install_menu_quit_handler) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
155 && MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if
156 CancelMenuTracking is available.
157
158 * macterm.c [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg)
159 [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
160 && MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if
161 CGContextShowGlyphsWithAdvances is available.
162
1632006-11-13 Jason Rumney <jasonr@gnu.org>
164
165 * s/ms-w32.h: Define HAVE_INET_SOCKETS.
166
1672006-11-13 Nozomu Ando <nand@mac.com>
168
169 * alloc.c (mark_memory): New argument OFFSET. All uses changed.
170 Fix address calculations for case END < START.
171 (mark_stack): Impose Lisp_Object alignment on jmp_buf.
172
1732006-11-12 Juanma Barranquero <lekktu@gmail.com>
174
175 * coding.c (Fencode_sjis_char, Fencode_big5_char):
176 Improve argument/docstring consistency.
177
178 * editfns.c (Fmessage): Doc fixes.
179
180 * process.c (syms_of_process) <delete-exited-processes>: Doc fix.
181
1822006-11-12 Chong Yidong <cyd@stupidchicken.com>
183
184 * xmenu.c (popup_activated): Define outside HAVE_MENUS.
185
1862006-11-12 Romain Francoise <romain@orebokech.com>
187
188 * xselect.c (selection-coding-system): Fix docstring.
189
1902006-11-12 Juanma Barranquero <lekktu@gmail.com>
191
192 * category.c (Fchar_category_set): Improve arg/docstring consistency.
193
194 * data.c (Flogxor):
195 * fns.c (Frandom, Flength, Fsafe_length, Fstring_bytes)
196 (Fstring_equal, Fcompare_strings, Fstring_lessp, Fcopy_sequence)
197 (Fstring_make_unibyte): Fix typos in docstrings.
198
1992006-11-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
200
201 * xterm.h (struct x_display_info): Fix indentation.
202
203 * xterm.c (do_ewmh_fullscreen, XTfullscreen_hook): New functions.
204 (x_check_fullscreen): Call do_ewmh_fullscreen.
205 (x_initialize): Set fullscreen_hook to XTfullscreen_hook.
206
207 * frame.c (x_set_fullscreen): Call fullscreen_hook if set.
208
209 * term.c: Define fullscreen_hook.
210 (syms_of_term): Initialize fullscreen_hook to NULL.
211
212 * termhooks.h: Add fullscreen_hook.
213
2142006-11-08 Juanma Barranquero <lekktu@gmail.com>
215
216 * bytecode.c (Fbyte_code):
217 * data.c (Fmakunbound): Use SYMBOL_CONSTANT_P macro.
218
2192006-11-06 Juanma Barranquero <lekktu@gmail.com>
220
221 * lread.c (syms_of_lread):
222 * xsmfns.c (syms_of_xsmfns): Fix typo in docstring.
223
2242006-11-06 Martin Rudalics <rudalics@gmx.at>
225
226 * macmenu.c (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
227
228 * w32menu.c (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
229 Return nil if building without menus.
230
231 * xmenu.c (Fmenu_or_popup_active_p): Define outside HAVE_MENUS.
232 Return nil if building without menus.
233
2342006-11-05 Mark Davies <mark@mcs.vuw.ac.nz> (tiny change)
235
236 * s/netbsd.h (POSIX_SIGNALS): Define.
237
2382006-11-05 Martin Rudalics <rudalics@gmx.at>
239
240 * macmenu.c (Fmenu_or_popup_active_p): New function.
241 (syms_of_macmenu): Defsubr it.
242
243 * w32menu.c (Fmenu_or_popup_active_p): New function.
244 (syms_of_w32menu): Defsubr it.
245 (popup_activated_flag, popup_activated): Remove.
246
247 * xdisp.c (note_mouse_highlight) [HAVE_NTGUI]: Don't bother to
248 check popup_activated.
249
250 * xmenu.c (Fmenu_or_popup_active_p): New function.
251 (syms_of_xmenu): Defsubr it.
252
2532006-11-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
254
255 * unexmacosx.c (malloc_cookie): Remove unused variable.
256 (region_list_head, region_list_tail, lca, nlc, infile_lc_highest_addr)
257 (text_seg_lowest_offset, mh, curr_header_offset, infd, outfd)
258 (emacs_zone, data_segment_old_fileoff, data_segment_scp)
259 (num_unexec_regions, unexec_regions): Make variables static.
260 (print_regions, find_emacs_zone_regions): Make static.
261 (unexec_region_info): New typedef.
262 (unexec_regions): Change type from vm_range_t[] to unexec_region_info[].
263 All uses changed.
264 (unexec_regions_recorder): Subtract size of trailing null pages from
265 filesize. Show filesize.
266 (unexec_regions_merge): Don't merge if null pages of preceding region
267 is not too small. Use long format in printf.
268 (copy_segment, copy_data_segment): Show filesize.
269 (copy_data_segment): Write filesize bytes of region data.
270 Adjust filesize in segment command accordingly.
271 (dump_it): Use long format in printf.
272
2732006-11-05 Juanma Barranquero <lekktu@gmail.com>
274
275 * dosfns.c (Finsert_startup_screen):
276 * fns.c (Ffeaturep, syms_of_fns):
277 * frame.c (syms_of_frame): Fix typos in docstrings.
278
279 * unexcw.c (unexec): Fix typo in output message.
280
2812006-11-04 Ralf Angeli <angeli@caeruleus.net>
282
283 * w32fns.c (w32_createwindow): Remove code for handling -geometry
284 command line option and `initial-frame-alist' which is superfluous
285 after the last change to `w32_createwindow'.
286
2872006-11-04 Slawomir Nowaczyk <slawek@cs.lth.se> (tiny change)
288
289 * w32proc.c (sys_wait): Only wait for processes with fd<0.
290 Others should be handled by sys_select instead. Fixes problems
291 with (progn (start-process "" nil "ls") (call-process "ls")).
292
2932006-11-04 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change)
294
295 * xmenu.c (Fmenu_bar_open): Declare variable before BLOCK_INPUT to
296 avoid gcc 2.95 error.
297
2982006-11-04 Chong Yidong <cyd@stupidchicken.com>
299
300 * gtkutil.c (update_frame_tool_bar): If icon image is invalid and
301 wicon is null, insert an empty button.
302
3032006-11-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
304
305 * xterm.c (x_raise_frame): Send _NET_ACTIVE_WINDOW when raising the
306 window.
307
3082006-11-02 Juanma Barranquero <lekktu@gmail.com>
309
310 * emacs.c (Fkill_emacs): Fix typo in docstring.
311
3122006-11-02 Nozomu Ando <nand@mac.com>
313
314 * unexmacosx.c (mach_header, segment_command, vm_region, section)
315 [_LP64]: New defines.
316 (VM_REGION_BASIC_INFO_COUNT, VM_REGION_BASIC_INFO, LC_SEGMENT)
317 (MH_MAGIC) [_LP64]: Redefine.
318 (delta): Remove variable.
319 (curr_file_offset, pagesize): New variables.
320 (ROUNDUP_TO_PAGE_BOUNDARY): New macro.
321 (data_segment_old_fileoff): Initialize explicitly.
322 (print_region, unexec_regions_recorder, print_load_command_name)
323 (copy_segment, copy_data_segment): Use long format in printf.
324 (MAX_UNEXEC_REGIONS): Increase to 400.
325 (unexec_regions_recorder): Don't warn too many regions here.
326 (find_emacs_zone_regions): Warn too many regions here.
327 (print_load_command_name) [_LP64]: Show correct load command name.
328 (copy_segment, copy_data_segment): Use variable `curr_file_offset'.
329 Show starting virtual memory address. Don't show ending file offset.
330 (copy_symtab, copy_dysymtab, copy_twolevelhints): New argument DELTA.
331 (dump_it): Use new local variable `linkedit_delta' and pass to them.
332 Error if trying to handle multiple DATA segments.
333 (unexec): Initialize variable `pagesize'.
334
3352006-11-01 Juanma Barranquero <lekktu@gmail.com>
336
337 * eval.c (Fcatch): Doc fix.
338
3392006-10-31 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
340
341 * image.c [MAC_OS] (image_load_qt_1, xpm_scan, xpm_make_color_table_v)
342 (xpm_put_color_table_v, xpm_get_color_table_v, xpm_make_color_table_h)
343 (xpm_put_color_table_h, xpm_get_color_table_h, xpm_str_to_color_key)
344 (xpm_load_image): Add const qualifier to arguments.
345 [MAC_OS] (xpm_color_key_strings): Make static const.
346
347 * mac.c (create_apple_event_from_event_ref)
348 (create_apple_event_from_drag_ref, skip_white_space, parse_comment)
349 (parse_include_file, parse_binding, parse_component)
350 (parse_resource_name, parse_value, parse_resource_line)
351 (xrm_merge_string_database, xrm_get_resource)
352 (xrm_get_preference_database): Add const qualifier to arguments.
353 [MAC_OSX] (sys_select): Make variable `context' static const.
354
355 * macfns.c (mac_color_map): Make static const.
356 (mac_color_map_lookup): Add const qualifier to arguments.
357
358 * macmenu.c (install_menu_quit_handler): Make variable `typesList'
359 static const.
360 (name_is_separator): Add const qualifier to arguments.
361
362 * macselect.c (init_service_handler): Make variable `specs' static
363 const.
364
365 * macterm.c (mac_create_bitmap_from_bitmap_data): Make variable
366 `swap_nibbles' static const.
367 (atsu_get_text_layout_with_text_ptr): Make variables `lengths',
368 `tags', `sizes', `values' static const.
369 (mac_draw_string_common): Make variables `context' static.
370 Make variables `tags', `sizes', and `values' static const.
371 (pcm_get_status, x_detect_focus_change, x_scroll_bar_handle_click)
372 (xlfdpat_create, xlfdpat_block_match_1, xlfdpat_match)
373 (mac_to_x_fontname, parse_x_font_name, add_mac_font_name)
374 (mac_do_list_fonts, is_fully_specified_xlfd, do_grow_window)
375 (mac_store_event_ref_as_apple_event, mac_make_rdb): Add const
376 qualifier to arguments.
377 (xlfd_scalable_fields, keycode_to_xkeysym_table)
378 (fn_keycode_to_keycode_table): Make static const.
379 (mac_load_query_font): Make variables `tags', `sizes', `values',
380 `types', and `selectors' static const.
381 (mac_handle_command_event, mac_handle_window_event):
382 Make variables `names' and `types' static const.
383 (init_command_handler, install_window_handler): Make variables
384 `specs*' static const.
385 (mac_handle_font_event, mac_handle_text_input_event)
386 (mac_store_service_event): Make variables `names' and `types'
387 const. Make variables `names_*' and `types_*' static const.
388
389 * macterm.h (create_apple_event_from_event_ref)
390 (create_apple_event_from_drag_ref, xrm_merge_string_database)
391 (xrm_get_resource, xrm_get_preference_database): Add const
392 qualifier to arguments in externs.
393
3942006-10-31 Kenichi Handa <handa@m17n.org>
395
396 * xfns.c (xic_create_xfontset): Fix previous change.
397
3982006-10-30 Chong Yidong <cyd@stupidchicken.com>
399
400 * s/openbsd.h (LD_SWITCH_SYSTEM): Add /usr/pkg/lib and
401 /usr/pkg/lib to library search path.
402
4032006-10-29 Mark Davies <mark@mcs.vuw.ac.nz> (tiny change)
2 404
3 * ralloc.c (relinquish): Use a long for excess space counter to 405 * ralloc.c (relinquish): Use a long for excess space counter to
4 handle 64-bit case correctly. 406 handle 64-bit case correctly.
@@ -69,7 +471,7 @@
692006-10-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 4712006-10-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
70 472
71 * gtkutil.c (get_utf8_string): Remove warnings with casts. 473 * gtkutil.c (get_utf8_string): Remove warnings with casts.
72 (xg_tool_bar_button_cb): Ditto 474 (xg_tool_bar_button_cb): Ditto.
73 (xg_tool_bar_callback): Ditto. 475 (xg_tool_bar_callback): Ditto.
74 476
752006-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 4772006-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
@@ -532,7 +934,7 @@
532 * editfns.c (Fsystem_name): Mention "host" in the doc string. 934 * editfns.c (Fsystem_name): Mention "host" in the doc string.
533 (syms_of_editfns) <system-name>: Likewise. 935 (syms_of_editfns) <system-name>: Likewise.
534 936
5352006-08-27 Martin Rudalics <rudalics@gmx.at> 9372006-09-08 Martin Rudalics <rudalics@gmx.at>
536 938
537 * xdisp.c (mouse_autoselect_window): Remove. 939 * xdisp.c (mouse_autoselect_window): Remove.
538 (Vmouse_autoselect_window): New variable. DEFVAR_LISP it. 940 (Vmouse_autoselect_window): New variable. DEFVAR_LISP it.
@@ -10932,7 +11334,7 @@
10932 precedence. 11334 precedence.
10933 (XTread_socket) [TARGET_API_MAC_CARBON]: Don't specify drag area. 11335 (XTread_socket) [TARGET_API_MAC_CARBON]: Don't specify drag area.
10934 11336
109352004-10-05 Jan Dj,Ad(Brv. <jan.h.d@swipnet.se> 113372004-10-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
10936 11338
10937 * config.in: Regenerate. 11339 * config.in: Regenerate.
10938 11340
@@ -15311,7 +15713,7 @@
15311 Set BUF_INTERVALS (buffer)->up_obj when appropriate. 15713 Set BUF_INTERVALS (buffer)->up_obj when appropriate.
15312 Handle over_used when splitting UNDER. 15714 Handle over_used when splitting UNDER.
15313 15715
153142003-09-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 157162003-09-30 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
15315 15717
15316 * regex.c (regex_compile): Free the stack when returning from function. 15718 * regex.c (regex_compile): Free the stack when returning from function.
15317 15719
@@ -19549,7 +19951,7 @@
19549 19951
19550 * alloca.c: Undo ifdef change accidentally made on 12-04. 19952 * alloca.c: Undo ifdef change accidentally made on 12-04.
19551 19953
195522002-12-06 Francesco Potorti` <pot@gnu.org> 199542002-12-06 Francesco Potort,Al(B <pot@gnu.org>
19553 19955
19554 * xfns.c (png_load): Avoid double gamma correction for PNG images. 19956 * xfns.c (png_load): Avoid double gamma correction for PNG images.
19555 19957
@@ -19870,7 +20272,7 @@
19870 * fns.c (Fcopy_sequence): Doc fix. 20272 * fns.c (Fcopy_sequence): Doc fix.
19871 (Fmap_char_table): Cast `call2'. 20273 (Fmap_char_table): Cast `call2'.
19872 20274
198732002-11-14 Francesco Potorti` <pot@gnu.org> 202752002-11-14 Francesco Potort,Al(B <pot@gnu.org>
19874 20276
19875 * s/sol2-8.h: New file. 20277 * s/sol2-8.h: New file.
19876 20278
@@ -26188,6 +26590,7 @@ See ChangeLog.9 for earlier changes.
26188 26590
26189;; Local Variables: 26591;; Local Variables:
26190;; coding: iso-2022-7bit 26592;; coding: iso-2022-7bit
26593;; add-log-time-zone-rule: t
26191;; End: 26594;; End:
26192 26595
26193 Copyright (C) 2001, 2002, 2003, 2004, 2005, 26596 Copyright (C) 2001, 2002, 2003, 2004, 2005,
diff --git a/src/alloc.c b/src/alloc.c
index 2f186fd3d12..c49d3b5becc 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -480,7 +480,7 @@ static int live_symbol_p P_ ((struct mem_node *, void *));
480static int live_float_p P_ ((struct mem_node *, void *)); 480static int live_float_p P_ ((struct mem_node *, void *));
481static int live_misc_p P_ ((struct mem_node *, void *)); 481static int live_misc_p P_ ((struct mem_node *, void *));
482static void mark_maybe_object P_ ((Lisp_Object)); 482static void mark_maybe_object P_ ((Lisp_Object));
483static void mark_memory P_ ((void *, void *)); 483static void mark_memory P_ ((void *, void *, int));
484static void mem_init P_ ((void)); 484static void mem_init P_ ((void));
485static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type)); 485static struct mem_node *mem_insert P_ ((void *, void *, enum mem_type));
486static void mem_insert_fixup P_ ((struct mem_node *)); 486static void mem_insert_fixup P_ ((struct mem_node *));
@@ -4330,11 +4330,13 @@ mark_maybe_pointer (p)
4330} 4330}
4331 4331
4332 4332
4333/* Mark Lisp objects referenced from the address range START..END. */ 4333/* Mark Lisp objects referenced from the address range START+OFFSET..END
4334 or END+OFFSET..START. */
4334 4335
4335static void 4336static void
4336mark_memory (start, end) 4337mark_memory (start, end, offset)
4337 void *start, *end; 4338 void *start, *end;
4339 int offset;
4338{ 4340{
4339 Lisp_Object *p; 4341 Lisp_Object *p;
4340 void **pp; 4342 void **pp;
@@ -4353,7 +4355,7 @@ mark_memory (start, end)
4353 } 4355 }
4354 4356
4355 /* Mark Lisp_Objects. */ 4357 /* Mark Lisp_Objects. */
4356 for (p = (Lisp_Object *) start; (void *) p < end; ++p) 4358 for (p = (Lisp_Object *) ((char *) start + offset); (void *) p < end; ++p)
4357 mark_maybe_object (*p); 4359 mark_maybe_object (*p);
4358 4360
4359 /* Mark Lisp data pointed to. This is necessary because, in some 4361 /* Mark Lisp data pointed to. This is necessary because, in some
@@ -4374,7 +4376,7 @@ mark_memory (start, end)
4374 away. The only reference to the life string is through the 4376 away. The only reference to the life string is through the
4375 pointer `s'. */ 4377 pointer `s'. */
4376 4378
4377 for (pp = (void **) start; (void *) pp < end; ++pp) 4379 for (pp = (void **) ((char *) start + offset); (void *) pp < end; ++pp)
4378 mark_maybe_pointer (*pp); 4380 mark_maybe_pointer (*pp);
4379} 4381}
4380 4382
@@ -4553,7 +4555,11 @@ static void
4553mark_stack () 4555mark_stack ()
4554{ 4556{
4555 int i; 4557 int i;
4556 jmp_buf j; 4558 /* jmp_buf may not be aligned enough on darwin-ppc64 */
4559 union aligned_jmpbuf {
4560 Lisp_Object o;
4561 jmp_buf j;
4562 } j;
4557 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base; 4563 volatile int stack_grows_down_p = (char *) &j > (char *) stack_base;
4558 void *end; 4564 void *end;
4559 4565
@@ -4584,7 +4590,7 @@ mark_stack ()
4584 } 4590 }
4585#endif /* GC_SETJMP_WORKS */ 4591#endif /* GC_SETJMP_WORKS */
4586 4592
4587 setjmp (j); 4593 setjmp (j.j);
4588 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; 4594 end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j;
4589#endif /* not GC_SAVE_REGISTERS_ON_STACK */ 4595#endif /* not GC_SAVE_REGISTERS_ON_STACK */
4590 4596
@@ -4599,7 +4605,7 @@ mark_stack ()
4599#endif 4605#endif
4600#endif 4606#endif
4601 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT) 4607 for (i = 0; i < sizeof (Lisp_Object); i += GC_LISP_OBJECT_ALIGNMENT)
4602 mark_memory ((char *) stack_base + i, end); 4608 mark_memory (stack_base, end, i);
4603 /* Allow for marking a secondary stack, like the register stack on the 4609 /* Allow for marking a secondary stack, like the register stack on the
4604 ia64. */ 4610 ia64. */
4605#ifdef GC_MARK_SECONDARY_STACK 4611#ifdef GC_MARK_SECONDARY_STACK
diff --git a/src/buffer.c b/src/buffer.c
index f2f15a54743..05555913c59 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5948,8 +5948,8 @@ An entry of the form POSITION indicates that point was at the buffer
5948location given by the integer. Undoing an entry of this form places 5948location given by the integer. Undoing an entry of this form places
5949point at POSITION. 5949point at POSITION.
5950 5950
5951nil marks undo boundaries. The undo command treats the changes 5951Entries with value `nil' mark undo boundaries. The undo command treats
5952between two undo boundaries as a single step to be undone. 5952the changes between two undo boundaries as a single step to be undone.
5953 5953
5954If the value of the variable is t, undo information is not recorded. */); 5954If the value of the variable is t, undo information is not recorded. */);
5955 5955
diff --git a/src/bytecode.c b/src/bytecode.c
index 2facaa47062..f96535354a4 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -597,7 +597,7 @@ If the third argument is incorrect, Emacs may crash. */)
597 if (SYMBOLP (sym) 597 if (SYMBOLP (sym)
598 && !EQ (val, Qunbound) 598 && !EQ (val, Qunbound)
599 && !XSYMBOL (sym)->indirect_variable 599 && !XSYMBOL (sym)->indirect_variable
600 && !XSYMBOL (sym)->constant 600 && !SYMBOL_CONSTANT_P (sym)
601 && !MISCP (XSYMBOL (sym)->value)) 601 && !MISCP (XSYMBOL (sym)->value))
602 XSYMBOL (sym)->value = val; 602 XSYMBOL (sym)->value = val;
603 else 603 else
diff --git a/src/category.c b/src/category.c
index 6835d00d824..d7178055b27 100644
--- a/src/category.c
+++ b/src/category.c
@@ -284,7 +284,8 @@ Return TABLE. */)
284 284
285 285
286DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, 286DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
287 doc: /* Return the category set of CHAR. */) 287 doc: /* Return the category set of CHAR.
288usage: (char-category-set CHAR) */)
288 (ch) 289 (ch)
289 Lisp_Object ch; 290 Lisp_Object ch;
290{ 291{
diff --git a/src/coding.c b/src/coding.c
index 24c6ef0b6b1..53661fc33cc 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5577,6 +5577,8 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
5577 inhibit_modification_hooks = saved_inhibit_modification_hooks; 5577 inhibit_modification_hooks = saved_inhibit_modification_hooks;
5578 } 5578 }
5579 5579
5580 coding->heading_ascii = 0;
5581
5580 if (! encodep && CODING_REQUIRE_DETECTION (coding)) 5582 if (! encodep && CODING_REQUIRE_DETECTION (coding))
5581 { 5583 {
5582 /* We must detect encoding of text and eol format. */ 5584 /* We must detect encoding of text and eol format. */
@@ -6221,6 +6223,8 @@ decode_coding_string (str, coding, nocopy)
6221 saved_coding_symbol = coding->symbol; 6223 saved_coding_symbol = coding->symbol;
6222 coding->src_multibyte = STRING_MULTIBYTE (str); 6224 coding->src_multibyte = STRING_MULTIBYTE (str);
6223 coding->dst_multibyte = 1; 6225 coding->dst_multibyte = 1;
6226 coding->heading_ascii = 0;
6227
6224 if (CODING_REQUIRE_DETECTION (coding)) 6228 if (CODING_REQUIRE_DETECTION (coding))
6225 { 6229 {
6226 /* See the comments in code_convert_region. */ 6230 /* See the comments in code_convert_region. */
@@ -6433,6 +6437,7 @@ encode_coding_string (str, coding, nocopy)
6433 /* Try to skip the heading and tailing ASCIIs. We can't skip them 6437 /* Try to skip the heading and tailing ASCIIs. We can't skip them
6434 if we must run CCL program or there are compositions to 6438 if we must run CCL program or there are compositions to
6435 encode. */ 6439 encode. */
6440 coding->heading_ascii = 0;
6436 if (coding->type != coding_type_ccl 6441 if (coding->type != coding_type_ccl
6437 && (! coding->cmp_data || coding->cmp_data->used == 0)) 6442 && (! coding->cmp_data || coding->cmp_data->used == 0))
6438 { 6443 {
@@ -7270,7 +7275,7 @@ Return the corresponding character. */)
7270} 7275}
7271 7276
7272DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0, 7277DEFUN ("encode-sjis-char", Fencode_sjis_char, Sencode_sjis_char, 1, 1, 0,
7273 doc: /* Encode a Japanese character CHAR to shift_jis encoding. 7278 doc: /* Encode a Japanese character CH to shift_jis encoding.
7274Return the corresponding code in SJIS. */) 7279Return the corresponding code in SJIS. */)
7275 (ch) 7280 (ch)
7276 Lisp_Object ch; 7281 Lisp_Object ch;
@@ -7330,7 +7335,7 @@ Return the corresponding character. */)
7330} 7335}
7331 7336
7332DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0, 7337DEFUN ("encode-big5-char", Fencode_big5_char, Sencode_big5_char, 1, 1, 0,
7333 doc: /* Encode the Big5 character CHAR to BIG5 coding system. 7338 doc: /* Encode the Big5 character CH to BIG5 coding system.
7334Return the corresponding character code in Big5. */) 7339Return the corresponding character code in Big5. */)
7335 (ch) 7340 (ch)
7336 Lisp_Object ch; 7341 Lisp_Object ch;
diff --git a/src/config.in b/src/config.in
index 51f4aaa07fa..21052474ec6 100644
--- a/src/config.in
+++ b/src/config.in
@@ -99,9 +99,6 @@ Boston, MA 02110-1301, USA. */
99/* Define to 1 if you have the `bzero' function. */ 99/* Define to 1 if you have the `bzero' function. */
100#undef HAVE_BZERO 100#undef HAVE_BZERO
101 101
102/* Define to 1 if CancelMenuTracking is available (Mac OSX). */
103#undef HAVE_CANCELMENUTRACKING
104
105/* Define to 1 if you are using the Carbon API on Mac OS X. */ 102/* Define to 1 if you are using the Carbon API on Mac OS X. */
106#undef HAVE_CARBON 103#undef HAVE_CARBON
107 104
@@ -697,6 +694,9 @@ Boston, MA 02110-1301, USA. */
697/* Define to 1 if you have the X11R6 or newer version of Xt. */ 694/* Define to 1 if you have the X11R6 or newer version of Xt. */
698#undef HAVE_X11XTR6 695#undef HAVE_X11XTR6
699 696
697/* Define to 1 if the file /usr/lib64 exists. */
698#undef HAVE_X86_64_LIB64_DIR
699
700/* Define to 1 if you have the Xaw3d library (-lXaw3d). */ 700/* Define to 1 if you have the Xaw3d library (-lXaw3d). */
701#undef HAVE_XAW3D 701#undef HAVE_XAW3D
702 702
diff --git a/src/data.c b/src/data.c
index cc15431cd16..cc0f96793ca 100644
--- a/src/data.c
+++ b/src/data.c
@@ -607,7 +607,7 @@ Return SYMBOL. */)
607 register Lisp_Object symbol; 607 register Lisp_Object symbol;
608{ 608{
609 CHECK_SYMBOL (symbol); 609 CHECK_SYMBOL (symbol);
610 if (XSYMBOL (symbol)->constant) 610 if (SYMBOL_CONSTANT_P (symbol))
611 xsignal1 (Qsetting_constant, symbol); 611 xsignal1 (Qsetting_constant, symbol);
612 Fset (symbol, Qunbound); 612 Fset (symbol, Qunbound);
613 return symbol; 613 return symbol;
@@ -2884,7 +2884,7 @@ usage: (logior &rest INTS-OR-MARKERS) */)
2884DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0, 2884DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0,
2885 doc: /* Return bitwise-exclusive-or of all the arguments. 2885 doc: /* Return bitwise-exclusive-or of all the arguments.
2886Arguments may be integers, or markers converted to integers. 2886Arguments may be integers, or markers converted to integers.
2887usage: (logxor &rest INTS-OR-MARKERS) */) 2887usage: (logxor &rest INTS-OR-MARKERS) */)
2888 (nargs, args) 2888 (nargs, args)
2889 int nargs; 2889 int nargs;
2890 Lisp_Object *args; 2890 Lisp_Object *args;
diff --git a/src/dosfns.c b/src/dosfns.c
index 22aaa62f0d1..92b90e530da 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -213,7 +213,7 @@ DEFUN ("msdos-mouse-disable", Fmsdos_mouse_disable, Smsdos_mouse_disable, 0, 0,
213} 213}
214 214
215DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "", 215DEFUN ("insert-startup-screen", Finsert_startup_screen, Sinsert_startup_screen, 0, 0, "",
216 doc: /* Insert copy of screen contents prior to starting emacs. 216 doc: /* Insert copy of screen contents prior to starting Emacs.
217Return nil if startup screen is not available. */) 217Return nil if startup screen is not available. */)
218 () 218 ()
219{ 219{
diff --git a/src/editfns.c b/src/editfns.c
index 71b518acb74..39f8f87c673 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3171,9 +3171,10 @@ static char *message_text;
3171static int message_length; 3171static int message_length;
3172 3172
3173DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, 3173DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
3174 doc: /* Print a one-line message at the bottom of the screen. 3174 doc: /* Display a message at the bottom of the screen.
3175The message also goes into the `*Messages*' buffer. 3175The message also goes into the `*Messages*' buffer.
3176\(In keyboard macros, that's all it does.) 3176\(In keyboard macros, that's all it does.)
3177Return the message.
3177 3178
3178The first argument is a format control string, and the rest are data 3179The first argument is a format control string, and the rest are data
3179to be formatted under control of the string. See `format' for details. 3180to be formatted under control of the string. See `format' for details.
diff --git a/src/emacs.c b/src/emacs.c
index 26a0c4da859..76ad59c78d1 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -2055,7 +2055,7 @@ sort_args (argc, argv)
2055DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P", 2055DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P",
2056 doc: /* Exit the Emacs job and kill it. 2056 doc: /* Exit the Emacs job and kill it.
2057If ARG is an integer, return ARG as the exit program code. 2057If ARG is an integer, return ARG as the exit program code.
2058If ARG is a string, stuff it as keyboard input. 2058If ARG is a string, stuff it as keyboard input.
2059 2059
2060The value of `kill-emacs-hook', if not void, 2060The value of `kill-emacs-hook', if not void,
2061is a list of functions (of no args), 2061is a list of functions (of no args),
diff --git a/src/eval.c b/src/eval.c
index 3c9a0c03214..c587142762e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1174,7 +1174,7 @@ DEFUN ("catch", Fcatch, Scatch, 1, UNEVALLED, 0,
1174TAG is evalled to get the tag to use; it must not be nil. 1174TAG is evalled to get the tag to use; it must not be nil.
1175 1175
1176Then the BODY is executed. 1176Then the BODY is executed.
1177Within BODY, (throw TAG) with same tag exits BODY and exits this `catch'. 1177Within BODY, a call to `throw' with the same TAG exits BODY and this `catch'.
1178If no throw happens, `catch' returns the value of the last BODY form. 1178If no throw happens, `catch' returns the value of the last BODY form.
1179If a throw happens, it specifies the value to return from `catch'. 1179If a throw happens, it specifies the value to return from `catch'.
1180usage: (catch TAG BODY...) */) 1180usage: (catch TAG BODY...) */)
diff --git a/src/fileio.c b/src/fileio.c
index 62d539dcfca..e6a4314e543 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1250,9 +1250,9 @@ See also the function `substitute-in-file-name'. */)
1250 } 1250 }
1251 else 1251 else
1252#endif /* NO_HYPHENS_IN_FILENAMES */ 1252#endif /* NO_HYPHENS_IN_FILENAMES */
1253 if (lbrack > rbrack && 1253 if (lbrack > rbrack
1254 ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<') && 1254 && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
1255 (p[1] == '.' || p[1] == ']' || p[1] == '>'))) 1255 && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
1256 lose = 1; 1256 lose = 1;
1257#ifdef NO_HYPHENS_IN_FILENAMES 1257#ifdef NO_HYPHENS_IN_FILENAMES
1258 else 1258 else
@@ -1621,8 +1621,8 @@ See also the function `substitute-in-file-name'. */)
1621 else if (*p == '-' && *o != '.') 1621 else if (*p == '-' && *o != '.')
1622 *--p = '.'; 1622 *--p = '.';
1623 } 1623 }
1624 else if (p[0] == '-' && o[-1] == '.' && 1624 else if (p[0] == '-' && o[-1] == '.'
1625 (p[1] == '.' || p[1] == ']' || p[1] == '>')) 1625 && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
1626 /* flush .foo.- ; leave - if stopped by '[' or '<' */ 1626 /* flush .foo.- ; leave - if stopped by '[' or '<' */
1627 { 1627 {
1628 do 1628 do
@@ -1637,9 +1637,9 @@ See also the function `substitute-in-file-name'. */)
1637 else 1637 else
1638 { 1638 {
1639#ifdef NO_HYPHENS_IN_FILENAMES 1639#ifdef NO_HYPHENS_IN_FILENAMES
1640 if (*p == '-' && 1640 if (*p == '-'
1641 o[-1] != '[' && o[-1] != '<' && o[-1] != '.' && 1641 && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
1642 p[1] != ']' && p[1] != '>' && p[1] != '.') 1642 && p[1] != ']' && p[1] != '>' && p[1] != '.')
1643 *p = '_'; 1643 *p = '_';
1644#endif /* NO_HYPHENS_IN_FILENAMES */ 1644#endif /* NO_HYPHENS_IN_FILENAMES */
1645 *o++ = *p++; 1645 *o++ = *p++;
@@ -1822,9 +1822,9 @@ See also the function `substitute-in-file-name'.")
1822 } 1822 }
1823 else 1823 else
1824#endif /* VMS4_4 */ 1824#endif /* VMS4_4 */
1825 if (lbrack > rbrack && 1825 if (lbrack > rbrack
1826 ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<') && 1826 && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
1827 (p[1] == '.' || p[1] == ']' || p[1] == '>'))) 1827 && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
1828 lose = 1; 1828 lose = 1;
1829#ifndef VMS4_4 1829#ifndef VMS4_4
1830 else 1830 else
@@ -1993,8 +1993,8 @@ See also the function `substitute-in-file-name'.")
1993 else if (*p == '-' && *o != '.') 1993 else if (*p == '-' && *o != '.')
1994 *--p = '.'; 1994 *--p = '.';
1995 } 1995 }
1996 else if (p[0] == '-' && o[-1] == '.' && 1996 else if (p[0] == '-' && o[-1] == '.'
1997 (p[1] == '.' || p[1] == ']' || p[1] == '>')) 1997 && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
1998 /* flush .foo.- ; leave - if stopped by '[' or '<' */ 1998 /* flush .foo.- ; leave - if stopped by '[' or '<' */
1999 { 1999 {
2000 do 2000 do
@@ -2009,9 +2009,9 @@ See also the function `substitute-in-file-name'.")
2009 else 2009 else
2010 { 2010 {
2011#ifndef VMS4_4 2011#ifndef VMS4_4
2012 if (*p == '-' && 2012 if (*p == '-'
2013 o[-1] != '[' && o[-1] != '<' && o[-1] != '.' && 2013 && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
2014 p[1] != ']' && p[1] != '>' && p[1] != '.') 2014 && p[1] != ']' && p[1] != '>' && p[1] != '.')
2015 *p = '_'; 2015 *p = '_';
2016#endif /* VMS4_4 */ 2016#endif /* VMS4_4 */
2017 *o++ = *p++; 2017 *o++ = *p++;
@@ -2031,8 +2031,8 @@ See also the function `substitute-in-file-name'.")
2031 o = target; 2031 o = target;
2032 p++; 2032 p++;
2033 } 2033 }
2034 else if (p[0] == '/' && p[1] == '.' && 2034 else if (p[0] == '/' && p[1] == '.'
2035 (p[2] == '/' || p[2] == 0)) 2035 && (p[2] == '/' || p[2] == 0))
2036 p += 2; 2036 p += 2;
2037 else if (!strncmp (p, "/..", 3) 2037 else if (!strncmp (p, "/..", 3)
2038 /* `/../' is the "superroot" on certain file systems. */ 2038 /* `/../' is the "superroot" on certain file systems. */
@@ -6203,9 +6203,9 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
6203 { 6203 {
6204 Lisp_Object tem = XCAR (all); 6204 Lisp_Object tem = XCAR (all);
6205 int len; 6205 int len;
6206 if (STRINGP (tem) && 6206 if (STRINGP (tem)
6207 (len = SCHARS (tem), len > 0) && 6207 && (len = SBYTES (tem), len > 0)
6208 IS_DIRECTORY_SEP (SREF (tem, len-1))) 6208 && IS_DIRECTORY_SEP (SREF (tem, len-1)))
6209 comp = Fcons (tem, comp); 6209 comp = Fcons (tem, comp);
6210 } 6210 }
6211 } 6211 }
diff --git a/src/fns.c b/src/fns.c
index 31774e71787..709b58882ef 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -103,7 +103,7 @@ DEFUN ("random", Frandom, Srandom, 0, 1, 0,
103All integers representable in Lisp are equally likely. 103All integers representable in Lisp are equally likely.
104 On most systems, this is 29 bits' worth. 104 On most systems, this is 29 bits' worth.
105With positive integer argument N, return random number in interval [0,N). 105With positive integer argument N, return random number in interval [0,N).
106With argument t, set the random number seed from the current time and pid. */) 106With argument t, set the random number seed from the current time and pid. */)
107 (n) 107 (n)
108 Lisp_Object n; 108 Lisp_Object n;
109{ 109{
@@ -140,7 +140,7 @@ DEFUN ("length", Flength, Slength, 1, 1, 0,
140A byte-code function object is also allowed. 140A byte-code function object is also allowed.
141If the string contains multibyte characters, this is not necessarily 141If the string contains multibyte characters, this is not necessarily
142the number of bytes in the string; it is the number of characters. 142the number of bytes in the string; it is the number of characters.
143To get the number of bytes, use `string-bytes'. */) 143To get the number of bytes, use `string-bytes'. */)
144 (sequence) 144 (sequence)
145 register Lisp_Object sequence; 145 register Lisp_Object sequence;
146{ 146{
@@ -150,7 +150,7 @@ To get the number of bytes, use `string-bytes'. */)
150 if (STRINGP (sequence)) 150 if (STRINGP (sequence))
151 XSETFASTINT (val, SCHARS (sequence)); 151 XSETFASTINT (val, SCHARS (sequence));
152 else if (VECTORP (sequence)) 152 else if (VECTORP (sequence))
153 XSETFASTINT (val, XVECTOR (sequence)->size); 153 XSETFASTINT (val, ASIZE (sequence));
154 else if (SUB_CHAR_TABLE_P (sequence)) 154 else if (SUB_CHAR_TABLE_P (sequence))
155 XSETFASTINT (val, SUB_CHAR_TABLE_ORDINARY_SLOTS); 155 XSETFASTINT (val, SUB_CHAR_TABLE_ORDINARY_SLOTS);
156 else if (CHAR_TABLE_P (sequence)) 156 else if (CHAR_TABLE_P (sequence))
@@ -158,7 +158,7 @@ To get the number of bytes, use `string-bytes'. */)
158 else if (BOOL_VECTOR_P (sequence)) 158 else if (BOOL_VECTOR_P (sequence))
159 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size); 159 XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
160 else if (COMPILEDP (sequence)) 160 else if (COMPILEDP (sequence))
161 XSETFASTINT (val, XVECTOR (sequence)->size & PSEUDOVECTOR_SIZE_MASK); 161 XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
162 else if (CONSP (sequence)) 162 else if (CONSP (sequence))
163 { 163 {
164 i = 0; 164 i = 0;
@@ -193,7 +193,7 @@ DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0,
193 doc: /* Return the length of a list, but avoid error or infinite loop. 193 doc: /* Return the length of a list, but avoid error or infinite loop.
194This function never gets an error. If LIST is not really a list, 194This function never gets an error. If LIST is not really a list,
195it returns 0. If LIST is circular, it returns a finite value 195it returns 0. If LIST is circular, it returns a finite value
196which is at least the number of distinct elements. */) 196which is at least the number of distinct elements. */)
197 (list) 197 (list)
198 Lisp_Object list; 198 Lisp_Object list;
199{ 199{
@@ -217,7 +217,7 @@ which is at least the number of distinct elements. */)
217 217
218DEFUN ("string-bytes", Fstring_bytes, Sstring_bytes, 1, 1, 0, 218DEFUN ("string-bytes", Fstring_bytes, Sstring_bytes, 1, 1, 0,
219 doc: /* Return the number of bytes in STRING. 219 doc: /* Return the number of bytes in STRING.
220If STRING is a multibyte string, this is greater than the length of STRING. */) 220If STRING is a multibyte string, this is greater than the length of STRING. */)
221 (string) 221 (string)
222 Lisp_Object string; 222 Lisp_Object string;
223{ 223{
@@ -228,7 +228,7 @@ If STRING is a multibyte string, this is greater than the length of STRING. */)
228DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0, 228DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
229 doc: /* Return t if two strings have identical contents. 229 doc: /* Return t if two strings have identical contents.
230Case is significant, but text properties are ignored. 230Case is significant, but text properties are ignored.
231Symbols are also allowed; their print names are used instead. */) 231Symbols are also allowed; their print names are used instead. */)
232 (s1, s2) 232 (s1, s2)
233 register Lisp_Object s1, s2; 233 register Lisp_Object s1, s2;
234{ 234{
@@ -260,7 +260,7 @@ The value is t if the strings (or specified portions) match.
260If string STR1 is less, the value is a negative number N; 260If string STR1 is less, the value is a negative number N;
261 - 1 - N is the number of characters that match at the beginning. 261 - 1 - N is the number of characters that match at the beginning.
262If string STR1 is greater, the value is a positive number N; 262If string STR1 is greater, the value is a positive number N;
263 N - 1 is the number of characters that match at the beginning. */) 263 N - 1 is the number of characters that match at the beginning. */)
264 (str1, start1, end1, str2, start2, end2, ignore_case) 264 (str1, start1, end1, str2, start2, end2, ignore_case)
265 Lisp_Object str1, start1, end1, start2, str2, end2, ignore_case; 265 Lisp_Object str1, start1, end1, start2, str2, end2, ignore_case;
266{ 266{
@@ -352,7 +352,7 @@ If string STR1 is greater, the value is a positive number N;
352DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0, 352DEFUN ("string-lessp", Fstring_lessp, Sstring_lessp, 2, 2, 0,
353 doc: /* Return t if first arg string is less than second in lexicographic order. 353 doc: /* Return t if first arg string is less than second in lexicographic order.
354Case is significant. 354Case is significant.
355Symbols are also allowed; their print names are used instead. */) 355Symbols are also allowed; their print names are used instead. */)
356 (s1, s2) 356 (s1, s2)
357 register Lisp_Object s1, s2; 357 register Lisp_Object s1, s2;
358{ 358{
@@ -391,7 +391,9 @@ Symbols are also allowed; their print names are used instead. */)
391/* "gcc -O3" enables automatic function inlining, which optimizes out 391/* "gcc -O3" enables automatic function inlining, which optimizes out
392 the arguments for the invocations of this function, whereas it 392 the arguments for the invocations of this function, whereas it
393 expects these values on the stack. */ 393 expects these values on the stack. */
394static Lisp_Object concat () __attribute__((noinline)); 394static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special)) __attribute__((noinline));
395#else /* !__GNUC__ */
396static Lisp_Object concat P_ ((int nargs, Lisp_Object *args, enum Lisp_Type target_type, int last_special));
395#endif 397#endif
396 398
397/* ARGSUSED */ 399/* ARGSUSED */
@@ -488,7 +490,7 @@ copy_sub_char_table (arg)
488DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0, 490DEFUN ("copy-sequence", Fcopy_sequence, Scopy_sequence, 1, 1, 0,
489 doc: /* Return a copy of a list, vector, string or char-table. 491 doc: /* Return a copy of a list, vector, string or char-table.
490The elements of a list or vector are not copied; they are shared 492The elements of a list or vector are not copied; they are shared
491with the original. */) 493with the original. */)
492 (arg) 494 (arg)
493 Lisp_Object arg; 495 Lisp_Object arg;
494{ 496{
@@ -615,7 +617,7 @@ concat (nargs, args, target_type, last_special)
615 if (VECTORP (this)) 617 if (VECTORP (this))
616 for (i = 0; i < len; i++) 618 for (i = 0; i < len; i++)
617 { 619 {
618 ch = XVECTOR (this)->contents[i]; 620 ch = AREF (this, i);
619 CHECK_NUMBER (ch); 621 CHECK_NUMBER (ch);
620 this_len_byte = CHAR_BYTES (XINT (ch)); 622 this_len_byte = CHAR_BYTES (XINT (ch));
621 result_len_byte += this_len_byte; 623 result_len_byte += this_len_byte;
@@ -768,7 +770,7 @@ concat (nargs, args, target_type, last_special)
768 thisindex++; 770 thisindex++;
769 } 771 }
770 else 772 else
771 elt = XVECTOR (this)->contents[thisindex++]; 773 elt = AREF (this, thisindex++);
772 774
773 /* Store this element into the result. */ 775 /* Store this element into the result. */
774 if (toindex < 0) 776 if (toindex < 0)
@@ -778,7 +780,7 @@ concat (nargs, args, target_type, last_special)
778 tail = XCDR (tail); 780 tail = XCDR (tail);
779 } 781 }
780 else if (VECTORP (val)) 782 else if (VECTORP (val))
781 XVECTOR (val)->contents[toindex++] = elt; 783 AREF (val, toindex++) = elt;
782 else 784 else
783 { 785 {
784 CHECK_NUMBER (elt); 786 CHECK_NUMBER (elt);
@@ -1109,7 +1111,7 @@ DEFUN ("string-make-unibyte", Fstring_make_unibyte, Sstring_make_unibyte,
1109Multibyte character codes are converted to unibyte according to 1111Multibyte character codes are converted to unibyte according to
1110`nonascii-translation-table' or, if that is nil, `nonascii-insert-offset'. 1112`nonascii-translation-table' or, if that is nil, `nonascii-insert-offset'.
1111If the lookup in the translation table fails, this function takes just 1113If the lookup in the translation table fails, this function takes just
1112the low 8 bits of each character. */) 1114the low 8 bits of each character. */)
1113 (string) 1115 (string)
1114 Lisp_Object string; 1116 Lisp_Object string;
1115{ 1117{
@@ -1259,7 +1261,7 @@ This function allows vectors as well as strings. */)
1259 size_byte = SBYTES (string); 1261 size_byte = SBYTES (string);
1260 } 1262 }
1261 else 1263 else
1262 size = XVECTOR (string)->size; 1264 size = ASIZE (string);
1263 1265
1264 if (NILP (to)) 1266 if (NILP (to))
1265 { 1267 {
@@ -1297,8 +1299,7 @@ This function allows vectors as well as strings. */)
1297 string, make_number (0), res, Qnil); 1299 string, make_number (0), res, Qnil);
1298 } 1300 }
1299 else 1301 else
1300 res = Fvector (to_char - from_char, 1302 res = Fvector (to_char - from_char, &AREF (string, from_char));
1301 XVECTOR (string)->contents + from_char);
1302 1303
1303 return res; 1304 return res;
1304} 1305}
@@ -1382,7 +1383,7 @@ substring_both (string, from, from_byte, to, to_byte)
1382 size_byte = SBYTES (string); 1383 size_byte = SBYTES (string);
1383 } 1384 }
1384 else 1385 else
1385 size = XVECTOR (string)->size; 1386 size = ASIZE (string);
1386 1387
1387 if (!(0 <= from && from <= to && to <= size)) 1388 if (!(0 <= from && from <= to && to <= size))
1388 args_out_of_range_3 (string, make_number (from), make_number (to)); 1389 args_out_of_range_3 (string, make_number (from), make_number (to));
@@ -1396,8 +1397,7 @@ substring_both (string, from, from_byte, to, to_byte)
1396 string, make_number (0), res, Qnil); 1397 string, make_number (0), res, Qnil);
1397 } 1398 }
1398 else 1399 else
1399 res = Fvector (to - from, 1400 res = Fvector (to - from, &AREF (string, from));
1400 XVECTOR (string)->contents + from);
1401 1401
1402 return res; 1402 return res;
1403} 1403}
@@ -2243,11 +2243,11 @@ internal_equal (o1, o2, depth, props)
2243 case Lisp_Vectorlike: 2243 case Lisp_Vectorlike:
2244 { 2244 {
2245 register int i; 2245 register int i;
2246 EMACS_INT size = XVECTOR (o1)->size; 2246 EMACS_INT size = ASIZE (o1);
2247 /* Pseudovectors have the type encoded in the size field, so this test 2247 /* Pseudovectors have the type encoded in the size field, so this test
2248 actually checks that the objects have the same type as well as the 2248 actually checks that the objects have the same type as well as the
2249 same size. */ 2249 same size. */
2250 if (XVECTOR (o2)->size != size) 2250 if (ASIZE (o2) != size)
2251 return 0; 2251 return 0;
2252 /* Boolvectors are compared much like strings. */ 2252 /* Boolvectors are compared much like strings. */
2253 if (BOOL_VECTOR_P (o1)) 2253 if (BOOL_VECTOR_P (o1))
@@ -2277,8 +2277,8 @@ internal_equal (o1, o2, depth, props)
2277 for (i = 0; i < size; i++) 2277 for (i = 0; i < size; i++)
2278 { 2278 {
2279 Lisp_Object v1, v2; 2279 Lisp_Object v1, v2;
2280 v1 = XVECTOR (o1)->contents [i]; 2280 v1 = AREF (o1, i);
2281 v2 = XVECTOR (o2)->contents [i]; 2281 v2 = AREF (o2, i);
2282 if (!internal_equal (v1, v2, depth + 1, props)) 2282 if (!internal_equal (v1, v2, depth + 1, props))
2283 return 0; 2283 return 0;
2284 } 2284 }
@@ -2319,7 +2319,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */)
2319 if (VECTORP (array)) 2319 if (VECTORP (array))
2320 { 2320 {
2321 register Lisp_Object *p = XVECTOR (array)->contents; 2321 register Lisp_Object *p = XVECTOR (array)->contents;
2322 size = XVECTOR (array)->size; 2322 size = ASIZE (array);
2323 for (index = 0; index < size; index++) 2323 for (index = 0; index < size; index++)
2324 p[index] = item; 2324 p[index] = item;
2325 } 2325 }
@@ -2547,7 +2547,7 @@ Note that this function doesn't check the parent of CHAR-TABLE. */)
2547 2547
2548 charset_info = Fget (range, Qcharset); 2548 charset_info = Fget (range, Qcharset);
2549 CHECK_VECTOR (charset_info); 2549 CHECK_VECTOR (charset_info);
2550 charset_id = XINT (XVECTOR (charset_info)->contents[0]); 2550 charset_id = XINT (AREF (charset_info, 0));
2551 ch = Fmake_char_internal (make_number (charset_id), 2551 ch = Fmake_char_internal (make_number (charset_id),
2552 make_number (0), make_number (0)); 2552 make_number (0), make_number (0));
2553 } 2553 }
@@ -2673,7 +2673,7 @@ character set, or a character code. Return VALUE. */)
2673 Faset (char_table, range, value); 2673 Faset (char_table, range, value);
2674 else if (VECTORP (range)) 2674 else if (VECTORP (range))
2675 { 2675 {
2676 int size = XVECTOR (range)->size; 2676 int size = ASIZE (range);
2677 Lisp_Object *val = XVECTOR (range)->contents; 2677 Lisp_Object *val = XVECTOR (range)->contents;
2678 Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0], 2678 Lisp_Object ch = Fmake_char_internal (size <= 0 ? Qnil : val[0],
2679 size <= 1 ? Qnil : val[1], 2679 size <= 1 ? Qnil : val[1],
@@ -3059,14 +3059,14 @@ mapcar1 (leni, vals, fn, seq)
3059 else 3059 else
3060 GCPRO2 (fn, seq); 3060 GCPRO2 (fn, seq);
3061 /* We need not explicitly protect `tail' because it is used only on lists, and 3061 /* We need not explicitly protect `tail' because it is used only on lists, and
3062 1) lists are not relocated and 2) the list is marked via `seq' so will not be freed */ 3062 1) lists are not relocated and 2) the list is marked via `seq' so will not
3063 be freed */
3063 3064
3064 if (VECTORP (seq)) 3065 if (VECTORP (seq))
3065 { 3066 {
3066 for (i = 0; i < leni; i++) 3067 for (i = 0; i < leni; i++)
3067 { 3068 {
3068 dummy = XVECTOR (seq)->contents[i]; 3069 dummy = call1 (fn, AREF (seq, i));
3069 dummy = call1 (fn, dummy);
3070 if (vals) 3070 if (vals)
3071 vals[i] = dummy; 3071 vals[i] = dummy;
3072 } 3072 }
@@ -3077,11 +3077,7 @@ mapcar1 (leni, vals, fn, seq)
3077 { 3077 {
3078 int byte; 3078 int byte;
3079 byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR]; 3079 byte = XBOOL_VECTOR (seq)->data[i / BOOL_VECTOR_BITS_PER_CHAR];
3080 if (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))) 3080 dummy = (byte & (1 << (i % BOOL_VECTOR_BITS_PER_CHAR))) ? Qt : Qnil;
3081 dummy = Qt;
3082 else
3083 dummy = Qnil;
3084
3085 dummy = call1 (fn, dummy); 3081 dummy = call1 (fn, dummy);
3086 if (vals) 3082 if (vals)
3087 vals[i] = dummy; 3083 vals[i] = dummy;
@@ -3464,7 +3460,7 @@ DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0,
3464 doc: /* Returns t if FEATURE is present in this Emacs. 3460 doc: /* Returns t if FEATURE is present in this Emacs.
3465 3461
3466Use this to conditionalize execution of lisp code based on the 3462Use this to conditionalize execution of lisp code based on the
3467presence or absence of emacs or environment extensions. 3463presence or absence of Emacs or environment extensions.
3468Use `provide' to declare that a feature is available. This function 3464Use `provide' to declare that a feature is available. This function
3469looks at the value of the variable `features'. The optional argument 3465looks at the value of the variable `features'. The optional argument
3470SUBFEATURE can be used to check a specific subfeature of FEATURE. */) 3466SUBFEATURE can be used to check a specific subfeature of FEATURE. */)
@@ -4385,7 +4381,7 @@ larger_vector (vec, new_size, init)
4385 int i, old_size; 4381 int i, old_size;
4386 4382
4387 xassert (VECTORP (vec)); 4383 xassert (VECTORP (vec));
4388 old_size = XVECTOR (vec)->size; 4384 old_size = ASIZE (vec);
4389 xassert (new_size >= old_size); 4385 xassert (new_size >= old_size);
4390 4386
4391 v = allocate_vector (new_size); 4387 v = allocate_vector (new_size);
@@ -4717,7 +4713,7 @@ maybe_resize_hash_table (h)
4717 if (!NILP (HASH_HASH (h, i))) 4713 if (!NILP (HASH_HASH (h, i)))
4718 { 4714 {
4719 unsigned hash_code = XUINT (HASH_HASH (h, i)); 4715 unsigned hash_code = XUINT (HASH_HASH (h, i));
4720 int start_of_bucket = hash_code % XVECTOR (h->index)->size; 4716 int start_of_bucket = hash_code % ASIZE (h->index);
4721 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); 4717 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
4722 HASH_INDEX (h, start_of_bucket) = make_number (i); 4718 HASH_INDEX (h, start_of_bucket) = make_number (i);
4723 } 4719 }
@@ -4743,7 +4739,7 @@ hash_lookup (h, key, hash)
4743 if (hash) 4739 if (hash)
4744 *hash = hash_code; 4740 *hash = hash_code;
4745 4741
4746 start_of_bucket = hash_code % XVECTOR (h->index)->size; 4742 start_of_bucket = hash_code % ASIZE (h->index);
4747 idx = HASH_INDEX (h, start_of_bucket); 4743 idx = HASH_INDEX (h, start_of_bucket);
4748 4744
4749 /* We need not gcpro idx since it's either an integer or nil. */ 4745 /* We need not gcpro idx since it's either an integer or nil. */
@@ -4790,7 +4786,7 @@ hash_put (h, key, value, hash)
4790 HASH_HASH (h, i) = make_number (hash); 4786 HASH_HASH (h, i) = make_number (hash);
4791 4787
4792 /* Add new entry to its collision chain. */ 4788 /* Add new entry to its collision chain. */
4793 start_of_bucket = hash % XVECTOR (h->index)->size; 4789 start_of_bucket = hash % ASIZE (h->index);
4794 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); 4790 HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
4795 HASH_INDEX (h, start_of_bucket) = make_number (i); 4791 HASH_INDEX (h, start_of_bucket) = make_number (i);
4796 return i; 4792 return i;
@@ -4809,7 +4805,7 @@ hash_remove (h, key)
4809 Lisp_Object idx, prev; 4805 Lisp_Object idx, prev;
4810 4806
4811 hash_code = h->hashfn (h, key); 4807 hash_code = h->hashfn (h, key);
4812 start_of_bucket = hash_code % XVECTOR (h->index)->size; 4808 start_of_bucket = hash_code % ASIZE (h->index);
4813 idx = HASH_INDEX (h, start_of_bucket); 4809 idx = HASH_INDEX (h, start_of_bucket);
4814 prev = Qnil; 4810 prev = Qnil;
4815 4811
@@ -4865,8 +4861,8 @@ hash_clear (h)
4865 HASH_HASH (h, i) = Qnil; 4861 HASH_HASH (h, i) = Qnil;
4866 } 4862 }
4867 4863
4868 for (i = 0; i < XVECTOR (h->index)->size; ++i) 4864 for (i = 0; i < ASIZE (h->index); ++i)
4869 XVECTOR (h->index)->contents[i] = Qnil; 4865 AREF (h->index, i) = Qnil;
4870 4866
4871 h->next_free = make_number (0); 4867 h->next_free = make_number (0);
4872 h->count = make_number (0); 4868 h->count = make_number (0);
@@ -4891,7 +4887,7 @@ sweep_weak_table (h, remove_entries_p)
4891{ 4887{
4892 int bucket, n, marked; 4888 int bucket, n, marked;
4893 4889
4894 n = XVECTOR (h->index)->size & ~ARRAY_MARK_FLAG; 4890 n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
4895 marked = 0; 4891 marked = 0;
4896 4892
4897 for (bucket = 0; bucket < n; ++bucket) 4893 for (bucket = 0; bucket < n; ++bucket)
@@ -5105,13 +5101,13 @@ sxhash_vector (vec, depth)
5105 Lisp_Object vec; 5101 Lisp_Object vec;
5106 int depth; 5102 int depth;
5107{ 5103{
5108 unsigned hash = XVECTOR (vec)->size; 5104 unsigned hash = ASIZE (vec);
5109 int i, n; 5105 int i, n;
5110 5106
5111 n = min (SXHASH_MAX_LEN, XVECTOR (vec)->size); 5107 n = min (SXHASH_MAX_LEN, ASIZE (vec));
5112 for (i = 0; i < n; ++i) 5108 for (i = 0; i < n; ++i)
5113 { 5109 {
5114 unsigned hash2 = sxhash (XVECTOR (vec)->contents[i], depth + 1); 5110 unsigned hash2 = sxhash (AREF (vec, i), depth + 1);
5115 hash = SXHASH_COMBINE (hash, hash2); 5111 hash = SXHASH_COMBINE (hash, hash2);
5116 } 5112 }
5117 5113
@@ -5806,7 +5802,7 @@ syms_of_fns ()
5806 Fset (Qyes_or_no_p_history, Qnil); 5802 Fset (Qyes_or_no_p_history, Qnil);
5807 5803
5808 DEFVAR_LISP ("features", &Vfeatures, 5804 DEFVAR_LISP ("features", &Vfeatures,
5809 doc: /* A list of symbols which are the features of the executing emacs. 5805 doc: /* A list of symbols which are the features of the executing Emacs.
5810Used by `featurep' and `require', and altered by `provide'. */); 5806Used by `featurep' and `require', and altered by `provide'. */);
5811 Vfeatures = Fcons (intern ("emacs"), Qnil); 5807 Vfeatures = Fcons (intern ("emacs"), Qnil);
5812 Qsubfeatures = intern ("subfeatures"); 5808 Qsubfeatures = intern ("subfeatures");
diff --git a/src/frame.c b/src/frame.c
index d7c58fd8faa..b6f361bcbfe 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2905,7 +2905,7 @@ extern Lisp_Object Qbox;
2905extern Lisp_Object Qtop; 2905extern Lisp_Object Qtop;
2906 2906
2907/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the 2907/* Calculate fullscreen size. Return in *TOP_POS and *LEFT_POS the
2908 wanted positions of the WM window (not emacs window). 2908 wanted positions of the WM window (not Emacs window).
2909 Return in *WIDTH and *HEIGHT the wanted width and height of Emacs 2909 Return in *WIDTH and *HEIGHT the wanted width and height of Emacs
2910 window (FRAME_X_WINDOW). 2910 window (FRAME_X_WINDOW).
2911 */ 2911 */
@@ -3340,6 +3340,9 @@ x_set_fullscreen (f, new_value, old_value)
3340 f->want_fullscreen = FULLSCREEN_WIDTH; 3340 f->want_fullscreen = FULLSCREEN_WIDTH;
3341 else if (EQ (new_value, Qfullheight)) 3341 else if (EQ (new_value, Qfullheight))
3342 f->want_fullscreen = FULLSCREEN_HEIGHT; 3342 f->want_fullscreen = FULLSCREEN_HEIGHT;
3343
3344 if (FRAME_TERMINAL (f)->fullscreen_hook != NULL)
3345 FRAME_TERMINAL (f)->fullscreen_hook (f);
3343} 3346}
3344 3347
3345 3348
@@ -4429,7 +4432,7 @@ Setting this variable does not affect existing frames, only new ones. */);
4429 doc: /* The initial frame-object, which represents Emacs's stdout. */); 4432 doc: /* The initial frame-object, which represents Emacs's stdout. */);
4430 4433
4431 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified, 4434 DEFVAR_LISP ("emacs-iconified", &Vemacs_iconified,
4432 doc: /* Non-nil if all of emacs is iconified and frame updates are not needed. */); 4435 doc: /* Non-nil if all of Emacs is iconified and frame updates are not needed. */);
4433 Vemacs_iconified = Qnil; 4436 Vemacs_iconified = Qnil;
4434 4437
4435 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function, 4438 DEFVAR_LISP ("mouse-position-function", &Vmouse_position_function,
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 2370855248a..17bf2d20a4c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3720,7 +3720,12 @@ update_frame_tool_bar (f)
3720 3720
3721 if (img->load_failed_p || img->pixmap == None) 3721 if (img->load_failed_p || img->pixmap == None)
3722 { 3722 {
3723 if (wicon) gtk_widget_hide (wicon); 3723 if (wicon)
3724 gtk_widget_hide (wicon);
3725 else
3726 gtk_toolbar_insert (GTK_TOOLBAR (x->toolbar_widget),
3727 gtk_tool_button_new (NULL, ""),
3728 i);
3724 continue; 3729 continue;
3725 } 3730 }
3726 3731
diff --git a/src/image.c b/src/image.c
index 5b80fe5b692..8f13da337ff 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2395,7 +2395,7 @@ image_load_qt_1 (f, img, type, fss, dh)
2395 struct frame *f; 2395 struct frame *f;
2396 struct image *img; 2396 struct image *img;
2397 OSType type; 2397 OSType type;
2398 FSSpec *fss; 2398 const FSSpec *fss;
2399 Handle dh; 2399 Handle dh;
2400{ 2400{
2401 ComponentResult err; 2401 ComponentResult err;
@@ -2409,8 +2409,7 @@ image_load_qt_1 (f, img, type, fss, dh)
2409 XImagePtr ximg; 2409 XImagePtr ximg;
2410 RGBColor bg_color; 2410 RGBColor bg_color;
2411 2411
2412 err = OpenADefaultComponent (GraphicsImporterComponentType, 2412 err = OpenADefaultComponent (GraphicsImporterComponentType, type, &gi);
2413 type, &gi);
2414 if (err != noErr) 2413 if (err != noErr)
2415 { 2414 {
2416 image_error ("Cannot get importer component for `%s'", img->spec, Qnil); 2415 image_error ("Cannot get importer component for `%s'", img->spec, Qnil);
@@ -4112,25 +4111,25 @@ xpm_load (f, img)
4112/* XPM support functions for Mac OS where libxpm is not available. 4111/* XPM support functions for Mac OS where libxpm is not available.
4113 Only XPM version 3 (without any extensions) is supported. */ 4112 Only XPM version 3 (without any extensions) is supported. */
4114 4113
4115static int xpm_scan P_ ((unsigned char **, unsigned char *, 4114static int xpm_scan P_ ((const unsigned char **, const unsigned char *,
4116 unsigned char **, int *)); 4115 const unsigned char **, int *));
4117static Lisp_Object xpm_make_color_table_v 4116static Lisp_Object xpm_make_color_table_v
4118 P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), 4117 P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
4119 Lisp_Object (**) (Lisp_Object, unsigned char *, int))); 4118 Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
4120static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *, 4119static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *,
4121 int, Lisp_Object)); 4120 int, Lisp_Object));
4122static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, 4121static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object,
4123 unsigned char *, int)); 4122 const unsigned char *, int));
4124static Lisp_Object xpm_make_color_table_h 4123static Lisp_Object xpm_make_color_table_h
4125 P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), 4124 P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
4126 Lisp_Object (**) (Lisp_Object, unsigned char *, int))); 4125 Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
4127static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *, 4126static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *,
4128 int, Lisp_Object)); 4127 int, Lisp_Object));
4129static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, 4128static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object,
4130 unsigned char *, int)); 4129 const unsigned char *, int));
4131static int xpm_str_to_color_key P_ ((char *)); 4130static int xpm_str_to_color_key P_ ((const char *));
4132static int xpm_load_image P_ ((struct frame *, struct image *, 4131static int xpm_load_image P_ ((struct frame *, struct image *,
4133 unsigned char *, unsigned char *)); 4132 const unsigned char *, const unsigned char *));
4134 4133
4135/* Tokens returned from xpm_scan. */ 4134/* Tokens returned from xpm_scan. */
4136 4135
@@ -4150,7 +4149,7 @@ enum xpm_token
4150 4149
4151static int 4150static int
4152xpm_scan (s, end, beg, len) 4151xpm_scan (s, end, beg, len)
4153 unsigned char **s, *end, **beg; 4152 const unsigned char **s, *end, **beg;
4154 int *len; 4153 int *len;
4155{ 4154{
4156 int c; 4155 int c;
@@ -4216,8 +4215,8 @@ xpm_scan (s, end, beg, len)
4216 4215
4217static Lisp_Object 4216static Lisp_Object
4218xpm_make_color_table_v (put_func, get_func) 4217xpm_make_color_table_v (put_func, get_func)
4219 void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); 4218 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
4220 Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); 4219 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
4221{ 4220{
4222 *put_func = xpm_put_color_table_v; 4221 *put_func = xpm_put_color_table_v;
4223 *get_func = xpm_get_color_table_v; 4222 *get_func = xpm_get_color_table_v;
@@ -4227,7 +4226,7 @@ xpm_make_color_table_v (put_func, get_func)
4227static void 4226static void
4228xpm_put_color_table_v (color_table, chars_start, chars_len, color) 4227xpm_put_color_table_v (color_table, chars_start, chars_len, color)
4229 Lisp_Object color_table; 4228 Lisp_Object color_table;
4230 unsigned char *chars_start; 4229 const unsigned char *chars_start;
4231 int chars_len; 4230 int chars_len;
4232 Lisp_Object color; 4231 Lisp_Object color;
4233{ 4232{
@@ -4237,7 +4236,7 @@ xpm_put_color_table_v (color_table, chars_start, chars_len, color)
4237static Lisp_Object 4236static Lisp_Object
4238xpm_get_color_table_v (color_table, chars_start, chars_len) 4237xpm_get_color_table_v (color_table, chars_start, chars_len)
4239 Lisp_Object color_table; 4238 Lisp_Object color_table;
4240 unsigned char *chars_start; 4239 const unsigned char *chars_start;
4241 int chars_len; 4240 int chars_len;
4242{ 4241{
4243 return XVECTOR (color_table)->contents[*chars_start]; 4242 return XVECTOR (color_table)->contents[*chars_start];
@@ -4245,8 +4244,8 @@ xpm_get_color_table_v (color_table, chars_start, chars_len)
4245 4244
4246static Lisp_Object 4245static Lisp_Object
4247xpm_make_color_table_h (put_func, get_func) 4246xpm_make_color_table_h (put_func, get_func)
4248 void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); 4247 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
4249 Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); 4248 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
4250{ 4249{
4251 *put_func = xpm_put_color_table_h; 4250 *put_func = xpm_put_color_table_h;
4252 *get_func = xpm_get_color_table_h; 4251 *get_func = xpm_get_color_table_h;
@@ -4259,7 +4258,7 @@ xpm_make_color_table_h (put_func, get_func)
4259static void 4258static void
4260xpm_put_color_table_h (color_table, chars_start, chars_len, color) 4259xpm_put_color_table_h (color_table, chars_start, chars_len, color)
4261 Lisp_Object color_table; 4260 Lisp_Object color_table;
4262 unsigned char *chars_start; 4261 const unsigned char *chars_start;
4263 int chars_len; 4262 int chars_len;
4264 Lisp_Object color; 4263 Lisp_Object color;
4265{ 4264{
@@ -4274,7 +4273,7 @@ xpm_put_color_table_h (color_table, chars_start, chars_len, color)
4274static Lisp_Object 4273static Lisp_Object
4275xpm_get_color_table_h (color_table, chars_start, chars_len) 4274xpm_get_color_table_h (color_table, chars_start, chars_len)
4276 Lisp_Object color_table; 4275 Lisp_Object color_table;
4277 unsigned char *chars_start; 4276 const unsigned char *chars_start;
4278 int chars_len; 4277 int chars_len;
4279{ 4278{
4280 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); 4279 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
@@ -4292,11 +4291,11 @@ enum xpm_color_key {
4292 XPM_COLOR_KEY_C 4291 XPM_COLOR_KEY_C
4293}; 4292};
4294 4293
4295static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; 4294static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
4296 4295
4297static int 4296static int
4298xpm_str_to_color_key (s) 4297xpm_str_to_color_key (s)
4299 char *s; 4298 const char *s;
4300{ 4299{
4301 int i; 4300 int i;
4302 4301
@@ -4312,15 +4311,15 @@ static int
4312xpm_load_image (f, img, contents, end) 4311xpm_load_image (f, img, contents, end)
4313 struct frame *f; 4312 struct frame *f;
4314 struct image *img; 4313 struct image *img;
4315 unsigned char *contents, *end; 4314 const unsigned char *contents, *end;
4316{ 4315{
4317 unsigned char *s = contents, *beg, *str; 4316 const unsigned char *s = contents, *beg, *str;
4318 unsigned char buffer[BUFSIZ]; 4317 unsigned char buffer[BUFSIZ];
4319 int width, height, x, y; 4318 int width, height, x, y;
4320 int num_colors, chars_per_pixel; 4319 int num_colors, chars_per_pixel;
4321 int len, LA1; 4320 int len, LA1;
4322 void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object); 4321 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object);
4323 Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int); 4322 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int);
4324 Lisp_Object frame, color_symbols, color_table; 4323 Lisp_Object frame, color_symbols, color_table;
4325 int best_key, have_mask = 0; 4324 int best_key, have_mask = 0;
4326 XImagePtr ximg = NULL, mask_img = NULL; 4325 XImagePtr ximg = NULL, mask_img = NULL;
diff --git a/src/indent.c b/src/indent.c
index efe10bc3f78..e84059972f3 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -2090,10 +2090,10 @@ whether or not it is currently displayed in some window. */)
2090 it_start = IT_CHARPOS (it); 2090 it_start = IT_CHARPOS (it);
2091 2091
2092 /* We expect the call to move_it_to, further down, to overshoot 2092 /* We expect the call to move_it_to, further down, to overshoot
2093 if the starting point is on an image, stretch glyph, or Lisp 2093 if the starting point is on an image, stretch glyph,
2094 string. We won't need to backtrack in this situation, except 2094 composition, or Lisp string. We won't need to backtrack in
2095 for one corner case: when the Lisp string contains a 2095 this situation, except for one corner case: when the Lisp
2096 newline. */ 2096 string contains a newline. */
2097 if (it.method == GET_FROM_STRING) 2097 if (it.method == GET_FROM_STRING)
2098 { 2098 {
2099 const char *s = SDATA (it.string); 2099 const char *s = SDATA (it.string);
@@ -2106,7 +2106,8 @@ whether or not it is currently displayed in some window. */)
2106 } 2106 }
2107 else 2107 else
2108 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE 2108 it_overshoot_expected_p = (it.method == GET_FROM_IMAGE
2109 || it.method == GET_FROM_STRETCH); 2109 || it.method == GET_FROM_STRETCH
2110 || it.method == GET_FROM_COMPOSITION);
2110 2111
2111 reseat_at_previous_visible_line_start (&it); 2112 reseat_at_previous_visible_line_start (&it);
2112 it.current_x = it.hpos = 0; 2113 it.current_x = it.hpos = 0;
diff --git a/src/keyboard.c b/src/keyboard.c
index 97554717e9a..2f4879da110 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -5816,7 +5816,7 @@ make_lispy_event (event)
5816 position = make_lispy_position (f, &event->x, &event->y, 5816 position = make_lispy_position (f, &event->x, &event->y,
5817 event->timestamp); 5817 event->timestamp);
5818 5818
5819 /* Set double or triple modifiers to indicate the wheel speed. */ 5819 /* Set double or triple modifiers to indicate the wheel speed. */
5820 { 5820 {
5821 /* On window-system frames, use the value of 5821 /* On window-system frames, use the value of
5822 double-click-fuzz as is. On other frames, interpret it 5822 double-click-fuzz as is. On other frames, interpret it
@@ -5870,7 +5870,7 @@ make_lispy_event (event)
5870 5870
5871 if (event->modifiers & up_modifier) 5871 if (event->modifiers & up_modifier)
5872 { 5872 {
5873 /* Emit a wheel-up event. */ 5873 /* Emit a wheel-up event. */
5874 event->modifiers &= ~up_modifier; 5874 event->modifiers &= ~up_modifier;
5875 symbol_num = 0; 5875 symbol_num = 0;
5876 } 5876 }
@@ -5885,7 +5885,7 @@ make_lispy_event (event)
5885 the up_modifier set. */ 5885 the up_modifier set. */
5886 abort (); 5886 abort ();
5887 5887
5888 /* Get the symbol we should use for the wheel event. */ 5888 /* Get the symbol we should use for the wheel event. */
5889 head = modify_event_symbol (symbol_num, 5889 head = modify_event_symbol (symbol_num,
5890 event->modifiers, 5890 event->modifiers,
5891 Qmouse_click, 5891 Qmouse_click,
diff --git a/src/lread.c b/src/lread.c
index ef76e72f75f..596ba79cb57 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -134,7 +134,7 @@ static int load_force_doc_strings;
134/* Nonzero means read should convert strings to unibyte. */ 134/* Nonzero means read should convert strings to unibyte. */
135static int load_convert_to_unibyte; 135static int load_convert_to_unibyte;
136 136
137/* Function to use for loading an Emacs lisp source file (not 137/* Function to use for loading an Emacs Lisp source file (not
138 compiled) instead of readevalloop. */ 138 compiled) instead of readevalloop. */
139Lisp_Object Vload_source_file_function; 139Lisp_Object Vload_source_file_function;
140 140
@@ -4119,7 +4119,7 @@ The default is nil, which means use the function `read'. */);
4119 Vload_read_function = Qnil; 4119 Vload_read_function = Qnil;
4120 4120
4121 DEFVAR_LISP ("load-source-file-function", &Vload_source_file_function, 4121 DEFVAR_LISP ("load-source-file-function", &Vload_source_file_function,
4122 doc: /* Function called in `load' for loading an Emacs lisp source file. 4122 doc: /* Function called in `load' for loading an Emacs Lisp source file.
4123This function is for doing code conversion before reading the source file. 4123This function is for doing code conversion before reading the source file.
4124If nil, loading is done without any code conversion. 4124If nil, loading is done without any code conversion.
4125Arguments are FULLNAME, FILE, NOERROR, NOMESSAGE, where 4125Arguments are FULLNAME, FILE, NOERROR, NOMESSAGE, where
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
index 419fa131692..940ff70dbda 100644
--- a/src/m/amdx86-64.h
+++ b/src/m/amdx86-64.h
@@ -128,7 +128,11 @@ Boston, MA 02110-1301, USA. */
128#else /* !__OpenBSD__ && !__FreeBSD__ */ 128#else /* !__OpenBSD__ && !__FreeBSD__ */
129 129
130#undef START_FILES 130#undef START_FILES
131#ifdef HAVE_X86_64_LIB64_DIR
131#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o 132#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
133#else
134#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
135#endif
132 136
133/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD. 137/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
134 The reason is that some functions in libgcc.a call functions from libc.a, 138 The reason is that some functions in libgcc.a call functions from libc.a,
@@ -136,7 +140,11 @@ Boston, MA 02110-1301, USA. */
136 versions of ld are one-pass linkers, we need to mention -lgcc twice, 140 versions of ld are one-pass linkers, we need to mention -lgcc twice,
137 or else we risk getting unresolved externals. */ 141 or else we risk getting unresolved externals. */
138#undef LIB_STANDARD 142#undef LIB_STANDARD
143#ifdef HAVE_X86_64_LIB64_DIR
139#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o 144#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
145#else
146#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
147#endif
140 148
141#endif /* __FreeBSD__ */ 149#endif /* __FreeBSD__ */
142 150
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h
index 3d3e45eda81..10b43bf8246 100644
--- a/src/m/ibmrs6000.h
+++ b/src/m/ibmrs6000.h
@@ -44,7 +44,7 @@ Boston, MA 02110-1301, USA. */
44#define IBMR2AIX 44#define IBMR2AIX
45 45
46/* Use type int rather than a union, to represent Lisp_Object */ 46/* Use type int rather than a union, to represent Lisp_Object */
47/* This is desirable for most machines. */ 47/* This is desirable for most machines. */
48 48
49#define NO_UNION_TYPE 49#define NO_UNION_TYPE
50 50
@@ -72,7 +72,7 @@ Boston, MA 02110-1301, USA. */
72 72
73/* The data segment in this machine always starts at address 0x20000000. 73/* The data segment in this machine always starts at address 0x20000000.
74 An address of data cannot be stored correctly in a Lisp object; 74 An address of data cannot be stored correctly in a Lisp object;
75 we always lose the high bits. We must tell XPNTR to add them back. */ 75 we always lose the high bits. We must tell XPNTR to add them back. */
76 76
77#ifndef USG5_4 77#ifndef USG5_4
78#define DATA_SEG_BITS 0x20000000 78#define DATA_SEG_BITS 0x20000000
@@ -86,7 +86,7 @@ Boston, MA 02110-1301, USA. */
86#define PURE_SEG_BITS 0x30000000 86#define PURE_SEG_BITS 0x30000000
87 87
88/* Use shared memory. */ 88/* Use shared memory. */
89/* This is turned off because it does not always work. See etc/AIX.DUMP. */ 89/* This is turned off because it does not always work. See etc/AIX.DUMP. */
90/* #define HAVE_SHM */ 90/* #define HAVE_SHM */
91#define SHMKEY 5305035 /* used for shared memory code segments */ 91#define SHMKEY 5305035 /* used for shared memory code segments */
92#endif /* CANNOT_DUMP */ 92#endif /* CANNOT_DUMP */
diff --git a/src/m/pfa50.h b/src/m/pfa50.h
index 85d281073f1..0b1511fd8e7 100644
--- a/src/m/pfa50.h
+++ b/src/m/pfa50.h
@@ -50,7 +50,7 @@ Boston, MA 02110-1301, USA. */
50#define NO_REMAP 50#define NO_REMAP
51 51
52/* Define TEXT_START_ADDR if your linker don't set execute point to _start. 52/* Define TEXT_START_ADDR if your linker don't set execute point to _start.
53 If it needed, temacs always CORE-DUMP. */ 53 If it needed, temacs always CORE-DUMP. */
54 54
55#define TEXT_START_ADDR __start 55#define TEXT_START_ADDR __start
56 56
diff --git a/src/mac.c b/src/mac.c
index d127422ccde..c4275caa741 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -835,8 +835,8 @@ OSStatus
835create_apple_event_from_event_ref (event, num_params, names, types, result) 835create_apple_event_from_event_ref (event, num_params, names, types, result)
836 EventRef event; 836 EventRef event;
837 UInt32 num_params; 837 UInt32 num_params;
838 EventParamName *names; 838 const EventParamName *names;
839 EventParamType *types; 839 const EventParamType *types;
840 AppleEvent *result; 840 AppleEvent *result;
841{ 841{
842 OSStatus err; 842 OSStatus err;
@@ -891,7 +891,7 @@ OSErr
891create_apple_event_from_drag_ref (drag, num_types, types, result) 891create_apple_event_from_drag_ref (drag, num_types, types, result)
892 DragRef drag; 892 DragRef drag;
893 UInt32 num_types; 893 UInt32 num_types;
894 FlavorType *types; 894 const FlavorType *types;
895 AppleEvent *result; 895 AppleEvent *result;
896{ 896{
897 OSErr err; 897 OSErr err;
@@ -1315,7 +1315,7 @@ cfproperty_list_to_lisp (plist, with_tag, hash_bound)
1315 1315
1316static void 1316static void
1317skip_white_space (p) 1317skip_white_space (p)
1318 char **p; 1318 const char **p;
1319{ 1319{
1320 /* WhiteSpace = {<space> | <horizontal tab>} */ 1320 /* WhiteSpace = {<space> | <horizontal tab>} */
1321 while (*P == ' ' || *P == '\t') 1321 while (*P == ' ' || *P == '\t')
@@ -1324,7 +1324,7 @@ skip_white_space (p)
1324 1324
1325static int 1325static int
1326parse_comment (p) 1326parse_comment (p)
1327 char **p; 1327 const char **p;
1328{ 1328{
1329 /* Comment = "!" {<any character except null or newline>} */ 1329 /* Comment = "!" {<any character except null or newline>} */
1330 if (*P == '!') 1330 if (*P == '!')
@@ -1342,7 +1342,7 @@ parse_comment (p)
1342/* Don't interpret filename. Just skip until the newline. */ 1342/* Don't interpret filename. Just skip until the newline. */
1343static int 1343static int
1344parse_include_file (p) 1344parse_include_file (p)
1345 char **p; 1345 const char **p;
1346{ 1346{
1347 /* IncludeFile = "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace */ 1347 /* IncludeFile = "#" WhiteSpace "include" WhiteSpace FileName WhiteSpace */
1348 if (*P == '#') 1348 if (*P == '#')
@@ -1359,7 +1359,7 @@ parse_include_file (p)
1359 1359
1360static char 1360static char
1361parse_binding (p) 1361parse_binding (p)
1362 char **p; 1362 const char **p;
1363{ 1363{
1364 /* Binding = "." | "*" */ 1364 /* Binding = "." | "*" */
1365 if (*P == '.' || *P == '*') 1365 if (*P == '.' || *P == '*')
@@ -1377,7 +1377,7 @@ parse_binding (p)
1377 1377
1378static Lisp_Object 1378static Lisp_Object
1379parse_component (p) 1379parse_component (p)
1380 char **p; 1380 const char **p;
1381{ 1381{
1382 /* Component = "?" | ComponentName 1382 /* Component = "?" | ComponentName
1383 ComponentName = NameChar {NameChar} 1383 ComponentName = NameChar {NameChar}
@@ -1389,7 +1389,7 @@ parse_component (p)
1389 } 1389 }
1390 else if (isalnum (*P) || *P == '_' || *P == '-') 1390 else if (isalnum (*P) || *P == '_' || *P == '-')
1391 { 1391 {
1392 char *start = P++; 1392 const char *start = P++;
1393 1393
1394 while (isalnum (*P) || *P == '_' || *P == '-') 1394 while (isalnum (*P) || *P == '_' || *P == '-')
1395 P++; 1395 P++;
@@ -1402,7 +1402,7 @@ parse_component (p)
1402 1402
1403static Lisp_Object 1403static Lisp_Object
1404parse_resource_name (p) 1404parse_resource_name (p)
1405 char **p; 1405 const char **p;
1406{ 1406{
1407 Lisp_Object result = Qnil, component; 1407 Lisp_Object result = Qnil, component;
1408 char binding; 1408 char binding;
@@ -1436,7 +1436,7 @@ parse_resource_name (p)
1436 1436
1437static Lisp_Object 1437static Lisp_Object
1438parse_value (p) 1438parse_value (p)
1439 char **p; 1439 const char **p;
1440{ 1440{
1441 char *q, *buf; 1441 char *q, *buf;
1442 Lisp_Object seq = Qnil, result; 1442 Lisp_Object seq = Qnil, result;
@@ -1526,7 +1526,7 @@ parse_value (p)
1526 1526
1527static Lisp_Object 1527static Lisp_Object
1528parse_resource_line (p) 1528parse_resource_line (p)
1529 char **p; 1529 const char **p;
1530{ 1530{
1531 Lisp_Object quarks, value; 1531 Lisp_Object quarks, value;
1532 1532
@@ -1629,7 +1629,7 @@ xrm_q_put_resource (database, quarks, value)
1629void 1629void
1630xrm_merge_string_database (database, data) 1630xrm_merge_string_database (database, data)
1631 XrmDatabase database; 1631 XrmDatabase database;
1632 char *data; 1632 const char *data;
1633{ 1633{
1634 Lisp_Object quarks_value; 1634 Lisp_Object quarks_value;
1635 1635
@@ -1705,7 +1705,7 @@ xrm_q_get_resource (database, quark_name, quark_class)
1705Lisp_Object 1705Lisp_Object
1706xrm_get_resource (database, name, class) 1706xrm_get_resource (database, name, class)
1707 XrmDatabase database; 1707 XrmDatabase database;
1708 char *name, *class; 1708 const char *name, *class;
1709{ 1709{
1710 Lisp_Object key, query_cache, quark_name, quark_class, tmp; 1710 Lisp_Object key, query_cache, quark_name, quark_class, tmp;
1711 int i, nn, nc; 1711 int i, nn, nc;
@@ -1794,7 +1794,7 @@ xrm_cfproperty_list_to_value (plist)
1794 1794
1795XrmDatabase 1795XrmDatabase
1796xrm_get_preference_database (application) 1796xrm_get_preference_database (application)
1797 char *application; 1797 const char *application;
1798{ 1798{
1799#if TARGET_API_MAC_CARBON 1799#if TARGET_API_MAC_CARBON
1800 CFStringRef app_id, *keys, user_doms[2], host_doms[2]; 1800 CFStringRef app_id, *keys, user_doms[2], host_doms[2];
@@ -5129,7 +5129,7 @@ sys_select (nfds, rfds, wfds, efds, timeout)
5129 int minfd, fd; 5129 int minfd, fd;
5130 CFRunLoopRef runloop = 5130 CFRunLoopRef runloop =
5131 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); 5131 (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ());
5132 static CFSocketContext context = {0, ofds, NULL, NULL, NULL}; 5132 static const CFSocketContext context = {0, ofds, NULL, NULL, NULL};
5133 static CFMutableDictionaryRef sources; 5133 static CFMutableDictionaryRef sources;
5134 5134
5135 if (sources == NULL) 5135 if (sources == NULL)
diff --git a/src/macfns.c b/src/macfns.c
index e0e58ff5c6f..14261f67ad6 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -251,7 +251,7 @@ typedef struct colormap_t
251 char *name; 251 char *name;
252} colormap_t; 252} colormap_t;
253 253
254colormap_t mac_color_map[] = 254static const colormap_t mac_color_map[] =
255{ 255{
256 { RGB_TO_ULONG(255, 250, 250), "snow" }, 256 { RGB_TO_ULONG(255, 250, 250), "snow" },
257 { RGB_TO_ULONG(248, 248, 255), "ghost white" }, 257 { RGB_TO_ULONG(248, 248, 255), "ghost white" },
@@ -1009,7 +1009,7 @@ colormap_t mac_color_map[] =
1009 1009
1010Lisp_Object 1010Lisp_Object
1011mac_color_map_lookup (colorname) 1011mac_color_map_lookup (colorname)
1012 char *colorname; 1012 const char *colorname;
1013{ 1013{
1014 Lisp_Object ret = Qnil; 1014 Lisp_Object ret = Qnil;
1015 int i; 1015 int i;
@@ -3092,18 +3092,30 @@ If omitted or nil, that stands for the selected frame's display. */)
3092 Lisp_Object display; 3092 Lisp_Object display;
3093{ 3093{
3094 struct mac_display_info *dpyinfo = check_x_display_info (display); 3094 struct mac_display_info *dpyinfo = check_x_display_info (display);
3095
3095 /* Only of the main display. */ 3096 /* Only of the main display. */
3096#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 3097#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
3097 CGSize size; 3098#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3099 if (CGDisplayScreenSize != NULL)
3100#endif
3101 {
3102 CGSize size;
3098 3103
3099 BLOCK_INPUT; 3104 BLOCK_INPUT;
3100 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3105 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3101 UNBLOCK_INPUT; 3106 UNBLOCK_INPUT;
3102 3107
3103 return make_number ((int) (size.height + .5f)); 3108 return make_number ((int) (size.height + .5f));
3104#else 3109 }
3105 /* This is an approximation. */ 3110#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3106 return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy)); 3111 else
3112#endif
3113#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
3114#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3115 {
3116 /* This is an approximation. */
3117 return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy));
3118 }
3107#endif 3119#endif
3108} 3120}
3109 3121
@@ -3116,18 +3128,30 @@ If omitted or nil, that stands for the selected frame's display. */)
3116 Lisp_Object display; 3128 Lisp_Object display;
3117{ 3129{
3118 struct mac_display_info *dpyinfo = check_x_display_info (display); 3130 struct mac_display_info *dpyinfo = check_x_display_info (display);
3131
3119 /* Only of the main display. */ 3132 /* Only of the main display. */
3120#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 3133#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
3121 CGSize size; 3134#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3135 if (CGDisplayScreenSize != NULL)
3136#endif
3137 {
3138 CGSize size;
3122 3139
3123 BLOCK_INPUT; 3140 BLOCK_INPUT;
3124 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3141 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3125 UNBLOCK_INPUT; 3142 UNBLOCK_INPUT;
3126 3143
3127 return make_number ((int) (size.width + .5f)); 3144 return make_number ((int) (size.width + .5f));
3128#else 3145 }
3129 /* This is an approximation. */ 3146#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3130 return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx)); 3147 else
3148#endif
3149#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
3150#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3151 {
3152 /* This is an approximation. */
3153 return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
3154 }
3131#endif 3155#endif
3132} 3156}
3133 3157
diff --git a/src/macmenu.c b/src/macmenu.c
index 1a1525eafb7..14bfe92cb25 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -319,7 +319,7 @@ restore_menu_items (saved)
319 menu_items_used = XINT (XCAR (saved)); 319 menu_items_used = XINT (XCAR (saved));
320 saved = XCDR (saved); 320 saved = XCDR (saved);
321 menu_items_n_panes = XINT (XCAR (saved)); 321 menu_items_n_panes = XINT (XCAR (saved));
322 saved = XCDR (saved); 322 saved = XCDR (saved);
323 menu_items_submenu_depth = XINT (XCAR (saved)); 323 menu_items_submenu_depth = XINT (XCAR (saved));
324 return Qnil; 324 return Qnil;
325} 325}
@@ -1453,7 +1453,7 @@ update_submenu_strings (first_wv)
1453/* Event handler function that pops down a menu on C-g. We can only pop 1453/* Event handler function that pops down a menu on C-g. We can only pop
1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */ 1454 down menus if CancelMenuTracking is present (OSX 10.3 or later). */
1455 1455
1456#ifdef HAVE_CANCELMENUTRACKING 1456#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
1457static pascal OSStatus 1457static pascal OSStatus
1458menu_quit_handler (nextHandler, theEvent, userData) 1458menu_quit_handler (nextHandler, theEvent, userData)
1459 EventHandlerCallRef nextHandler; 1459 EventHandlerCallRef nextHandler;
@@ -1487,7 +1487,7 @@ menu_quit_handler (nextHandler, theEvent, userData)
1487 1487
1488 return CallNextEventHandler (nextHandler, theEvent); 1488 return CallNextEventHandler (nextHandler, theEvent);
1489} 1489}
1490#endif /* HAVE_CANCELMENUTRACKING */ 1490#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
1491 1491
1492/* Add event handler to all menus that belong to KIND so we can detect C-g. 1492/* Add event handler to all menus that belong to KIND so we can detect C-g.
1493 MENU_HANDLE is the root menu of the tracking session to dismiss 1493 MENU_HANDLE is the root menu of the tracking session to dismiss
@@ -1499,10 +1499,15 @@ install_menu_quit_handler (kind, menu_handle)
1499 enum mac_menu_kind kind; 1499 enum mac_menu_kind kind;
1500 MenuHandle menu_handle; 1500 MenuHandle menu_handle;
1501{ 1501{
1502#ifdef HAVE_CANCELMENUTRACKING 1502#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
1503 EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } }; 1503 static const EventTypeSpec typesList[] =
1504 {{kEventClassKeyboard, kEventRawKeyDown}};
1504 int id; 1505 int id;
1505 1506
1507#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
1508 if (CancelMenuTracking == NULL)
1509 return;
1510#endif
1506 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++) 1511 for (id = min_menu_id[kind]; id < min_menu_id[kind + 1]; id++)
1507 { 1512 {
1508 MenuHandle menu = GetMenuHandle (id); 1513 MenuHandle menu = GetMenuHandle (id);
@@ -1511,9 +1516,9 @@ install_menu_quit_handler (kind, menu_handle)
1511 break; 1516 break;
1512 InstallMenuEventHandler (menu, menu_quit_handler, 1517 InstallMenuEventHandler (menu, menu_quit_handler,
1513 GetEventTypeCount (typesList), 1518 GetEventTypeCount (typesList),
1514 typesList, menu_handle, NULL); 1519 typesList, menu_handle, NULL);
1515 } 1520 }
1516#endif /* HAVE_CANCELMENUTRACKING */ 1521#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
1517} 1522}
1518 1523
1519/* Set the contents of the menubar widgets of frame F. 1524/* Set the contents of the menubar widgets of frame F.
@@ -2428,9 +2433,9 @@ mac_dialog_show (f, keymaps, title, header, error_name)
2428/* Is this item a separator? */ 2433/* Is this item a separator? */
2429static int 2434static int
2430name_is_separator (name) 2435name_is_separator (name)
2431 char *name; 2436 const char *name;
2432{ 2437{
2433 char *start = name; 2438 const char *start = name;
2434 2439
2435 /* Check if name string consists of only dashes ('-'). */ 2440 /* Check if name string consists of only dashes ('-'). */
2436 while (*name == '-') name++; 2441 while (*name == '-') name++;
@@ -2641,6 +2646,17 @@ dispose_menus (kind, id)
2641} 2646}
2642 2647
2643#endif /* HAVE_MENUS */ 2648#endif /* HAVE_MENUS */
2649
2650/* The following is used by delayed window autoselection. */
2651
2652DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
2653 doc: /* Return t if a menu or popup dialog is active. */)
2654 ()
2655{
2656 /* Always return Qnil since menu selection functions do not return
2657 until a selection has been made or cancelled. */
2658 return Qnil;
2659}
2644 2660
2645void 2661void
2646syms_of_macmenu () 2662syms_of_macmenu ()
@@ -2652,6 +2668,7 @@ syms_of_macmenu ()
2652 staticpro (&Qdebug_on_next_call); 2668 staticpro (&Qdebug_on_next_call);
2653 2669
2654 defsubr (&Sx_popup_menu); 2670 defsubr (&Sx_popup_menu);
2671 defsubr (&Smenu_or_popup_active_p);
2655#ifdef HAVE_MENUS 2672#ifdef HAVE_MENUS
2656 defsubr (&Sx_popup_dialog); 2673 defsubr (&Sx_popup_dialog);
2657#endif 2674#endif
diff --git a/src/macselect.c b/src/macselect.c
index fd72bd3cb14..7a952f88367 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -1616,10 +1616,11 @@ remove_drag_handler (window)
1616void 1616void
1617init_service_handler () 1617init_service_handler ()
1618{ 1618{
1619 EventTypeSpec specs[] = {{kEventClassService, kEventServiceGetTypes}, 1619 static const EventTypeSpec specs[] =
1620 {kEventClassService, kEventServiceCopy}, 1620 {{kEventClassService, kEventServiceGetTypes},
1621 {kEventClassService, kEventServicePaste}, 1621 {kEventClassService, kEventServiceCopy},
1622 {kEventClassService, kEventServicePerform}}; 1622 {kEventClassService, kEventServicePaste},
1623 {kEventClassService, kEventServicePerform}};
1623 InstallApplicationEventHandler (NewEventHandlerUPP (mac_handle_service_event), 1624 InstallApplicationEventHandler (NewEventHandlerUPP (mac_handle_service_event),
1624 GetEventTypeCount (specs), specs, NULL, NULL); 1625 GetEventTypeCount (specs), specs, NULL, NULL);
1625} 1626}
diff --git a/src/macterm.c b/src/macterm.c
index d4ce2a1b298..4739a52520e 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -244,7 +244,8 @@ static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
244static void mac_focus_changed P_ ((int, struct mac_display_info *, 244static void mac_focus_changed P_ ((int, struct mac_display_info *,
245 struct frame *, struct input_event *)); 245 struct frame *, struct input_event *));
246static void x_detect_focus_change P_ ((struct mac_display_info *, 246static void x_detect_focus_change P_ ((struct mac_display_info *,
247 EventRecord *, struct input_event *)); 247 const EventRecord *,
248 struct input_event *));
248static void XTframe_rehighlight P_ ((struct frame *)); 249static void XTframe_rehighlight P_ ((struct frame *));
249static void x_frame_rehighlight P_ ((struct x_display_info *)); 250static void x_frame_rehighlight P_ ((struct x_display_info *));
250static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *)); 251static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
@@ -640,7 +641,7 @@ mac_create_bitmap_from_bitmap_data (bitmap, bits, w, h)
640 char *bits; 641 char *bits;
641 int w, h; 642 int w, h;
642{ 643{
643 static unsigned char swap_nibble[16] 644 static const unsigned char swap_nibble[16]
644 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */ 645 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
645 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */ 646 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
646 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */ 647 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
@@ -826,9 +827,9 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
826 827
827 if (saved_text_layout == NULL) 828 if (saved_text_layout == NULL)
828 { 829 {
829 UniCharCount lengths[] = {kATSUToTextEnd}; 830 static const UniCharCount lengths[] = {kATSUToTextEnd};
830 ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag}; 831 static const ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag};
831 ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)}; 832 static const ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
832 static ATSLineLayoutOptions line_layout = 833 static ATSLineLayoutOptions line_layout =
833#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 834#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
834 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics 835 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics
@@ -837,7 +838,7 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
837 kATSLineIsDisplayOnly | kATSLineFractDisable 838 kATSLineIsDisplayOnly | kATSLineFractDisable
838#endif 839#endif
839 ; 840 ;
840 ATSUAttributeValuePtr values[] = {&line_layout}; 841 static const ATSUAttributeValuePtr values[] = {&line_layout};
841 842
842 err = ATSUCreateTextLayoutWithTextPtr (text, 843 err = ATSUCreateTextLayoutWithTextPtr (text,
843 kATSUFromTextBeginning, 844 kATSUFromTextBeginning,
@@ -960,11 +961,11 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
960 else 961 else
961 { 962 {
962 CGrafPtr port; 963 CGrafPtr port;
963 CGContextRef context; 964 static CGContextRef context;
964 float port_height = FRAME_PIXEL_HEIGHT (f); 965 float port_height = FRAME_PIXEL_HEIGHT (f);
965 ATSUAttributeTag tags[] = {kATSUCGContextTag}; 966 static const ATSUAttributeTag tags[] = {kATSUCGContextTag};
966 ByteCount sizes[] = {sizeof (CGContextRef)}; 967 static const ByteCount sizes[] = {sizeof (CGContextRef)};
967 ATSUAttributeValuePtr values[] = {&context}; 968 static const ATSUAttributeValuePtr values[] = {&context};
968 969
969#if USE_CG_DRAWING 970#if USE_CG_DRAWING
970 context = mac_begin_cg_clip (f, gc); 971 context = mac_begin_cg_clip (f, gc);
@@ -1359,20 +1360,31 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
1359 if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold) 1360 if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold)
1360 CGContextSetShouldAntialias (context, false); 1361 CGContextSetShouldAntialias (context, false);
1361#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 1362#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
1362 CGContextSetTextPosition (context, gx, gy); 1363#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
1363 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); 1364 if (CGContextShowGlyphsWithAdvances != NULL)
1364 if (overstrike_p) 1365#endif
1365 { 1366 {
1366 CGContextSetTextPosition (context, gx + 1.0f, gy); 1367 CGContextSetTextPosition (context, gx, gy);
1367 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); 1368 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
1369 if (overstrike_p)
1370 {
1371 CGContextSetTextPosition (context, gx + 1.0f, gy);
1372 CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
1373 }
1368 } 1374 }
1369#else 1375#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
1370 for (i = 0; i < nchars; i++) 1376 else
1377#endif
1378#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
1379#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
1371 { 1380 {
1372 CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1); 1381 for (i = 0; i < nchars; i++)
1373 if (overstrike_p) 1382 {
1374 CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1); 1383 CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1);
1375 gx += advances[i].width; 1384 if (overstrike_p)
1385 CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1);
1386 gx += advances[i].width;
1387 }
1376 } 1388 }
1377#endif 1389#endif
1378#if USE_CG_DRAWING 1390#if USE_CG_DRAWING
@@ -2196,7 +2208,7 @@ pcm_init (pcm, count)
2196 2208
2197static enum pcm_status 2209static enum pcm_status
2198pcm_get_status (pcm) 2210pcm_get_status (pcm)
2199 XCharStruct *pcm; 2211 const XCharStruct *pcm;
2200{ 2212{
2201 int height = pcm->ascent + pcm->descent; 2213 int height = pcm->ascent + pcm->descent;
2202 2214
@@ -4219,7 +4231,7 @@ mac_focus_changed (type, dpyinfo, frame, bufp)
4219static void 4231static void
4220x_detect_focus_change (dpyinfo, event, bufp) 4232x_detect_focus_change (dpyinfo, event, bufp)
4221 struct mac_display_info *dpyinfo; 4233 struct mac_display_info *dpyinfo;
4222 EventRecord *event; 4234 const EventRecord *event;
4223 struct input_event *bufp; 4235 struct input_event *bufp;
4224{ 4236{
4225 struct frame *frame; 4237 struct frame *frame;
@@ -5232,7 +5244,7 @@ static void
5232x_scroll_bar_handle_click (bar, part_code, er, bufp) 5244x_scroll_bar_handle_click (bar, part_code, er, bufp)
5233 struct scroll_bar *bar; 5245 struct scroll_bar *bar;
5234 ControlPartCode part_code; 5246 ControlPartCode part_code;
5235 EventRecord *er; 5247 const EventRecord *er;
5236 struct input_event *bufp; 5248 struct input_event *bufp;
5237{ 5249{
5238 int win_y, top_range; 5250 int win_y, top_range;
@@ -6695,11 +6707,12 @@ xlfdpat_destroy (pat)
6695 6707
6696static struct xlfdpat * 6708static struct xlfdpat *
6697xlfdpat_create (pattern) 6709xlfdpat_create (pattern)
6698 char *pattern; 6710 const char *pattern;
6699{ 6711{
6700 struct xlfdpat *pat; 6712 struct xlfdpat *pat;
6701 int nblocks, i, skip; 6713 int nblocks, i, skip;
6702 unsigned char last_char, *p, *q, *anychar_head; 6714 unsigned char last_char, *p, *q, *anychar_head;
6715 const unsigned char *ptr;
6703 struct xlfdpat_block *blk; 6716 struct xlfdpat_block *blk;
6704 6717
6705 pat = xmalloc (sizeof (struct xlfdpat)); 6718 pat = xmalloc (sizeof (struct xlfdpat));
@@ -6710,9 +6723,9 @@ xlfdpat_create (pattern)
6710 anychar_head = NULL; 6723 anychar_head = NULL;
6711 q = pat->buf; 6724 q = pat->buf;
6712 last_char = '\0'; 6725 last_char = '\0';
6713 for (p = pattern; *p; p++) 6726 for (ptr = pattern; *ptr; ptr++)
6714 { 6727 {
6715 unsigned char c = *p; 6728 unsigned char c = *ptr;
6716 6729
6717 if (c == '*') 6730 if (c == '*')
6718 if (last_char == '*') 6731 if (last_char == '*')
@@ -6816,14 +6829,15 @@ xlfdpat_exact_p (pat)
6816 that the pattern in *BLK matches with its prefix. Return NULL 6829 that the pattern in *BLK matches with its prefix. Return NULL
6817 there is no such strings. STRING must be lowered in advance. */ 6830 there is no such strings. STRING must be lowered in advance. */
6818 6831
6819static char * 6832static const char *
6820xlfdpat_block_match_1 (blk, string, start_max) 6833xlfdpat_block_match_1 (blk, string, start_max)
6821 struct xlfdpat_block *blk; 6834 struct xlfdpat_block *blk;
6822 unsigned char *string; 6835 const unsigned char *string;
6823 int start_max; 6836 int start_max;
6824{ 6837{
6825 int start, infinity; 6838 int start, infinity;
6826 unsigned char *p, *s; 6839 unsigned char *p;
6840 const unsigned char *s;
6827 6841
6828 xassert (blk->len > 0); 6842 xassert (blk->len > 0);
6829 xassert (start_max + blk->len <= strlen (string)); 6843 xassert (start_max + blk->len <= strlen (string));
@@ -6880,17 +6894,17 @@ xlfdpat_block_match_1 (blk, string, start_max)
6880 ((b)->len == 1 ? memchr ((s), (b)->last_char, (m) + 1) \ 6894 ((b)->len == 1 ? memchr ((s), (b)->last_char, (m) + 1) \
6881 : xlfdpat_block_match_1 (b, s, m)) 6895 : xlfdpat_block_match_1 (b, s, m))
6882 6896
6883/* Check if XLFD pattern PAT, which is generated by `xfldpat_create', 6897/* Check if XLFD pattern PAT, which is generated by `xlfdpat_create',
6884 matches with STRING. STRING must be lowered in advance. */ 6898 matches with STRING. STRING must be lowered in advance. */
6885 6899
6886static int 6900static int
6887xlfdpat_match (pat, string) 6901xlfdpat_match (pat, string)
6888 struct xlfdpat *pat; 6902 struct xlfdpat *pat;
6889 unsigned char *string; 6903 const unsigned char *string;
6890{ 6904{
6891 int str_len, nblocks, i, start_max; 6905 int str_len, nblocks, i, start_max;
6892 struct xlfdpat_block *blk; 6906 struct xlfdpat_block *blk;
6893 unsigned char *s; 6907 const unsigned char *s;
6894 6908
6895 xassert (pat->nblocks > 0); 6909 xassert (pat->nblocks > 0);
6896 6910
@@ -7061,7 +7075,7 @@ decode_mac_font_name (name, size, coding_system)
7061 7075
7062static char * 7076static char *
7063mac_to_x_fontname (name, size, style, charset) 7077mac_to_x_fontname (name, size, style, charset)
7064 char *name; 7078 const char *name;
7065 int size; 7079 int size;
7066 Style style; 7080 Style style;
7067 char *charset; 7081 char *charset;
@@ -7108,7 +7122,8 @@ const int kDefaultFontSize = 12;
7108 7122
7109static int 7123static int
7110parse_x_font_name (xf, family, size, style, charset) 7124parse_x_font_name (xf, family, size, style, charset)
7111 char *xf, *family; 7125 const char *xf;
7126 char *family;
7112 int *size; 7127 int *size;
7113 Style *style; 7128 Style *style;
7114 char *charset; 7129 char *charset;
@@ -7191,10 +7206,10 @@ add_font_name_table_entry (char *font_name)
7191 7206
7192static void 7207static void
7193add_mac_font_name (name, size, style, charset) 7208add_mac_font_name (name, size, style, charset)
7194 char *name; 7209 const char *name;
7195 int size; 7210 int size;
7196 Style style; 7211 Style style;
7197 char *charset; 7212 const char *charset;
7198{ 7213{
7199 if (size > 0) 7214 if (size > 0)
7200 add_font_name_table_entry (mac_to_x_fontname (name, size, style, charset)); 7215 add_font_name_table_entry (mac_to_x_fontname (name, size, style, charset));
@@ -7496,7 +7511,7 @@ enum xlfd_scalable_field_index
7496 XLFD_SCL_LAST 7511 XLFD_SCL_LAST
7497 }; 7512 };
7498 7513
7499static int xlfd_scalable_fields[] = 7514static const int xlfd_scalable_fields[] =
7500 { 7515 {
7501 6, /* PIXEL_SIZE */ 7516 6, /* PIXEL_SIZE */
7502 7, /* POINT_SIZE */ 7517 7, /* POINT_SIZE */
@@ -7506,14 +7521,16 @@ static int xlfd_scalable_fields[] =
7506 7521
7507static Lisp_Object 7522static Lisp_Object
7508mac_do_list_fonts (pattern, maxnames) 7523mac_do_list_fonts (pattern, maxnames)
7509 char *pattern; 7524 const char *pattern;
7510 int maxnames; 7525 int maxnames;
7511{ 7526{
7512 int i, n_fonts = 0; 7527 int i, n_fonts = 0;
7513 Lisp_Object font_list = Qnil; 7528 Lisp_Object font_list = Qnil;
7514 struct xlfdpat *pat; 7529 struct xlfdpat *pat;
7515 char *scaled, *ptr; 7530 char *scaled;
7516 int scl_val[XLFD_SCL_LAST], *field, *val; 7531 const char *ptr;
7532 int scl_val[XLFD_SCL_LAST], *val;
7533 const int *field;
7517 int exact; 7534 int exact;
7518 7535
7519 if (font_name_table == NULL) /* Initialize when first used. */ 7536 if (font_name_table == NULL) /* Initialize when first used. */
@@ -7763,7 +7780,8 @@ x_compute_min_glyph_bounds (f)
7763 fields are present, none is '*'. */ 7780 fields are present, none is '*'. */
7764 7781
7765static int 7782static int
7766is_fully_specified_xlfd (char *p) 7783is_fully_specified_xlfd (p)
7784 const char *p;
7767{ 7785{
7768 int i; 7786 int i;
7769 char *q; 7787 char *q;
@@ -7840,18 +7858,21 @@ mac_load_query_font (f, fontname)
7840 if (strcmp (charset, "iso10646-1") == 0) /* XXX */ 7858 if (strcmp (charset, "iso10646-1") == 0) /* XXX */
7841 { 7859 {
7842 OSStatus err; 7860 OSStatus err;
7843 ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag, 7861 static const ATSUAttributeTag tags[] =
7844 kATSUQDBoldfaceTag, kATSUQDItalicTag}; 7862 {kATSUFontTag, kATSUSizeTag,
7845 ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed), 7863 kATSUQDBoldfaceTag, kATSUQDItalicTag};
7846 sizeof (Boolean), sizeof (Boolean)}; 7864 static const ByteCount sizes[] =
7865 {sizeof (ATSUFontID), sizeof (Fixed),
7866 sizeof (Boolean), sizeof (Boolean)};
7847 static Fixed size_fixed; 7867 static Fixed size_fixed;
7848 static Boolean bold_p, italic_p; 7868 static Boolean bold_p, italic_p;
7849 ATSUAttributeValuePtr values[] = {&font_id, &size_fixed, 7869 static const ATSUAttributeValuePtr values[] =
7850 &bold_p, &italic_p}; 7870 {&font_id, &size_fixed,
7851 ATSUFontFeatureType types[] = {kAllTypographicFeaturesType, 7871 &bold_p, &italic_p};
7852 kDiacriticsType}; 7872 static const ATSUFontFeatureType types[] =
7853 ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, 7873 {kAllTypographicFeaturesType, kDiacriticsType};
7854 kDecomposeDiacriticsSelector}; 7874 static const ATSUFontFeatureSelector selectors[] =
7875 {kAllTypeFeaturesOffSelector, kDecomposeDiacriticsSelector};
7855 Lisp_Object font_id_cons; 7876 Lisp_Object font_id_cons;
7856 FMFontStyle style; 7877 FMFontStyle style;
7857 7878
@@ -8642,7 +8663,7 @@ extern void terminate_applescript();
8642 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>) 8663 except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
8643 on the right of the Cmd key on laptops, and fn + `enter' (-> 8664 on the right of the Cmd key on laptops, and fn + `enter' (->
8644 <linefeed>). */ 8665 <linefeed>). */
8645static unsigned char keycode_to_xkeysym_table[] = { 8666static const unsigned char keycode_to_xkeysym_table[] = {
8646 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8667 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8647 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8668 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8648 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8669 /*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -8679,7 +8700,7 @@ static unsigned char keycode_to_xkeysym_table[] = {
8679 keyboard, and they may not be the same on other types of keyboards. 8700 keyboard, and they may not be the same on other types of keyboards.
8680 If the destination is identical to the source (f1 ... f12), it 8701 If the destination is identical to the source (f1 ... f12), it
8681 doesn't map `fn' key to a modifier. */ 8702 doesn't map `fn' key to a modifier. */
8682static unsigned char fn_keycode_to_keycode_table[] = { 8703static const unsigned char fn_keycode_to_keycode_table[] = {
8683 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8704 /*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8684 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8705 /*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8685 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8706 /*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -9137,7 +9158,9 @@ do_apple_menu (SInt16 menu_item)
9137 Mesander and IM - Window Manager A. */ 9158 Mesander and IM - Window Manager A. */
9138 9159
9139static void 9160static void
9140do_grow_window (WindowPtr w, EventRecord *e) 9161do_grow_window (w, e)
9162 WindowPtr w;
9163 const EventRecord *e;
9141{ 9164{
9142 Rect limit_rect; 9165 Rect limit_rect;
9143 int rows, columns, width, height; 9166 int rows, columns, width, height;
@@ -9321,8 +9344,8 @@ mac_store_event_ref_as_apple_event (class, id, class_key, id_key,
9321 Lisp_Object class_key, id_key; 9344 Lisp_Object class_key, id_key;
9322 EventRef event; 9345 EventRef event;
9323 UInt32 num_params; 9346 UInt32 num_params;
9324 EventParamName *names; 9347 const EventParamName *names;
9325 EventParamType *types; 9348 const EventParamType *types;
9326{ 9349{
9327 OSStatus err = eventNotHandledErr; 9350 OSStatus err = eventNotHandledErr;
9328 Lisp_Object binding; 9351 Lisp_Object binding;
@@ -9383,10 +9406,10 @@ mac_handle_command_event (next_handler, event, data)
9383{ 9406{
9384 OSStatus result, err; 9407 OSStatus result, err;
9385 HICommand command; 9408 HICommand command;
9386 static EventParamName names[] = {kEventParamDirectObject, 9409 static const EventParamName names[] =
9387 kEventParamKeyModifiers}; 9410 {kEventParamDirectObject, kEventParamKeyModifiers};
9388 static EventParamType types[] = {typeHICommand, 9411 static const EventParamType types[] =
9389 typeUInt32}; 9412 {typeHICommand, typeUInt32};
9390 int num_params = sizeof (names) / sizeof (names[0]); 9413 int num_params = sizeof (names) / sizeof (names[0]);
9391 9414
9392 result = CallNextEventHandler (next_handler, event); 9415 result = CallNextEventHandler (next_handler, event);
@@ -9410,7 +9433,8 @@ mac_handle_command_event (next_handler, event, data)
9410static OSStatus 9433static OSStatus
9411init_command_handler () 9434init_command_handler ()
9412{ 9435{
9413 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; 9436 static const EventTypeSpec specs[] =
9437 {{kEventClassCommand, kEventCommandProcess}};
9414 static EventHandlerUPP handle_command_eventUPP = NULL; 9438 static EventHandlerUPP handle_command_eventUPP = NULL;
9415 9439
9416 if (handle_command_eventUPP == NULL) 9440 if (handle_command_eventUPP == NULL)
@@ -9570,18 +9594,18 @@ mac_handle_window_event (next_handler, event, data)
9570 case kEventWindowToolbarSwitchMode: 9594 case kEventWindowToolbarSwitchMode:
9571 result = CallNextEventHandler (next_handler, event); 9595 result = CallNextEventHandler (next_handler, event);
9572 { 9596 {
9573 static EventParamName names[] = {kEventParamDirectObject, 9597 static const EventParamName names[] = {kEventParamDirectObject,
9574 kEventParamWindowMouseLocation, 9598 kEventParamWindowMouseLocation,
9575 kEventParamKeyModifiers, 9599 kEventParamKeyModifiers,
9576 kEventParamMouseButton, 9600 kEventParamMouseButton,
9577 kEventParamClickCount, 9601 kEventParamClickCount,
9578 kEventParamMouseChord}; 9602 kEventParamMouseChord};
9579 static EventParamType types[] = {typeWindowRef, 9603 static const EventParamType types[] = {typeWindowRef,
9580 typeQDPoint, 9604 typeQDPoint,
9581 typeUInt32, 9605 typeUInt32,
9582 typeMouseButton, 9606 typeMouseButton,
9583 typeUInt32, 9607 typeUInt32,
9584 typeUInt32}; 9608 typeUInt32};
9585 int num_params = sizeof (names) / sizeof (names[0]); 9609 int num_params = sizeof (names) / sizeof (names[0]);
9586 9610
9587 err = mac_store_event_ref_as_apple_event (0, 0, 9611 err = mac_store_event_ref_as_apple_event (0, 0,
@@ -9688,18 +9712,18 @@ mac_handle_font_event (next_handler, event, data)
9688 OSStatus result, err; 9712 OSStatus result, err;
9689 Lisp_Object id_key; 9713 Lisp_Object id_key;
9690 int num_params; 9714 int num_params;
9691 EventParamName *names; 9715 const EventParamName *names;
9692 EventParamType *types; 9716 const EventParamType *types;
9693 static EventParamName names_sel[] = {kEventParamATSUFontID, 9717 static const EventParamName names_sel[] = {kEventParamATSUFontID,
9694 kEventParamATSUFontSize, 9718 kEventParamATSUFontSize,
9695 kEventParamFMFontFamily, 9719 kEventParamFMFontFamily,
9696 kEventParamFMFontSize, 9720 kEventParamFMFontSize,
9697 kEventParamFontColor}; 9721 kEventParamFontColor};
9698 static EventParamType types_sel[] = {typeATSUFontID, 9722 static const EventParamType types_sel[] = {typeATSUFontID,
9699 typeATSUSize, 9723 typeATSUSize,
9700 typeFMFontFamily, 9724 typeFMFontFamily,
9701 typeFMFontSize, 9725 typeFMFontSize,
9702 typeFontColor}; 9726 typeFontColor};
9703 9727
9704 result = CallNextEventHandler (next_handler, event); 9728 result = CallNextEventHandler (next_handler, event);
9705 if (result != eventNotHandledErr) 9729 if (result != eventNotHandledErr)
@@ -9740,10 +9764,10 @@ mac_handle_text_input_event (next_handler, event, data)
9740 OSStatus result, err = noErr; 9764 OSStatus result, err = noErr;
9741 Lisp_Object id_key = Qnil; 9765 Lisp_Object id_key = Qnil;
9742 int num_params; 9766 int num_params;
9743 EventParamName *names; 9767 const EventParamName *names;
9744 EventParamType *types; 9768 const EventParamType *types;
9745 static UInt32 seqno_uaia = 0; 9769 static UInt32 seqno_uaia = 0;
9746 static EventParamName names_uaia[] = 9770 static const EventParamName names_uaia[] =
9747 {kEventParamTextInputSendComponentInstance, 9771 {kEventParamTextInputSendComponentInstance,
9748 kEventParamTextInputSendRefCon, 9772 kEventParamTextInputSendRefCon,
9749 kEventParamTextInputSendSLRec, 9773 kEventParamTextInputSendSLRec,
@@ -9756,7 +9780,7 @@ mac_handle_text_input_event (next_handler, event, data)
9756 kEventParamTextInputSendTextServiceEncoding, 9780 kEventParamTextInputSendTextServiceEncoding,
9757 kEventParamTextInputSendTextServiceMacEncoding, 9781 kEventParamTextInputSendTextServiceMacEncoding,
9758 EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER}; 9782 EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER};
9759 static EventParamType types_uaia[] = 9783 static const EventParamType types_uaia[] =
9760 {typeComponentInstance, 9784 {typeComponentInstance,
9761 typeLongInteger, 9785 typeLongInteger,
9762 typeIntlWritingCode, 9786 typeIntlWritingCode,
@@ -9773,12 +9797,12 @@ mac_handle_text_input_event (next_handler, event, data)
9773 typeUInt32, 9797 typeUInt32,
9774 typeUInt32, 9798 typeUInt32,
9775 typeUInt32}; 9799 typeUInt32};
9776 static EventParamName names_ufke[] = 9800 static const EventParamName names_ufke[] =
9777 {kEventParamTextInputSendComponentInstance, 9801 {kEventParamTextInputSendComponentInstance,
9778 kEventParamTextInputSendRefCon, 9802 kEventParamTextInputSendRefCon,
9779 kEventParamTextInputSendSLRec, 9803 kEventParamTextInputSendSLRec,
9780 kEventParamTextInputSendText}; 9804 kEventParamTextInputSendText};
9781 static EventParamType types_ufke[] = 9805 static const EventParamType types_ufke[] =
9782 {typeComponentInstance, 9806 {typeComponentInstance,
9783 typeLongInteger, 9807 typeLongInteger,
9784 typeIntlWritingCode, 9808 typeIntlWritingCode,
@@ -9931,12 +9955,12 @@ mac_store_service_event (event)
9931 OSStatus err; 9955 OSStatus err;
9932 Lisp_Object id_key; 9956 Lisp_Object id_key;
9933 int num_params; 9957 int num_params;
9934 EventParamName *names; 9958 const EventParamName *names;
9935 EventParamType *types; 9959 const EventParamType *types;
9936 static EventParamName names_pfm[] = {kEventParamServiceMessageName, 9960 static const EventParamName names_pfm[] =
9937 kEventParamServiceUserData}; 9961 {kEventParamServiceMessageName, kEventParamServiceUserData};
9938 static EventParamType types_pfm[] = {typeCFStringRef, 9962 static const EventParamType types_pfm[] =
9939 typeCFStringRef}; 9963 {typeCFStringRef, typeCFStringRef};
9940 9964
9941 switch (GetEventKind (event)) 9965 switch (GetEventKind (event))
9942 { 9966 {
@@ -9974,7 +9998,7 @@ install_window_handler (window)
9974{ 9998{
9975 OSStatus err = noErr; 9999 OSStatus err = noErr;
9976#if USE_CARBON_EVENTS 10000#if USE_CARBON_EVENTS
9977 EventTypeSpec specs_window[] = 10001 static const EventTypeSpec specs_window[] =
9978 {{kEventClassWindow, kEventWindowUpdate}, 10002 {{kEventClassWindow, kEventWindowUpdate},
9979 {kEventClassWindow, kEventWindowGetIdealSize}, 10003 {kEventClassWindow, kEventWindowGetIdealSize},
9980 {kEventClassWindow, kEventWindowBoundsChanging}, 10004 {kEventClassWindow, kEventWindowBoundsChanging},
@@ -9992,16 +10016,18 @@ install_window_handler (window)
9992 {kEventClassWindow, kEventWindowFocusRelinquish}, 10016 {kEventClassWindow, kEventWindowFocusRelinquish},
9993#endif 10017#endif
9994 }; 10018 };
9995 EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; 10019 static const EventTypeSpec specs_mouse[] =
10020 {{kEventClassMouse, kEventMouseWheelMoved}};
9996 static EventHandlerUPP handle_window_eventUPP = NULL; 10021 static EventHandlerUPP handle_window_eventUPP = NULL;
9997 static EventHandlerUPP handle_mouse_eventUPP = NULL; 10022 static EventHandlerUPP handle_mouse_eventUPP = NULL;
9998#if USE_MAC_FONT_PANEL 10023#if USE_MAC_FONT_PANEL
9999 EventTypeSpec specs_font[] = {{kEventClassFont, kEventFontPanelClosed}, 10024 static const EventTypeSpec specs_font[] =
10000 {kEventClassFont, kEventFontSelection}}; 10025 {{kEventClassFont, kEventFontPanelClosed},
10026 {kEventClassFont, kEventFontSelection}};
10001 static EventHandlerUPP handle_font_eventUPP = NULL; 10027 static EventHandlerUPP handle_font_eventUPP = NULL;
10002#endif 10028#endif
10003#if USE_MAC_TSM 10029#if USE_MAC_TSM
10004 EventTypeSpec specs_text_input[] = 10030 static const EventTypeSpec specs_text_input[] =
10005 {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, 10031 {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea},
10006 {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, 10032 {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent},
10007 {kEventClassTextInput, kEventTextInputOffsetToPos}}; 10033 {kEventClassTextInput, kEventTextInputOffsetToPos}};
@@ -11218,7 +11244,7 @@ mac_initialize_display_info ()
11218 11244
11219static XrmDatabase 11245static XrmDatabase
11220mac_make_rdb (xrm_option) 11246mac_make_rdb (xrm_option)
11221 char *xrm_option; 11247 const char *xrm_option;
11222{ 11248{
11223 XrmDatabase database; 11249 XrmDatabase database;
11224 11250
diff --git a/src/macterm.h b/src/macterm.h
index e33f939940c..33692a8b8d2 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -666,11 +666,11 @@ extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *));
666extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object)); 666extern OSErr mac_ae_put_lisp P_ ((AEDescList *, UInt32, Lisp_Object));
667#if TARGET_API_MAC_CARBON 667#if TARGET_API_MAC_CARBON
668extern OSStatus create_apple_event_from_event_ref P_ ((EventRef, UInt32, 668extern OSStatus create_apple_event_from_event_ref P_ ((EventRef, UInt32,
669 EventParamName *, 669 const EventParamName *,
670 EventParamType *, 670 const EventParamType *,
671 AppleEvent *)); 671 AppleEvent *));
672extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32, 672extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32,
673 FlavorType *, 673 const FlavorType *,
674 AppleEvent *)); 674 AppleEvent *));
675extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); 675extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *));
676extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object)); 676extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object));
@@ -683,9 +683,10 @@ extern Lisp_Object cfboolean_to_lisp P_ ((CFBooleanRef));
683extern Lisp_Object cfobject_desc_to_lisp P_ ((CFTypeRef)); 683extern Lisp_Object cfobject_desc_to_lisp P_ ((CFTypeRef));
684extern Lisp_Object cfproperty_list_to_lisp P_ ((CFPropertyListRef, int, int)); 684extern Lisp_Object cfproperty_list_to_lisp P_ ((CFPropertyListRef, int, int));
685#endif 685#endif
686extern void xrm_merge_string_database P_ ((XrmDatabase, char *)); 686extern void xrm_merge_string_database P_ ((XrmDatabase, const char *));
687extern Lisp_Object xrm_get_resource P_ ((XrmDatabase, char *, char *)); 687extern Lisp_Object xrm_get_resource P_ ((XrmDatabase, const char *,
688extern XrmDatabase xrm_get_preference_database P_ ((char *)); 688 const char *));
689extern XrmDatabase xrm_get_preference_database P_ ((const char *));
689EXFUN (Fmac_get_preference, 4); 690EXFUN (Fmac_get_preference, 4);
690 691
691/* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79 692/* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79
diff --git a/src/minibuf.c b/src/minibuf.c
index f54feffbb21..31c0fd1768e 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1689,7 +1689,7 @@ Lisp_Object Vminibuffer_completing_file_name;
1689DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, 1689DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0,
1690 doc: /* Read a string in the minibuffer, with completion. 1690 doc: /* Read a string in the minibuffer, with completion.
1691PROMPT is a string to prompt with; normally it ends in a colon and a space. 1691PROMPT is a string to prompt with; normally it ends in a colon and a space.
1692TABLE can be an list of strings, an alist, an obarray or a hash table. 1692TABLE can be a list of strings, an alist, an obarray or a hash table.
1693TABLE can also be a function to do the completion itself. 1693TABLE can also be a function to do the completion itself.
1694PREDICATE limits completion to a subset of TABLE. 1694PREDICATE limits completion to a subset of TABLE.
1695See `try-completion' and `all-completions' for more details 1695See `try-completion' and `all-completions' for more details
diff --git a/src/msdos.c b/src/msdos.c
index 8595c8f6ce9..834a32db97b 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -2639,7 +2639,7 @@ check_x (void)
2639#define Ctrl 0x0200 /* ctrl scan-code */ 2639#define Ctrl 0x0200 /* ctrl scan-code */
2640#define Shift 0x0400 /* shift scan-code */ 2640#define Shift 0x0400 /* shift scan-code */
2641 2641
2642static int extended_kbd; /* 101 (102) keyboard present. */ 2642static int extended_kbd; /* 101 (102) keyboard present. */
2643 2643
2644struct kbd_translate { 2644struct kbd_translate {
2645 unsigned char sc; 2645 unsigned char sc;
diff --git a/src/process.c b/src/process.c
index 9062e6c3d6e..7a8ad5c339b 100644
--- a/src/process.c
+++ b/src/process.c
@@ -7074,7 +7074,7 @@ syms_of_process ()
7074 7074
7075 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes, 7075 DEFVAR_BOOL ("delete-exited-processes", &delete_exited_processes,
7076 doc: /* *Non-nil means delete processes immediately when they exit. 7076 doc: /* *Non-nil means delete processes immediately when they exit.
7077nil means don't delete them until `list-processes' is run. */); 7077A value of nil means don't delete them until `list-processes' is run. */);
7078 7078
7079 delete_exited_processes = 1; 7079 delete_exited_processes = 1;
7080 7080
diff --git a/src/regex.c b/src/regex.c
index ae80ad0cee8..c0dd6e00ffc 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -12,13 +12,13 @@
12 12
13 This program is distributed in the hope that it will be useful, 13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 GNU General Public License for more details.
17 17
18 You should have received a copy of the GNU General Public License 18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 USA. */ 21 USA. */
22 22
23/* TODO: 23/* TODO:
24 - structure the opcode space into opcode+flag. 24 - structure the opcode space into opcode+flag.
@@ -139,7 +139,7 @@
139# endif 139# endif
140# define free xfree 140# define free xfree
141 141
142/* Converts the pointer to the char to BEG-based offset from the start. */ 142/* Converts the pointer to the char to BEG-based offset from the start. */
143# define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d)) 143# define PTR_TO_OFFSET(d) POS_AS_IN_BUFFER (POINTER_TO_OFFSET (d))
144# define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object))) 144# define POS_AS_IN_BUFFER(p) ((p) + (NILP (re_match_object) || BUFFERP (re_match_object)))
145 145
@@ -540,7 +540,7 @@ init_syntax_once ()
540 540
541# define REGEX_REALLOCATE_STACK(source, osize, nsize) \ 541# define REGEX_REALLOCATE_STACK(source, osize, nsize) \
542 REGEX_REALLOCATE (source, osize, nsize) 542 REGEX_REALLOCATE (source, osize, nsize)
543/* No need to explicitly free anything. */ 543/* No need to explicitly free anything. */
544# define REGEX_FREE_STACK(arg) ((void)0) 544# define REGEX_FREE_STACK(arg) ((void)0)
545 545
546# endif /* not REGEX_MALLOC */ 546# endif /* not REGEX_MALLOC */
@@ -654,7 +654,7 @@ typedef enum
654 jump, 654 jump,
655 655
656 /* Followed by two-byte relative address of place to resume at 656 /* Followed by two-byte relative address of place to resume at
657 in case of failure. */ 657 in case of failure. */
658 on_failure_jump, 658 on_failure_jump,
659 659
660 /* Like on_failure_jump, but pushes a placeholder instead of the 660 /* Like on_failure_jump, but pushes a placeholder instead of the
@@ -691,7 +691,7 @@ typedef enum
691 jump_n, 691 jump_n,
692 692
693 /* Set the following two-byte relative address to the 693 /* Set the following two-byte relative address to the
694 subsequent two-byte number. The address *includes* the two 694 subsequent two-byte number. The address *includes* the two
695 bytes of number. */ 695 bytes of number. */
696 set_number_at, 696 set_number_at,
697 697
@@ -699,7 +699,7 @@ typedef enum
699 wordend, /* Succeeds if at word end. */ 699 wordend, /* Succeeds if at word end. */
700 700
701 wordbound, /* Succeeds if at a word boundary. */ 701 wordbound, /* Succeeds if at a word boundary. */
702 notwordbound, /* Succeeds if not at a word boundary. */ 702 notwordbound, /* Succeeds if not at a word boundary. */
703 703
704 symbeg, /* Succeeds if at symbol beginning. */ 704 symbeg, /* Succeeds if at symbol beginning. */
705 symend, /* Succeeds if at symbol end. */ 705 symend, /* Succeeds if at symbol end. */
@@ -717,8 +717,8 @@ typedef enum
717 after_dot, /* Succeeds if after point. */ 717 after_dot, /* Succeeds if after point. */
718 718
719 /* Matches any character whose category-set contains the specified 719 /* Matches any character whose category-set contains the specified
720 category. The operator is followed by a byte which contains a 720 category. The operator is followed by a byte which contains a
721 category code (mnemonic ASCII character). */ 721 category code (mnemonic ASCII character). */
722 categoryspec, 722 categoryspec,
723 723
724 /* Matches any character whose category-set does not contain the 724 /* Matches any character whose category-set does not contain the
@@ -807,7 +807,7 @@ extract_number_and_incr (destination, source)
807 807
808/* Store a multibyte character in three contiguous bytes starting 808/* Store a multibyte character in three contiguous bytes starting
809 DESTINATION, and increment DESTINATION to the byte after where the 809 DESTINATION, and increment DESTINATION to the byte after where the
810 character is stored. Therefore, DESTINATION must be an lvalue. */ 810 character is stored. Therefore, DESTINATION must be an lvalue. */
811 811
812#define STORE_CHARACTER_AND_INCR(destination, character) \ 812#define STORE_CHARACTER_AND_INCR(destination, character) \
813 do { \ 813 do { \
@@ -818,7 +818,7 @@ extract_number_and_incr (destination, source)
818 } while (0) 818 } while (0)
819 819
820/* Put into DESTINATION a character stored in three contiguous bytes 820/* Put into DESTINATION a character stored in three contiguous bytes
821 starting at SOURCE. */ 821 starting at SOURCE. */
822 822
823#define EXTRACT_CHARACTER(destination, source) \ 823#define EXTRACT_CHARACTER(destination, source) \
824 do { \ 824 do { \
@@ -854,13 +854,13 @@ extract_number_and_incr (destination, source)
854 && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH))) 854 && (p)[2 + (c) / BYTEWIDTH] & (1 << ((c) % BYTEWIDTH)))
855 855
856/* Return the address of end of RANGE_TABLE. COUNT is number of 856/* Return the address of end of RANGE_TABLE. COUNT is number of
857 ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2' 857 ranges (which is a pair of (start, end)) in the RANGE_TABLE. `* 2'
858 is start of range and end of range. `* 3' is size of each start 858 is start of range and end of range. `* 3' is size of each start
859 and end. */ 859 and end. */
860#define CHARSET_RANGE_TABLE_END(range_table, count) \ 860#define CHARSET_RANGE_TABLE_END(range_table, count) \
861 ((range_table) + (count) * 2 * 3) 861 ((range_table) + (count) * 2 * 3)
862 862
863/* Test if C is in RANGE_TABLE. A flag NOT is negated if C is in. 863/* Test if C is in RANGE_TABLE. A flag NOT is negated if C is in.
864 COUNT is number of ranges in RANGE_TABLE. */ 864 COUNT is number of ranges in RANGE_TABLE. */
865#define CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count) \ 865#define CHARSET_LOOKUP_RANGE_TABLE_RAW(not, c, range_table, count) \
866 do \ 866 do \
@@ -1667,7 +1667,7 @@ do { \
1667 REGSTART, REGEND -- arrays of string positions. 1667 REGSTART, REGEND -- arrays of string positions.
1668 1668
1669 Also assumes the variables `fail_stack' and (if debugging), `bufp', 1669 Also assumes the variables `fail_stack' and (if debugging), `bufp',
1670 `pend', `string1', `size1', `string2', and `size2'. */ 1670 `pend', `string1', `size1', `string2', and `size2'. */
1671 1671
1672#define POP_FAILURE_POINT(str, pat) \ 1672#define POP_FAILURE_POINT(str, pat) \
1673do { \ 1673do { \
@@ -1936,7 +1936,7 @@ struct range_table_work_area
1936{ 1936{
1937 int *table; /* actual work area. */ 1937 int *table; /* actual work area. */
1938 int allocated; /* allocated size for work area in bytes. */ 1938 int allocated; /* allocated size for work area in bytes. */
1939 int used; /* actually used size in words. */ 1939 int used; /* actually used size in words. */
1940 int bits; /* flag to record character classes */ 1940 int bits; /* flag to record character classes */
1941}; 1941};
1942 1942
@@ -1978,7 +1978,7 @@ struct range_table_work_area
1978 FREE_STACK_RETURN (tem); \ 1978 FREE_STACK_RETURN (tem); \
1979 } while (0) 1979 } while (0)
1980 1980
1981/* Free allocated memory for WORK_AREA. */ 1981/* Free allocated memory for WORK_AREA. */
1982#define FREE_RANGE_TABLE_WORK_AREA(work_area) \ 1982#define FREE_RANGE_TABLE_WORK_AREA(work_area) \
1983 do { \ 1983 do { \
1984 if ((work_area).table) \ 1984 if ((work_area).table) \
@@ -2478,7 +2478,7 @@ regex_compile (pattern, size, syntax, bufp)
2478 re_char *beg_interval; 2478 re_char *beg_interval;
2479 2479
2480 /* Address of the place where a forward jump should go to the end of 2480 /* Address of the place where a forward jump should go to the end of
2481 the containing expression. Each alternative of an `or' -- except the 2481 the containing expression. Each alternative of an `or' -- except the
2482 last -- ends with a forward jump of this sort. */ 2482 last -- ends with a forward jump of this sort. */
2483 unsigned char *fixup_alt_jump = 0; 2483 unsigned char *fixup_alt_jump = 0;
2484 2484
@@ -2550,11 +2550,11 @@ regex_compile (pattern, size, syntax, bufp)
2550 if (bufp->buffer) 2550 if (bufp->buffer)
2551 { /* If zero allocated, but buffer is non-null, try to realloc 2551 { /* If zero allocated, but buffer is non-null, try to realloc
2552 enough space. This loses if buffer's address is bogus, but 2552 enough space. This loses if buffer's address is bogus, but
2553 that is the user's responsibility. */ 2553 that is the user's responsibility. */
2554 RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); 2554 RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
2555 } 2555 }
2556 else 2556 else
2557 { /* Caller did not allocate a buffer. Do it for them. */ 2557 { /* Caller did not allocate a buffer. Do it for them. */
2558 bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); 2558 bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
2559 } 2559 }
2560 if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); 2560 if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE);
@@ -2618,15 +2618,15 @@ regex_compile (pattern, size, syntax, bufp)
2618 p = pattern = whitespace_regexp; 2618 p = pattern = whitespace_regexp;
2619 pend = p + strlen (p); 2619 pend = p + strlen (p);
2620 break; 2620 break;
2621 } 2621 }
2622 2622
2623 case '^': 2623 case '^':
2624 { 2624 {
2625 if ( /* If at start of pattern, it's an operator. */ 2625 if ( /* If at start of pattern, it's an operator. */
2626 p == pattern + 1 2626 p == pattern + 1
2627 /* If context independent, it's an operator. */ 2627 /* If context independent, it's an operator. */
2628 || syntax & RE_CONTEXT_INDEP_ANCHORS 2628 || syntax & RE_CONTEXT_INDEP_ANCHORS
2629 /* Otherwise, depends on what's come before. */ 2629 /* Otherwise, depends on what's come before. */
2630 || at_begline_loc_p (pattern, p, syntax)) 2630 || at_begline_loc_p (pattern, p, syntax))
2631 BUF_PUSH ((syntax & RE_NO_NEWLINE_ANCHOR) ? begbuf : begline); 2631 BUF_PUSH ((syntax & RE_NO_NEWLINE_ANCHOR) ? begbuf : begline);
2632 else 2632 else
@@ -2639,7 +2639,7 @@ regex_compile (pattern, size, syntax, bufp)
2639 { 2639 {
2640 if ( /* If at end of pattern, it's an operator. */ 2640 if ( /* If at end of pattern, it's an operator. */
2641 p == pend 2641 p == pend
2642 /* If context independent, it's an operator. */ 2642 /* If context independent, it's an operator. */
2643 || syntax & RE_CONTEXT_INDEP_ANCHORS 2643 || syntax & RE_CONTEXT_INDEP_ANCHORS
2644 /* Otherwise, depends on what's next. */ 2644 /* Otherwise, depends on what's next. */
2645 || at_endline_loc_p (p, pend, syntax)) 2645 || at_endline_loc_p (p, pend, syntax))
@@ -2667,14 +2667,14 @@ regex_compile (pattern, size, syntax, bufp)
2667 } 2667 }
2668 2668
2669 { 2669 {
2670 /* 1 means zero (many) matches is allowed. */ 2670 /* 1 means zero (many) matches is allowed. */
2671 boolean zero_times_ok = 0, many_times_ok = 0; 2671 boolean zero_times_ok = 0, many_times_ok = 0;
2672 boolean greedy = 1; 2672 boolean greedy = 1;
2673 2673
2674 /* If there is a sequence of repetition chars, collapse it 2674 /* If there is a sequence of repetition chars, collapse it
2675 down to just one (the right one). We can't combine 2675 down to just one (the right one). We can't combine
2676 interval operators with these because of, e.g., `a{2}*', 2676 interval operators with these because of, e.g., `a{2}*',
2677 which should only match an even number of `a's. */ 2677 which should only match an even number of `a's. */
2678 2678
2679 for (;;) 2679 for (;;)
2680 { 2680 {
@@ -2714,7 +2714,7 @@ regex_compile (pattern, size, syntax, bufp)
2714 break; 2714 break;
2715 2715
2716 /* Now we know whether or not zero matches is allowed 2716 /* Now we know whether or not zero matches is allowed
2717 and also whether or not two or more matches is allowed. */ 2717 and also whether or not two or more matches is allowed. */
2718 if (greedy) 2718 if (greedy)
2719 { 2719 {
2720 if (many_times_ok) 2720 if (many_times_ok)
@@ -2821,7 +2821,7 @@ regex_compile (pattern, size, syntax, bufp)
2821 laststart = b; 2821 laststart = b;
2822 2822
2823 /* We test `*p == '^' twice, instead of using an if 2823 /* We test `*p == '^' twice, instead of using an if
2824 statement, so we only need one BUF_PUSH. */ 2824 statement, so we only need one BUF_PUSH. */
2825 BUF_PUSH (*p == '^' ? charset_not : charset); 2825 BUF_PUSH (*p == '^' ? charset_not : charset);
2826 if (*p == '^') 2826 if (*p == '^')
2827 p++; 2827 p++;
@@ -2829,7 +2829,7 @@ regex_compile (pattern, size, syntax, bufp)
2829 /* Remember the first position in the bracket expression. */ 2829 /* Remember the first position in the bracket expression. */
2830 p1 = p; 2830 p1 = p;
2831 2831
2832 /* Push the number of bytes in the bitmap. */ 2832 /* Push the number of bytes in the bitmap. */
2833 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); 2833 BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH);
2834 2834
2835 /* Clear the whole map. */ 2835 /* Clear the whole map. */
@@ -2840,7 +2840,7 @@ regex_compile (pattern, size, syntax, bufp)
2840 && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) 2840 && (syntax & RE_HAT_LISTS_NOT_NEWLINE))
2841 SET_LIST_BIT ('\n'); 2841 SET_LIST_BIT ('\n');
2842 2842
2843 /* Read in characters and ranges, setting map bits. */ 2843 /* Read in characters and ranges, setting map bits. */
2844 for (;;) 2844 for (;;)
2845 { 2845 {
2846 boolean escaped_char = false; 2846 boolean escaped_char = false;
@@ -2864,7 +2864,7 @@ regex_compile (pattern, size, syntax, bufp)
2864 } 2864 }
2865 else 2865 else
2866 { 2866 {
2867 /* Could be the end of the bracket expression. If it's 2867 /* Could be the end of the bracket expression. If it's
2868 not (i.e., when the bracket expression is `[]' so 2868 not (i.e., when the bracket expression is `[]' so
2869 far), the ']' character bit gets set way below. */ 2869 far), the ']' character bit gets set way below. */
2870 if (c == ']' && p2 != p1) 2870 if (c == ']' && p2 != p1)
@@ -2881,7 +2881,7 @@ regex_compile (pattern, size, syntax, bufp)
2881 if (!escaped_char && 2881 if (!escaped_char &&
2882 syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') 2882 syntax & RE_CHAR_CLASSES && c == '[' && *p == ':')
2883 { 2883 {
2884 /* Leave room for the null. */ 2884 /* Leave room for the null. */
2885 unsigned char str[CHAR_CLASS_MAX_LENGTH + 1]; 2885 unsigned char str[CHAR_CLASS_MAX_LENGTH + 1];
2886 const unsigned char *class_beg; 2886 const unsigned char *class_beg;
2887 2887
@@ -2939,7 +2939,8 @@ regex_compile (pattern, size, syntax, bufp)
2939 for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) 2939 for (ch = 0; ch < 1 << BYTEWIDTH; ++ch)
2940 { 2940 {
2941 int translated = TRANSLATE (ch); 2941 int translated = TRANSLATE (ch);
2942 if (re_iswctype (btowc (ch), cc)) 2942 if (translated < (1 << BYTEWIDTH)
2943 && re_iswctype (btowc (ch), cc))
2943 SET_LIST_BIT (translated); 2944 SET_LIST_BIT (translated);
2944 } 2945 }
2945 2946
@@ -2962,7 +2963,7 @@ regex_compile (pattern, size, syntax, bufp)
2962 2963
2963 /* Because the `:' may starts the range, we 2964 /* Because the `:' may starts the range, we
2964 can't simply set bit and repeat the loop. 2965 can't simply set bit and repeat the loop.
2965 Instead, just set it to C and handle below. */ 2966 Instead, just set it to C and handle below. */
2966 c = ':'; 2967 c = ':';
2967 } 2968 }
2968 } 2969 }
@@ -3020,7 +3021,14 @@ regex_compile (pattern, size, syntax, bufp)
3020 { 3021 {
3021 for (this_char = range_start; this_char <= range_end; 3022 for (this_char = range_start; this_char <= range_end;
3022 this_char++) 3023 this_char++)
3023 SET_LIST_BIT (TRANSLATE (this_char)); 3024 {
3025 int translated = TRANSLATE (this_char);
3026 if (translated < (1 << BYTEWIDTH))
3027 SET_LIST_BIT (translated);
3028 else
3029 SET_RANGE_TABLE_WORK_AREA
3030 (range_table_work, translated, translated);
3031 }
3024 } 3032 }
3025 } 3033 }
3026 else 3034 else
@@ -3029,7 +3037,7 @@ regex_compile (pattern, size, syntax, bufp)
3029 } 3037 }
3030 3038
3031 /* Discard any (non)matching list bytes that are all 0 at the 3039 /* Discard any (non)matching list bytes that are all 0 at the
3032 end of the map. Decrease the map-length byte too. */ 3040 end of the map. Decrease the map-length byte too. */
3033 while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) 3041 while ((int) b[-1] > 0 && b[b[-1] - 1] == 0)
3034 b[-1]--; 3042 b[-1]--;
3035 b += b[-1]; 3043 b += b[-1];
@@ -3148,7 +3156,7 @@ regex_compile (pattern, size, syntax, bufp)
3148 } 3156 }
3149 3157
3150 /* These are the values to restore when we hit end of this 3158 /* These are the values to restore when we hit end of this
3151 group. They are all relative offsets, so that if the 3159 group. They are all relative offsets, so that if the
3152 whole pattern moves because of realloc, they will still 3160 whole pattern moves because of realloc, they will still
3153 be valid. */ 3161 be valid. */
3154 COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; 3162 COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer;
@@ -3204,7 +3212,7 @@ regex_compile (pattern, size, syntax, bufp)
3204 { 3212 {
3205 /* We don't just want to restore into `regnum', because 3213 /* We don't just want to restore into `regnum', because
3206 later groups should continue to be numbered higher, 3214 later groups should continue to be numbered higher,
3207 as in `(ab)c(de)' -- the second group is #2. */ 3215 as in `(ab)c(de)' -- the second group is #2. */
3208 regnum_t this_group_regnum; 3216 regnum_t this_group_regnum;
3209 3217
3210 compile_stack.avail--; 3218 compile_stack.avail--;
@@ -3221,7 +3229,7 @@ regex_compile (pattern, size, syntax, bufp)
3221 pending_exact = 0; 3229 pending_exact = 0;
3222 3230
3223 /* We're at the end of the group, so now we know how many 3231 /* We're at the end of the group, so now we know how many
3224 groups were inside this one. */ 3232 groups were inside this one. */
3225 if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0) 3233 if (this_group_regnum <= MAX_REGNUM && this_group_regnum > 0)
3226 BUF_PUSH_2 (stop_memory, this_group_regnum); 3234 BUF_PUSH_2 (stop_memory, this_group_regnum);
3227 } 3235 }
@@ -3236,7 +3244,7 @@ regex_compile (pattern, size, syntax, bufp)
3236 goto normal_char; 3244 goto normal_char;
3237 3245
3238 /* Insert before the previous alternative a jump which 3246 /* Insert before the previous alternative a jump which
3239 jumps to this alternative if the former fails. */ 3247 jumps to this alternative if the former fails. */
3240 GET_BUFFER_SPACE (3); 3248 GET_BUFFER_SPACE (3);
3241 INSERT_JUMP (on_failure_jump, begalt, b + 6); 3249 INSERT_JUMP (on_failure_jump, begalt, b + 6);
3242 pending_exact = 0; 3250 pending_exact = 0;
@@ -3373,7 +3381,7 @@ regex_compile (pattern, size, syntax, bufp)
3373 b += 5; 3381 b += 5;
3374 3382
3375 /* Code to initialize the lower bound. Insert 3383 /* Code to initialize the lower bound. Insert
3376 before the `succeed_n'. The `5' is the last two 3384 before the `succeed_n'. The `5' is the last two
3377 bytes of this `set_number_at', plus 3 bytes of 3385 bytes of this `set_number_at', plus 3 bytes of
3378 the following `succeed_n'. */ 3386 the following `succeed_n'. */
3379 insert_op2 (set_number_at, laststart, 5, lower_bound, b); 3387 insert_op2 (set_number_at, laststart, 5, lower_bound, b);
@@ -3443,7 +3451,7 @@ regex_compile (pattern, size, syntax, bufp)
3443 3451
3444#ifdef emacs 3452#ifdef emacs
3445 /* There is no way to specify the before_dot and after_dot 3453 /* There is no way to specify the before_dot and after_dot
3446 operators. rms says this is ok. --karl */ 3454 operators. rms says this is ok. --karl */
3447 case '=': 3455 case '=':
3448 BUF_PUSH (at_dot); 3456 BUF_PUSH (at_dot);
3449 break; 3457 break;
@@ -3588,7 +3596,7 @@ regex_compile (pattern, size, syntax, bufp)
3588 /* We have only one byte following the exactn for the count. */ 3596 /* We have only one byte following the exactn for the count. */
3589 || *pending_exact >= (1 << BYTEWIDTH) - MAX_MULTIBYTE_LENGTH 3597 || *pending_exact >= (1 << BYTEWIDTH) - MAX_MULTIBYTE_LENGTH
3590 3598
3591 /* If followed by a repetition operator. */ 3599 /* If followed by a repetition operator. */
3592 || (p != pend && (*p == '*' || *p == '^')) 3600 || (p != pend && (*p == '*' || *p == '^'))
3593 || ((syntax & RE_BK_PLUS_QM) 3601 || ((syntax & RE_BK_PLUS_QM)
3594 ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?') 3602 ? p + 1 < pend && *p == '\\' && (p[1] == '+' || p[1] == '?')
@@ -3680,7 +3688,7 @@ regex_compile (pattern, size, syntax, bufp)
3680 3688
3681/* Subroutines for `regex_compile'. */ 3689/* Subroutines for `regex_compile'. */
3682 3690
3683/* Store OP at LOC followed by two-byte integer parameter ARG. */ 3691/* Store OP at LOC followed by two-byte integer parameter ARG. */
3684 3692
3685static void 3693static void
3686store_op1 (op, loc, arg) 3694store_op1 (op, loc, arg)
@@ -3832,7 +3840,7 @@ analyse_first (p, pend, fastmap, multibyte)
3832 boolean not; 3840 boolean not;
3833 3841
3834 /* If all elements for base leading-codes in fastmap is set, this 3842 /* If all elements for base leading-codes in fastmap is set, this
3835 flag is set true. */ 3843 flag is set true. */
3836 boolean match_any_multibyte_characters = false; 3844 boolean match_any_multibyte_characters = false;
3837 3845
3838 assert (p); 3846 assert (p);
@@ -3880,7 +3888,7 @@ analyse_first (p, pend, fastmap, multibyte)
3880 3888
3881 3889
3882 /* Following are the cases which match a character. These end 3890 /* Following are the cases which match a character. These end
3883 with `break'. */ 3891 with `break'. */
3884 3892
3885 case exactn: 3893 case exactn:
3886 if (fastmap) 3894 if (fastmap)
@@ -4102,7 +4110,7 @@ analyse_first (p, pend, fastmap, multibyte)
4102 4110
4103 /* Getting here means we have found the possible starting 4111 /* Getting here means we have found the possible starting
4104 characters for one path of the pattern -- and that the empty 4112 characters for one path of the pattern -- and that the empty
4105 string does not match. We need not follow this path further. */ 4113 string does not match. We need not follow this path further. */
4106 return 0; 4114 return 0;
4107 } /* while p */ 4115 } /* while p */
4108 4116
@@ -4137,7 +4145,7 @@ re_compile_fastmap (bufp)
4137 4145
4138 assert (fastmap && bufp->buffer); 4146 assert (fastmap && bufp->buffer);
4139 4147
4140 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ 4148 bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */
4141 bufp->fastmap_accurate = 1; /* It will be when we're done. */ 4149 bufp->fastmap_accurate = 1; /* It will be when we're done. */
4142 4150
4143 analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used, 4151 analysis = analyse_first (bufp->buffer, bufp->buffer + bufp->used,
@@ -4182,7 +4190,7 @@ re_set_registers (bufp, regs, num_regs, starts, ends)
4182} 4190}
4183WEAK_ALIAS (__re_set_registers, re_set_registers) 4191WEAK_ALIAS (__re_set_registers, re_set_registers)
4184 4192
4185/* Searching routines. */ 4193/* Searching routines. */
4186 4194
4187/* Like re_search_2, below, but only one string is specified, and 4195/* Like re_search_2, below, but only one string is specified, and
4188 doesn't let you say where to stop matching. */ 4196 doesn't let you say where to stop matching. */
@@ -4251,7 +4259,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
4251 int endpos = startpos + range; 4259 int endpos = startpos + range;
4252 boolean anchored_start; 4260 boolean anchored_start;
4253 4261
4254 /* Nonzero if we have to concern multibyte character. */ 4262 /* Nonzero if we have to concern multibyte character. */
4255 const boolean multibyte = RE_MULTIBYTE_P (bufp); 4263 const boolean multibyte = RE_MULTIBYTE_P (bufp);
4256 4264
4257 /* Check for out-of-range STARTPOS. */ 4265 /* Check for out-of-range STARTPOS. */
@@ -4321,7 +4329,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
4321 /* If a fastmap is supplied, skip quickly over characters that 4329 /* If a fastmap is supplied, skip quickly over characters that
4322 cannot be the start of a match. If the pattern can match the 4330 cannot be the start of a match. If the pattern can match the
4323 null string, however, we don't need to skip characters; we want 4331 null string, however, we don't need to skip characters; we want
4324 the first null string. */ 4332 the first null string. */
4325 if (fastmap && startpos < total_size && !bufp->can_be_null) 4333 if (fastmap && startpos < total_size && !bufp->can_be_null)
4326 { 4334 {
4327 register re_char *d; 4335 register re_char *d;
@@ -4329,7 +4337,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
4329 4337
4330 d = POS_ADDR_VSTRING (startpos); 4338 d = POS_ADDR_VSTRING (startpos);
4331 4339
4332 if (range > 0) /* Searching forwards. */ 4340 if (range > 0) /* Searching forwards. */
4333 { 4341 {
4334 register int lim = 0; 4342 register int lim = 0;
4335 int irange = range; 4343 int irange = range;
@@ -4403,7 +4411,7 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop)
4403 4411
4404 startpos += irange - range; 4412 startpos += irange - range;
4405 } 4413 }
4406 else /* Searching backwards. */ 4414 else /* Searching backwards. */
4407 { 4415 {
4408 int room = (startpos >= size1 4416 int room = (startpos >= size1
4409 ? size2 + size1 - startpos 4417 ? size2 + size1 - startpos
@@ -4526,7 +4534,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
4526 } \ 4534 } \
4527 4535
4528/* Test if at very beginning or at very end of the virtual concatenation 4536/* Test if at very beginning or at very end of the virtual concatenation
4529 of `string1' and `string2'. If only one string, it's `string2'. */ 4537 of `string1' and `string2'. If only one string, it's `string2'. */
4530#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) 4538#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2)
4531#define AT_STRINGS_END(d) ((d) == end2) 4539#define AT_STRINGS_END(d) ((d) == end2)
4532 4540
@@ -4547,7 +4555,7 @@ static int bcmp_translate _RE_ARGS((re_char *s1, re_char *s2,
4547 4555
4548 The DEC Alpha C compiler 3.x generates incorrect code for the 4556 The DEC Alpha C compiler 3.x generates incorrect code for the
4549 test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of 4557 test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of
4550 AT_WORD_BOUNDARY, so this code is disabled. Expanding the 4558 AT_WORD_BOUNDARY, so this code is disabled. Expanding the
4551 macro and introducing temporary variables works around the bug. */ 4559 macro and introducing temporary variables works around the bug. */
4552 4560
4553#if 0 4561#if 0
@@ -4749,7 +4757,7 @@ mutually_exclusive_p (bufp, p1, p2)
4749 { 4757 {
4750 /* Now, we are sure that P2 has no range table. 4758 /* Now, we are sure that P2 has no range table.
4751 So, for the size of bitmap in P2, `p2[1]' is 4759 So, for the size of bitmap in P2, `p2[1]' is
4752 enough. But P1 may have range table, so the 4760 enough. But P1 may have range table, so the
4753 size of bitmap table of P1 is extracted by 4761 size of bitmap table of P1 is extracted by
4754 using macro `CHARSET_BITMAP_SIZE'. 4762 using macro `CHARSET_BITMAP_SIZE'.
4755 4763
@@ -4780,7 +4788,7 @@ mutually_exclusive_p (bufp, p1, p2)
4780 { 4788 {
4781 int idx; 4789 int idx;
4782 /* We win if the charset_not inside the loop lists 4790 /* We win if the charset_not inside the loop lists
4783 every character listed in the charset after. */ 4791 every character listed in the charset after. */
4784 for (idx = 0; idx < (int) p2[1]; idx++) 4792 for (idx = 0; idx < (int) p2[1]; idx++)
4785 if (! (p2[2 + idx] == 0 4793 if (! (p2[2 + idx] == 0
4786 || (idx < CHARSET_BITMAP_SIZE (p1) 4794 || (idx < CHARSET_BITMAP_SIZE (p1)
@@ -4874,7 +4882,7 @@ WEAK_ALIAS (__re_match, re_match)
4874 4882
4875#ifdef emacs 4883#ifdef emacs
4876/* In Emacs, this is the string or buffer in which we 4884/* In Emacs, this is the string or buffer in which we
4877 are matching. It is used for looking up syntax properties. */ 4885 are matching. It is used for looking up syntax properties. */
4878Lisp_Object re_match_object; 4886Lisp_Object re_match_object;
4879#endif 4887#endif
4880 4888
@@ -4884,11 +4892,11 @@ Lisp_Object re_match_object;
4884 matching at STOP. 4892 matching at STOP.
4885 4893
4886 If REGS is non-null and the `no_sub' field of BUFP is nonzero, we 4894 If REGS is non-null and the `no_sub' field of BUFP is nonzero, we
4887 store offsets for the substring each group matched in REGS. See the 4895 store offsets for the substring each group matched in REGS. See the
4888 documentation for exactly how many groups we fill. 4896 documentation for exactly how many groups we fill.
4889 4897
4890 We return -1 if no match, -2 if an internal error (such as the 4898 We return -1 if no match, -2 if an internal error (such as the
4891 failure stack overflowing). Otherwise, we return the length of the 4899 failure stack overflowing). Otherwise, we return the length of the
4892 matched substring. */ 4900 matched substring. */
4893 4901
4894int 4902int
@@ -4920,7 +4928,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
4920WEAK_ALIAS (__re_match_2, re_match_2) 4928WEAK_ALIAS (__re_match_2, re_match_2)
4921 4929
4922/* This is a separate function so that we can force an alloca cleanup 4930/* This is a separate function so that we can force an alloca cleanup
4923 afterwards. */ 4931 afterwards. */
4924static int 4932static int
4925re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) 4933re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
4926 struct re_pattern_buffer *bufp; 4934 struct re_pattern_buffer *bufp;
@@ -4939,7 +4947,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
4939 re_char *end1, *end2; 4947 re_char *end1, *end2;
4940 4948
4941 /* Pointers into string1 and string2, just past the last characters in 4949 /* Pointers into string1 and string2, just past the last characters in
4942 each to consider matching. */ 4950 each to consider matching. */
4943 re_char *end_match_1, *end_match_2; 4951 re_char *end_match_1, *end_match_2;
4944 4952
4945 /* Where we are in the data, and the end of the current string. */ 4953 /* Where we are in the data, and the end of the current string. */
@@ -4955,10 +4963,10 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
4955 re_char *p = bufp->buffer; 4963 re_char *p = bufp->buffer;
4956 re_char *pend = p + bufp->used; 4964 re_char *pend = p + bufp->used;
4957 4965
4958 /* We use this to map every character in the string. */ 4966 /* We use this to map every character in the string. */
4959 RE_TRANSLATE_TYPE translate = bufp->translate; 4967 RE_TRANSLATE_TYPE translate = bufp->translate;
4960 4968
4961 /* Nonzero if we have to concern multibyte character. */ 4969 /* Nonzero if we have to concern multibyte character. */
4962 const boolean multibyte = RE_MULTIBYTE_P (bufp); 4970 const boolean multibyte = RE_MULTIBYTE_P (bufp);
4963 4971
4964 /* Failure point stack. Each place that can handle a failure further 4972 /* Failure point stack. Each place that can handle a failure further
@@ -4967,8 +4975,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
4967 the subexpressions we're currently inside, plus the number of such 4975 the subexpressions we're currently inside, plus the number of such
4968 registers, and, finally, two char *'s. The first char * is where 4976 registers, and, finally, two char *'s. The first char * is where
4969 to resume scanning the pattern; the second one is where to resume 4977 to resume scanning the pattern; the second one is where to resume
4970 scanning the strings. */ 4978 scanning the strings. */
4971#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ 4979#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */
4972 fail_stack_type fail_stack; 4980 fail_stack_type fail_stack;
4973#endif 4981#endif
4974#ifdef DEBUG 4982#ifdef DEBUG
@@ -4982,7 +4990,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
4982#endif 4990#endif
4983 4991
4984 /* We fill all the registers internally, independent of what we 4992 /* We fill all the registers internally, independent of what we
4985 return, for use in backreferences. The number here includes 4993 return, for use in backreferences. The number here includes
4986 an element for register zero. */ 4994 an element for register zero. */
4987 size_t num_regs = bufp->re_nsub + 1; 4995 size_t num_regs = bufp->re_nsub + 1;
4988 4996
@@ -5008,7 +5016,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5008 5016
5009 /* Logically, this is `best_regend[0]'. But we don't want to have to 5017 /* Logically, this is `best_regend[0]'. But we don't want to have to
5010 allocate space for that if we're not allocating space for anything 5018 allocate space for that if we're not allocating space for anything
5011 else (see below). Also, we never need info about register 0 for 5019 else (see below). Also, we never need info about register 0 for
5012 any of the other register vectors, and it seems rather a kludge to 5020 any of the other register vectors, and it seems rather a kludge to
5013 treat `best_regend' differently than the rest. So we keep track of 5021 treat `best_regend' differently than the rest. So we keep track of
5014 the end of the best match so far in a separate variable. We 5022 the end of the best match so far in a separate variable. We
@@ -5066,7 +5074,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5066 regstart[reg] = regend[reg] = NULL; 5074 regstart[reg] = regend[reg] = NULL;
5067 5075
5068 /* We move `string1' into `string2' if the latter's empty -- but not if 5076 /* We move `string1' into `string2' if the latter's empty -- but not if
5069 `string1' is null. */ 5077 `string1' is null. */
5070 if (size2 == 0 && string1 != NULL) 5078 if (size2 == 0 && string1 != NULL)
5071 { 5079 {
5072 string2 = string1; 5080 string2 = string1;
@@ -5123,7 +5131,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5123 DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); 5131 DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
5124 DEBUG_PRINT1 ("'\n"); 5132 DEBUG_PRINT1 ("'\n");
5125 5133
5126 /* This loops over pattern commands. It exits by returning from the 5134 /* This loops over pattern commands. It exits by returning from the
5127 function if the match is complete, or it drops through if the match 5135 function if the match is complete, or it drops through if the match
5128 fails at this starting point in the input data. */ 5136 fails at this starting point in the input data. */
5129 for (;;) 5137 for (;;)
@@ -5146,7 +5154,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5146 boolean best_match_p; 5154 boolean best_match_p;
5147 5155
5148 /* AIX compiler got confused when this was combined 5156 /* AIX compiler got confused when this was combined
5149 with the previous declaration. */ 5157 with the previous declaration. */
5150 if (same_str_p) 5158 if (same_str_p)
5151 best_match_p = d > match_end; 5159 best_match_p = d > match_end;
5152 else 5160 else
@@ -5184,7 +5192,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5184 end_match_1' while the restored d is in string2. 5192 end_match_1' while the restored d is in string2.
5185 For example, the pattern `x.*y.*z' against the 5193 For example, the pattern `x.*y.*z' against the
5186 strings `x-' and `y-z-', if the two strings are 5194 strings `x-' and `y-z-', if the two strings are
5187 not consecutive in memory. */ 5195 not consecutive in memory. */
5188 DEBUG_PRINT1 ("Restoring best registers.\n"); 5196 DEBUG_PRINT1 ("Restoring best registers.\n");
5189 5197
5190 d = match_end; 5198 d = match_end;
@@ -5207,7 +5215,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5207 { 5215 {
5208 /* Have the register data arrays been allocated? */ 5216 /* Have the register data arrays been allocated? */
5209 if (bufp->regs_allocated == REGS_UNALLOCATED) 5217 if (bufp->regs_allocated == REGS_UNALLOCATED)
5210 { /* No. So allocate them with malloc. We need one 5218 { /* No. So allocate them with malloc. We need one
5211 extra element beyond `num_regs' for the `-1' marker 5219 extra element beyond `num_regs' for the `-1' marker
5212 GNU code uses. */ 5220 GNU code uses. */
5213 regs->num_regs = MAX (RE_NREGS, num_regs + 1); 5221 regs->num_regs = MAX (RE_NREGS, num_regs + 1);
@@ -5239,7 +5247,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5239 else 5247 else
5240 { 5248 {
5241 /* These braces fend off a "empty body in an else-statement" 5249 /* These braces fend off a "empty body in an else-statement"
5242 warning under GCC when assert expands to nothing. */ 5250 warning under GCC when assert expands to nothing. */
5243 assert (bufp->regs_allocated == REGS_FIXED); 5251 assert (bufp->regs_allocated == REGS_FIXED);
5244 } 5252 }
5245 5253
@@ -5271,7 +5279,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5271 were in the pattern, set the extra elements to -1. If 5279 were in the pattern, set the extra elements to -1. If
5272 we (re)allocated the registers, this is the case, 5280 we (re)allocated the registers, this is the case,
5273 because we always allocate enough to have at least one 5281 because we always allocate enough to have at least one
5274 -1 at the end. */ 5282 -1 at the end. */
5275 for (reg = num_regs; reg < regs->num_regs; reg++) 5283 for (reg = num_regs; reg < regs->num_regs; reg++)
5276 regs->start[reg] = regs->end[reg] = -1; 5284 regs->start[reg] = regs->end[reg] = -1;
5277 } /* regs && !bufp->no_sub */ 5285 } /* regs && !bufp->no_sub */
@@ -5289,7 +5297,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5289 return mcnt; 5297 return mcnt;
5290 } 5298 }
5291 5299
5292 /* Otherwise match next pattern command. */ 5300 /* Otherwise match next pattern command. */
5293 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) 5301 switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++))
5294 { 5302 {
5295 /* Ignore these. Used to ignore the n of succeed_n's which 5303 /* Ignore these. Used to ignore the n of succeed_n's which
@@ -5302,9 +5310,9 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5302 DEBUG_PRINT1 ("EXECUTING succeed.\n"); 5310 DEBUG_PRINT1 ("EXECUTING succeed.\n");
5303 goto succeed_label; 5311 goto succeed_label;
5304 5312
5305 /* Match the next n pattern characters exactly. The following 5313 /* Match the next n pattern characters exactly. The following
5306 byte in the pattern defines n, and the n bytes after that 5314 byte in the pattern defines n, and the n bytes after that
5307 are the characters to match. */ 5315 are the characters to match. */
5308 case exactn: 5316 case exactn:
5309 mcnt = *p++; 5317 mcnt = *p++;
5310 DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); 5318 DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt);
@@ -5468,7 +5476,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5468 /* The beginning of a group is represented by start_memory. 5476 /* The beginning of a group is represented by start_memory.
5469 The argument is the register number. The text 5477 The argument is the register number. The text
5470 matched within the group is recorded (in the internal 5478 matched within the group is recorded (in the internal
5471 registers data structure) under the register number. */ 5479 registers data structure) under the register number. */
5472 case start_memory: 5480 case start_memory:
5473 DEBUG_PRINT2 ("EXECUTING start_memory %d:\n", *p); 5481 DEBUG_PRINT2 ("EXECUTING start_memory %d:\n", *p);
5474 5482
@@ -5517,14 +5525,14 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5517 case duplicate: 5525 case duplicate:
5518 { 5526 {
5519 register re_char *d2, *dend2; 5527 register re_char *d2, *dend2;
5520 int regno = *p++; /* Get which register to match against. */ 5528 int regno = *p++; /* Get which register to match against. */
5521 DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); 5529 DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno);
5522 5530
5523 /* Can't back reference a group which we've never matched. */ 5531 /* Can't back reference a group which we've never matched. */
5524 if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) 5532 if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno]))
5525 goto fail; 5533 goto fail;
5526 5534
5527 /* Where in input to try to start matching. */ 5535 /* Where in input to try to start matching. */
5528 d2 = regstart[regno]; 5536 d2 = regstart[regno];
5529 5537
5530 /* Remember the start point to rollback upon failure. */ 5538 /* Remember the start point to rollback upon failure. */
@@ -5637,7 +5645,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5637 pushes NULL as the value for the string on the stack. Then 5645 pushes NULL as the value for the string on the stack. Then
5638 `POP_FAILURE_POINT' will keep the current value for the 5646 `POP_FAILURE_POINT' will keep the current value for the
5639 string, instead of restoring it. To see why, consider 5647 string, instead of restoring it. To see why, consider
5640 matching `foo\nbar' against `.*\n'. The .* matches the foo; 5648 matching `foo\nbar' against `.*\n'. The .* matches the foo;
5641 then the . fails against the \n. But the next thing we want 5649 then the . fails against the \n. But the next thing we want
5642 to do is match the \n against the \n; if we restored the 5650 to do is match the \n against the \n; if we restored the
5643 string value, we would be back at the foo. 5651 string value, we would be back at the foo.
@@ -5782,7 +5790,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5782 IMMEDIATE_QUIT_CHECK; 5790 IMMEDIATE_QUIT_CHECK;
5783 EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ 5791 EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
5784 DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); 5792 DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
5785 p += mcnt; /* Do the jump. */ 5793 p += mcnt; /* Do the jump. */
5786 DEBUG_PRINT2 ("(to %p).\n", p); 5794 DEBUG_PRINT2 ("(to %p).\n", p);
5787 break; 5795 break;
5788 5796
@@ -5875,7 +5883,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5875 if (/* Case 2: Only one of S1 and S2 is Sword. */ 5883 if (/* Case 2: Only one of S1 and S2 is Sword. */
5876 ((s1 == Sword) != (s2 == Sword)) 5884 ((s1 == Sword) != (s2 == Sword))
5877 /* Case 3: Both of S1 and S2 are Sword, and macro 5885 /* Case 3: Both of S1 and S2 are Sword, and macro
5878 WORD_BOUNDARY_P (C1, C2) returns nonzero. */ 5886 WORD_BOUNDARY_P (C1, C2) returns nonzero. */
5879 || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2))) 5887 || ((s1 == Sword) && WORD_BOUNDARY_P (c1, c2)))
5880 not = !not; 5888 not = !not;
5881 } 5889 }
@@ -5889,7 +5897,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5889 5897
5890 /* We FAIL in one of the following cases: */ 5898 /* We FAIL in one of the following cases: */
5891 5899
5892 /* Case 1: D is at the end of string. */ 5900 /* Case 1: D is at the end of string. */
5893 if (AT_STRINGS_END (d)) 5901 if (AT_STRINGS_END (d))
5894 goto fail; 5902 goto fail;
5895 else 5903 else
@@ -5921,7 +5929,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5921 s1 = SYNTAX (c1); 5929 s1 = SYNTAX (c1);
5922 5930
5923 /* ... and S1 is Sword, and WORD_BOUNDARY_P (C1, C2) 5931 /* ... and S1 is Sword, and WORD_BOUNDARY_P (C1, C2)
5924 returns 0. */ 5932 returns 0. */
5925 if ((s1 == Sword) && !WORD_BOUNDARY_P (c1, c2)) 5933 if ((s1 == Sword) && !WORD_BOUNDARY_P (c1, c2))
5926 goto fail; 5934 goto fail;
5927 } 5935 }
@@ -5965,7 +5973,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5965 s2 = SYNTAX (c2); 5973 s2 = SYNTAX (c2);
5966 5974
5967 /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2) 5975 /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2)
5968 returns 0. */ 5976 returns 0. */
5969 if ((s2 == Sword) && !WORD_BOUNDARY_P (c1, c2)) 5977 if ((s2 == Sword) && !WORD_BOUNDARY_P (c1, c2))
5970 goto fail; 5978 goto fail;
5971 } 5979 }
@@ -5977,7 +5985,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5977 5985
5978 /* We FAIL in one of the following cases: */ 5986 /* We FAIL in one of the following cases: */
5979 5987
5980 /* Case 1: D is at the end of string. */ 5988 /* Case 1: D is at the end of string. */
5981 if (AT_STRINGS_END (d)) 5989 if (AT_STRINGS_END (d))
5982 goto fail; 5990 goto fail;
5983 else 5991 else
@@ -5994,7 +6002,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
5994 PREFETCH (); 6002 PREFETCH ();
5995 c2 = RE_STRING_CHAR (d, dend - d); 6003 c2 = RE_STRING_CHAR (d, dend - d);
5996 s2 = SYNTAX (c2); 6004 s2 = SYNTAX (c2);
5997 6005
5998 /* Case 2: S2 is neither Sword nor Ssymbol. */ 6006 /* Case 2: S2 is neither Sword nor Ssymbol. */
5999 if (s2 != Sword && s2 != Ssymbol) 6007 if (s2 != Sword && s2 != Ssymbol)
6000 goto fail; 6008 goto fail;
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 02225a9226f..c23987d2d9b 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -20,5 +20,19 @@
20*/ 20*/
21#define BROKEN_GET_CURRENT_DIR_NAME 1 21#define BROKEN_GET_CURRENT_DIR_NAME 1
22 22
23/* aix3-1.h defined _NO_PROTO, probably to work around an AIX compiler
24 that did not handle prototypes. On (at least) AIX 5.2, this causes
25 the proper prototype to be thrown away for lseek64, so compiled
26 Lisp files do not load correctly and compilation fails.
27
28 The AIX compiler should have learned about function prototypes long
29 ago, so we can probably go ahead and undefine _NO_PROTO. However,
30 if someone can demonstrate that this problem still exists for AIX
31 4, this should be moved into a new file (aix5.h).
32*/
33
34#undef _NO_PROTO
35
36
23/* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562 37/* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562
24 (do not change this comment) */ 38 (do not change this comment) */
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 55d9a725293..7116d24c718 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -377,7 +377,7 @@ Boston, MA 02110-1301, USA. */
377 extern void *__libc_ia64_register_backing_store_base; \ 377 extern void *__libc_ia64_register_backing_store_base; \
378 __builtin_ia64_flushrs (); \ 378 __builtin_ia64_flushrs (); \
379 mark_memory (__libc_ia64_register_backing_store_base, \ 379 mark_memory (__libc_ia64_register_backing_store_base, \
380 __builtin_ia64_bsp ()); \ 380 __builtin_ia64_bsp (), 0); \
381 } while (0) 381 } while (0)
382#endif 382#endif
383#endif 383#endif
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index fa4ca565171..461df7acfba 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -279,7 +279,7 @@ Boston, MA 02110-1301, USA. */
279#define HAVE_STRFTIME 1 279#define HAVE_STRFTIME 1
280 280
281#define LOCALTIME_CACHE 281#define LOCALTIME_CACHE
282#undef HAVE_INET_SOCKETS 282#define HAVE_INET_SOCKETS 1
283 283
284#undef HAVE_AIX_SMT_EXP 284#undef HAVE_AIX_SMT_EXP
285 285
diff --git a/src/s/netbsd.h b/src/s/netbsd.h
index 206ff55c854..c4bfddfbe5b 100644
--- a/src/s/netbsd.h
+++ b/src/s/netbsd.h
@@ -138,5 +138,10 @@
138 138
139#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS 139#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
140 140
141/* Use sigprocmask and friends instead of sigblock;
142 sigblock is considered obsolete on NetBSD. */
143
144#define POSIX_SIGNALS 1
145
141/* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81 146/* arch-tag: e80f364a-04e9-4faf-93cb-f36a0fe95c81
142 (do not change this comment) */ 147 (do not change this comment) */
diff --git a/src/s/openbsd.h b/src/s/openbsd.h
index 39e48da39a7..3b996de7059 100644
--- a/src/s/openbsd.h
+++ b/src/s/openbsd.h
@@ -21,13 +21,18 @@
21#undef LD_SWITCH_SYSTEM 21#undef LD_SWITCH_SYSTEM
22#ifdef __ELF__ 22#ifdef __ELF__
23 23
24/* Han Boetes <han@mijncomputer.nl> says this 24 /* Han Boetes <han@mijncomputer.nl> says this
25 is necessary, otherwise Emacs dumps core on elf systems. */ 25 is necessary, otherwise Emacs dumps core on elf systems. */
26#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z 26#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp -Z
27 27
28#else 28/* The version of gcc on OpenBSD doesn't search /usr/local/lib by
29 default. */
30#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
29 31
32#else
33
30#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp 34#define LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_tmp
35#define LD_SWITCH_X_DEFAULT -L/usr/local/lib
31 36
32#endif 37#endif
33 38
diff --git a/src/search.c b/src/search.c
index 7c3151b76b8..d6572c5397a 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1514,7 +1514,7 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
1514 int this_len_byte = len_byte; 1514 int this_len_byte = len_byte;
1515 unsigned char *p = pat; 1515 unsigned char *p = pat;
1516 1516
1517 if (pos - len < lim) 1517 if (this_pos < lim || this_pos_byte < lim_byte)
1518 goto stop; 1518 goto stop;
1519 1519
1520 while (this_len > 0) 1520 while (this_len > 0)
diff --git a/src/sound.c b/src/sound.c
index 6f955a7d691..6f8e3ecb308 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1015,14 +1015,14 @@ alsa_configure (sd)
1015 1015
1016 val = sd->format; 1016 val = sd->format;
1017 err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val); 1017 err = snd_pcm_hw_params_set_format (p->handle, p->hwparams, val);
1018 if (err < 0) 1018 if (err < 0)
1019 alsa_sound_perror ("Could not set sound format", err); 1019 alsa_sound_perror ("Could not set sound format", err);
1020 1020
1021 uval = sd->sample_rate; 1021 uval = sd->sample_rate;
1022 err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &uval, 0); 1022 err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &uval, 0);
1023 if (err < 0) 1023 if (err < 0)
1024 alsa_sound_perror ("Could not set sample rate", err); 1024 alsa_sound_perror ("Could not set sample rate", err);
1025 1025
1026 val = sd->channels; 1026 val = sd->channels;
1027 err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val); 1027 err = snd_pcm_hw_params_set_channels (p->handle, p->hwparams, val);
1028 if (err < 0) 1028 if (err < 0)
@@ -1072,11 +1072,11 @@ alsa_configure (sd)
1072 p->hwparams = NULL; 1072 p->hwparams = NULL;
1073 snd_pcm_sw_params_free (p->swparams); 1073 snd_pcm_sw_params_free (p->swparams);
1074 p->swparams = NULL; 1074 p->swparams = NULL;
1075 1075
1076 err = snd_pcm_prepare (p->handle); 1076 err = snd_pcm_prepare (p->handle);
1077 if (err < 0) 1077 if (err < 0)
1078 alsa_sound_perror ("Could not prepare audio interface for use", err); 1078 alsa_sound_perror ("Could not prepare audio interface for use", err);
1079 1079
1080 if (sd->volume > 0) 1080 if (sd->volume > 0)
1081 { 1081 {
1082 int chn; 1082 int chn;
@@ -1098,7 +1098,7 @@ alsa_configure (sd)
1098 long pmin, pmax; 1098 long pmin, pmax;
1099 snd_mixer_selem_get_playback_volume_range (e, &pmin, &pmax); 1099 snd_mixer_selem_get_playback_volume_range (e, &pmin, &pmax);
1100 long vol = pmin + (sd->volume * (pmax - pmin)) / 100; 1100 long vol = pmin + (sd->volume * (pmax - pmin)) / 100;
1101 1101
1102 for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++) 1102 for (chn = 0; chn <= SND_MIXER_SCHN_LAST; chn++)
1103 snd_mixer_selem_set_playback_volume (e, chn, vol); 1103 snd_mixer_selem_set_playback_volume (e, chn, vol);
1104 } 1104 }
@@ -1230,9 +1230,9 @@ alsa_write (sd, buffer, nbytes)
1230 err); 1230 err);
1231 } 1231 }
1232 } 1232 }
1233 else 1233 else
1234 alsa_sound_perror ("Error writing to sound device", err); 1234 alsa_sound_perror ("Error writing to sound device", err);
1235 1235
1236 } 1236 }
1237 else 1237 else
1238 nwritten += err * fact; 1238 nwritten += err * fact;
@@ -1374,7 +1374,7 @@ do_play_sound (psz_file, ui_volume)
1374DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1, 0, 1374DEFUN ("play-sound-internal", Fplay_sound_internal, Splay_sound_internal, 1, 1, 0,
1375 doc: /* Play sound SOUND. 1375 doc: /* Play sound SOUND.
1376 1376
1377Internal use only, use `play-sound' instead.\n */) 1377Internal use only, use `play-sound' instead. */)
1378 (sound) 1378 (sound)
1379 Lisp_Object sound; 1379 Lisp_Object sound;
1380{ 1380{
diff --git a/src/strftime.c b/src/strftime.c
index 123763d8845..88800c0d408 100644
--- a/src/strftime.c
+++ b/src/strftime.c
@@ -69,9 +69,9 @@ extern char *tzname[];
69#if DO_MULTIBYTE 69#if DO_MULTIBYTE
70# if HAVE_MBRLEN 70# if HAVE_MBRLEN
71# include <wchar.h> 71# include <wchar.h>
72# ifdef HAVE_SYS__MBSTATE_H /* previously tested __hpux */ 72# ifdef HAVE_SYS__MBSTATE_T_H /* previously tested __hpux */
73# include <sys/_mbstate_t.h> 73# include <sys/_mbstate_t.h>
74# endif 74# endif
75# if !defined (mbsinit) && !defined (HAVE_MBSINIT) 75# if !defined (mbsinit) && !defined (HAVE_MBSINIT)
76# define mbsinit(ps) 1 76# define mbsinit(ps) 1
77# endif /* !defined (mbsinit) && !defined (HAVE_MBSINIT) */ 77# endif /* !defined (mbsinit) && !defined (HAVE_MBSINIT) */
diff --git a/src/syntax.c b/src/syntax.c
index 052191d5fef..55f73d6d106 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1470,7 +1470,7 @@ skip_chars (forwardp, syntaxp, string, lim, handle_iso_classes)
1470 const unsigned char *class_beg = str + i_byte + 1; 1470 const unsigned char *class_beg = str + i_byte + 1;
1471 const unsigned char *class_end = class_beg; 1471 const unsigned char *class_end = class_beg;
1472 const unsigned char *class_limit = str + size_byte - 2; 1472 const unsigned char *class_limit = str + size_byte - 2;
1473 /* Leave room for the null. */ 1473 /* Leave room for the null. */
1474 unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1]; 1474 unsigned char class_name[CHAR_CLASS_MAX_LENGTH + 1];
1475 re_wctype_t cc; 1475 re_wctype_t cc;
1476 1476
diff --git a/src/sysdep.c b/src/sysdep.c
index 07f5f2e8a30..1068c7a1773 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3863,7 +3863,7 @@ set_file_times (filename, atime, mtime)
3863 * sdcsvax!rmr or rmr@uscd 3863 * sdcsvax!rmr or rmr@uscd
3864 * 3864 *
3865 * Severely hacked over by John Gilmore to make a 4.2BSD compatible 3865 * Severely hacked over by John Gilmore to make a 4.2BSD compatible
3866 * subroutine. 11Mar86; hoptoad!gnu 3866 * subroutine. 11Mar86; hoptoad!gnu
3867 * 3867 *
3868 * Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir, 3868 * Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir,
3869 * subroutine didn't return EEXIST. It does now. 3869 * subroutine didn't return EEXIST. It does now.
diff --git a/src/term.c b/src/term.c
index 924bebf5f7e..00c72ea8bee 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2300,6 +2300,7 @@ clear_tty_hooks (struct terminal *terminal)
2300 terminal->mouse_position_hook = 0; 2300 terminal->mouse_position_hook = 0;
2301 terminal->frame_rehighlight_hook = 0; 2301 terminal->frame_rehighlight_hook = 0;
2302 terminal->frame_raise_lower_hook = 0; 2302 terminal->frame_raise_lower_hook = 0;
2303 terminal->fullscreen_hook = 0;
2303 terminal->set_vertical_scroll_bar_hook = 0; 2304 terminal->set_vertical_scroll_bar_hook = 0;
2304 terminal->condemn_scroll_bars_hook = 0; 2305 terminal->condemn_scroll_bars_hook = 0;
2305 terminal->redeem_scroll_bar_hook = 0; 2306 terminal->redeem_scroll_bar_hook = 0;
diff --git a/src/termhooks.h b/src/termhooks.h
index 64a72acc360..98c4edb4f24 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -43,6 +43,11 @@ enum scroll_bar_part {
43 scroll_bar_move_ratio 43 scroll_bar_move_ratio
44}; 44};
45 45
46/* If the value of the frame parameter changed, whis hook is called.
47 For example, if going from fullscreen to not fullscreen this hook
48 may do something OS dependent, like extended window manager hints on X11. */
49extern void (*fullscreen_hook) P_ ((struct frame *f));
50
46 51
47/* Input queue declarations and hooks. */ 52/* Input queue declarations and hooks. */
48 53
@@ -443,6 +448,11 @@ struct terminal
443 windows. */ 448 windows. */
444 void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise)); 449 void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise));
445 450
451 /* If the value of the frame parameter changed, whis hook is called.
452 For example, if going from fullscreen to not fullscreen this hook
453 may do something OS dependent, like extended window manager hints on X11. */
454 void (*fullscreen_hook) P_ ((struct frame *f));
455
446 456
447 /* Scroll bar hooks. */ 457 /* Scroll bar hooks. */
448 458
diff --git a/src/unexcw.c b/src/unexcw.c
index aee4f58896c..92e313c05d6 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -262,7 +262,7 @@ unexec (char *outfile, char *infile, unsigned start_data, unsigned d1,
262 if (bss_sbrk_did_unexec) 262 if (bss_sbrk_did_unexec)
263 { 263 {
264 /* can only dump once */ 264 /* can only dump once */
265 printf ("You can only dump emacs once on this platform.\n"); 265 printf ("You can only dump Emacs once on this platform.\n");
266 return (1); 266 return (1);
267 } 267 }
268 268
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index f65fd9cbc22..e95aa2f2efc 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -69,10 +69,10 @@ Boston, MA 02110-1301, USA. */
69 fact, the earliest one starts a few hundred bytes beyond the end of 69 fact, the earliest one starts a few hundred bytes beyond the end of
70 the last load command. The linker option -headerpad controls the 70 the last load command. The linker option -headerpad controls the
71 minimum size of this padding. Its setting can be changed in 71 minimum size of this padding. Its setting can be changed in
72 s/darwin.h. A value of 0x300, e.g., leaves room for about 15 72 s/darwin.h. A value of 0x690, e.g., leaves room for 30 additional
73 additional load commands for the newly created __DATA segments (at 73 load commands for the newly created __DATA segments (at 56 bytes
74 56 bytes each). Unexec fails if there is not enough room for these 74 each). Unexec fails if there is not enough room for these new
75 new segments. 75 segments.
76 76
77 The __TEXT segment contains the sections __text, __cstring, 77 The __TEXT segment contains the sections __text, __cstring,
78 __picsymbol_stub, and __const and the __DATA segment contains the 78 __picsymbol_stub, and __const and the __DATA segment contains the
@@ -112,6 +112,20 @@ Boston, MA 02110-1301, USA. */
112 112
113#include <assert.h> 113#include <assert.h>
114 114
115#ifdef _LP64
116#define mach_header mach_header_64
117#define segment_command segment_command_64
118#undef VM_REGION_BASIC_INFO_COUNT
119#define VM_REGION_BASIC_INFO_COUNT VM_REGION_BASIC_INFO_COUNT_64
120#undef VM_REGION_BASIC_INFO
121#define VM_REGION_BASIC_INFO VM_REGION_BASIC_INFO_64
122#undef LC_SEGMENT
123#define LC_SEGMENT LC_SEGMENT_64
124#define vm_region vm_region_64
125#define section section_64
126#undef MH_MAGIC
127#define MH_MAGIC MH_MAGIC_64
128#endif
115 129
116#define VERBOSE 1 130#define VERBOSE 1
117 131
@@ -123,9 +137,6 @@ Boston, MA 02110-1301, USA. */
123 mapped to dynamically loaded libraries and will not be dumped. */ 137 mapped to dynamically loaded libraries and will not be dumped. */
124#define VM_DATA_TOP (20 * 1024 * 1024) 138#define VM_DATA_TOP (20 * 1024 * 1024)
125 139
126/* Used by malloc_freezedry and malloc_jumpstart. */
127int malloc_cookie;
128
129/* Type of an element on the list of regions to be dumped. */ 140/* Type of an element on the list of regions to be dumped. */
130struct region_t { 141struct region_t {
131 vm_address_t address; 142 vm_address_t address;
@@ -137,47 +148,49 @@ struct region_t {
137}; 148};
138 149
139/* Head and tail of the list of regions to be dumped. */ 150/* Head and tail of the list of regions to be dumped. */
140struct region_t *region_list_head = 0; 151static struct region_t *region_list_head = 0;
141struct region_t *region_list_tail = 0; 152static struct region_t *region_list_tail = 0;
142 153
143/* Pointer to array of load commands. */ 154/* Pointer to array of load commands. */
144struct load_command **lca; 155static struct load_command **lca;
145 156
146/* Number of load commands. */ 157/* Number of load commands. */
147int nlc; 158static int nlc;
148 159
149/* The highest VM address of segments loaded by the input file. 160/* The highest VM address of segments loaded by the input file.
150 Regions with addresses beyond this are assumed to be allocated 161 Regions with addresses beyond this are assumed to be allocated
151 dynamically and thus require dumping. */ 162 dynamically and thus require dumping. */
152vm_address_t infile_lc_highest_addr = 0; 163static vm_address_t infile_lc_highest_addr = 0;
153 164
154/* The lowest file offset used by the all sections in the __TEXT 165/* The lowest file offset used by the all sections in the __TEXT
155 segments. This leaves room at the beginning of the file to store 166 segments. This leaves room at the beginning of the file to store
156 the Mach-O header. Check this value against header size to ensure 167 the Mach-O header. Check this value against header size to ensure
157 the added load commands for the new __DATA segments did not 168 the added load commands for the new __DATA segments did not
158 overwrite any of the sections in the __TEXT segment. */ 169 overwrite any of the sections in the __TEXT segment. */
159unsigned long text_seg_lowest_offset = 0x10000000; 170static unsigned long text_seg_lowest_offset = 0x10000000;
160 171
161/* Mach header. */ 172/* Mach header. */
162struct mach_header mh; 173static struct mach_header mh;
163 174
164/* Offset at which the next load command should be written. */ 175/* Offset at which the next load command should be written. */
165unsigned long curr_header_offset = sizeof (struct mach_header); 176static unsigned long curr_header_offset = sizeof (struct mach_header);
166 177
167/* Current adjustment that needs to be made to offset values because 178/* Offset at which the next segment should be written. */
168 of additional data segments. */ 179static unsigned long curr_file_offset = 0;
169unsigned long delta = 0;
170 180
171int infd, outfd; 181static unsigned long pagesize;
182#define ROUNDUP_TO_PAGE_BOUNDARY(x) (((x) + pagesize - 1) & ~(pagesize - 1))
172 183
173int in_dumped_exec = 0; 184static int infd, outfd;
174 185
175malloc_zone_t *emacs_zone; 186static int in_dumped_exec = 0;
187
188static malloc_zone_t *emacs_zone;
176 189
177/* file offset of input file's data segment */ 190/* file offset of input file's data segment */
178off_t data_segment_old_fileoff; 191static off_t data_segment_old_fileoff = 0;
179 192
180struct segment_command *data_segment_scp; 193static struct segment_command *data_segment_scp;
181 194
182/* Read N bytes from infd into memory starting at address DEST. 195/* Read N bytes from infd into memory starting at address DEST.
183 Return true if successful, false otherwise. */ 196 Return true if successful, false otherwise. */
@@ -286,7 +299,7 @@ static void
286print_region (vm_address_t address, vm_size_t size, vm_prot_t prot, 299print_region (vm_address_t address, vm_size_t size, vm_prot_t prot,
287 vm_prot_t max_prot) 300 vm_prot_t max_prot)
288{ 301{
289 printf ("%#10x %#8x ", address, size); 302 printf ("%#10lx %#8lx ", (long) address, (long) size);
290 print_prot (prot); 303 print_prot (prot);
291 putchar (' '); 304 putchar (' ');
292 print_prot (max_prot); 305 print_prot (max_prot);
@@ -304,7 +317,7 @@ print_region_list ()
304 print_region (r->address, r->size, r->protection, r->max_protection); 317 print_region (r->address, r->size, r->protection, r->max_protection);
305} 318}
306 319
307void 320static void
308print_regions () 321print_regions ()
309{ 322{
310 task_t target_task = mach_task_self (); 323 task_t target_task = mach_task_self ();
@@ -412,23 +425,40 @@ build_region_list ()
412} 425}
413 426
414 427
415#define MAX_UNEXEC_REGIONS 200 428#define MAX_UNEXEC_REGIONS 400
416 429
417int num_unexec_regions; 430static int num_unexec_regions;
418vm_range_t unexec_regions[MAX_UNEXEC_REGIONS]; 431typedef struct {
432 vm_range_t range;
433 vm_size_t filesize;
434} unexec_region_info;
435static unexec_region_info unexec_regions[MAX_UNEXEC_REGIONS];
419 436
420static void 437static void
421unexec_regions_recorder (task_t task, void *rr, unsigned type, 438unexec_regions_recorder (task_t task, void *rr, unsigned type,
422 vm_range_t *ranges, unsigned num) 439 vm_range_t *ranges, unsigned num)
423{ 440{
441 vm_address_t p;
442 vm_size_t filesize;
443
424 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS) 444 while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
425 { 445 {
426 unexec_regions[num_unexec_regions++] = *ranges; 446 /* Subtract the size of trailing null pages from filesize. It
427 printf ("%#8x (sz: %#8x)\n", ranges->address, ranges->size); 447 can be smaller than vmsize in segment commands. In such a
448 case, trailing pages are initialized with zeros. */
449 for (p = ranges->address + ranges->size; p > ranges->address;
450 p -= sizeof (int))
451 if (*(((int *) p)-1))
452 break;
453 filesize = ROUNDUP_TO_PAGE_BOUNDARY (p - ranges->address);
454 assert (filesize <= ranges->size);
455
456 unexec_regions[num_unexec_regions].filesize = filesize;
457 unexec_regions[num_unexec_regions++].range = *ranges;
458 printf ("%#10lx (sz: %#8lx/%#8lx)\n", (long) (ranges->address),
459 (long) filesize, (long) (ranges->size));
428 ranges++; num--; 460 ranges++; num--;
429 } 461 }
430 if (num_unexec_regions == MAX_UNEXEC_REGIONS)
431 fprintf (stderr, "malloc_freezedry_recorder: too many regions\n");
432} 462}
433 463
434static kern_return_t 464static kern_return_t
@@ -438,7 +468,7 @@ unexec_reader (task_t task, vm_address_t address, vm_size_t size, void **ptr)
438 return KERN_SUCCESS; 468 return KERN_SUCCESS;
439} 469}
440 470
441void 471static void
442find_emacs_zone_regions () 472find_emacs_zone_regions ()
443{ 473{
444 num_unexec_regions = 0; 474 num_unexec_regions = 0;
@@ -449,13 +479,16 @@ find_emacs_zone_regions ()
449 (vm_address_t) emacs_zone, 479 (vm_address_t) emacs_zone,
450 unexec_reader, 480 unexec_reader,
451 unexec_regions_recorder); 481 unexec_regions_recorder);
482
483 if (num_unexec_regions == MAX_UNEXEC_REGIONS)
484 unexec_error ("find_emacs_zone_regions: too many regions");
452} 485}
453 486
454static int 487static int
455unexec_regions_sort_compare (const void *a, const void *b) 488unexec_regions_sort_compare (const void *a, const void *b)
456{ 489{
457 vm_address_t aa = ((vm_range_t *) a)->address; 490 vm_address_t aa = ((unexec_region_info *) a)->range.address;
458 vm_address_t bb = ((vm_range_t *) b)->address; 491 vm_address_t bb = ((unexec_region_info *) b)->range.address;
459 492
460 if (aa < bb) 493 if (aa < bb)
461 return -1; 494 return -1;
@@ -469,7 +502,7 @@ static void
469unexec_regions_merge () 502unexec_regions_merge ()
470{ 503{
471 int i, n; 504 int i, n;
472 vm_range_t r; 505 unexec_region_info r;
473 506
474 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]), 507 qsort (unexec_regions, num_unexec_regions, sizeof (unexec_regions[0]),
475 &unexec_regions_sort_compare); 508 &unexec_regions_sort_compare);
@@ -477,9 +510,11 @@ unexec_regions_merge ()
477 r = unexec_regions[0]; 510 r = unexec_regions[0];
478 for (i = 1; i < num_unexec_regions; i++) 511 for (i = 1; i < num_unexec_regions; i++)
479 { 512 {
480 if (r.address + r.size == unexec_regions[i].address) 513 if (r.range.address + r.range.size == unexec_regions[i].range.address
514 && r.range.size - r.filesize < 2 * pagesize)
481 { 515 {
482 r.size += unexec_regions[i].size; 516 r.filesize = r.range.size + unexec_regions[i].filesize;
517 r.range.size += unexec_regions[i].range.size;
483 } 518 }
484 else 519 else
485 { 520 {
@@ -500,7 +535,11 @@ print_load_command_name (int lc)
500 switch (lc) 535 switch (lc)
501 { 536 {
502 case LC_SEGMENT: 537 case LC_SEGMENT:
538#ifndef _LP64
503 printf ("LC_SEGMENT "); 539 printf ("LC_SEGMENT ");
540#else
541 printf ("LC_SEGMENT_64 ");
542#endif
504 break; 543 break;
505 case LC_LOAD_DYLINKER: 544 case LC_LOAD_DYLINKER:
506 printf ("LC_LOAD_DYLINKER "); 545 printf ("LC_LOAD_DYLINKER ");
@@ -541,14 +580,14 @@ print_load_command (struct load_command *lc)
541 int j; 580 int j;
542 581
543 scp = (struct segment_command *) lc; 582 scp = (struct segment_command *) lc;
544 printf (" %-16.16s %#10x %#8x\n", 583 printf (" %-16.16s %#10lx %#8lx\n",
545 scp->segname, scp->vmaddr, scp->vmsize); 584 scp->segname, (long) (scp->vmaddr), (long) (scp->vmsize));
546 585
547 sectp = (struct section *) (scp + 1); 586 sectp = (struct section *) (scp + 1);
548 for (j = 0; j < scp->nsects; j++) 587 for (j = 0; j < scp->nsects; j++)
549 { 588 {
550 printf (" %-16.16s %#10x %#8x\n", 589 printf (" %-16.16s %#10lx %#8lx\n",
551 sectp->sectname, sectp->addr, sectp->size); 590 sectp->sectname, (long) (sectp->addr), (long) (sectp->size));
552 sectp++; 591 sectp++;
553 } 592 }
554 } 593 }
@@ -620,7 +659,7 @@ read_load_commands ()
620 printf ("Highest address of load commands in input file: %#8x\n", 659 printf ("Highest address of load commands in input file: %#8x\n",
621 infile_lc_highest_addr); 660 infile_lc_highest_addr);
622 661
623 printf ("Lowest offset of all sections in __TEXT segment: %#8x\n", 662 printf ("Lowest offset of all sections in __TEXT segment: %#8lx\n",
624 text_seg_lowest_offset); 663 text_seg_lowest_offset);
625 664
626 printf ("--- List of Load Commands in Input File ---\n"); 665 printf ("--- List of Load Commands in Input File ---\n");
@@ -644,21 +683,23 @@ copy_segment (struct load_command *lc)
644 struct section *sectp; 683 struct section *sectp;
645 int j; 684 int j;
646 685
647 scp->fileoff += delta; 686 scp->fileoff = curr_file_offset;
648 687
649 sectp = (struct section *) (scp + 1); 688 sectp = (struct section *) (scp + 1);
650 for (j = 0; j < scp->nsects; j++) 689 for (j = 0; j < scp->nsects; j++)
651 { 690 {
652 sectp->offset += delta; 691 sectp->offset += curr_file_offset - old_fileoff;
653 sectp++; 692 sectp++;
654 } 693 }
655 694
656 printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n", 695 printf ("Writing segment %-16.16s @ %#8lx (%#8lx/%#8lx @ %#10lx)\n",
657 scp->segname, scp->fileoff, scp->fileoff + scp->filesize, 696 scp->segname, (long) (scp->fileoff), (long) (scp->filesize),
658 scp->filesize); 697 (long) (scp->vmsize), (long) (scp->vmaddr));
659 698
660 if (!unexec_copy (scp->fileoff, old_fileoff, scp->filesize)) 699 if (!unexec_copy (scp->fileoff, old_fileoff, scp->filesize))
661 unexec_error ("cannot copy segment from input to output file"); 700 unexec_error ("cannot copy segment from input to output file");
701 curr_file_offset += ROUNDUP_TO_PAGE_BOUNDARY (scp->filesize);
702
662 if (!unexec_write (curr_header_offset, lc, lc->cmdsize)) 703 if (!unexec_write (curr_header_offset, lc, lc->cmdsize))
663 unexec_error ("cannot write load command to header"); 704 unexec_error ("cannot write load command to header");
664 705
@@ -683,14 +724,18 @@ copy_data_segment (struct load_command *lc)
683 struct segment_command *scp = (struct segment_command *) lc; 724 struct segment_command *scp = (struct segment_command *) lc;
684 struct section *sectp; 725 struct section *sectp;
685 int j; 726 int j;
686 unsigned long header_offset, file_offset, old_file_offset; 727 unsigned long header_offset, old_file_offset;
687 728
688 printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n", 729 /* The new filesize of the segment is set to its vmsize because data
689 scp->segname, scp->fileoff, scp->fileoff + scp->filesize, 730 blocks for segments must start at region boundaries. Note that
690 scp->filesize); 731 this may leave unused locations at the end of the segment data
732 block because the total of the sizes of all sections in the
733 segment is generally smaller than vmsize. */
734 scp->filesize = scp->vmsize;
691 735
692 if (delta != 0) 736 printf ("Writing segment %-16.16s @ %#8lx (%#8lx/%#8lx @ %#10lx)\n",
693 unexec_error ("cannot handle multiple DATA segments in input file"); 737 scp->segname, curr_file_offset, (long)(scp->filesize),
738 (long)(scp->vmsize), (long) (scp->vmaddr));
694 739
695 /* Offsets in the output file for writing the next section structure 740 /* Offsets in the output file for writing the next section structure
696 and segment data block, respectively. */ 741 and segment data block, respectively. */
@@ -700,7 +745,7 @@ copy_data_segment (struct load_command *lc)
700 for (j = 0; j < scp->nsects; j++) 745 for (j = 0; j < scp->nsects; j++)
701 { 746 {
702 old_file_offset = sectp->offset; 747 old_file_offset = sectp->offset;
703 sectp->offset = sectp->addr - scp->vmaddr + scp->fileoff; 748 sectp->offset = sectp->addr - scp->vmaddr + curr_file_offset;
704 /* The __data section is dumped from memory. The __bss and 749 /* The __data section is dumped from memory. The __bss and
705 __common sections are also dumped from memory but their flag 750 __common sections are also dumped from memory but their flag
706 fields require changing (from S_ZEROFILL to S_REGULAR). The 751 fields require changing (from S_ZEROFILL to S_REGULAR). The
@@ -762,21 +807,16 @@ copy_data_segment (struct load_command *lc)
762 else 807 else
763 unexec_error ("unrecognized section name in __DATA segment"); 808 unexec_error ("unrecognized section name in __DATA segment");
764 809
765 printf (" section %-16.16s at %#8x - %#8x (sz: %#8x)\n", 810 printf (" section %-16.16s at %#8lx - %#8lx (sz: %#8lx)\n",
766 sectp->sectname, sectp->offset, sectp->offset + sectp->size, 811 sectp->sectname, (long) (sectp->offset),
767 sectp->size); 812 (long) (sectp->offset + sectp->size), (long) (sectp->size));
768 813
769 header_offset += sizeof (struct section); 814 header_offset += sizeof (struct section);
770 sectp++; 815 sectp++;
771 } 816 }
772 817
773 /* The new filesize of the segment is set to its vmsize because data 818 curr_file_offset += ROUNDUP_TO_PAGE_BOUNDARY (scp->filesize);
774 blocks for segments must start at region boundaries. Note that 819
775 this may leave unused locations at the end of the segment data
776 block because the total of the sizes of all sections in the
777 segment is generally smaller than vmsize. */
778 delta = scp->vmsize - scp->filesize;
779 scp->filesize = scp->vmsize;
780 if (!unexec_write (curr_header_offset, scp, sizeof (struct segment_command))) 820 if (!unexec_write (curr_header_offset, scp, sizeof (struct segment_command)))
781 unexec_error ("cannot write header of __DATA segment"); 821 unexec_error ("cannot write header of __DATA segment");
782 curr_header_offset += lc->cmdsize; 822 curr_header_offset += lc->cmdsize;
@@ -784,8 +824,7 @@ copy_data_segment (struct load_command *lc)
784 /* Create new __DATA segment load commands for regions on the region 824 /* Create new __DATA segment load commands for regions on the region
785 list that do not corresponding to any segment load commands in 825 list that do not corresponding to any segment load commands in
786 the input file. 826 the input file.
787 */ 827 */
788 file_offset = scp->fileoff + scp->filesize;
789 for (j = 0; j < num_unexec_regions; j++) 828 for (j = 0; j < num_unexec_regions; j++)
790 { 829 {
791 struct segment_command sc; 830 struct segment_command sc;
@@ -793,23 +832,22 @@ copy_data_segment (struct load_command *lc)
793 sc.cmd = LC_SEGMENT; 832 sc.cmd = LC_SEGMENT;
794 sc.cmdsize = sizeof (struct segment_command); 833 sc.cmdsize = sizeof (struct segment_command);
795 strncpy (sc.segname, SEG_DATA, 16); 834 strncpy (sc.segname, SEG_DATA, 16);
796 sc.vmaddr = unexec_regions[j].address; 835 sc.vmaddr = unexec_regions[j].range.address;
797 sc.vmsize = unexec_regions[j].size; 836 sc.vmsize = unexec_regions[j].range.size;
798 sc.fileoff = file_offset; 837 sc.fileoff = curr_file_offset;
799 sc.filesize = unexec_regions[j].size; 838 sc.filesize = unexec_regions[j].filesize;
800 sc.maxprot = VM_PROT_READ | VM_PROT_WRITE; 839 sc.maxprot = VM_PROT_READ | VM_PROT_WRITE;
801 sc.initprot = VM_PROT_READ | VM_PROT_WRITE; 840 sc.initprot = VM_PROT_READ | VM_PROT_WRITE;
802 sc.nsects = 0; 841 sc.nsects = 0;
803 sc.flags = 0; 842 sc.flags = 0;
804 843
805 printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n", 844 printf ("Writing segment %-16.16s @ %#8lx (%#8lx/%#8lx @ %#10lx)\n",
806 sc.segname, sc.fileoff, sc.fileoff + sc.filesize, 845 sc.segname, (long) (sc.fileoff), (long) (sc.filesize),
807 sc.filesize); 846 (long) (sc.vmsize), (long) (sc.vmaddr));
808 847
809 if (!unexec_write (sc.fileoff, (void *) sc.vmaddr, sc.vmsize)) 848 if (!unexec_write (sc.fileoff, (void *) sc.vmaddr, sc.filesize))
810 unexec_error ("cannot write new __DATA segment"); 849 unexec_error ("cannot write new __DATA segment");
811 delta += sc.filesize; 850 curr_file_offset += ROUNDUP_TO_PAGE_BOUNDARY (sc.filesize);
812 file_offset += sc.filesize;
813 851
814 if (!unexec_write (curr_header_offset, &sc, sc.cmdsize)) 852 if (!unexec_write (curr_header_offset, &sc, sc.cmdsize))
815 unexec_error ("cannot write new __DATA segment's header"); 853 unexec_error ("cannot write new __DATA segment's header");
@@ -821,7 +859,7 @@ copy_data_segment (struct load_command *lc)
821/* Copy a LC_SYMTAB load command from the input file to the output 859/* Copy a LC_SYMTAB load command from the input file to the output
822 file, adjusting the file offset fields. */ 860 file, adjusting the file offset fields. */
823static void 861static void
824copy_symtab (struct load_command *lc) 862copy_symtab (struct load_command *lc, long delta)
825{ 863{
826 struct symtab_command *stp = (struct symtab_command *) lc; 864 struct symtab_command *stp = (struct symtab_command *) lc;
827 865
@@ -898,7 +936,7 @@ unrelocate (const char *name, off_t reloff, int nrel)
898/* Copy a LC_DYSYMTAB load command from the input file to the output 936/* Copy a LC_DYSYMTAB load command from the input file to the output
899 file, adjusting the file offset fields. */ 937 file, adjusting the file offset fields. */
900static void 938static void
901copy_dysymtab (struct load_command *lc) 939copy_dysymtab (struct load_command *lc, long delta)
902{ 940{
903 struct dysymtab_command *dstp = (struct dysymtab_command *) lc; 941 struct dysymtab_command *dstp = (struct dysymtab_command *) lc;
904 942
@@ -927,7 +965,7 @@ copy_dysymtab (struct load_command *lc)
927/* Copy a LC_TWOLEVEL_HINTS load command from the input file to the output 965/* Copy a LC_TWOLEVEL_HINTS load command from the input file to the output
928 file, adjusting the file offset fields. */ 966 file, adjusting the file offset fields. */
929static void 967static void
930copy_twolevelhints (struct load_command *lc) 968copy_twolevelhints (struct load_command *lc, long delta)
931{ 969{
932 struct twolevel_hints_command *tlhp = (struct twolevel_hints_command *) lc; 970 struct twolevel_hints_command *tlhp = (struct twolevel_hints_command *) lc;
933 971
@@ -964,6 +1002,7 @@ static void
964dump_it () 1002dump_it ()
965{ 1003{
966 int i; 1004 int i;
1005 long linkedit_delta = 0;
967 1006
968 printf ("--- Load Commands written to Output File ---\n"); 1007 printf ("--- Load Commands written to Output File ---\n");
969 1008
@@ -977,6 +1016,9 @@ dump_it ()
977 { 1016 {
978 /* save data segment file offset and segment_command for 1017 /* save data segment file offset and segment_command for
979 unrelocate */ 1018 unrelocate */
1019 if (data_segment_old_fileoff)
1020 unexec_error ("cannot handle multiple DATA segments"
1021 " in input file");
980 data_segment_old_fileoff = scp->fileoff; 1022 data_segment_old_fileoff = scp->fileoff;
981 data_segment_scp = scp; 1023 data_segment_scp = scp;
982 1024
@@ -984,18 +1026,26 @@ dump_it ()
984 } 1026 }
985 else 1027 else
986 { 1028 {
1029 if (strncmp (scp->segname, SEG_LINKEDIT, 16) == 0)
1030 {
1031 if (linkedit_delta)
1032 unexec_error ("cannot handle multiple LINKEDIT segments"
1033 " in input file");
1034 linkedit_delta = curr_file_offset - scp->fileoff;
1035 }
1036
987 copy_segment (lca[i]); 1037 copy_segment (lca[i]);
988 } 1038 }
989 } 1039 }
990 break; 1040 break;
991 case LC_SYMTAB: 1041 case LC_SYMTAB:
992 copy_symtab (lca[i]); 1042 copy_symtab (lca[i], linkedit_delta);
993 break; 1043 break;
994 case LC_DYSYMTAB: 1044 case LC_DYSYMTAB:
995 copy_dysymtab (lca[i]); 1045 copy_dysymtab (lca[i], linkedit_delta);
996 break; 1046 break;
997 case LC_TWOLEVEL_HINTS: 1047 case LC_TWOLEVEL_HINTS:
998 copy_twolevelhints (lca[i]); 1048 copy_twolevelhints (lca[i], linkedit_delta);
999 break; 1049 break;
1000 default: 1050 default:
1001 copy_other (lca[i]); 1051 copy_other (lca[i]);
@@ -1005,7 +1055,7 @@ dump_it ()
1005 if (curr_header_offset > text_seg_lowest_offset) 1055 if (curr_header_offset > text_seg_lowest_offset)
1006 unexec_error ("not enough room for load commands for new __DATA segments"); 1056 unexec_error ("not enough room for load commands for new __DATA segments");
1007 1057
1008 printf ("%d unused bytes follow Mach-O header\n", 1058 printf ("%ld unused bytes follow Mach-O header\n",
1009 text_seg_lowest_offset - curr_header_offset); 1059 text_seg_lowest_offset - curr_header_offset);
1010 1060
1011 mh.sizeofcmds = curr_header_offset - sizeof (struct mach_header); 1061 mh.sizeofcmds = curr_header_offset - sizeof (struct mach_header);
@@ -1024,6 +1074,7 @@ unexec (char *outfile, char *infile, void *start_data, void *start_bss,
1024 if (in_dumped_exec) 1074 if (in_dumped_exec)
1025 unexec_error ("Unexec from a dumped executable is not supported."); 1075 unexec_error ("Unexec from a dumped executable is not supported.");
1026 1076
1077 pagesize = getpagesize ();
1027 infd = open (infile, O_RDONLY, 0); 1078 infd = open (infile, O_RDONLY, 0);
1028 if (infd < 0) 1079 if (infd < 0)
1029 { 1080 {
@@ -1081,8 +1132,8 @@ ptr_in_unexec_regions (void *ptr)
1081 int i; 1132 int i;
1082 1133
1083 for (i = 0; i < num_unexec_regions; i++) 1134 for (i = 0; i < num_unexec_regions; i++)
1084 if ((vm_address_t) ptr - unexec_regions[i].address 1135 if ((vm_address_t) ptr - unexec_regions[i].range.address
1085 < unexec_regions[i].size) 1136 < unexec_regions[i].range.size)
1086 return 1; 1137 return 1;
1087 1138
1088 return 0; 1139 return 0;
diff --git a/src/w16select.c b/src/w16select.c
index cd3098bae52..ea9d9aea190 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -590,7 +590,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
590 message2 (system_error_msg, sizeof (system_error_msg) - 1, 0); 590 message2 (system_error_msg, sizeof (system_error_msg) - 1, 0);
591 break; 591 break;
592 } 592 }
593 sit_for (2, 0, 0, 1, 1); 593 sit_for (make_number (2), 0, 2);
594 } 594 }
595 595
596 done: 596 done:
diff --git a/src/w32fns.c b/src/w32fns.c
index f7e211649e0..6313afe7867 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -2080,32 +2080,7 @@ w32_createwindow (f)
2080 2080
2081 if (!hprevinst) 2081 if (!hprevinst)
2082 { 2082 {
2083 Lisp_Object ifa;
2084
2085 w32_init_class (hinst); 2083 w32_init_class (hinst);
2086
2087 /* Handle the -geometry command line option and the geometry
2088 settings in the registry. They are decoded and put into
2089 initial-frame-alist by w32-win.el:x-handle-geometry. */
2090 ifa = Fsymbol_value (intern ("initial-frame-alist"));
2091 if (CONSP (ifa))
2092 {
2093 Lisp_Object lt = Fassq (Qleft, ifa);
2094 Lisp_Object tp = Fassq (Qtop, ifa);
2095
2096 if (!NILP (lt))
2097 {
2098 lt = XCDR (lt);
2099 if (INTEGERP (lt))
2100 left = lt;
2101 }
2102 if (!NILP (tp))
2103 {
2104 tp = XCDR (tp);
2105 if (INTEGERP (tp))
2106 top = tp;
2107 }
2108 }
2109 } 2084 }
2110 2085
2111 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition) 2086 if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition)
@@ -2714,9 +2689,8 @@ cancel_all_deferred_msgs ()
2714 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0); 2689 PostThreadMessage (dwWindowsThreadId, WM_NULL, 0, 0);
2715} 2690}
2716 2691
2717DWORD 2692DWORD WINAPI
2718w32_msg_worker (dw) 2693w32_msg_worker (void *arg)
2719 DWORD dw;
2720{ 2694{
2721 MSG msg; 2695 MSG msg;
2722 deferred_msg dummy_buf; 2696 deferred_msg dummy_buf;
@@ -8070,17 +8044,39 @@ DEFUN ("w32-shell-execute", Fw32_shell_execute, Sw32_shell_execute, 2, 4, 0,
8070 doc: /* Get Windows to perform OPERATION on DOCUMENT. 8044 doc: /* Get Windows to perform OPERATION on DOCUMENT.
8071This is a wrapper around the ShellExecute system function, which 8045This is a wrapper around the ShellExecute system function, which
8072invokes the application registered to handle OPERATION for DOCUMENT. 8046invokes the application registered to handle OPERATION for DOCUMENT.
8073OPERATION is typically \"open\", \"print\" or \"explore\" (but can be
8074nil for the default action), and DOCUMENT is typically the name of a
8075document file or URL, but can also be a program executable to run or
8076a directory to open in the Windows Explorer.
8077
8078If DOCUMENT is a program executable, PARAMETERS can be a string
8079containing command line parameters, but otherwise should be nil.
8080 8047
8081SHOW-FLAG can be used to control whether the invoked application is hidden 8048OPERATION is either nil or a string that names a supported operation.
8082or minimized. If SHOW-FLAG is nil, the application is displayed normally, 8049What operations can be used depends on the particular DOCUMENT and its
8083otherwise it is an integer representing a ShowWindow flag: 8050handler application, but typically it is one of the following common
8051operations:
8052
8053 \"open\" - open DOCUMENT, which could be a file, a directory, or an
8054 executable program. If it is an application, that
8055 application is launched in the current buffer's default
8056 directory. Otherwise, the application associated with
8057 DOCUMENT is launched in the buffer's default directory.
8058 \"print\" - print DOCUMENT, which must be a file
8059 \"explore\" - start the Windows Explorer on DOCUMENT
8060 \"edit\" - launch an editor and open DOCUMENT for editing; which
8061 editor is launched depends on the association for the
8062 specified DOCUMENT
8063 \"find\" - initiate search starting from DOCUMENT which must specify
8064 a directory
8065 nil - invoke the default OPERATION, or \"open\" if default is
8066 not defined or unavailable
8067
8068DOCUMENT is typically the name of a document file or a URL, but can
8069also be a program executable to run, or a directory to open in the
8070Windows Explorer.
8071
8072If DOCUMENT is a program executable, the optional arg PARAMETERS can
8073be a string containing command line parameters that will be passed to
8074the program; otherwise, PARAMETERS should be nil or unspecified.
8075
8076Second optional argument SHOW-FLAG can be used to control how the
8077application will be displayed when it is invoked. If SHOW-FLAG is nil
8078or unspceified, the application is displayed normally, otherwise it is
8079an integer representing a ShowWindow flag:
8084 8080
8085 0 - start hidden 8081 0 - start hidden
8086 1 - start normally 8082 1 - start normally
diff --git a/src/w32menu.c b/src/w32menu.c
index 3a4dc20fc15..d5c38bee336 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -235,10 +235,6 @@ static int menu_items_n_panes;
235/* Current depth within submenus. */ 235/* Current depth within submenus. */
236static int menu_items_submenu_depth; 236static int menu_items_submenu_depth;
237 237
238/* Flag which when set indicates a dialog or menu has been posted by
239 Xt on behalf of one of the widget sets. */
240static int popup_activated_flag;
241
242static int next_menubar_widget_id; 238static int next_menubar_widget_id;
243 239
244/* This is set nonzero after the user activates the menu bar, and set 240/* This is set nonzero after the user activates the menu bar, and set
@@ -2148,7 +2144,6 @@ w32_dialog_show (f, keymaps, title, header, error)
2148 2144
2149 /* Display the menu. */ 2145 /* Display the menu. */
2150 lw_pop_up_all_widgets (dialog_id); 2146 lw_pop_up_all_widgets (dialog_id);
2151 popup_activated_flag = 1;
2152 2147
2153 /* Process events that apply to the menu. */ 2148 /* Process events that apply to the menu. */
2154 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id); 2149 popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), dialog_id);
@@ -2428,13 +2423,6 @@ fill_in_menu (HMENU menu, widget_value *wv)
2428 return 1; 2423 return 1;
2429} 2424}
2430 2425
2431int
2432popup_activated ()
2433{
2434 /* popup_activated_flag not actually used on W32 */
2435 return 0;
2436}
2437
2438/* Display help string for currently pointed to menu item. Not 2426/* Display help string for currently pointed to menu item. Not
2439 supported on NT 3.51 and earlier, as GetMenuItemInfo is not 2427 supported on NT 3.51 and earlier, as GetMenuItemInfo is not
2440 available. */ 2428 available. */
@@ -2537,6 +2525,21 @@ w32_free_menu_strings (hwnd)
2537 2525
2538#endif /* HAVE_MENUS */ 2526#endif /* HAVE_MENUS */
2539 2527
2528/* The following is used by delayed window autoselection. */
2529
2530DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
2531 doc: /* Return t if a menu or popup dialog is active on selected frame. */)
2532 ()
2533{
2534#ifdef HAVE_MENUS
2535 FRAME_PTR f;
2536 f = SELECTED_FRAME ();
2537 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil;
2538#else
2539 return Qnil;
2540#endif /* HAVE_MENUS */
2541}
2542
2540void syms_of_w32menu () 2543void syms_of_w32menu ()
2541{ 2544{
2542 globals_of_w32menu (); 2545 globals_of_w32menu ();
@@ -2549,6 +2552,7 @@ void syms_of_w32menu ()
2549 staticpro (&Qdebug_on_next_call); 2552 staticpro (&Qdebug_on_next_call);
2550 2553
2551 defsubr (&Sx_popup_menu); 2554 defsubr (&Sx_popup_menu);
2555 defsubr (&Smenu_or_popup_active_p);
2552#ifdef HAVE_MENUS 2556#ifdef HAVE_MENUS
2553 defsubr (&Sx_popup_dialog); 2557 defsubr (&Sx_popup_dialog);
2554#endif 2558#endif
diff --git a/src/w32proc.c b/src/w32proc.c
index 29491931015..7d27172781d 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -486,7 +486,8 @@ sys_wait (int *status)
486 { 486 {
487 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--) 487 for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
488 /* some child_procs might be sockets; ignore them */ 488 /* some child_procs might be sockets; ignore them */
489 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess) 489 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess
490 && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0))
490 { 491 {
491 wait_hnd[nh] = cp->procinfo.hProcess; 492 wait_hnd[nh] = cp->procinfo.hProcess;
492 cps[nh] = cp; 493 cps[nh] = cp;
diff --git a/src/w32term.c b/src/w32term.c
index 948a5553e5d..bd3db15e11a 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4439,7 +4439,7 @@ w32_read_socket (sd, expected, hold_quit)
4439 /* Ignore any mouse motion that happened before this 4439 /* Ignore any mouse motion that happened before this
4440 event; any subsequent mouse-movement Emacs events 4440 event; any subsequent mouse-movement Emacs events
4441 should reflect only motion after the 4441 should reflect only motion after the
4442 ButtonPress. */ 4442 ButtonPress. */
4443 f->mouse_moved = 0; 4443 f->mouse_moved = 0;
4444 } 4444 }
4445 last_mouse_frame = f; 4445 last_mouse_frame = f;
@@ -6282,7 +6282,7 @@ x_delete_display (dpyinfo)
6282 6282
6283/* Set up use of W32. */ 6283/* Set up use of W32. */
6284 6284
6285DWORD w32_msg_worker (); 6285DWORD WINAPI w32_msg_worker (void * arg);
6286 6286
6287void 6287void
6288x_flush (struct frame * f) 6288x_flush (struct frame * f)
@@ -6388,8 +6388,8 @@ w32_initialize ()
6388 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); 6388 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
6389 6389
6390 hWindowsThread = CreateThread (NULL, 0, 6390 hWindowsThread = CreateThread (NULL, 0,
6391 (LPTHREAD_START_ROUTINE) w32_msg_worker, 6391 w32_msg_worker,
6392 0, 0, &dwWindowsThreadId); 6392 0, 0, &dwWindowsThreadId);
6393 6393
6394 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 6394 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
6395 } 6395 }
diff --git a/src/window.c b/src/window.c
index e996fc5c597..c46df0ef04d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3267,6 +3267,10 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p)
3267 struct window *w = XWINDOW (window); 3267 struct window *w = XWINDOW (window);
3268 struct buffer *b = XBUFFER (buffer); 3268 struct buffer *b = XBUFFER (buffer);
3269 int count = SPECPDL_INDEX (); 3269 int count = SPECPDL_INDEX ();
3270#ifdef HAVE_WINDOW_SYSTEM
3271 struct frame *f = XFRAME (w->frame);
3272 Display_Info *dpyinfo;
3273#endif
3270 3274
3271 w->buffer = buffer; 3275 w->buffer = buffer;
3272 3276
@@ -3347,6 +3351,15 @@ set_window_buffer (window, buffer, run_hooks_p, keep_margins_p)
3347 call1 (Vrun_hooks, Qwindow_configuration_change_hook); 3351 call1 (Vrun_hooks, Qwindow_configuration_change_hook);
3348 } 3352 }
3349 3353
3354#ifdef HAVE_WINDOW_SYSTEM
3355 BLOCK_INPUT;
3356 if (f && FRAME_X_OUTPUT (f)
3357 && (dpyinfo = FRAME_X_DISPLAY_INFO (f))
3358 && EQ (window, dpyinfo->mouse_face_window))
3359 clear_mouse_face (dpyinfo);
3360 UNBLOCK_INPUT;
3361#endif
3362
3350 unbind_to (count, Qnil); 3363 unbind_to (count, Qnil);
3351} 3364}
3352 3365
diff --git a/src/xdisp.c b/src/xdisp.c
index d99f7a9ad1d..0928d011a61 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6815,7 +6815,12 @@ move_it_to (it, to_charpos, to_x, to_y, to_vpos, op)
6815 break; 6815 break;
6816 6816
6817 case MOVE_LINE_CONTINUED: 6817 case MOVE_LINE_CONTINUED:
6818 it->continuation_lines_width += it->current_x; 6818 /* For continued lines ending in a tab, some of the glyphs
6819 associated with the tab are displayed on the current
6820 line. Since it->current_x does not include these glyphs,
6821 we use it->last_visible_x instead. */
6822 it->continuation_lines_width +=
6823 (it->c == '\t') ? it->last_visible_x : it->current_x;
6819 break; 6824 break;
6820 6825
6821 default: 6826 default:
@@ -17396,7 +17401,7 @@ pint2str (buf, width, d)
17396 17401
17397/* Write a null-terminated, right justified decimal and "human 17402/* Write a null-terminated, right justified decimal and "human
17398 readable" representation of the nonnegative integer D to BUF using 17403 readable" representation of the nonnegative integer D to BUF using
17399 a minimal field width WIDTH. D should be smaller than 999.5e24. */ 17404 a minimal field width WIDTH. D should be smaller than 999.5e24. */
17400 17405
17401static const char power_letter[] = 17406static const char power_letter[] =
17402 { 17407 {
@@ -22650,7 +22655,7 @@ note_mouse_highlight (f, x, y)
22650 struct buffer *b; 22655 struct buffer *b;
22651 22656
22652 /* When a menu is active, don't highlight because this looks odd. */ 22657 /* When a menu is active, don't highlight because this looks odd. */
22653#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) 22658#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
22654 if (popup_activated ()) 22659 if (popup_activated ())
22655 return; 22660 return;
22656#endif 22661#endif
diff --git a/src/xfaces.c b/src/xfaces.c
index b55118acdf0..ec20445b7dc 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -6195,7 +6195,7 @@ face for italic. */)
6195 (attributes, display) 6195 (attributes, display)
6196 Lisp_Object attributes, display; 6196 Lisp_Object attributes, display;
6197{ 6197{
6198 int supports, i; 6198 int supports = 0, i;
6199 Lisp_Object frame; 6199 Lisp_Object frame;
6200 struct frame *f; 6200 struct frame *f;
6201 struct face *def_face; 6201 struct face *def_face;
@@ -7089,10 +7089,18 @@ realize_default_face (f)
7089#ifdef HAVE_WINDOW_SYSTEM 7089#ifdef HAVE_WINDOW_SYSTEM
7090#ifdef HAVE_X_WINDOWS 7090#ifdef HAVE_X_WINDOWS
7091 if (FRAME_X_P (f) && face->font != FRAME_FONT (f)) 7091 if (FRAME_X_P (f) && face->font != FRAME_FONT (f))
7092 /* As the font specified for the frame was not acceptable as a 7092 {
7093 font for the default face (perhaps because auto-scaled fonts 7093 /* This can happen when making a frame on a display that does
7094 are rejected), we must adjust the frame font. */ 7094 not support the default font. */
7095 x_set_font (f, build_string (face->font_name), Qnil); 7095 if (!face->font)
7096 return 0;
7097
7098 /* Otherwise, the font specified for the frame was not
7099 acceptable as a font for the default face (perhaps because
7100 auto-scaled fonts are rejected), so we must adjust the frame
7101 font. */
7102 x_set_font (f, build_string (face->font_name), Qnil);
7103 }
7096#endif /* HAVE_X_WINDOWS */ 7104#endif /* HAVE_X_WINDOWS */
7097#endif /* HAVE_WINDOW_SYSTEM */ 7105#endif /* HAVE_WINDOW_SYSTEM */
7098 return 1; 7106 return 1;
diff --git a/src/xfns.c b/src/xfns.c
index 1cd8265d20f..8b4ab0ca363 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2143,27 +2143,35 @@ xic_create_xfontset (f, base_fontname)
2143 if (!xfs) 2143 if (!xfs)
2144 { 2144 {
2145 char *fontsetname = xic_create_fontsetname (base_fontname, False); 2145 char *fontsetname = xic_create_fontsetname (base_fontname, False);
2146 char *p0 = fontsetname, *p1;
2147 2146
2148 /* New fontset. */ 2147 /* New fontset. */
2149 /* FONTSETNAME contains a list of font names (specific fonts 2148 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
2150 first, general fonts last), but giving that to XCreateFontSet 2149 fontsetname, &missing_list,
2151 at once occasionally fails (bug of X?). So, we try to call 2150 &missing_count, &def_string);
2152 XCreateFontSet for each fontname. */ 2151 if (missing_list)
2153 2152 XFreeStringList (missing_list);
2154 while (p0) 2153 if (! xfs)
2155 { 2154 {
2156 p1 = strchr (p0, ','); 2155 /* FONTSETNAME contains a list of font names (specific fonts
2157 if (p1) 2156 first, general fonts last), but giving that to
2158 *p1 = '\0'; 2157 XCreateFontSet at once occasionally fails (bug of X?).
2159 xfs = XCreateFontSet (FRAME_X_DISPLAY (f), 2158 So, we try to call XCreateFontSet for each fontname. */
2160 p0, &missing_list, 2159 char *p0 = fontsetname, *p1;
2161 &missing_count, &def_string); 2160
2162 if (missing_list) 2161 while (p0)
2163 XFreeStringList (missing_list); 2162 {
2164 if (xfs) 2163 p1 = strchr (p0, ',');
2165 break; 2164 if (p1)
2166 p0 = p1 ? p1 + 1 : NULL; 2165 *p1 = '\0';
2166 xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
2167 p0, &missing_list,
2168 &missing_count, &def_string);
2169 if (missing_list)
2170 XFreeStringList (missing_list);
2171 if (xfs)
2172 break;
2173 p0 = p1 ? p1 + 1 : NULL;
2174 }
2167 } 2175 }
2168 xfree (fontsetname); 2176 xfree (fontsetname);
2169 } 2177 }
diff --git a/src/xmenu.c b/src/xmenu.c
index b615d321cc7..b4665f88e07 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -825,7 +825,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
825 int xpos = 0, ypos = 0; 825 int xpos = 0, ypos = 0;
826 Lisp_Object title; 826 Lisp_Object title;
827 char *error_name = NULL; 827 char *error_name = NULL;
828 Lisp_Object selection; 828 Lisp_Object selection = Qnil;
829 FRAME_PTR f = NULL; 829 FRAME_PTR f = NULL;
830 Lisp_Object x, y, window; 830 Lisp_Object x, y, window;
831 int keymaps = 0; 831 int keymaps = 0;
@@ -1404,8 +1404,13 @@ If FRAME is nil or not given, use the selected frame. */)
1404 Lisp_Object frame; 1404 Lisp_Object frame;
1405{ 1405{
1406 GtkWidget *menubar; 1406 GtkWidget *menubar;
1407 FRAME_PTR f;
1408
1409 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
1410 BLOCK_INPUT. */
1411
1407 BLOCK_INPUT; 1412 BLOCK_INPUT;
1408 FRAME_PTR f = check_x_frame (frame); 1413 f = check_x_frame (frame);
1409 1414
1410 if (FRAME_EXTERNAL_MENU_BAR (f)) 1415 if (FRAME_EXTERNAL_MENU_BAR (f))
1411 set_frame_menubar (f, 0, 1); 1416 set_frame_menubar (f, 0, 1);
@@ -1418,7 +1423,7 @@ If FRAME is nil or not given, use the selected frame. */)
1418 1423
1419 gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), 1424 gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar),
1420 GTK_WIDGET (children->data)); 1425 GTK_WIDGET (children->data));
1421 1426
1422 popup_activated_flag = 1; 1427 popup_activated_flag = 1;
1423 g_list_free (children); 1428 g_list_free (children);
1424 } 1429 }
@@ -1495,14 +1500,6 @@ x_activate_menubar (f)
1495 f->output_data.x->saved_menu_event->type = 0; 1500 f->output_data.x->saved_menu_event->type = 0;
1496} 1501}
1497 1502
1498/* Detect if a dialog or menu has been posted. */
1499
1500int
1501popup_activated ()
1502{
1503 return popup_activated_flag;
1504}
1505
1506/* This callback is invoked when the user selects a menubar cascade 1503/* This callback is invoked when the user selects a menubar cascade
1507 pushbutton, but before the pulldown menu is posted. */ 1504 pushbutton, but before the pulldown menu is posted. */
1508 1505
@@ -3801,6 +3798,27 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
3801#endif /* not USE_X_TOOLKIT */ 3798#endif /* not USE_X_TOOLKIT */
3802 3799
3803#endif /* HAVE_MENUS */ 3800#endif /* HAVE_MENUS */
3801
3802/* Detect if a dialog or menu has been posted. */
3803
3804int
3805popup_activated ()
3806{
3807 return popup_activated_flag;
3808}
3809
3810/* The following is used by delayed window autoselection. */
3811
3812DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_p, 0, 0, 0,
3813 doc: /* Return t if a menu or popup dialog is active. */)
3814 ()
3815{
3816#ifdef HAVE_MENUS
3817 return (popup_activated ()) ? Qt : Qnil;
3818#else
3819 return Qnil;
3820#endif /* HAVE_MENUS */
3821}
3804 3822
3805void 3823void
3806syms_of_xmenu () 3824syms_of_xmenu ()
@@ -3818,6 +3836,7 @@ syms_of_xmenu ()
3818#endif 3836#endif
3819 3837
3820 defsubr (&Sx_popup_menu); 3838 defsubr (&Sx_popup_menu);
3839 defsubr (&Smenu_or_popup_active_p);
3821 3840
3822#if defined (USE_GTK) || defined (USE_X_TOOLKIT) 3841#if defined (USE_GTK) || defined (USE_X_TOOLKIT)
3823 defsubr (&Sx_menu_bar_open_internal); 3842 defsubr (&Sx_menu_bar_open_internal);
diff --git a/src/xselect.c b/src/xselect.c
index e6103043dce..54b20d89d5f 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -123,8 +123,8 @@ Lisp_Object QCUT_BUFFER0, QCUT_BUFFER1, QCUT_BUFFER2, QCUT_BUFFER3,
123 123
124static Lisp_Object Vx_lost_selection_functions; 124static Lisp_Object Vx_lost_selection_functions;
125static Lisp_Object Vx_sent_selection_functions; 125static Lisp_Object Vx_sent_selection_functions;
126/* Coding system for communicating with other X clients via cutbuffer, 126/* Coding system for communicating with other X clients via selection
127 selection, and clipboard. */ 127 and clipboard. */
128static Lisp_Object Vselection_coding_system; 128static Lisp_Object Vselection_coding_system;
129 129
130/* Coding system for the next communicating with other X clients. */ 130/* Coding system for the next communicating with other X clients. */
@@ -843,7 +843,7 @@ x_reply_selection_request (event, format, data, size, type)
843 break; 843 break;
844 844
845 /* Now wait for the requester to ack this chunk by deleting the 845 /* Now wait for the requester to ack this chunk by deleting the
846 property. This can run random lisp code or signal. */ 846 property. This can run random lisp code or signal. */
847 TRACE1 ("Waiting for increment ACK (deletion of %s)", 847 TRACE1 ("Waiting for increment ACK (deletion of %s)",
848 XGetAtomName (display, reply.property)); 848 XGetAtomName (display, reply.property));
849 wait_for_property_change (wait_object); 849 wait_for_property_change (wait_object);
@@ -2742,11 +2742,11 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
2742 else 2742 else
2743 error ("ATOM must be a symbol or a string"); 2743 error ("ATOM must be a symbol or a string");
2744 2744
2745 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) 2745 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i)
2746 if (dpyinfo->x_dnd_atoms[i] == x_atom) 2746 if (dpyinfo->x_dnd_atoms[i] == x_atom)
2747 return Qnil; 2747 return Qnil;
2748 2748
2749 if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size) 2749 if (dpyinfo->x_dnd_atoms_length == dpyinfo->x_dnd_atoms_size)
2750 { 2750 {
2751 dpyinfo->x_dnd_atoms_size *= 2; 2751 dpyinfo->x_dnd_atoms_size *= 2;
2752 dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms, 2752 dpyinfo->x_dnd_atoms = xrealloc (dpyinfo->x_dnd_atoms,
@@ -2776,7 +2776,7 @@ x_handle_dnd_message (f, event, dpyinfo, bufp)
2776 int idata[5]; 2776 int idata[5];
2777 size_t i; 2777 size_t i;
2778 2778
2779 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i) 2779 for (i = 0; i < dpyinfo->x_dnd_atoms_length; ++i)
2780 if (dpyinfo->x_dnd_atoms[i] == event->message_type) break; 2780 if (dpyinfo->x_dnd_atoms[i] == event->message_type) break;
2781 2781
2782 if (i == dpyinfo->x_dnd_atoms_length) return 0; 2782 if (i == dpyinfo->x_dnd_atoms_length) return 0;
@@ -3007,8 +3007,8 @@ it merely informs you that they have happened. */);
3007 3007
3008 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system, 3008 DEFVAR_LISP ("selection-coding-system", &Vselection_coding_system,
3009 doc: /* Coding system for communicating with other X clients. 3009 doc: /* Coding system for communicating with other X clients.
3010When sending or receiving text via cut_buffer, selection, and clipboard, 3010When sending or receiving text via selection and clipboard, the text is
3011the text is encoded or decoded by this coding system. 3011encoded or decoded by this coding system.
3012The default value is `compound-text-with-extensions'. */); 3012The default value is `compound-text-with-extensions'. */);
3013 Vselection_coding_system = intern ("compound-text-with-extensions"); 3013 Vselection_coding_system = intern ("compound-text-with-extensions");
3014 3014
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 974b3a1c6ad..1e4618ed567 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -570,7 +570,7 @@ See also `x-session-previous-id', `emacs-save-session-functions',
570 DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id, 570 DEFVAR_LISP ("x-session-previous-id", &Vx_session_previous_id,
571 doc: /* The previous session id Emacs got from session manager. 571 doc: /* The previous session id Emacs got from session manager.
572If Emacs is running on a window system that has a session manager, the 572If Emacs is running on a window system that has a session manager, the
573session manager gives Emacs a session id. It is feasible for Emacs lisp 573session manager gives Emacs a session id. It is feasible for Emacs Lisp
574code to use the session id to save configuration in, for example, a file 574code to use the session id to save configuration in, for example, a file
575with a file name based on the session id. If Emacs is running when the 575with a file name based on the session id. If Emacs is running when the
576window system is shut down, the session manager remembers that Emacs was 576window system is shut down, the session manager remembers that Emacs was
diff --git a/src/xterm.c b/src/xterm.c
index 95b2a87fd4b..7bbd2736307 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8336,6 +8336,119 @@ x_set_offset (f, xoff, yoff, change_gravity)
8336 UNBLOCK_INPUT; 8336 UNBLOCK_INPUT;
8337} 8337}
8338 8338
8339/* Do fullscreen as specified in extended window manager hints */
8340static int
8341do_ewmh_fullscreen (f)
8342 struct frame *f;
8343{
8344 int have_net_atom = FRAME_X_DISPLAY_INFO (f)->have_net_atoms;
8345
8346 if (!have_net_atom)
8347 {
8348 int num;
8349 Atom *atoms = XListProperties (FRAME_X_DISPLAY (f),
8350 FRAME_X_DISPLAY_INFO (f)->root_window,
8351 &num);
8352 if (atoms && num > 0)
8353 {
8354 char **names = (char **) xmalloc (num * sizeof(*names));
8355 if (XGetAtomNames (FRAME_X_DISPLAY (f), atoms, num, names))
8356 {
8357 int i;
8358 for (i = 0; i < num; ++i)
8359 {
8360 if (!have_net_atom)
8361 have_net_atom = strncmp (names[i], "_NET_", 5) == 0;
8362 XFree (names[i]);
8363 }
8364 }
8365 xfree (names);
8366 }
8367 if (atoms)
8368 XFree (atoms);
8369
8370 FRAME_X_DISPLAY_INFO (f)->have_net_atoms = have_net_atom;
8371 }
8372
8373 if (have_net_atom)
8374 {
8375 Lisp_Object frame;
8376 const char *atom = "_NET_WM_STATE";
8377 const char *fs = "_NET_WM_STATE_FULLSCREEN";
8378 const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
8379 const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
8380 const char *what = NULL;
8381
8382 XSETFRAME (frame, f);
8383
8384 /* If there are _NET_ atoms we assume we have extended window manager
8385 hints. */
8386 switch (f->want_fullscreen)
8387 {
8388 case FULLSCREEN_BOTH:
8389 what = fs;
8390 break;
8391 case FULLSCREEN_WIDTH:
8392 what = fw;
8393 break;
8394 case FULLSCREEN_HEIGHT:
8395 what = fh;
8396 break;
8397 }
8398
8399 Fx_send_client_event (frame, make_number (0), frame,
8400 make_unibyte_string (atom, strlen (atom)),
8401 make_number (32),
8402 Fcons (make_number (0), /* Remove */
8403 Fcons
8404 (make_unibyte_string (fs,
8405 strlen (fs)),
8406 Qnil)));
8407 Fx_send_client_event (frame, make_number (0), frame,
8408 make_unibyte_string (atom, strlen (atom)),
8409 make_number (32),
8410 Fcons (make_number (0), /* Remove */
8411 Fcons
8412 (make_unibyte_string (fh,
8413 strlen (fh)),
8414 Qnil)));
8415 Fx_send_client_event (frame, make_number (0), frame,
8416 make_unibyte_string (atom, strlen (atom)),
8417 make_number (32),
8418 Fcons (make_number (0), /* Remove */
8419 Fcons
8420 (make_unibyte_string (fw,
8421 strlen (fw)),
8422 Qnil)));
8423 f->want_fullscreen = FULLSCREEN_NONE;
8424 if (what != NULL)
8425 Fx_send_client_event (frame, make_number (0), frame,
8426 make_unibyte_string (atom, strlen (atom)),
8427 make_number (32),
8428 Fcons (make_number (1), /* Add */
8429 Fcons
8430 (make_unibyte_string (what,
8431 strlen (what)),
8432 Qnil)));
8433 }
8434
8435 return have_net_atom;
8436}
8437
8438static void
8439XTfullscreen_hook (f)
8440 FRAME_PTR f;
8441{
8442 if (f->async_visible)
8443 {
8444 BLOCK_INPUT;
8445 do_ewmh_fullscreen (f);
8446 x_sync (f);
8447 UNBLOCK_INPUT;
8448 }
8449}
8450
8451
8339/* Check if we need to resize the frame due to a fullscreen request. 8452/* Check if we need to resize the frame due to a fullscreen request.
8340 If so needed, resize the frame. */ 8453 If so needed, resize the frame. */
8341static void 8454static void
@@ -8346,6 +8459,9 @@ x_check_fullscreen (f)
8346 { 8459 {
8347 int width, height, ign; 8460 int width, height, ign;
8348 8461
8462 if (do_ewmh_fullscreen (f))
8463 return;
8464
8349 x_real_positions (f, &f->left_pos, &f->top_pos); 8465 x_real_positions (f, &f->left_pos, &f->top_pos);
8350 8466
8351 x_fullscreen_adjust (f, &width, &height, &ign, &ign); 8467 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
@@ -8647,13 +8763,12 @@ void
8647x_raise_frame (f) 8763x_raise_frame (f)
8648 struct frame *f; 8764 struct frame *f;
8649{ 8765{
8766 BLOCK_INPUT;
8650 if (f->async_visible) 8767 if (f->async_visible)
8651 { 8768 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
8652 BLOCK_INPUT; 8769
8653 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); 8770 XFlush (FRAME_X_DISPLAY (f));
8654 XFlush (FRAME_X_DISPLAY (f)); 8771 UNBLOCK_INPUT;
8655 UNBLOCK_INPUT;
8656 }
8657} 8772}
8658 8773
8659/* Lower frame F. */ 8774/* Lower frame F. */
@@ -8677,7 +8792,22 @@ XTframe_raise_lower (f, raise_flag)
8677 int raise_flag; 8792 int raise_flag;
8678{ 8793{
8679 if (raise_flag) 8794 if (raise_flag)
8680 x_raise_frame (f); 8795 {
8796 Lisp_Object frame;
8797 const char *atom = "_NET_ACTIVE_WINDOW";
8798
8799 x_raise_frame (f);
8800 /* See Window Manager Specification/Extended Window Manager Hints at
8801 http://freedesktop.org/wiki/Standards_2fwm_2dspec */
8802
8803 XSETFRAME (frame, f);
8804 Fx_send_client_event (frame, make_number (0), frame,
8805 make_unibyte_string (atom, strlen (atom)),
8806 make_number (32),
8807 Fcons (make_number (1),
8808 Fcons (make_number (time (NULL) * 1000),
8809 Qnil)));
8810 }
8681 else 8811 else
8682 x_lower_frame (f); 8812 x_lower_frame (f);
8683} 8813}
@@ -11038,6 +11168,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
11038 terminal->mouse_position_hook = XTmouse_position; 11168 terminal->mouse_position_hook = XTmouse_position;
11039 terminal->frame_rehighlight_hook = XTframe_rehighlight; 11169 terminal->frame_rehighlight_hook = XTframe_rehighlight;
11040 terminal->frame_raise_lower_hook = XTframe_raise_lower; 11170 terminal->frame_raise_lower_hook = XTframe_raise_lower;
11171 terminal->fullscreen_hook = XTfullscreen_hook;
11041 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 11172 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
11042 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; 11173 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
11043 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; 11174 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
diff --git a/src/xterm.h b/src/xterm.h
index 3c4bdab33c9..1ea50b8158f 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -391,10 +391,12 @@ struct x_display_info
391 } wm_type; 391 } wm_type;
392 392
393 393
394 /* Atoms that are drag and drop atoms */ 394 /* Atoms that are drag and drop atoms */
395 Atom *x_dnd_atoms; 395 Atom *x_dnd_atoms;
396 size_t x_dnd_atoms_size; 396 size_t x_dnd_atoms_size;
397 size_t x_dnd_atoms_length; 397 size_t x_dnd_atoms_length;
398
399 int have_net_atoms;
398}; 400};
399 401
400#ifdef HAVE_X_I18N 402#ifdef HAVE_X_I18N