aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2004-05-18 19:12:15 +0000
committerKaroly Lorentey2004-05-18 19:12:15 +0000
commitc23670f81e059ebe645c88575f4ddfa67f26bf6b (patch)
tree71667a6ceaa877ccf3953abedfa7b0fd5f0f5369 /src
parentd9858e4f1889a61b216ae1f99053846362067ccc (diff)
parenta7f7f2540f02834ad128d0c9357a4dbd8222dff4 (diff)
downloademacs-c23670f81e059ebe645c88575f4ddfa67f26bf6b.tar.gz
emacs-c23670f81e059ebe645c88575f4ddfa67f26bf6b.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-301 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-302 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-303 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-304 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-305 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-306 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-307 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-308 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-309 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-310 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-311 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-312 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-313 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-314 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-315 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-316 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-317 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-318 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-319 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-320 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-321 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-322 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-323 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-324 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-163
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit12
-rw-r--r--src/ChangeLog191
-rw-r--r--src/alloc.c32
-rw-r--r--src/blockinput.h3
-rw-r--r--src/buffer.h19
-rw-r--r--src/ccl.c4
-rw-r--r--src/charset.c26
-rw-r--r--src/data.c2
-rw-r--r--src/emacs.c1
-rw-r--r--src/image.c475
-rw-r--r--src/keyboard.c22
-rw-r--r--src/lisp.h52
-rw-r--r--src/macfns.c4
-rw-r--r--src/macmenu.c3
-rw-r--r--src/macterm.c24
-rw-r--r--src/macterm.h14
-rw-r--r--src/msdos.c33
-rw-r--r--src/print.c35
-rw-r--r--src/process.c15
-rw-r--r--src/regex.c2
-rw-r--r--src/textprop.c23
-rw-r--r--src/w32.c14
-rw-r--r--src/w32console.c26
-rw-r--r--src/w32fns.c156
-rw-r--r--src/w32heap.c3
-rw-r--r--src/w32inevt.c12
-rw-r--r--src/w32proc.c8
-rw-r--r--src/w32term.c16
-rw-r--r--src/window.c9
-rw-r--r--src/xdisp.c28
-rw-r--r--src/xfaces.c32
-rw-r--r--src/xfns.c5
32 files changed, 1029 insertions, 272 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index 1b141a42064..c976d3633de 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -81,7 +81,7 @@ end
81define xvectype 81define xvectype
82 xgetptr $ 82 xgetptr $
83 set $size = ((struct Lisp_Vector *) $ptr)->size 83 set $size = ((struct Lisp_Vector *) $ptr)->size
84 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size 84 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
85 echo \n 85 echo \n
86end 86end
87document xvectype 87document xvectype
@@ -199,7 +199,7 @@ end
199define xstring 199define xstring
200 xgetptr $ 200 xgetptr $
201 print (struct Lisp_String *) $ptr 201 print (struct Lisp_String *) $ptr
202 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte) 202 output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size & ~gdb_array_mark_flag : $->size_byte)
203 echo \n 203 echo \n
204end 204end
205document xstring 205document xstring
@@ -210,7 +210,7 @@ end
210define xvector 210define xvector
211 xgetptr $ 211 xgetptr $
212 print (struct Lisp_Vector *) $ptr 212 print (struct Lisp_Vector *) $ptr
213 output ($->size > 50) ? 0 : ($->contents[0])@($->size) 213 output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag)
214echo \n 214echo \n
215end 215end
216document xvector 216document xvector
@@ -289,7 +289,7 @@ end
289define xboolvector 289define xboolvector
290 xgetptr $ 290 xgetptr $
291 print (struct Lisp_Bool_Vector *) $ptr 291 print (struct Lisp_Bool_Vector *) $ptr
292 output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8) 292 output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8)
293 echo \n 293 echo \n
294end 294end
295document xboolvector 295document xboolvector
@@ -377,7 +377,7 @@ define xprintsym
377 set $sym = (struct Lisp_Symbol *) $ptr 377 set $sym = (struct Lisp_Symbol *) $ptr
378 xgetptr $sym->xname 378 xgetptr $sym->xname
379 set $sym_name = (struct Lisp_String *) $ptr 379 set $sym_name = (struct Lisp_String *) $ptr
380 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte) 380 output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size & ~gdb_array_mark_flag : $sym_name->size_byte)
381end 381end
382document xprintsym 382document xprintsym
383 Print argument as a symbol. 383 Print argument as a symbol.
@@ -395,7 +395,7 @@ define xbacktrace
395 if $type == Lisp_Vectorlike 395 if $type == Lisp_Vectorlike
396 xgetptr (*$bt->function) 396 xgetptr (*$bt->function)
397 set $size = ((struct Lisp_Vector *) $ptr)->size 397 set $size = ((struct Lisp_Vector *) $ptr)->size
398 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size 398 output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag
399 else 399 else
400 printf "Lisp type %d", $type 400 printf "Lisp type %d", $type
401 end 401 end
diff --git a/src/ChangeLog b/src/ChangeLog
index fad84ff38f5..7425754e042 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,186 @@
12004-05-18 Eli Zaretskii <eliz@gnu.org>
2
3 * lisp.h (DECL_ALIGN): Remove restriction on MS-DOS systems.
4
5 * msdos.c (syms_of_msdos): Initialize dos-unsupported-char-glyph
6 with make_number.
7 (IT_write_glyphs): Extract glyph from dos-unsupported-char-glyph
8 with XINT.
9
102004-05-18 Kim F. Storm <storm@cua.dk>
11
12 * blockinput.h (INPUT_BLOCKED_P): New macros.
13
14 * keyboard.c (Frecursive_edit): Return immediately if input blocked.
15 (Ftop_level): Unblock input if blocked.
16
17 * buffer.h (GET_OVERLAYS_AT): New macro.
18 * msdos.c (IT_note_mouse_highlight): Use it.
19 * textprop.c (get_char_property_and_overlay): Use it.
20 * xdisp.c (next_overlay_change, note_mouse_highlight): Use it.
21 * xfaces.c (face_at_buffer_position): Use it.
22
23 * print.c (print_object): Increase buf size.
24
252004-05-17 Jason Rumney <jasonr@gnu.org>
26
27 * w32fns.c (Fw32_register_hot_key, Fw32_unregister_hot_key)
28 (Fw32_toggle_lock_key) [USE_LISP_UNION_TYPE]: Cast from
29 Lisp_Object using i member.
30 (w32_quit_key): Rename from Vw32_quit_key, and make an int.
31 (syms_of_w32fns, globals_of_w32fns): Use Lisp_Object and int
32 consistently.
33
34 * w32proc.c (create_child): Use make_number instead of masking pid.
35
36 * w32fns.c (w32_color_map_lookup): Return a Lisp_Object.
37 (x_to_w32_charset, w32_to_x_charset, w32_to_all_x_charsets):
38 Use EQ to compare Lisp_Objects.
39 (w32_parse_hot_key): Use int for lisp_modifiers consistently.
40
41 * w32term.c (w32_num_mouse_buttons): Rename from
42 Vw32_num_mouse_buttons and make it an int.
43
44 * w32.c (init_environment): Use it.
45
46 * w32fns.c (w32_wnd_proc): Likewise.
47
48 * w32proc.c (w32_pipe_read_delay): Rename from
49 Vw32_pipe_read_delay and make it an int.
50
51 * w32.c (_sys_read_ahead): Use it.
52
53 * lisp.h (egetenv) [USE_CRT_DLL]: Remove condition.
54
55 * w32proc.c (create_child) [USE_LSB_TAG]: Don't try to mask pid.
56
57 * w32inevt.c (w32_console_mouse_position, do_mouse_event)
58 (key_event): Don't mix Lisp_Object and int.
59
60 * w32heap.c (init_heap) [USE_LSB_TAG]: Don't check heap location.
61
62 * keyboard.c (kbd_buffer_get_event): Don't use event->code and
63 modifiers in language change event.
64
652004-05-17 Kim F. Storm <storm@cua.dk>
66
67 * alloc.c (mark_object): Ignore Lisp_Misc_Free objects.
68 Such objects may be freed markers which still exist on an undo list.
69
702004-05-16 Juanma Barranquero <lektu@terra.es>
71
72 * data.c (Fset_default): Make argument names match their use in
73 docstring.
74
752004-05-15 Andreas Schwab <schwab@suse.de>
76
77 * emacs.c (gdb_array_mark_flag): Define.
78 * .gdbinit: Mask off gdb_array_mark_flag from vector sizes.
79
802004-05-15 Eli Zaretskii <eliz@gnu.org>
81
82 * lisp.h (DECL_ALIGN) [MSDOS]: Don't define DECL_ALIGN to use
83 __attribute__((__aligned__)), so that USE_LSB_TAG would not become
84 defined for the MS-DOS build.
85
862004-05-14 Stefan Monnier <monnier@iro.umontreal.ca>
87
88 * w32fns.c (Fw32_define_rgb_color): Avoid XSET.
89
902004-05-14 Kenichi Handa <handa@m17n.org>
91
92 * ccl.c (Fccl_execute_on_string): Fix setting elements of STATUS.
93
942004-05-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
95
96 * lisp.h (Vx_resource_name, Vx_resource_class): Move from xfns.c
97 section to frame.c section.
98 (Fxw_display_color_p, Fx_file_dialog): Declare if
99 HAVE_WINDOW_SYSTEM defined.
100 * macfns.c (Fx_create_frame): Fix int/Lisp_Object mixup.
101 * macmenu.c (set_frame_menubar): Use NILP to test a lisp value.
102 * macterm.c (mac_get_emulated_btn, mac_event_to_emacs_modifiers)
103 (mac_get_mouse_btn): Use NILP and EQ to test/compare lisp values.
104 (XTread_socket): Fix int/Lisp_Object mixup.
105 (mac_check_for_quit_char): Fix pointer/Lisp_Object mixup.
106 * macterm.h (struct frame, struct face, struct image)
107 (display_x_get_resource, Fx_display_color_p)
108 (Fx_display_grayscale_p, Fx_display_planes, x_free_gcs):
109 Add prototypes.
110
1112004-05-14 Kim F. Storm <storm@cua.dk>
112
113 * process.c (wait_reading_process_input): Make reentrant.
114 Make Available and Connecting non-static. Save and restore value
115 of waiting_for_user_input_p.
116
1172004-05-13 Kim F. Storm <storm@cua.dk>
118
119 * keyboard.c (mark_kboards): Don't mark x and y members
120 that are overloaded in selection request events.
121
1222004-05-13 Stefan Monnier <monnier@iro.umontreal.ca>
123
124 * lisp.h (USE_LSB_TAG): Make it the default when it is known to work.
125
1262004-05-13 Glenn Morris <gmorris@ast.cam.ac.uk>
127
128 * window.c (Fdisplay_buffer, Fsplit_window)
129 (split-height-threshold): Doc fix.
130
1312004-05-13 Juanma Barranquero <lektu@terra.es>
132
133 * xfaces.c (Ftty_supports_face_attributes_p)
134 (Finternal_copy_lisp_face): Fix typo in docstring.
135 (Finternal_get_lisp_face_attribute): Fix docstring.
136
1372004-05-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
138
139 * xfns.c (syms_of_xfns): Provide x-toolkit also for GTK.
140
1412004-05-11 Steven Tamm <steventamm@mac.com>
142
143 * macfns.c (Fx_create_frame): Default to using tool-bar by
144 setting tool-bar-lines to 1 in default-frame-alist.
145
1462004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
147
148 * image.c (xpm_scan, xpm_make_color_table_v, xpm_put_color_table_v)
149 (xpm_get_color_table_v, xpm_make_color_table_h)
150 (xpm_put_color_table_h, xpm_get_color_table_h)
151 (xpm_str_to_color_key, xpm_load_image, xpm_load)
152 (syms_of_image): Support XPM on Carbon Emacs. Does not
153 depend on libXpm, but only supports XPM version 3 without extensions.
154
1552004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
156
157 * macterm.c (x_flush, XTframe_up_to_date): Use FRAME_MAC_P
158 instead of FRAME_X_P
159
1602004-05-11 Kim F. Storm <storm@cua.dk>
161
162 * process.c (read_process_output): Grow decoding_buf when needed;
163 this could cause a crash in allocate_string and compact_small_strings.
164
1652004-04-29 Jim Blandy <jimb@redhat.com>
166
167 * regex.c (mutually_exclusive_p): In 'case wordbeg', compare op2
168 against proper opcode.
169
1702004-05-10 Juanma Barranquero <lektu@terra.es>
171
172 * process.c (Fstart_process): Fix docstring.
173
174 * charset.c (Fget_unused_iso_final_char): Fix typos in docstring.
175 (Fchar_bytes, Fchar_width, Fstring_width, Fchar_direction)
176 (Fsplit_char, Fchar_charset): Make argument names match their use
177 in docstring.
178
1792004-05-10 Richard M. Stallman <rms@gnu.org>
180
181 * print.c (print_preprocess): Use being_printed, loop_count and
182 halftail to detect overdeep nesting and cyclic cdr chains.
183
12004-05-10 Andreas Schwab <schwab@suse.de> 1842004-05-10 Andreas Schwab <schwab@suse.de>
2 185
3 * lisp.h: Declare Fmake_symbolic_link. 186 * lisp.h: Declare Fmake_symbolic_link.
@@ -115,8 +298,8 @@
115 298
1162004-05-02 Eli Zaretskii <eliz@gnu.org> 2992004-05-02 Eli Zaretskii <eliz@gnu.org>
117 300
118 * syntax.h (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY_INT): Avoid 301 * syntax.h (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY_INT):
119 compiler warnings. 302 Avoid compiler warnings.
120 303
121 * Makefile.in (region-cache.o): Depend on config.h. 304 * Makefile.in (region-cache.o): Depend on config.h.
122 305
@@ -1461,7 +1644,7 @@
1461 1644
14622004-02-09 Sam Steingold <sds@gnu.org> 16452004-02-09 Sam Steingold <sds@gnu.org>
1463 1646
1464 * w32term.c (w32_draw_fringe_bitmap): Fixed a typo in the last patch. 1647 * w32term.c (w32_draw_fringe_bitmap): Fix a typo in the last patch.
1465 1648
14662004-02-09 Kim F. Storm <storm@cua.dk> 16492004-02-09 Kim F. Storm <storm@cua.dk>
1467 1650
@@ -8193,7 +8376,7 @@
8193 8376
8194 * msdos.c (croak): Add `void' to definition. 8377 * msdos.c (croak): Add `void' to definition.
8195 8378
8196 * sysdep.c [MSDOS] (request_sigio, unrequest_sigio): 8379 * sysdep.c (request_sigio, unrequest_sigio) [MSDOS]:
8197 Don't define them, they are defined in msdos.c. 8380 Don't define them, they are defined in msdos.c.
8198 8381
8199 * mem-limits.h [MSDOS]: Declare etext. 8382 * mem-limits.h [MSDOS]: Declare etext.
diff --git a/src/alloc.c b/src/alloc.c
index 29351952860..63447d078f9 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -845,7 +845,7 @@ lisp_align_free (block)
845 free_ablock = ablock; 845 free_ablock = ablock;
846 /* Update busy count. */ 846 /* Update busy count. */
847 ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase)); 847 ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase));
848 848
849 if (2 > (long) ABLOCKS_BUSY (abase)) 849 if (2 > (long) ABLOCKS_BUSY (abase))
850 { /* All the blocks are free. */ 850 { /* All the blocks are free. */
851 int i = 0, aligned = (long) ABLOCKS_BUSY (abase); 851 int i = 0, aligned = (long) ABLOCKS_BUSY (abase);
@@ -4467,6 +4467,17 @@ returns nil, because real GC can't be done. */)
4467 mark_kboards (); 4467 mark_kboards ();
4468 mark_ttys (); 4468 mark_ttys ();
4469 4469
4470#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4471 mark_stack ();
4472#endif
4473
4474#ifdef USE_GTK
4475 {
4476 extern void xg_mark_data ();
4477 xg_mark_data ();
4478 }
4479#endif
4480
4470 /* Look thru every buffer's undo list 4481 /* Look thru every buffer's undo list
4471 for elements that update markers that were not marked, 4482 for elements that update markers that were not marked,
4472 and delete them. */ 4483 and delete them. */
@@ -4510,17 +4521,6 @@ returns nil, because real GC can't be done. */)
4510 } 4521 }
4511 } 4522 }
4512 4523
4513#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4514 mark_stack ();
4515#endif
4516
4517#ifdef USE_GTK
4518 {
4519 extern void xg_mark_data ();
4520 xg_mark_data ();
4521 }
4522#endif
4523
4524 gc_sweep (); 4524 gc_sweep ();
4525 4525
4526 /* Clear the mark bits that we set in certain root slots. */ 4526 /* Clear the mark bits that we set in certain root slots. */
@@ -4978,6 +4978,14 @@ mark_object (arg)
4978 break; 4978 break;
4979 4979
4980 case Lisp_Misc: 4980 case Lisp_Misc:
4981 if (XMISCTYPE (obj) == Lisp_Misc_Free)
4982 {
4983 /* This is (probably) a freed marker which may still exist on
4984 a buffer undo list, so accept it here, as check below will
4985 fail (not live). KFS 2004-05-17 */
4986 XMARKER (obj)->gcmarkbit = 1;
4987 break;
4988 }
4981 CHECK_ALLOCATED_AND_LIVE (live_misc_p); 4989 CHECK_ALLOCATED_AND_LIVE (live_misc_p);
4982 if (XMARKER (obj)->gcmarkbit) 4990 if (XMARKER (obj)->gcmarkbit)
4983 break; 4991 break;
diff --git a/src/blockinput.h b/src/blockinput.h
index eba192c9863..e9f2f3bc217 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -97,6 +97,9 @@ extern int pending_atimers;
97#define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0) 97#define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0)
98#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT 98#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
99 99
100/* In critical section ? */
101#define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
102
100/* Defined in keyboard.c */ 103/* Defined in keyboard.c */
101/* Don't use a prototype here; it causes trouble in some files. */ 104/* Don't use a prototype here; it causes trouble in some files. */
102extern void reinvoke_input_signal (); 105extern void reinvoke_input_signal ();
diff --git a/src/buffer.h b/src/buffer.h
index e2205a916e6..b5227cb9981 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -823,6 +823,25 @@ extern void buffer_slot_type_mismatch P_ ((int));
823extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); 823extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT));
824extern void mmap_set_vars P_ ((int)); 824extern void mmap_set_vars P_ ((int));
825 825
826/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
827 If NEXTP is non-NULL, return next overlay there.
828 See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */
829
830#define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \
831 do { \
832 int maxlen = 40; \
833 overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
834 noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
835 nextp, NULL, chrq); \
836 if (noverlays > maxlen) \
837 { \
838 maxlen = noverlays; \
839 overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
840 noverlays = overlays_at (posn, 0, &overlays, &maxlen, \
841 nextp, NULL, chrq); \
842 } \
843 } while (0)
844
826EXFUN (Fbuffer_name, 1); 845EXFUN (Fbuffer_name, 1);
827EXFUN (Fget_file_buffer, 1); 846EXFUN (Fget_file_buffer, 1);
828EXFUN (Fnext_overlay_change, 1); 847EXFUN (Fnext_overlay_change, 1);
diff --git a/src/ccl.c b/src/ccl.c
index 81e90319e52..4c3528075b4 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2196,8 +2196,8 @@ See the documentation of `define-ccl-program' for the detail of CCL program. */
2196 produced = ccl_driver (&ccl, SDATA (str), outbuf, 2196 produced = ccl_driver (&ccl, SDATA (str), outbuf,
2197 SBYTES (str), outbufsize, (int *) 0); 2197 SBYTES (str), outbufsize, (int *) 0);
2198 for (i = 0; i < 8; i++) 2198 for (i = 0; i < 8; i++)
2199 XSET (AREF (status, i), Lisp_Int, ccl.reg[i]); 2199 ASET (status, i, make_number (ccl.reg[i]));
2200 XSETINT (AREF (status, 8), ccl.ic); 2200 ASET (status, 8, make_number (ccl.ic));
2201 UNGCPRO; 2201 UNGCPRO;
2202 2202
2203 if (NILP (unibyte_p)) 2203 if (NILP (unibyte_p))
diff --git a/src/charset.c b/src/charset.c
index 48382a44bd6..57a12b2398d 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,7 +1,7 @@
1/* Basic multilingual character support. 1/* Basic multilingual character support.
2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. 2 Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation. 3 Licensed to the Free Software Foundation.
4 Copyright (C) 2001 Free Software Foundation, Inc. 4 Copyright (C) 2001, 2004 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -730,7 +730,7 @@ It includes a generic character for a charset not yet defined. */)
730 730
731DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char, 731DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char,
732 Sget_unused_iso_final_char, 2, 2, 0, 732 Sget_unused_iso_final_char, 2, 2, 0,
733 doc: /* Return an unsed ISO's final char for a charset of DIMENISION and CHARS. 733 doc: /* Return an unused ISO's final char for a charset of DIMENSION and CHARS.
734DIMENSION is the number of bytes to represent a character: 1 or 2. 734DIMENSION is the number of bytes to represent a character: 1 or 2.
735CHARS is the number of characters in a dimension: 94 or 96. 735CHARS is the number of characters in a dimension: 94 or 96.
736 736
@@ -1028,9 +1028,9 @@ Internal use only. */)
1028} 1028}
1029 1029
1030DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0, 1030DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0,
1031 doc: /* Return list of charset and one or two position-codes of CHAR. 1031 doc: /* Return list of charset and one or two position-codes of CH.
1032If CHAR is invalid as a character code, 1032If CH is invalid as a character code,
1033return a list of symbol `unknown' and CHAR. */) 1033return a list of symbol `unknown' and CH. */)
1034 (ch) 1034 (ch)
1035 Lisp_Object ch; 1035 Lisp_Object ch;
1036{ 1036{
@@ -1048,7 +1048,7 @@ return a list of symbol `unknown' and CHAR. */)
1048} 1048}
1049 1049
1050DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0, 1050DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0,
1051 doc: /* Return charset of CHAR. */) 1051 doc: /* Return charset of CH. */)
1052 (ch) 1052 (ch)
1053 Lisp_Object ch; 1053 Lisp_Object ch;
1054{ 1054{
@@ -1179,7 +1179,7 @@ The conversion is done based on `nonascii-translation-table' (which see)
1179} 1179}
1180 1180
1181DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, 1181DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0,
1182 doc: /* Return 1 regardless of the argument CHAR. */) 1182 doc: /* Return 1 regardless of the argument CH. */)
1183 (ch) 1183 (ch)
1184 Lisp_Object ch; 1184 Lisp_Object ch;
1185{ 1185{
@@ -1223,7 +1223,7 @@ char_bytes (c)
1223 : 4)))) 1223 : 4))))
1224 1224
1225DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, 1225DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0,
1226 doc: /* Return width of CHAR when displayed in the current buffer. 1226 doc: /* Return width of CH when displayed in the current buffer.
1227The width is measured by how many columns it occupies on the screen. 1227The width is measured by how many columns it occupies on the screen.
1228Tab is taken to occupy `tab-width' columns. */) 1228Tab is taken to occupy `tab-width' columns. */)
1229 (ch) 1229 (ch)
@@ -1406,18 +1406,18 @@ When calculating width of a multibyte character in STRING,
1406only the base leading-code is considered; the validity of 1406only the base leading-code is considered; the validity of
1407the following bytes is not checked. Tabs in STRING are always 1407the following bytes is not checked. Tabs in STRING are always
1408taken to occupy `tab-width' columns. */) 1408taken to occupy `tab-width' columns. */)
1409 (str) 1409 (string)
1410 Lisp_Object str; 1410 Lisp_Object string;
1411{ 1411{
1412 Lisp_Object val; 1412 Lisp_Object val;
1413 1413
1414 CHECK_STRING (str); 1414 CHECK_STRING (string);
1415 XSETFASTINT (val, lisp_string_width (str, -1, NULL, NULL)); 1415 XSETFASTINT (val, lisp_string_width (string, -1, NULL, NULL));
1416 return val; 1416 return val;
1417} 1417}
1418 1418
1419DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0, 1419DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0,
1420 doc: /* Return the direction of CHAR. 1420 doc: /* Return the direction of CH.
1421The returned value is 0 for left-to-right and 1 for right-to-left. */) 1421The returned value is 0 for left-to-right and 1 for right-to-left. */)
1422 (ch) 1422 (ch)
1423 Lisp_Object ch; 1423 Lisp_Object ch;
diff --git a/src/data.c b/src/data.c
index 992aac66476..5a1a648dcb7 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1407,7 +1407,7 @@ local bindings in certain buffers. */)
1407} 1407}
1408 1408
1409DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, 1409DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0,
1410 doc: /* Set SYMBOL's default value to VAL. SYMBOL and VAL are evaluated. 1410 doc: /* Set SYMBOL's default value to VALUE. SYMBOL and VALUE are evaluated.
1411The default value is seen in buffers that do not have their own values 1411The default value is seen in buffers that do not have their own values
1412for this variable. */) 1412for this variable. */)
1413 (symbol, value) 1413 (symbol, value)
diff --git a/src/emacs.c b/src/emacs.c
index 75bea1da4cf..f7bae2dc13d 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -105,6 +105,7 @@ EMACS_INT gdb_data_seg_bits = DATA_SEG_BITS;
105EMACS_INT gdb_data_seg_bits = 0; 105EMACS_INT gdb_data_seg_bits = 0;
106#endif 106#endif
107EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; 107EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG;
108EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG;
108 109
109/* Command line args from shell, as list of strings. */ 110/* Command line args from shell, as list of strings. */
110Lisp_Object Vcommand_line_args; 111Lisp_Object Vcommand_line_args;
diff --git a/src/image.c b/src/image.c
index c7bedb5de32..700ab3fa2d9 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3184,12 +3184,15 @@ xbm_load (f, img)
3184 XPM images 3184 XPM images
3185 ***********************************************************************/ 3185 ***********************************************************************/
3186 3186
3187#ifdef HAVE_XPM 3187#if defined (HAVE_XPM) || defined (MAC_OS)
3188 3188
3189static int xpm_image_p P_ ((Lisp_Object object)); 3189static int xpm_image_p P_ ((Lisp_Object object));
3190static int xpm_load P_ ((struct frame *f, struct image *img)); 3190static int xpm_load P_ ((struct frame *f, struct image *img));
3191static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); 3191static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
3192 3192
3193#endif /* HAVE_XPM || MAC_OS */
3194
3195#ifdef HAVE_XPM
3193#ifdef HAVE_NTGUI 3196#ifdef HAVE_NTGUI
3194/* Indicate to xpm.h that we don't have Xlib. */ 3197/* Indicate to xpm.h that we don't have Xlib. */
3195#define FOR_MSW 3198#define FOR_MSW
@@ -3208,7 +3211,9 @@ static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
3208#else 3211#else
3209#include "X11/xpm.h" 3212#include "X11/xpm.h"
3210#endif /* HAVE_NTGUI */ 3213#endif /* HAVE_NTGUI */
3214#endif /* HAVE_XPM */
3211 3215
3216#if defined (HAVE_XPM) || defined (MAC_OS)
3212/* The symbol `xpm' identifying XPM-format images. */ 3217/* The symbol `xpm' identifying XPM-format images. */
3213 3218
3214Lisp_Object Qxpm; 3219Lisp_Object Qxpm;
@@ -3536,10 +3541,13 @@ xpm_image_p (object)
3536 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))); 3541 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)));
3537} 3542}
3538 3543
3544#endif /* HAVE_XPM || MAC_OS */
3539 3545
3540/* Load image IMG which will be displayed on frame F. Value is 3546/* Load image IMG which will be displayed on frame F. Value is
3541 non-zero if successful. */ 3547 non-zero if successful. */
3542 3548
3549#ifdef HAVE_XPM
3550
3543static int 3551static int
3544xpm_load (f, img) 3552xpm_load (f, img)
3545 struct frame *f; 3553 struct frame *f;
@@ -3771,6 +3779,467 @@ xpm_load (f, img)
3771 3779
3772#endif /* HAVE_XPM */ 3780#endif /* HAVE_XPM */
3773 3781
3782#ifdef MAC_OS
3783
3784/* XPM support functions for Mac OS where libxpm is not available.
3785 Only XPM version 3 (without any extensions) is supported. */
3786
3787static int xpm_scan P_ ((unsigned char **, unsigned char *,
3788 unsigned char **, int *));
3789static Lisp_Object xpm_make_color_table_v
3790 P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object),
3791 Lisp_Object (**) (Lisp_Object, unsigned char *, int)));
3792static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *,
3793 int, Lisp_Object));
3794static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object,
3795 unsigned char *, int));
3796static Lisp_Object xpm_make_color_table_h
3797 P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object),
3798 Lisp_Object (**) (Lisp_Object, unsigned char *, int)));
3799static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *,
3800 int, Lisp_Object));
3801static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object,
3802 unsigned char *, int));
3803static int xpm_str_to_color_key P_ ((char *));
3804static int xpm_load_image P_ ((struct frame *, struct image *,
3805 unsigned char *, unsigned char *));
3806
3807/* Tokens returned from xpm_scan. */
3808
3809enum xpm_token
3810{
3811 XPM_TK_IDENT = 256,
3812 XPM_TK_STRING,
3813 XPM_TK_EOF
3814};
3815
3816/* Scan an XPM data and return a character (< 256) or a token defined
3817 by enum xpm_token above. *S and END are the start (inclusive) and
3818 the end (exclusive) addresses of the data, respectively. Advance
3819 *S while scanning. If token is either XPM_TK_IDENT or
3820 XPM_TK_STRING, *BEG and *LEN are set to the start address and the
3821 length of the corresponding token, respectively. */
3822
3823static int
3824xpm_scan (s, end, beg, len)
3825 unsigned char **s, *end, **beg;
3826 int *len;
3827{
3828 int c;
3829
3830 while (*s < end)
3831 {
3832 /* Skip white-space. */
3833 while (*s < end && (c = *(*s)++, isspace (c)))
3834 ;
3835
3836 /* gnus-pointer.xpm uses '-' in its identifier.
3837 sb-dir-plus.xpm uses '+' in its identifier. */
3838 if (isalpha (c) || c == '_' || c == '-' || c == '+')
3839 {
3840 *beg = *s - 1;
3841 while (*s < end &&
3842 (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+'))
3843 ++*s;
3844 *len = *s - *beg;
3845 return XPM_TK_IDENT;
3846 }
3847 else if (c == '"')
3848 {
3849 *beg = *s;
3850 while (*s < end && **s != '"')
3851 ++*s;
3852 *len = *s - *beg;
3853 if (*s < end)
3854 ++*s;
3855 return XPM_TK_STRING;
3856 }
3857 else if (c == '/')
3858 {
3859 if (*s < end && **s == '*')
3860 {
3861 /* C-style comment. */
3862 ++*s;
3863 do
3864 {
3865 while (*s < end && *(*s)++ != '*')
3866 ;
3867 }
3868 while (*s < end && **s != '/');
3869 if (*s < end)
3870 ++*s;
3871 }
3872 else
3873 return c;
3874 }
3875 else
3876 return c;
3877 }
3878
3879 return XPM_TK_EOF;
3880}
3881
3882/* Functions for color table lookup in XPM data. A Key is a string
3883 specifying the color of each pixel in XPM data. A value is either
3884 an integer that specifies a pixel color, Qt that specifies
3885 transparency, or Qnil for the unspecified color. If the length of
3886 the key string is one, a vector is used as a table. Otherwise, a
3887 hash table is used. */
3888
3889static Lisp_Object
3890xpm_make_color_table_v (put_func, get_func)
3891 void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object);
3892 Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int);
3893{
3894 *put_func = xpm_put_color_table_v;
3895 *get_func = xpm_get_color_table_v;
3896 return Fmake_vector (make_number (256), Qnil);
3897}
3898
3899static void
3900xpm_put_color_table_v (color_table, chars_start, chars_len, color)
3901 Lisp_Object color_table;
3902 unsigned char *chars_start;
3903 int chars_len;
3904 Lisp_Object color;
3905{
3906 XVECTOR (color_table)->contents[*chars_start] = color;
3907}
3908
3909static Lisp_Object
3910xpm_get_color_table_v (color_table, chars_start, chars_len)
3911 Lisp_Object color_table;
3912 unsigned char *chars_start;
3913 int chars_len;
3914{
3915 return XVECTOR (color_table)->contents[*chars_start];
3916}
3917
3918static Lisp_Object
3919xpm_make_color_table_h (put_func, get_func)
3920 void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object);
3921 Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int);
3922{
3923 *put_func = xpm_put_color_table_h;
3924 *get_func = xpm_get_color_table_h;
3925 return make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
3926 make_float (DEFAULT_REHASH_SIZE),
3927 make_float (DEFAULT_REHASH_THRESHOLD),
3928 Qnil, Qnil, Qnil);
3929}
3930
3931static void
3932xpm_put_color_table_h (color_table, chars_start, chars_len, color)
3933 Lisp_Object color_table;
3934 unsigned char *chars_start;
3935 int chars_len;
3936 Lisp_Object color;
3937{
3938 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
3939 unsigned hash_code;
3940 Lisp_Object chars = make_unibyte_string (chars_start, chars_len);
3941
3942 hash_lookup (table, chars, &hash_code);
3943 hash_put (table, chars, color, hash_code);
3944}
3945
3946static Lisp_Object
3947xpm_get_color_table_h (color_table, chars_start, chars_len)
3948 Lisp_Object color_table;
3949 unsigned char *chars_start;
3950 int chars_len;
3951{
3952 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
3953 int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len),
3954 NULL);
3955
3956 return i >= 0 ? HASH_VALUE (table, i) : Qnil;
3957}
3958
3959enum xpm_color_key {
3960 XPM_COLOR_KEY_S,
3961 XPM_COLOR_KEY_M,
3962 XPM_COLOR_KEY_G4,
3963 XPM_COLOR_KEY_G,
3964 XPM_COLOR_KEY_C
3965};
3966
3967static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
3968
3969static int
3970xpm_str_to_color_key (s)
3971 char *s;
3972{
3973 int i;
3974
3975 for (i = 0;
3976 i < sizeof xpm_color_key_strings / sizeof xpm_color_key_strings[0];
3977 i++)
3978 if (strcmp (xpm_color_key_strings[i], s) == 0)
3979 return i;
3980 return -1;
3981}
3982
3983static int
3984xpm_load_image (f, img, contents, end)
3985 struct frame *f;
3986 struct image *img;
3987 unsigned char *contents, *end;
3988{
3989 unsigned char *s = contents, *beg, *str;
3990 unsigned char buffer[BUFSIZ];
3991 int width, height, x, y;
3992 int num_colors, chars_per_pixel;
3993 int len, LA1;
3994 void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object);
3995 Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int);
3996 Lisp_Object frame, color_symbols, color_table;
3997 int best_key, have_mask = 0;
3998 XImagePtr ximg = NULL, mask_img = NULL;
3999
4000#define match() \
4001 LA1 = xpm_scan (&s, end, &beg, &len)
4002
4003#define expect(TOKEN) \
4004 if (LA1 != (TOKEN)) \
4005 goto failure; \
4006 else \
4007 match ()
4008
4009#define expect_ident(IDENT) \
4010 if (LA1 == XPM_TK_IDENT \
4011 && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \
4012 match (); \
4013 else \
4014 goto failure
4015
4016 if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0))
4017 goto failure;
4018 s += 9;
4019 match();
4020 expect_ident ("static");
4021 expect_ident ("char");
4022 expect ('*');
4023 expect (XPM_TK_IDENT);
4024 expect ('[');
4025 expect (']');
4026 expect ('=');
4027 expect ('{');
4028 expect (XPM_TK_STRING);
4029 if (len >= BUFSIZ)
4030 goto failure;
4031 memcpy (buffer, beg, len);
4032 buffer[len] = '\0';
4033 if (sscanf (buffer, "%d %d %d %d", &width, &height,
4034 &num_colors, &chars_per_pixel) != 4
4035 || width <= 0 || height <= 0
4036 || num_colors <= 0 || chars_per_pixel <= 0)
4037 goto failure;
4038 expect (',');
4039
4040 XSETFRAME (frame, f);
4041 if (!NILP (Fxw_display_color_p (frame)))
4042 best_key = XPM_COLOR_KEY_C;
4043 else if (!NILP (Fx_display_grayscale_p (frame)))
4044 best_key = (XFASTINT (Fx_display_planes (frame)) > 2
4045 ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4);
4046 else
4047 best_key = XPM_COLOR_KEY_M;
4048
4049 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
4050 if (chars_per_pixel == 1)
4051 color_table = xpm_make_color_table_v (&put_color_table,
4052 &get_color_table);
4053 else
4054 color_table = xpm_make_color_table_h (&put_color_table,
4055 &get_color_table);
4056
4057 while (num_colors-- > 0)
4058 {
4059 unsigned char *color, *max_color;
4060 int key, next_key, max_key = 0;
4061 Lisp_Object symbol_color = Qnil, color_val;
4062 XColor cdef;
4063
4064 expect (XPM_TK_STRING);
4065 if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel)
4066 goto failure;
4067 memcpy (buffer, beg + chars_per_pixel, len - chars_per_pixel);
4068 buffer[len - chars_per_pixel] = '\0';
4069
4070 str = strtok (buffer, " \t");
4071 if (str == NULL)
4072 goto failure;
4073 key = xpm_str_to_color_key (str);
4074 if (key < 0)
4075 goto failure;
4076 do
4077 {
4078 color = strtok (NULL, " \t");
4079 if (color == NULL)
4080 goto failure;
4081
4082 while (str = strtok (NULL, " \t"))
4083 {
4084 next_key = xpm_str_to_color_key (str);
4085 if (next_key >= 0)
4086 break;
4087 color[strlen (color)] = ' ';
4088 }
4089
4090 if (key == XPM_COLOR_KEY_S)
4091 {
4092 if (NILP (symbol_color))
4093 symbol_color = build_string (color);
4094 }
4095 else if (max_key < key && key <= best_key)
4096 {
4097 max_key = key;
4098 max_color = color;
4099 }
4100 key = next_key;
4101 }
4102 while (str);
4103
4104 color_val = Qnil;
4105 if (!NILP (color_symbols) && !NILP (symbol_color))
4106 {
4107 Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
4108
4109 if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
4110 if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
4111 color_val = Qt;
4112 else if (x_defined_color (f, SDATA (XCDR (specified_color)),
4113 &cdef, 0))
4114 color_val = make_number (cdef.pixel);
4115 }
4116 if (NILP (color_val) && max_key > 0)
4117 if (xstricmp (max_color, "None") == 0)
4118 color_val = Qt;
4119 else if (x_defined_color (f, max_color, &cdef, 0))
4120 color_val = make_number (cdef.pixel);
4121 if (!NILP (color_val))
4122 (*put_color_table) (color_table, beg, chars_per_pixel, color_val);
4123
4124 expect (',');
4125 }
4126
4127 if (!x_create_x_image_and_pixmap (f, width, height, 0,
4128 &ximg, &img->pixmap)
4129 || !x_create_x_image_and_pixmap (f, width, height, 1,
4130 &mask_img, &img->mask))
4131 {
4132 image_error ("Out of memory (%s)", img->spec, Qnil);
4133 goto error;
4134 }
4135
4136 for (y = 0; y < height; y++)
4137 {
4138 expect (XPM_TK_STRING);
4139 str = beg;
4140 if (len < width * chars_per_pixel)
4141 goto failure;
4142 for (x = 0; x < width; x++, str += chars_per_pixel)
4143 {
4144 Lisp_Object color_val =
4145 (*get_color_table) (color_table, str, chars_per_pixel);
4146
4147 XPutPixel (ximg, x, y,
4148 (INTEGERP (color_val) ? XINT (color_val)
4149 : FRAME_FOREGROUND_PIXEL (f)));
4150 XPutPixel (mask_img, x, y,
4151 (!EQ (color_val, Qt) ? PIX_MASK_DRAW (f)
4152 : (have_mask = 1, PIX_MASK_RETAIN (f))));
4153 }
4154 if (y + 1 < height)
4155 expect (',');
4156 }
4157
4158 img->width = width;
4159 img->height = height;
4160
4161 x_put_x_image (f, ximg, img->pixmap, width, height);
4162 x_destroy_x_image (ximg);
4163 if (have_mask)
4164 {
4165 x_put_x_image (f, mask_img, img->mask, width, height);
4166 x_destroy_x_image (mask_img);
4167 }
4168 else
4169 {
4170 x_destroy_x_image (mask_img);
4171 Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
4172 img->mask = NO_PIXMAP;
4173 }
4174
4175 return 1;
4176
4177 failure:
4178 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
4179 error:
4180 x_destroy_x_image (ximg);
4181 x_destroy_x_image (mask_img);
4182 x_clear_image (f, img);
4183 return 0;
4184
4185#undef match
4186#undef expect
4187#undef expect_ident
4188}
4189
4190static int
4191xpm_load (f, img)
4192 struct frame *f;
4193 struct image *img;
4194{
4195 int success_p = 0;
4196 Lisp_Object file_name;
4197
4198 /* If IMG->spec specifies a file name, create a non-file spec from it. */
4199 file_name = image_spec_value (img->spec, QCfile, NULL);
4200 if (STRINGP (file_name))
4201 {
4202 Lisp_Object file;
4203 unsigned char *contents;
4204 int size;
4205 struct gcpro gcpro1;
4206
4207 file = x_find_image_file (file_name);
4208 GCPRO1 (file);
4209 if (!STRINGP (file))
4210 {
4211 image_error ("Cannot find image file `%s'", file_name, Qnil);
4212 UNGCPRO;
4213 return 0;
4214 }
4215
4216 contents = slurp_file (SDATA (file), &size);
4217 if (contents == NULL)
4218 {
4219 image_error ("Error loading XPM image `%s'", img->spec, Qnil);
4220 UNGCPRO;
4221 return 0;
4222 }
4223
4224 success_p = xpm_load_image (f, img, contents, contents + size);
4225 xfree (contents);
4226 UNGCPRO;
4227 }
4228 else
4229 {
4230 Lisp_Object data;
4231
4232 data = image_spec_value (img->spec, QCdata, NULL);
4233 success_p = xpm_load_image (f, img, SDATA (data),
4234 SDATA (data) + SBYTES (data));
4235 }
4236
4237 return success_p;
4238}
4239
4240#endif /* MAC_OS */
4241
4242
3774 4243
3775/*********************************************************************** 4244/***********************************************************************
3776 Color table 4245 Color table
@@ -7447,7 +7916,7 @@ syms_of_image ()
7447 Qxbm = intern ("xbm"); 7916 Qxbm = intern ("xbm");
7448 staticpro (&Qxbm); 7917 staticpro (&Qxbm);
7449 7918
7450#ifdef HAVE_XPM 7919#if defined (HAVE_XPM) || defined (MAC_OS)
7451 Qxpm = intern ("xpm"); 7920 Qxpm = intern ("xpm");
7452 staticpro (&Qxpm); 7921 staticpro (&Qxpm);
7453#endif 7922#endif
@@ -7517,7 +7986,7 @@ init_image ()
7517 define_image_type (&xbm_type); 7986 define_image_type (&xbm_type);
7518 define_image_type (&pbm_type); 7987 define_image_type (&pbm_type);
7519 7988
7520#ifdef HAVE_XPM 7989#if defined (HAVE_XPM) || defined (MAC_OS)
7521 IF_LIB_AVAILABLE(init_xpm_functions) 7990 IF_LIB_AVAILABLE(init_xpm_functions)
7522 define_image_type (&xpm_type); 7991 define_image_type (&xpm_type);
7523#endif 7992#endif
diff --git a/src/keyboard.c b/src/keyboard.c
index 2a1c1c89e87..75a049b5775 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -985,6 +985,11 @@ This function is called by the editor initialization to begin editing. */)
985 int count = SPECPDL_INDEX (); 985 int count = SPECPDL_INDEX ();
986 Lisp_Object buffer; 986 Lisp_Object buffer;
987 987
988 /* If we enter while input is blocked, don't lock up here.
989 This may happen through the debugger during redisplay. */
990 if (INPUT_BLOCKED_P)
991 return Qnil;
992
988 command_loop_level++; 993 command_loop_level++;
989 update_mode_lines = 1; 994 update_mode_lines = 1;
990 995
@@ -1281,6 +1286,12 @@ DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "",
1281 if (display_hourglass_p) 1286 if (display_hourglass_p)
1282 cancel_hourglass (); 1287 cancel_hourglass ();
1283#endif 1288#endif
1289
1290 /* Unblock input if we enter with input blocked. This may happen if
1291 redisplay traps e.g. during tool-bar update with input blocked. */
1292 while (INPUT_BLOCKED_P)
1293 UNBLOCK_INPUT;
1294
1284 return Fthrow (Qtop_level, Qnil); 1295 return Fthrow (Qtop_level, Qnil);
1285} 1296}
1286 1297
@@ -3964,9 +3975,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu)
3964 else if (event->kind == LANGUAGE_CHANGE_EVENT) 3975 else if (event->kind == LANGUAGE_CHANGE_EVENT)
3965 { 3976 {
3966 /* Make an event (language-change (FRAME CHARSET LCID)). */ 3977 /* Make an event (language-change (FRAME CHARSET LCID)). */
3967 obj = Fcons (event->modifiers, Qnil); 3978 obj = Fcons (event->frame_or_window, Qnil);
3968 obj = Fcons (event->code, obj);
3969 obj = Fcons (event->frame_or_window, obj);
3970 obj = Fcons (Qlanguage_change, Fcons (obj, Qnil)); 3979 obj = Fcons (Qlanguage_change, Fcons (obj, Qnil));
3971 kbd_fetch_ptr = event + 1; 3980 kbd_fetch_ptr = event + 1;
3972 } 3981 }
@@ -11548,8 +11557,11 @@ mark_kboards ()
11548 { 11557 {
11549 if (event == kbd_buffer + KBD_BUFFER_SIZE) 11558 if (event == kbd_buffer + KBD_BUFFER_SIZE)
11550 event = kbd_buffer; 11559 event = kbd_buffer;
11551 mark_object (event->x); 11560 if (event->kind != SELECTION_REQUEST_EVENT)
11552 mark_object (event->y); 11561 {
11562 mark_object (event->x);
11563 mark_object (event->y);
11564 }
11553 mark_object (event->frame_or_window); 11565 mark_object (event->frame_or_window);
11554 mark_object (event->arg); 11566 mark_object (event->arg);
11555 } 11567 }
diff --git a/src/lisp.h b/src/lisp.h
index 023bedaea04..ca060cb4c2f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -284,24 +284,51 @@ enum pvec_type
284#define BOOL_VECTOR_BITS_PER_CHAR 8 284#define BOOL_VECTOR_BITS_PER_CHAR 8
285 285
286/***** Select the tagging scheme. *****/ 286/***** Select the tagging scheme. *****/
287/* There are basically two options that control the tagging scheme:
288 - NO_UNION_TYPE says that Lisp_Object should be an integer instead
289 of a union.
290 - USE_LSB_TAG means that we can assume the least 3 bits of pointers are
291 always 0, and we can thus use them to hold tag bits, without
292 restricting our addressing space.
293
294 If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus
295 restricting our possible address range. Currently USE_LSB_TAG is not
296 allowed together with a union. This is not due to any fundamental
297 technical (or political ;-) problem: nobody wrote the code to do it yet.
298
299 USE_LSB_TAG not only requires the least 3 bits of pointers returned by
300 malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
301 on the few static Lisp_Objects used: all the defsubr as well
302 as the two special buffers buffer_defaults and buffer_local_symbols. */
287 303
288/* First, try and define DECL_ALIGN(type,var) which declares a static 304/* First, try and define DECL_ALIGN(type,var) which declares a static
289 variable VAR of type TYPE with the added requirement that it be 305 variable VAR of type TYPE with the added requirement that it be
290 TYPEBITS-aligned. */ 306 TYPEBITS-aligned. */
291#if defined USE_LSB_TAG && !defined DECL_ALIGN 307#ifndef DECL_ALIGN
292/* What compiler directive should we use for non-gcc compilers? -stef */ 308/* What compiler directive should we use for non-gcc compilers? -stef */
293# if defined (__GNUC__) 309# if defined (__GNUC__)
294# define DECL_ALIGN(type, var) \ 310# define DECL_ALIGN(type, var) \
295 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var 311 type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var
296# else
297# error "USE_LSB_TAG used without defining DECL_ALIGN"
298# endif 312# endif
299#endif 313#endif
300 314
301#ifndef USE_LSB_TAG 315/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */
316#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX
317/* We also need to be able to specify mult-of-8 alignment on static vars. */
318# if defined DECL_ALIGN
319/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */
320# if defined NO_UNION_TYPE
321# define USE_LSB_TAG
322# endif
323# endif
324#endif
325
302/* Just remove the alignment annotation if we don't use it. */ 326/* Just remove the alignment annotation if we don't use it. */
303#undef DECL_ALIGN 327#ifndef DECL_ALIGN
304#define DECL_ALIGN(type, var) type var 328# ifdef USE_LSB_TAG
329# error "USE_LSB_TAG used without defining DECL_ALIGN"
330# endif
331# define DECL_ALIGN(type, var) type var
305#endif 332#endif
306 333
307 334
@@ -2857,6 +2884,10 @@ extern int indented_beyond_p P_ ((int, int, double));
2857extern void syms_of_indent P_ ((void)); 2884extern void syms_of_indent P_ ((void));
2858 2885
2859/* defined in frame.c */ 2886/* defined in frame.c */
2887#ifdef HAVE_WINDOW_SYSTEM
2888extern Lisp_Object Vx_resource_name;
2889extern Lisp_Object Vx_resource_class;
2890#endif /* HAVE_WINDOW_SYSTEM */
2860extern Lisp_Object Qvisible; 2891extern Lisp_Object Qvisible;
2861extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object)); 2892extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object));
2862extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object)); 2893extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object));
@@ -3079,11 +3110,12 @@ extern int getloadavg P_ ((double *, int));
3079#ifdef HAVE_X_WINDOWS 3110#ifdef HAVE_X_WINDOWS
3080/* Defined in xfns.c */ 3111/* Defined in xfns.c */
3081extern void syms_of_xfns P_ ((void)); 3112extern void syms_of_xfns P_ ((void));
3082extern Lisp_Object Vx_resource_name; 3113#endif /* HAVE_X_WINDOWS */
3083extern Lisp_Object Vx_resource_class; 3114#ifdef HAVE_WINDOW_SYSTEM
3115/* Defined in xfns.c, w32fns.c, or macfns.c */
3084EXFUN (Fxw_display_color_p, 1); 3116EXFUN (Fxw_display_color_p, 1);
3085EXFUN (Fx_file_dialog, 4); 3117EXFUN (Fx_file_dialog, 4);
3086#endif /* HAVE_X_WINDOWS */ 3118#endif /* HAVE_WINDOW_SYSTEM */
3087 3119
3088/* Defined in xsmfns.c */ 3120/* Defined in xsmfns.c */
3089extern void syms_of_xsmfns P_ ((void)); 3121extern void syms_of_xsmfns P_ ((void));
@@ -3109,9 +3141,7 @@ extern void xfree P_ ((POINTER_TYPE *));
3109 3141
3110extern char *xstrdup P_ ((const char *)); 3142extern char *xstrdup P_ ((const char *));
3111 3143
3112#ifndef USE_CRT_DLL
3113extern char *egetenv P_ ((char *)); 3144extern char *egetenv P_ ((char *));
3114#endif
3115 3145
3116/* Set up the name of the machine we're running on. */ 3146/* Set up the name of the machine we're running on. */
3117extern void init_system_name P_ ((void)); 3147extern void init_system_name P_ ((void));
diff --git a/src/macfns.c b/src/macfns.c
index dbb8adb3fe1..625ca29336c 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -2598,7 +2598,7 @@ This function is an internal primitive--use `make-frame' instead. */)
2598 2598
2599 if (!NILP (parent)) 2599 if (!NILP (parent))
2600 { 2600 {
2601 f->output_data.mac->parent_desc = (Window) parent; 2601 f->output_data.mac->parent_desc = (Window) XFASTINT (parent);
2602 f->output_data.mac->explicit_parent = 1; 2602 f->output_data.mac->explicit_parent = 1;
2603 } 2603 }
2604 else 2604 else
@@ -2708,7 +2708,7 @@ This function is an internal primitive--use `make-frame' instead. */)
2708 2708
2709 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), 2709 x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1),
2710 "menuBar", "MenuBar", RES_TYPE_NUMBER); 2710 "menuBar", "MenuBar", RES_TYPE_NUMBER);
2711 x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), 2711 x_default_parameter (f, parms, Qtool_bar_lines, make_number (1),
2712 "toolBar", "ToolBar", RES_TYPE_NUMBER); 2712 "toolBar", "ToolBar", RES_TYPE_NUMBER);
2713 x_default_parameter (f, parms, Qbuffer_predicate, Qnil, 2713 x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
2714 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); 2714 "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
diff --git a/src/macmenu.c b/src/macmenu.c
index 06b1b16cf41..de768d4aea5 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1424,7 +1424,8 @@ set_frame_menubar (f, first_time, deep_p)
1424 1424
1425 for (i = 0; i < previous_menu_items_used; i++) 1425 for (i = 0; i < previous_menu_items_used; i++)
1426 if (menu_items_used == i 1426 if (menu_items_used == i
1427 || (!Fequal (previous_items[i], XVECTOR (menu_items)->contents[i]))) 1427 || (NILP (Fequal (previous_items[i],
1428 XVECTOR (menu_items)->contents[i]))))
1428 break; 1429 break;
1429 if (i == menu_items_used && i == previous_menu_items_used && i != 0) 1430 if (i == menu_items_used && i == previous_menu_items_used && i != 0)
1430 { 1431 {
diff --git a/src/macterm.c b/src/macterm.c
index 1a281d808a0..9351fd5e36f 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -1210,7 +1210,7 @@ x_flush (f)
1210 FOR_EACH_FRAME (rest, frame) 1210 FOR_EACH_FRAME (rest, frame)
1211 x_flush (XFRAME (frame)); 1211 x_flush (XFRAME (frame));
1212 } 1212 }
1213 else if (FRAME_X_P (f)) 1213 else if (FRAME_MAC_P (f))
1214 XFlush (FRAME_MAC_DISPLAY (f)); 1214 XFlush (FRAME_MAC_DISPLAY (f));
1215 UNBLOCK_INPUT; 1215 UNBLOCK_INPUT;
1216#endif /* TARGET_API_MAC_CARBON */ 1216#endif /* TARGET_API_MAC_CARBON */
@@ -1410,7 +1410,7 @@ static void
1410XTframe_up_to_date (f) 1410XTframe_up_to_date (f)
1411 struct frame *f; 1411 struct frame *f;
1412{ 1412{
1413 if (FRAME_X_P (f)) 1413 if (FRAME_MAC_P (f))
1414 { 1414 {
1415 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); 1415 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
1416 1416
@@ -7033,8 +7033,8 @@ static int
7033mac_get_emulated_btn ( UInt32 modifiers ) 7033mac_get_emulated_btn ( UInt32 modifiers )
7034{ 7034{
7035 int result = 0; 7035 int result = 0;
7036 if (Vmac_emulate_three_button_mouse != Qnil) { 7036 if (!NILP (Vmac_emulate_three_button_mouse)) {
7037 int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse); 7037 int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse);
7038 if (modifiers & controlKey) 7038 if (modifiers & controlKey)
7039 result = cmdIs3 ? 2 : 1; 7039 result = cmdIs3 ? 2 : 1;
7040 else if (modifiers & optionKey) 7040 else if (modifiers & optionKey)
@@ -7052,7 +7052,7 @@ mac_event_to_emacs_modifiers (EventRef eventRef)
7052 UInt32 mods = 0; 7052 UInt32 mods = 0;
7053 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, 7053 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL,
7054 sizeof (UInt32), NULL, &mods); 7054 sizeof (UInt32), NULL, &mods);
7055 if (Vmac_emulate_three_button_mouse != Qnil && 7055 if (!NILP (Vmac_emulate_three_button_mouse) &&
7056 GetEventClass(eventRef) == kEventClassMouse) 7056 GetEventClass(eventRef) == kEventClassMouse)
7057 { 7057 {
7058 mods &= ~(optionKey & cmdKey); 7058 mods &= ~(optionKey & cmdKey);
@@ -7071,7 +7071,7 @@ mac_get_mouse_btn (EventRef ref)
7071 switch (result) 7071 switch (result)
7072 { 7072 {
7073 case kEventMouseButtonPrimary: 7073 case kEventMouseButtonPrimary:
7074 if (Vmac_emulate_three_button_mouse == Qnil) 7074 if (NILP (Vmac_emulate_three_button_mouse))
7075 return 0; 7075 return 0;
7076 else { 7076 else {
7077 UInt32 mods = 0; 7077 UInt32 mods = 0;
@@ -8227,7 +8227,7 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8227 inev.timestamp = er.when * (1000 / 60); 8227 inev.timestamp = er.when * (1000 / 60);
8228 /* ticks to milliseconds */ 8228 /* ticks to milliseconds */
8229 8229
8230 XSETINT (inev.x, tracked_scroll_bar->left + 2); 8230 XSETINT (inev.x, XFASTINT (tracked_scroll_bar->left) + 2);
8231 XSETINT (inev.y, mouse_loc.v - 24); 8231 XSETINT (inev.y, mouse_loc.v - 24);
8232 tracked_scroll_bar->dragging = Qnil; 8232 tracked_scroll_bar->dragging = Qnil;
8233 mouse_tracking_in_progress = mouse_tracking_none; 8233 mouse_tracking_in_progress = mouse_tracking_none;
@@ -8312,6 +8312,8 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8312 else 8312 else
8313 { 8313 {
8314 Lisp_Object window; 8314 Lisp_Object window;
8315 int x = mouse_loc.h;
8316 int y = mouse_loc.v;
8315 8317
8316 XSETFRAME (inev.frame_or_window, mwp->mFP); 8318 XSETFRAME (inev.frame_or_window, mwp->mFP);
8317 if (er.what == mouseDown) 8319 if (er.what == mouseDown)
@@ -8319,14 +8321,14 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8319 = mouse_tracking_mouse_movement; 8321 = mouse_tracking_mouse_movement;
8320 else 8322 else
8321 mouse_tracking_in_progress = mouse_tracking_none; 8323 mouse_tracking_in_progress = mouse_tracking_none;
8322 window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1); 8324 window = window_from_coordinates (mwp->mFP, x, y, 0, 0, 0, 1);
8323 8325
8324 if (EQ (window, mwp->mFP->tool_bar_window)) 8326 if (EQ (window, mwp->mFP->tool_bar_window))
8325 { 8327 {
8326 if (er.what == mouseDown) 8328 if (er.what == mouseDown)
8327 handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0); 8329 handle_tool_bar_click (mwp->mFP, x, y, 1, 0);
8328 else 8330 else
8329 handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0, 8331 handle_tool_bar_click (mwp->mFP, x, y, 0,
8330#if USE_CARBON_EVENTS 8332#if USE_CARBON_EVENTS
8331 mac_event_to_emacs_modifiers (eventRef) 8333 mac_event_to_emacs_modifiers (eventRef)
8332#else 8334#else
@@ -9024,7 +9026,7 @@ mac_check_for_quit_char ()
9024 EVENT_INIT (e); 9026 EVENT_INIT (e);
9025 e.kind = ASCII_KEYSTROKE_EVENT; 9027 e.kind = ASCII_KEYSTROKE_EVENT;
9026 e.code = quit_char; 9028 e.code = quit_char;
9027 e.arg = NULL; 9029 e.arg = Qnil;
9028 e.modifiers = NULL; 9030 e.modifiers = NULL;
9029 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 9031 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9030 XSETFRAME (e.frame_or_window, mwp->mFP); 9032 XSETFRAME (e.frame_or_window, mwp->mFP);
diff --git a/src/macterm.h b/src/macterm.h
index 1b4148ed71d..6ce034e9534 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -562,8 +562,18 @@ struct scroll_bar {
562 text from glomming up against the scroll bar */ 562 text from glomming up against the scroll bar */
563#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) 563#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
564 564
565 565struct frame;
566struct frame * check_x_frame (Lisp_Object); 566struct face;
567struct image;
568
569Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
570 Lisp_Object, Lisp_Object,
571 Lisp_Object, Lisp_Object));
572struct frame *check_x_frame P_ ((Lisp_Object));
573EXFUN (Fx_display_color_p, 1);
574EXFUN (Fx_display_grayscale_p, 1);
575EXFUN (Fx_display_planes, 1);
576extern void x_free_gcs P_ ((struct frame *));
567 577
568void activate_scroll_bars (FRAME_PTR); 578void activate_scroll_bars (FRAME_PTR);
569void deactivate_scroll_bars (FRAME_PTR); 579void deactivate_scroll_bars (FRAME_PTR);
diff --git a/src/msdos.c b/src/msdos.c
index 6c534d6d2d9..da7fab89c7e 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -951,8 +951,8 @@ static void
951IT_write_glyphs (struct glyph *str, int str_len) 951IT_write_glyphs (struct glyph *str, int str_len)
952{ 952{
953 unsigned char *screen_buf, *screen_bp, *screen_buf_end, *bp; 953 unsigned char *screen_buf, *screen_bp, *screen_buf_end, *bp;
954 int unsupported_face = FAST_GLYPH_FACE (Vdos_unsupported_char_glyph); 954 int unsupported_face = 0;
955 unsigned unsupported_char= FAST_GLYPH_CHAR (Vdos_unsupported_char_glyph); 955 unsigned unsupported_char = '\177';
956 int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); 956 int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y);
957 register int sl = str_len; 957 register int sl = str_len;
958 register int tlen = GLYPH_TABLE_LENGTH; 958 register int tlen = GLYPH_TABLE_LENGTH;
@@ -978,6 +978,13 @@ IT_write_glyphs (struct glyph *str, int str_len)
978 978
979 if (str_len <= 0) return; 979 if (str_len <= 0) return;
980 980
981 /* Set up the unsupported character glyph */
982 if (!NILP (Vdos_unsupported_char_glyph))
983 {
984 unsupported_char = FAST_GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph));
985 unsupported_face = FAST_GLYPH_FACE (XINT (Vdos_unsupported_char_glyph));
986 }
987
981 screen_buf = screen_bp = alloca (str_len * 2); 988 screen_buf = screen_bp = alloca (str_len * 2);
982 screen_buf_end = screen_buf + str_len * 2; 989 screen_buf_end = screen_buf + str_len * 2;
983 sf = SELECTED_FRAME(); 990 sf = SELECTED_FRAME();
@@ -1042,7 +1049,7 @@ IT_write_glyphs (struct glyph *str, int str_len)
1042 if (! CHAR_VALID_P (ch, 0)) 1049 if (! CHAR_VALID_P (ch, 0))
1043 { 1050 {
1044 g = !NILP (Vdos_unsupported_char_glyph) 1051 g = !NILP (Vdos_unsupported_char_glyph)
1045 ? Vdos_unsupported_char_glyph 1052 ? XINT (Vdos_unsupported_char_glyph)
1046 : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g)); 1053 : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g));
1047 ch = FAST_GLYPH_CHAR (g); 1054 ch = FAST_GLYPH_CHAR (g);
1048 } 1055 }
@@ -1572,7 +1579,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1572 { 1579 {
1573 extern Lisp_Object Qmouse_face; 1580 extern Lisp_Object Qmouse_face;
1574 Lisp_Object mouse_face, overlay, position, *overlay_vec; 1581 Lisp_Object mouse_face, overlay, position, *overlay_vec;
1575 int len, noverlays, obegv, ozv;; 1582 int noverlays, obegv, ozv;;
1576 struct buffer *obuf; 1583 struct buffer *obuf;
1577 1584
1578 /* If we get an out-of-range value, return now; avoid an error. */ 1585 /* If we get an out-of-range value, return now; avoid an error. */
@@ -1591,20 +1598,8 @@ IT_note_mouse_highlight (struct frame *f, int x, int y)
1591 /* Is this char mouse-active or does it have help-echo? */ 1598 /* Is this char mouse-active or does it have help-echo? */
1592 XSETINT (position, pos); 1599 XSETINT (position, pos);
1593 1600
1594 /* Put all the overlays we want in a vector in overlay_vec. 1601 /* Put all the overlays we want in a vector in overlay_vec. */
1595 Store the length in len. If there are more than 10, make 1602 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
1596 enough space for all, and try again. */
1597 len = 10;
1598 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
1599 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
1600 if (noverlays > len)
1601 {
1602 len = noverlays;
1603 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
1604 noverlays = overlays_at (pos,
1605 0, &overlay_vec, &len, NULL, NULL, 0);
1606 }
1607
1608 /* Sort overlays into increasing priority order. */ 1603 /* Sort overlays into increasing priority order. */
1609 noverlays = sort_overlays (overlay_vec, noverlays, w); 1604 noverlays = sort_overlays (overlay_vec, noverlays, w);
1610 1605
@@ -5292,7 +5287,7 @@ syms_of_msdos ()
5292 DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph, 5287 DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph,
5293 doc: /* *Glyph to display instead of chars not supported by current codepage. 5288 doc: /* *Glyph to display instead of chars not supported by current codepage.
5294This variable is used only by MSDOS terminals. */); 5289This variable is used only by MSDOS terminals. */);
5295 Vdos_unsupported_char_glyph = '\177'; 5290 Vdos_unsupported_char_glyph = make_number ('\177');
5296 5291
5297#endif 5292#endif
5298#ifndef subprocesses 5293#ifndef subprocesses
diff --git a/src/print.c b/src/print.c
index e729b468fd1..74f8fad8d15 100644
--- a/src/print.c
+++ b/src/print.c
@@ -791,7 +791,7 @@ A printed representation of an object is text which describes that object. */)
791 if (SBYTES (object) == SCHARS (object)) 791 if (SBYTES (object) == SCHARS (object))
792 STRING_SET_UNIBYTE (object); 792 STRING_SET_UNIBYTE (object);
793 793
794 /* Note that this won't make prepare_to_modify_buffer call 794 /* Note that this won't make prepare_to_modify_buffer call
795 ask-user-about-supersession-threat because this buffer 795 ask-user-about-supersession-threat because this buffer
796 does not visit a file. */ 796 does not visit a file. */
797 Ferase_buffer (); 797 Ferase_buffer ();
@@ -929,7 +929,7 @@ DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugg
929 doc: /* Redirect debugging output (stderr stream) to file FILE. 929 doc: /* Redirect debugging output (stderr stream) to file FILE.
930If FILE is nil, reset target to the initial stderr stream. 930If FILE is nil, reset target to the initial stderr stream.
931Optional arg APPEND non-nil (interactively, with prefix arg) means 931Optional arg APPEND non-nil (interactively, with prefix arg) means
932append to existing target file. */) 932append to existing target file. */)
933 (file, append) 933 (file, append)
934 Lisp_Object file, append; 934 Lisp_Object file, append;
935{ 935{
@@ -1280,6 +1280,26 @@ print_preprocess (obj)
1280{ 1280{
1281 int i; 1281 int i;
1282 EMACS_INT size; 1282 EMACS_INT size;
1283 int loop_count = 0;
1284 Lisp_Object halftail;
1285
1286 /* Avoid infinite recursion for circular nested structure
1287 in the case where Vprint_circle is nil. */
1288 if (NILP (Vprint_circle))
1289 {
1290 for (i = 0; i < print_depth; i++)
1291 if (EQ (obj, being_printed[i]))
1292 return;
1293 being_printed[print_depth] = obj;
1294 }
1295
1296 /* Give up if we go so deep that print_object will get an error. */
1297 /* See similar code in print_object. */
1298 if (print_depth >= PRINT_CIRCLE)
1299 return;
1300
1301 print_depth++;
1302 halftail = obj;
1283 1303
1284 loop: 1304 loop:
1285 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) 1305 if (STRINGP (obj) || CONSP (obj) || VECTORP (obj)
@@ -1340,8 +1360,15 @@ print_preprocess (obj)
1340 break; 1360 break;
1341 1361
1342 case Lisp_Cons: 1362 case Lisp_Cons:
1363 /* Use HALFTAIL and LOOP_COUNT to detect circular lists,
1364 just as in print_object. */
1365 if (loop_count && EQ (obj, halftail))
1366 break;
1343 print_preprocess (XCAR (obj)); 1367 print_preprocess (XCAR (obj));
1344 obj = XCDR (obj); 1368 obj = XCDR (obj);
1369 loop_count++;
1370 if (!(loop_count & 1))
1371 halftail = XCDR (halftail);
1345 goto loop; 1372 goto loop;
1346 1373
1347 case Lisp_Vectorlike: 1374 case Lisp_Vectorlike:
@@ -1356,6 +1383,7 @@ print_preprocess (obj)
1356 break; 1383 break;
1357 } 1384 }
1358 } 1385 }
1386 print_depth--;
1359} 1387}
1360 1388
1361static void 1389static void
@@ -1372,7 +1400,7 @@ print_object (obj, printcharfun, escapeflag)
1372 register Lisp_Object printcharfun; 1400 register Lisp_Object printcharfun;
1373 int escapeflag; 1401 int escapeflag;
1374{ 1402{
1375 char buf[30]; 1403 char buf[40];
1376 1404
1377 QUIT; 1405 QUIT;
1378 1406
@@ -1426,6 +1454,7 @@ print_object (obj, printcharfun, escapeflag)
1426 1454
1427 print_depth++; 1455 print_depth++;
1428 1456
1457 /* See similar code in print_preprocess. */
1429 if (print_depth > PRINT_CIRCLE) 1458 if (print_depth > PRINT_CIRCLE)
1430 error ("Apparently circular structure being printed"); 1459 error ("Apparently circular structure being printed");
1431#ifdef MAX_PRINT_CHARS 1460#ifdef MAX_PRINT_CHARS
diff --git a/src/process.c b/src/process.c
index db7e31dd244..d5e76b29b98 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1457,12 +1457,12 @@ static Lisp_Object start_process_unwind ();
1457DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, 1457DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0,
1458 doc: /* Start a program in a subprocess. Return the process object for it. 1458 doc: /* Start a program in a subprocess. Return the process object for it.
1459NAME is name for process. It is modified if necessary to make it unique. 1459NAME is name for process. It is modified if necessary to make it unique.
1460BUFFER is the buffer or (buffer-name) to associate with the process. 1460BUFFER is the buffer (or buffer name) to associate with the process.
1461 Process output goes at end of that buffer, unless you specify 1461 Process output goes at end of that buffer, unless you specify
1462 an output stream or filter function to handle the output. 1462 an output stream or filter function to handle the output.
1463 BUFFER may be also nil, meaning that this process is not associated 1463 BUFFER may be also nil, meaning that this process is not associated
1464 with any buffer. 1464 with any buffer.
1465Third arg is program file name. It is searched for in PATH. 1465PROGRAM is the program file name. It is searched for in PATH.
1466Remaining arguments are strings to give program as arguments. 1466Remaining arguments are strings to give program as arguments.
1467 1467
1468usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) 1468usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
@@ -4018,8 +4018,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
4018 int do_display; 4018 int do_display;
4019{ 4019{
4020 register int channel, nfds; 4020 register int channel, nfds;
4021 static SELECT_TYPE Available; 4021 SELECT_TYPE Available;
4022 static SELECT_TYPE Connecting; 4022 SELECT_TYPE Connecting;
4023 int check_connect, check_delay, no_avail; 4023 int check_connect, check_delay, no_avail;
4024 int xerrno; 4024 int xerrno;
4025 Lisp_Object proc; 4025 Lisp_Object proc;
@@ -4030,6 +4030,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
4030 /* Either nil or a cons cell, the car of which is of interest and 4030 /* Either nil or a cons cell, the car of which is of interest and
4031 may be changed outside of this routine. */ 4031 may be changed outside of this routine. */
4032 Lisp_Object wait_for_cell = Qnil; 4032 Lisp_Object wait_for_cell = Qnil;
4033 int saved_waiting_for_user_input_p = waiting_for_user_input_p;
4033 4034
4034 FD_ZERO (&Available); 4035 FD_ZERO (&Available);
4035 FD_ZERO (&Connecting); 4036 FD_ZERO (&Connecting);
@@ -4643,7 +4644,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
4643 } /* end for each file descriptor */ 4644 } /* end for each file descriptor */
4644 } /* end while exit conditions not met */ 4645 } /* end while exit conditions not met */
4645 4646
4646 waiting_for_user_input_p = 0; 4647 waiting_for_user_input_p = saved_waiting_for_user_input_p;
4647 4648
4648 /* If calling from keyboard input, do not quit 4649 /* If calling from keyboard input, do not quit
4649 since we want to return C-g as an input character. 4650 since we want to return C-g as an input character.
@@ -4894,6 +4895,8 @@ read_process_output (proc, channel)
4894 } 4895 }
4895 4896
4896 carryover = nbytes - coding->consumed; 4897 carryover = nbytes - coding->consumed;
4898 if (SCHARS (p->decoding_buf) < carryover)
4899 p->decoding_buf = make_uninit_string (carryover);
4897 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 4900 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
4898 carryover); 4901 carryover);
4899 XSETINT (p->decoding_carryover, carryover); 4902 XSETINT (p->decoding_carryover, carryover);
@@ -4998,6 +5001,8 @@ read_process_output (proc, channel)
4998 } 5001 }
4999 } 5002 }
5000 carryover = nbytes - coding->consumed; 5003 carryover = nbytes - coding->consumed;
5004 if (SCHARS (p->decoding_buf) < carryover)
5005 p->decoding_buf = make_uninit_string (carryover);
5001 bcopy (chars + coding->consumed, SDATA (p->decoding_buf), 5006 bcopy (chars + coding->consumed, SDATA (p->decoding_buf),
5002 carryover); 5007 carryover);
5003 XSETINT (p->decoding_carryover, carryover); 5008 XSETINT (p->decoding_carryover, carryover);
diff --git a/src/regex.c b/src/regex.c
index a145183510d..a518ef81a0c 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -4661,7 +4661,7 @@ mutually_exclusive_p (bufp, p1, p2)
4661 case wordbeg: 4661 case wordbeg:
4662 case syntaxspec: 4662 case syntaxspec:
4663 return ((re_opcode_t) *p1 == notsyntaxspec 4663 return ((re_opcode_t) *p1 == notsyntaxspec
4664 && p1[1] == (op2 == wordend ? Sword : p2[1])); 4664 && p1[1] == (op2 == wordbeg ? Sword : p2[1]));
4665 4665
4666 case wordbound: 4666 case wordbound:
4667 return (((re_opcode_t) *p1 == notsyntaxspec 4667 return (((re_opcode_t) *p1 == notsyntaxspec
diff --git a/src/textprop.c b/src/textprop.c
index 4f13aefb1be..c8ec008dcbd 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -637,30 +637,13 @@ get_char_property_and_overlay (position, prop, object, overlay)
637 } 637 }
638 if (BUFFERP (object)) 638 if (BUFFERP (object))
639 { 639 {
640 int posn = XINT (position);
641 int noverlays; 640 int noverlays;
642 Lisp_Object *overlay_vec, tem; 641 Lisp_Object *overlay_vec;
643 int len;
644 struct buffer *obuf = current_buffer; 642 struct buffer *obuf = current_buffer;
645 643
646 set_buffer_temp (XBUFFER (object)); 644 set_buffer_temp (XBUFFER (object));
647 645
648 /* First try with room for 40 overlays. */ 646 GET_OVERLAYS_AT (XINT (position), overlay_vec, noverlays, NULL, 0);
649 len = 40;
650 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
651
652 noverlays = overlays_at (posn, 0, &overlay_vec, &len,
653 NULL, NULL, 0);
654
655 /* If there are more than 40,
656 make enough space for all, and try again. */
657 if (noverlays > len)
658 {
659 len = noverlays;
660 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
661 noverlays = overlays_at (posn, 0, &overlay_vec, &len,
662 NULL, NULL, 0);
663 }
664 noverlays = sort_overlays (overlay_vec, noverlays, w); 647 noverlays = sort_overlays (overlay_vec, noverlays, w);
665 648
666 set_buffer_temp (obuf); 649 set_buffer_temp (obuf);
@@ -668,7 +651,7 @@ get_char_property_and_overlay (position, prop, object, overlay)
668 /* Now check the overlays in order of decreasing priority. */ 651 /* Now check the overlays in order of decreasing priority. */
669 while (--noverlays >= 0) 652 while (--noverlays >= 0)
670 { 653 {
671 tem = Foverlay_get (overlay_vec[noverlays], prop); 654 Lisp_Object tem = Foverlay_get (overlay_vec[noverlays], prop);
672 if (!NILP (tem)) 655 if (!NILP (tem))
673 { 656 {
674 if (overlay) 657 if (overlay)
diff --git a/src/w32.c b/src/w32.c
index 98d630529e6..12d1f21b091 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -105,7 +105,7 @@ void globals_of_w32 ();
105extern Lisp_Object Vw32_downcase_file_names; 105extern Lisp_Object Vw32_downcase_file_names;
106extern Lisp_Object Vw32_generate_fake_inodes; 106extern Lisp_Object Vw32_generate_fake_inodes;
107extern Lisp_Object Vw32_get_true_file_attributes; 107extern Lisp_Object Vw32_get_true_file_attributes;
108extern Lisp_Object Vw32_num_mouse_buttons; 108extern int w32_num_mouse_buttons;
109 109
110 110
111/* 111/*
@@ -1094,7 +1094,7 @@ init_environment (char ** argv)
1094 /* Determine if there is a middle mouse button, to allow parse_button 1094 /* Determine if there is a middle mouse button, to allow parse_button
1095 to decide whether right mouse events should be mouse-2 or 1095 to decide whether right mouse events should be mouse-2 or
1096 mouse-3. */ 1096 mouse-3. */
1097 XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS)); 1097 w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
1098 1098
1099 init_user_info (); 1099 init_user_info ();
1100} 1100}
@@ -1627,7 +1627,7 @@ static WIN32_FIND_DATA dir_find_data;
1627/* Support shares on a network resource as subdirectories of a read-only 1627/* Support shares on a network resource as subdirectories of a read-only
1628 root directory. */ 1628 root directory. */
1629static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE; 1629static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE;
1630HANDLE open_unc_volume (char *); 1630HANDLE open_unc_volume (const char *);
1631char *read_unc_volume (HANDLE, char *, int); 1631char *read_unc_volume (HANDLE, char *, int);
1632void close_unc_volume (HANDLE); 1632void close_unc_volume (HANDLE);
1633 1633
@@ -1740,7 +1740,7 @@ readdir (DIR *dirp)
1740} 1740}
1741 1741
1742HANDLE 1742HANDLE
1743open_unc_volume (char *path) 1743open_unc_volume (const char *path)
1744{ 1744{
1745 NETRESOURCE nr; 1745 NETRESOURCE nr;
1746 HANDLE henum; 1746 HANDLE henum;
@@ -1797,7 +1797,7 @@ close_unc_volume (HANDLE henum)
1797} 1797}
1798 1798
1799DWORD 1799DWORD
1800unc_volume_file_attributes (char *path) 1800unc_volume_file_attributes (const char *path)
1801{ 1801{
1802 HANDLE henum; 1802 HANDLE henum;
1803 DWORD attrs; 1803 DWORD attrs;
@@ -3486,7 +3486,7 @@ sys_pipe (int * phandles)
3486} 3486}
3487 3487
3488/* From ntproc.c */ 3488/* From ntproc.c */
3489extern Lisp_Object Vw32_pipe_read_delay; 3489extern int w32_pipe_read_delay;
3490 3490
3491/* Function to do blocking read of one byte, needed to implement 3491/* Function to do blocking read of one byte, needed to implement
3492 select. It is only allowed on sockets and pipes. */ 3492 select. It is only allowed on sockets and pipes. */
@@ -3526,7 +3526,7 @@ _sys_read_ahead (int fd)
3526 shell on NT is very slow if we don't do this. */ 3526 shell on NT is very slow if we don't do this. */
3527 if (rc > 0) 3527 if (rc > 0)
3528 { 3528 {
3529 int wait = XINT (Vw32_pipe_read_delay); 3529 int wait = w32_pipe_read_delay;
3530 3530
3531 if (wait > 0) 3531 if (wait > 0)
3532 Sleep (wait); 3532 Sleep (wait);
diff --git a/src/w32console.c b/src/w32console.c
index 14885f90730..b2d340d579c 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -55,18 +55,18 @@ extern int meta_key;
55 55
56static void move_cursor (int row, int col); 56static void move_cursor (int row, int col);
57static void clear_to_end (void); 57static void clear_to_end (void);
58static void clear_frame (void); 58void clear_frame (void);
59static void clear_end_of_line (int); 59void clear_end_of_line (int);
60static void ins_del_lines (int vpos, int n); 60static void ins_del_lines (int vpos, int n);
61static void insert_glyphs (struct glyph *start, int len); 61void insert_glyphs (struct glyph *start, int len);
62static void write_glyphs (struct glyph *string, int len); 62void write_glyphs (struct glyph *string, int len);
63static void delete_glyphs (int n); 63void delete_glyphs (int n);
64void w32_sys_ring_bell (void); 64void w32_sys_ring_bell (void);
65static void reset_terminal_modes (void); 65void reset_terminal_modes (void);
66static void set_terminal_modes (void); 66void set_terminal_modes (void);
67static void set_terminal_window (int size); 67void set_terminal_window (int size);
68static void update_begin (struct frame * f); 68void update_begin (struct frame * f);
69static void update_end (struct frame * f); 69void update_end (struct frame * f);
70static WORD w32_face_attributes (struct frame *f, int face_id); 70static WORD w32_face_attributes (struct frame *f, int face_id);
71 71
72static COORD cursor_coords; 72static COORD cursor_coords;
@@ -103,7 +103,7 @@ ctrl_c_handler (unsigned long type)
103#define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ()) 103#define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ())
104 104
105/* Move the cursor to (row, col). */ 105/* Move the cursor to (row, col). */
106void 106static void
107move_cursor (int row, int col) 107move_cursor (int row, int col)
108{ 108{
109 cursor_coords.X = col; 109 cursor_coords.X = col;
@@ -116,7 +116,7 @@ move_cursor (int row, int col)
116} 116}
117 117
118/* Clear from cursor to end of screen. */ 118/* Clear from cursor to end of screen. */
119void 119static void
120clear_to_end (void) 120clear_to_end (void)
121{ 121{
122 struct frame * f = PICK_FRAME (); 122 struct frame * f = PICK_FRAME ();
@@ -240,7 +240,7 @@ ins_del_lines (int vpos, int n)
240#define LEFT 1 240#define LEFT 1
241#define RIGHT 0 241#define RIGHT 0
242 242
243void 243static void
244scroll_line (int dist, int direction) 244scroll_line (int dist, int direction)
245{ 245{
246 /* The idea here is to implement a horizontal scroll in one line to 246 /* The idea here is to implement a horizontal scroll in one line to
diff --git a/src/w32fns.c b/src/w32fns.c
index fc40f5f68da..f56ecc35cc6 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,5 +1,5 @@
1/* Graphical user interface functions for the Microsoft W32 API. 1/* Graphical user interface functions for the Microsoft W32 API.
2 Copyright (C) 1989, 92, 93, 94, 95, 1996, 1997, 1998, 1999, 2000, 2001 2 Copyright (C) 1989, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 01, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -88,7 +88,7 @@ Lisp_Object Vw32_pass_alt_to_system;
88Lisp_Object Vw32_alt_is_meta; 88Lisp_Object Vw32_alt_is_meta;
89 89
90/* If non-zero, the windows virtual key code for an alternative quit key. */ 90/* If non-zero, the windows virtual key code for an alternative quit key. */
91Lisp_Object Vw32_quit_key; 91int w32_quit_key;
92 92
93/* Non nil if left window key events are passed on to Windows (this only 93/* Non nil if left window key events are passed on to Windows (this only
94 affects whether "tapping" the key opens the Start menu). */ 94 affects whether "tapping" the key opens the Start menu). */
@@ -132,11 +132,11 @@ Lisp_Object Vw32_enable_palette;
132 132
133/* Control how close left/right button down events must be to 133/* Control how close left/right button down events must be to
134 be converted to a middle button down event. */ 134 be converted to a middle button down event. */
135Lisp_Object Vw32_mouse_button_tolerance; 135int w32_mouse_button_tolerance;
136 136
137/* Minimum interval between mouse movement (and scroll bar drag) 137/* Minimum interval between mouse movement (and scroll bar drag)
138 events that are passed on to the event loop. */ 138 events that are passed on to the event loop. */
139Lisp_Object Vw32_mouse_move_interval; 139int w32_mouse_move_interval;
140 140
141/* Flag to indicate if XBUTTON events should be passed on to Windows. */ 141/* Flag to indicate if XBUTTON events should be passed on to Windows. */
142int w32_pass_extra_mouse_buttons_to_system; 142int w32_pass_extra_mouse_buttons_to_system;
@@ -235,7 +235,7 @@ Lisp_Object Qw32_charset_unicode;
235#endif 235#endif
236 236
237/* The ANSI codepage. */ 237/* The ANSI codepage. */
238Lisp_Object Vw32_ansi_code_page; 238int w32_ansi_code_page;
239 239
240/* Prefix for system colors. */ 240/* Prefix for system colors. */
241#define SYSTEM_COLOR_PREFIX "System" 241#define SYSTEM_COLOR_PREFIX "System"
@@ -283,7 +283,7 @@ int image_cache_refcount, dpyinfo_refcount;
283 283
284 284
285/* From w32term.c. */ 285/* From w32term.c. */
286extern Lisp_Object Vw32_num_mouse_buttons; 286extern int w32_num_mouse_buttons;
287extern Lisp_Object Vw32_recognize_altgr; 287extern Lisp_Object Vw32_recognize_altgr;
288 288
289extern HWND w32_system_caret_hwnd; 289extern HWND w32_system_caret_hwnd;
@@ -465,7 +465,7 @@ if the entry is new. */)
465 CHECK_NUMBER (blue); 465 CHECK_NUMBER (blue);
466 CHECK_STRING (name); 466 CHECK_STRING (name);
467 467
468 XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue))); 468 XSETINT (rgb, RGB(XUINT (red), XUINT (green), XUINT (blue)));
469 469
470 BLOCK_INPUT; 470 BLOCK_INPUT;
471 471
@@ -828,7 +828,7 @@ w32_to_x_color (rgb)
828 return Qnil; 828 return Qnil;
829} 829}
830 830
831COLORREF 831static Lisp_Object
832w32_color_map_lookup (colorname) 832w32_color_map_lookup (colorname)
833 char *colorname; 833 char *colorname;
834{ 834{
@@ -847,7 +847,7 @@ w32_color_map_lookup (colorname)
847 847
848 if (lstrcmpi (SDATA (tem), colorname) == 0) 848 if (lstrcmpi (SDATA (tem), colorname) == 0)
849 { 849 {
850 ret = XUINT (Fcdr (elt)); 850 ret = Fcdr (elt);
851 break; 851 break;
852 } 852 }
853 853
@@ -910,7 +910,7 @@ add_system_logical_colors_to_map (system_colors)
910} 910}
911 911
912 912
913COLORREF 913static Lisp_Object
914x_to_w32_color (colorname) 914x_to_w32_color (colorname)
915 char * colorname; 915 char * colorname;
916{ 916{
@@ -970,7 +970,8 @@ x_to_w32_color (colorname)
970 if (i == 2) 970 if (i == 2)
971 { 971 {
972 UNBLOCK_INPUT; 972 UNBLOCK_INPUT;
973 return (colorval); 973 XSETINT (ret, colorval);
974 return ret;
974 } 975 }
975 color = end; 976 color = end;
976 } 977 }
@@ -1023,7 +1024,8 @@ x_to_w32_color (colorname)
1023 if (*end != '\0') 1024 if (*end != '\0')
1024 break; 1025 break;
1025 UNBLOCK_INPUT; 1026 UNBLOCK_INPUT;
1026 return (colorval); 1027 XSETINT (ret, colorval);
1028 return ret;
1027 } 1029 }
1028 if (*end != '/') 1030 if (*end != '/')
1029 break; 1031 break;
@@ -1064,7 +1066,8 @@ x_to_w32_color (colorname)
1064 if (*end != '\0') 1066 if (*end != '\0')
1065 break; 1067 break;
1066 UNBLOCK_INPUT; 1068 UNBLOCK_INPUT;
1067 return (colorval); 1069 XSETINT (ret, colorval);
1070 return ret;
1068 } 1071 }
1069 if (*end != '/') 1072 if (*end != '/')
1070 break; 1073 break;
@@ -2418,6 +2421,10 @@ Lisp_Object w32_grabbed_keys;
2418#define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255) 2421#define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255)
2419#define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8) 2422#define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8)
2420 2423
2424#define RAW_HOTKEY_ID(k) ((k) & 0xbfff)
2425#define RAW_HOTKEY_VK_CODE(k) ((k) & 255)
2426#define RAW_HOTKEY_MODIFIERS(k) ((k) >> 8)
2427
2421/* Register hot-keys for reserved key combinations when Emacs has 2428/* Register hot-keys for reserved key combinations when Emacs has
2422 keyboard focus, since this is the only way Emacs can receive key 2429 keyboard focus, since this is the only way Emacs can receive key
2423 combinations like Alt-Tab which are used by the system. */ 2430 combinations like Alt-Tab which are used by the system. */
@@ -2499,20 +2506,20 @@ w32_msg_pump (deferred_msg * msg_buf)
2499 focus_window = GetFocus (); 2506 focus_window = GetFocus ();
2500 if (focus_window != NULL) 2507 if (focus_window != NULL)
2501 RegisterHotKey (focus_window, 2508 RegisterHotKey (focus_window,
2502 HOTKEY_ID (msg.wParam), 2509 RAW_HOTKEY_ID (msg.wParam),
2503 HOTKEY_MODIFIERS (msg.wParam), 2510 RAW_HOTKEY_MODIFIERS (msg.wParam),
2504 HOTKEY_VK_CODE (msg.wParam)); 2511 RAW_HOTKEY_VK_CODE (msg.wParam));
2505 /* Reply is not expected. */ 2512 /* Reply is not expected. */
2506 break; 2513 break;
2507 case WM_EMACS_UNREGISTER_HOT_KEY: 2514 case WM_EMACS_UNREGISTER_HOT_KEY:
2508 focus_window = GetFocus (); 2515 focus_window = GetFocus ();
2509 if (focus_window != NULL) 2516 if (focus_window != NULL)
2510 UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam)); 2517 UnregisterHotKey (focus_window, RAW_HOTKEY_ID (msg.wParam));
2511 /* Mark item as erased. NB: this code must be 2518 /* Mark item as erased. NB: this code must be
2512 thread-safe. The next line is okay because the cons 2519 thread-safe. The next line is okay because the cons
2513 cell is never made into garbage and is not relocated by 2520 cell is never made into garbage and is not relocated by
2514 GC. */ 2521 GC. */
2515 XSETCAR ((Lisp_Object) msg.lParam, Qnil); 2522 XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil);
2516 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) 2523 if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0))
2517 abort (); 2524 abort ();
2518 break; 2525 break;
@@ -2520,7 +2527,7 @@ w32_msg_pump (deferred_msg * msg_buf)
2520 { 2527 {
2521 int vk_code = (int) msg.wParam; 2528 int vk_code = (int) msg.wParam;
2522 int cur_state = (GetKeyState (vk_code) & 1); 2529 int cur_state = (GetKeyState (vk_code) & 1);
2523 Lisp_Object new_state = (Lisp_Object) msg.lParam; 2530 Lisp_Object new_state = (Lisp_Object) ((EMACS_INT) msg.lParam);
2524 2531
2525 /* NB: This code must be thread-safe. It is safe to 2532 /* NB: This code must be thread-safe. It is safe to
2526 call NILP because symbols are not relocated by GC, 2533 call NILP because symbols are not relocated by GC,
@@ -2710,7 +2717,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers)
2710 c = make_ctrl_char (c) & 0377; 2717 c = make_ctrl_char (c) & 0377;
2711 if (c == quit_char 2718 if (c == quit_char
2712 || (wmsg.dwModifiers == 0 && 2719 || (wmsg.dwModifiers == 0 &&
2713 XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key))) 2720 w32_quit_key && wParam == w32_quit_key))
2714 { 2721 {
2715 Vquit_flag = Qt; 2722 Vquit_flag = Qt;
2716 2723
@@ -3120,7 +3127,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3120 are used together, but only if user has two button mouse. */ 3127 are used together, but only if user has two button mouse. */
3121 case WM_LBUTTONDOWN: 3128 case WM_LBUTTONDOWN:
3122 case WM_RBUTTONDOWN: 3129 case WM_RBUTTONDOWN:
3123 if (XINT (Vw32_num_mouse_buttons) > 2) 3130 if (w32_num_mouse_buttons > 2)
3124 goto handle_plain_button; 3131 goto handle_plain_button;
3125 3132
3126 { 3133 {
@@ -3170,7 +3177,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3170 /* Hold onto message for now. */ 3177 /* Hold onto message for now. */
3171 mouse_button_timer = 3178 mouse_button_timer =
3172 SetTimer (hwnd, MOUSE_BUTTON_ID, 3179 SetTimer (hwnd, MOUSE_BUTTON_ID,
3173 XINT (Vw32_mouse_button_tolerance), NULL); 3180 w32_mouse_button_tolerance, NULL);
3174 saved_mouse_button_msg.msg.hwnd = hwnd; 3181 saved_mouse_button_msg.msg.hwnd = hwnd;
3175 saved_mouse_button_msg.msg.message = msg; 3182 saved_mouse_button_msg.msg.message = msg;
3176 saved_mouse_button_msg.msg.wParam = wParam; 3183 saved_mouse_button_msg.msg.wParam = wParam;
@@ -3183,7 +3190,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3183 3190
3184 case WM_LBUTTONUP: 3191 case WM_LBUTTONUP:
3185 case WM_RBUTTONUP: 3192 case WM_RBUTTONUP:
3186 if (XINT (Vw32_num_mouse_buttons) > 2) 3193 if (w32_num_mouse_buttons > 2)
3187 goto handle_plain_button; 3194 goto handle_plain_button;
3188 3195
3189 { 3196 {
@@ -3279,7 +3286,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3279 track_mouse_window = hwnd; 3286 track_mouse_window = hwnd;
3280 } 3287 }
3281 case WM_VSCROLL: 3288 case WM_VSCROLL:
3282 if (XINT (Vw32_mouse_move_interval) <= 0 3289 if (w32_mouse_move_interval <= 0
3283 || (msg == WM_MOUSEMOVE && button_state == 0)) 3290 || (msg == WM_MOUSEMOVE && button_state == 0))
3284 { 3291 {
3285 wmsg.dwModifiers = w32_get_modifiers (); 3292 wmsg.dwModifiers = w32_get_modifiers ();
@@ -3295,7 +3302,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3295 if (saved_mouse_move_msg.msg.hwnd == 0) 3302 if (saved_mouse_move_msg.msg.hwnd == 0)
3296 mouse_move_timer = 3303 mouse_move_timer =
3297 SetTimer (hwnd, MOUSE_MOVE_ID, 3304 SetTimer (hwnd, MOUSE_MOVE_ID,
3298 XINT (Vw32_mouse_move_interval), NULL); 3305 w32_mouse_move_interval, NULL);
3299 3306
3300 /* Hold onto message for now. */ 3307 /* Hold onto message for now. */
3301 saved_mouse_move_msg.msg.hwnd = hwnd; 3308 saved_mouse_move_msg.msg.hwnd = hwnd;
@@ -4772,46 +4779,46 @@ x_to_w32_charset (lpcs)
4772 w32_charset = Fcar (Fcdr (this_entry)); 4779 w32_charset = Fcar (Fcdr (this_entry));
4773 4780
4774 /* Translate Lisp symbol to number. */ 4781 /* Translate Lisp symbol to number. */
4775 if (w32_charset == Qw32_charset_ansi) 4782 if (EQ (w32_charset, Qw32_charset_ansi))
4776 return ANSI_CHARSET; 4783 return ANSI_CHARSET;
4777 if (w32_charset == Qw32_charset_symbol) 4784 if (EQ (w32_charset, Qw32_charset_symbol))
4778 return SYMBOL_CHARSET; 4785 return SYMBOL_CHARSET;
4779 if (w32_charset == Qw32_charset_shiftjis) 4786 if (EQ (w32_charset, Qw32_charset_shiftjis))
4780 return SHIFTJIS_CHARSET; 4787 return SHIFTJIS_CHARSET;
4781 if (w32_charset == Qw32_charset_hangeul) 4788 if (EQ (w32_charset, Qw32_charset_hangeul))
4782 return HANGEUL_CHARSET; 4789 return HANGEUL_CHARSET;
4783 if (w32_charset == Qw32_charset_chinesebig5) 4790 if (EQ (w32_charset, Qw32_charset_chinesebig5))
4784 return CHINESEBIG5_CHARSET; 4791 return CHINESEBIG5_CHARSET;
4785 if (w32_charset == Qw32_charset_gb2312) 4792 if (EQ (w32_charset, Qw32_charset_gb2312))
4786 return GB2312_CHARSET; 4793 return GB2312_CHARSET;
4787 if (w32_charset == Qw32_charset_oem) 4794 if (EQ (w32_charset, Qw32_charset_oem))
4788 return OEM_CHARSET; 4795 return OEM_CHARSET;
4789#ifdef JOHAB_CHARSET 4796#ifdef JOHAB_CHARSET
4790 if (w32_charset == Qw32_charset_johab) 4797 if (EQ (w32_charset, Qw32_charset_johab))
4791 return JOHAB_CHARSET; 4798 return JOHAB_CHARSET;
4792 if (w32_charset == Qw32_charset_easteurope) 4799 if (EQ (w32_charset, Qw32_charset_easteurope))
4793 return EASTEUROPE_CHARSET; 4800 return EASTEUROPE_CHARSET;
4794 if (w32_charset == Qw32_charset_turkish) 4801 if (EQ (w32_charset, Qw32_charset_turkish))
4795 return TURKISH_CHARSET; 4802 return TURKISH_CHARSET;
4796 if (w32_charset == Qw32_charset_baltic) 4803 if (EQ (w32_charset, Qw32_charset_baltic))
4797 return BALTIC_CHARSET; 4804 return BALTIC_CHARSET;
4798 if (w32_charset == Qw32_charset_russian) 4805 if (EQ (w32_charset, Qw32_charset_russian))
4799 return RUSSIAN_CHARSET; 4806 return RUSSIAN_CHARSET;
4800 if (w32_charset == Qw32_charset_arabic) 4807 if (EQ (w32_charset, Qw32_charset_arabic))
4801 return ARABIC_CHARSET; 4808 return ARABIC_CHARSET;
4802 if (w32_charset == Qw32_charset_greek) 4809 if (EQ (w32_charset, Qw32_charset_greek))
4803 return GREEK_CHARSET; 4810 return GREEK_CHARSET;
4804 if (w32_charset == Qw32_charset_hebrew) 4811 if (EQ (w32_charset, Qw32_charset_hebrew))
4805 return HEBREW_CHARSET; 4812 return HEBREW_CHARSET;
4806 if (w32_charset == Qw32_charset_vietnamese) 4813 if (EQ (w32_charset, Qw32_charset_vietnamese))
4807 return VIETNAMESE_CHARSET; 4814 return VIETNAMESE_CHARSET;
4808 if (w32_charset == Qw32_charset_thai) 4815 if (EQ (w32_charset, Qw32_charset_thai))
4809 return THAI_CHARSET; 4816 return THAI_CHARSET;
4810 if (w32_charset == Qw32_charset_mac) 4817 if (EQ (w32_charset, Qw32_charset_mac))
4811 return MAC_CHARSET; 4818 return MAC_CHARSET;
4812#endif /* JOHAB_CHARSET */ 4819#endif /* JOHAB_CHARSET */
4813#ifdef UNICODE_CHARSET 4820#ifdef UNICODE_CHARSET
4814 if (w32_charset == Qw32_charset_unicode) 4821 if (EQ (w32_charset, Qw32_charset_unicode))
4815 return UNICODE_CHARSET; 4822 return UNICODE_CHARSET;
4816#endif 4823#endif
4817 4824
@@ -4937,8 +4944,8 @@ w32_to_x_charset (fncharset)
4937 4944
4938 /* Look for Same charset and a valid codepage (or non-int 4945 /* Look for Same charset and a valid codepage (or non-int
4939 which means ignore). */ 4946 which means ignore). */
4940 if (w32_charset == charset_type 4947 if (EQ (w32_charset, charset_type)
4941 && (!INTEGERP (codepage) || codepage == CP_DEFAULT 4948 && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
4942 || IsValidCodePage (XINT (codepage)))) 4949 || IsValidCodePage (XINT (codepage))))
4943 { 4950 {
4944 /* If we don't have a match already, then this is the 4951 /* If we don't have a match already, then this is the
@@ -5095,8 +5102,8 @@ w32_to_all_x_charsets (fncharset)
5095 5102
5096 /* Look for Same charset and a valid codepage (or non-int 5103 /* Look for Same charset and a valid codepage (or non-int
5097 which means ignore). */ 5104 which means ignore). */
5098 if (w32_charset == charset_type 5105 if (EQ (w32_charset, charset_type)
5099 && (!INTEGERP (codepage) || codepage == CP_DEFAULT 5106 && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT
5100 || IsValidCodePage (XINT (codepage)))) 5107 || IsValidCodePage (XINT (codepage))))
5101 { 5108 {
5102 retval = Fcons (x_charset, retval); 5109 retval = Fcons (x_charset, retval);
@@ -6145,6 +6152,9 @@ w32_find_ccl_program (fontp)
6145 } 6152 }
6146} 6153}
6147 6154
6155/* directory-files from dired.c. */
6156Lisp_Object Fdirectory_files P_((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object));
6157
6148 6158
6149/* Find BDF files in a specified directory. (use GCPRO when calling, 6159/* Find BDF files in a specified directory. (use GCPRO when calling,
6150 as this calls lisp to get a directory listing). */ 6160 as this calls lisp to get a directory listing). */
@@ -6158,7 +6168,7 @@ w32_find_bdf_fonts_in_dir (Lisp_Object directory)
6158 return Qnil; 6168 return Qnil;
6159 6169
6160 filelist = Fdirectory_files (directory, Qt, 6170 filelist = Fdirectory_files (directory, Qt,
6161 build_string (".*\\.[bB][dD][fF]"), Qt); 6171 build_string (".*\\.[bB][dD][fF]"), Qt);
6162 6172
6163 for ( ; CONSP(filelist); filelist = XCDR (filelist)) 6173 for ( ; CONSP(filelist); filelist = XCDR (filelist))
6164 { 6174 {
@@ -7945,7 +7955,7 @@ lookup_vk_code (char *key)
7945 7955
7946/* Convert a one-element vector style key sequence to a hot key 7956/* Convert a one-element vector style key sequence to a hot key
7947 definition. */ 7957 definition. */
7948static int 7958static Lisp_Object
7949w32_parse_hot_key (key) 7959w32_parse_hot_key (key)
7950 Lisp_Object key; 7960 Lisp_Object key;
7951{ 7961{
@@ -7977,7 +7987,7 @@ w32_parse_hot_key (key)
7977 if (SYMBOLP (c)) 7987 if (SYMBOLP (c))
7978 { 7988 {
7979 c = parse_modifiers (c); 7989 c = parse_modifiers (c);
7980 lisp_modifiers = Fcar (Fcdr (c)); 7990 lisp_modifiers = XINT (Fcar (Fcdr (c)));
7981 c = Fcar (c); 7991 c = Fcar (c);
7982 if (!SYMBOLP (c)) 7992 if (!SYMBOLP (c))
7983 abort (); 7993 abort ();
@@ -8046,8 +8056,13 @@ The return value is the hotkey-id if registered, otherwise nil. */)
8046 8056
8047 /* Notify input thread about new hot-key definition, so that it 8057 /* Notify input thread about new hot-key definition, so that it
8048 takes effect without needing to switch focus. */ 8058 takes effect without needing to switch focus. */
8059#ifdef USE_LISP_UNION_TYPE
8060 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
8061 (WPARAM) key.i, 0);
8062#else
8049 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, 8063 PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
8050 (WPARAM) key, 0); 8064 (WPARAM) key, 0);
8065#endif
8051 } 8066 }
8052 8067
8053 return key; 8068 return key;
@@ -8070,8 +8085,14 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
8070 { 8085 {
8071 /* Notify input thread about hot-key definition being removed, so 8086 /* Notify input thread about hot-key definition being removed, so
8072 that it takes effect without needing focus switch. */ 8087 that it takes effect without needing focus switch. */
8088#ifdef USE_LISP_UNION_TYPE
8089 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
8090 (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
8091#else
8073 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, 8092 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
8074 (WPARAM) XINT (XCAR (item)), (LPARAM) item)) 8093 (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
8094
8095#endif
8075 { 8096 {
8076 MSG msg; 8097 MSG msg;
8077 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 8098 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -8144,8 +8165,13 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
8144 if (!dwWindowsThreadId) 8165 if (!dwWindowsThreadId)
8145 return make_number (w32_console_toggle_lock_key (vk_code, new_state)); 8166 return make_number (w32_console_toggle_lock_key (vk_code, new_state));
8146 8167
8168#ifdef USE_LISP_UNION_TYPE
8169 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
8170 (WPARAM) vk_code, (LPARAM) new_state.i))
8171#else
8147 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, 8172 if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
8148 (WPARAM) vk_code, (LPARAM) new_state)) 8173 (WPARAM) vk_code, (LPARAM) new_state.i))
8174#endif
8149 { 8175 {
8150 MSG msg; 8176 MSG msg;
8151 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); 8177 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -8424,9 +8450,9 @@ open the System menu. When nil, Emacs silently swallows alt key events. */);
8424When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */); 8450When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */);
8425 Vw32_alt_is_meta = Qt; 8451 Vw32_alt_is_meta = Qt;
8426 8452
8427 DEFVAR_INT ("w32-quit-key", &Vw32_quit_key, 8453 DEFVAR_INT ("w32-quit-key", &w32_quit_key,
8428 doc: /* If non-zero, the virtual key code for an alternative quit key. */); 8454 doc: /* If non-zero, the virtual key code for an alternative quit key. */);
8429 XSETINT (Vw32_quit_key, 0); 8455 w32_quit_key = 0;
8430 8456
8431 DEFVAR_LISP ("w32-pass-lwindow-to-system", 8457 DEFVAR_LISP ("w32-pass-lwindow-to-system",
8432 &Vw32_pass_lwindow_to_system, 8458 &Vw32_pass_lwindow_to_system,
@@ -8440,9 +8466,9 @@ When non-nil, the Start menu is opened by tapping the key. */);
8440When non-nil, the Start menu is opened by tapping the key. */); 8466When non-nil, the Start menu is opened by tapping the key. */);
8441 Vw32_pass_rwindow_to_system = Qt; 8467 Vw32_pass_rwindow_to_system = Qt;
8442 8468
8443 DEFVAR_INT ("w32-phantom-key-code", 8469 DEFVAR_LISP ("w32-phantom-key-code",
8444 &Vw32_phantom_key_code, 8470 &Vw32_phantom_key_code,
8445 doc: /* Virtual key code used to generate \"phantom\" key presses. 8471 doc: /* Virtual key code used to generate \"phantom\" key presses.
8446Value is a number between 0 and 255. 8472Value is a number between 0 and 255.
8447 8473
8448Phantom key presses are generated in order to stop the system from 8474Phantom key presses are generated in order to stop the system from
@@ -8450,7 +8476,7 @@ acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or
8450`w32-pass-rwindow-to-system' is nil. */); 8476`w32-pass-rwindow-to-system' is nil. */);
8451 /* Although 255 is technically not a valid key code, it works and 8477 /* Although 255 is technically not a valid key code, it works and
8452 means that this hack won't interfere with any real key code. */ 8478 means that this hack won't interfere with any real key code. */
8453 Vw32_phantom_key_code = 255; 8479 XSETINT (Vw32_phantom_key_code, 255);
8454 8480
8455 DEFVAR_LISP ("w32-enable-num-lock", 8481 DEFVAR_LISP ("w32-enable-num-lock",
8456 &Vw32_enable_num_lock, 8482 &Vw32_enable_num_lock,
@@ -8505,21 +8531,21 @@ Any other value will cause the key to be ignored. */);
8505 Vw32_enable_palette = Qt; 8531 Vw32_enable_palette = Qt;
8506 8532
8507 DEFVAR_INT ("w32-mouse-button-tolerance", 8533 DEFVAR_INT ("w32-mouse-button-tolerance",
8508 &Vw32_mouse_button_tolerance, 8534 &w32_mouse_button_tolerance,
8509 doc: /* Analogue of double click interval for faking middle mouse events. 8535 doc: /* Analogue of double click interval for faking middle mouse events.
8510The value is the minimum time in milliseconds that must elapse between 8536The value is the minimum time in milliseconds that must elapse between
8511left/right button down events before they are considered distinct events. 8537left/right button down events before they are considered distinct events.
8512If both mouse buttons are depressed within this interval, a middle mouse 8538If both mouse buttons are depressed within this interval, a middle mouse
8513button down event is generated instead. */); 8539button down event is generated instead. */);
8514 XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2); 8540 w32_mouse_button_tolerance = GetDoubleClickTime () / 2;
8515 8541
8516 DEFVAR_INT ("w32-mouse-move-interval", 8542 DEFVAR_INT ("w32-mouse-move-interval",
8517 &Vw32_mouse_move_interval, 8543 &w32_mouse_move_interval,
8518 doc: /* Minimum interval between mouse move events. 8544 doc: /* Minimum interval between mouse move events.
8519The value is the minimum time in milliseconds that must elapse between 8545The value is the minimum time in milliseconds that must elapse between
8520successive mouse move (or scroll bar drag) events before they are 8546successive mouse move (or scroll bar drag) events before they are
8521reported as lisp events. */); 8547reported as lisp events. */);
8522 XSETINT (Vw32_mouse_move_interval, 0); 8548 w32_mouse_move_interval = 0;
8523 8549
8524 DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system", 8550 DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system",
8525 &w32_pass_extra_mouse_buttons_to_system, 8551 &w32_pass_extra_mouse_buttons_to_system,
@@ -8800,9 +8826,9 @@ void globals_of_w32fns ()
8800 GetProcAddress (user32_lib, "GetClipboardSequenceNumber"); 8826 GetProcAddress (user32_lib, "GetClipboardSequenceNumber");
8801 8827
8802 DEFVAR_INT ("w32-ansi-code-page", 8828 DEFVAR_INT ("w32-ansi-code-page",
8803 &Vw32_ansi_code_page, 8829 &w32_ansi_code_page,
8804 doc: /* The ANSI code page used by the system. */); 8830 doc: /* The ANSI code page used by the system. */);
8805 XSETINT (Vw32_ansi_code_page, GetACP ()); 8831 w32_ansi_code_page = GetACP ();
8806} 8832}
8807 8833
8808#undef abort 8834#undef abort
diff --git a/src/w32heap.c b/src/w32heap.c
index b40db430ea9..d947842474f 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -245,6 +245,7 @@ init_heap ()
245 exit (1); 245 exit (1);
246 } 246 }
247 247
248#if defined (NO_UNION_TYPE) && !defined (USE_LSB_TAG)
248 /* Ensure that the addresses don't use the upper tag bits since 249 /* Ensure that the addresses don't use the upper tag bits since
249 the Lisp type goes there. */ 250 the Lisp type goes there. */
250 if (((unsigned long) data_region_base & ~VALMASK) != 0) 251 if (((unsigned long) data_region_base & ~VALMASK) != 0)
@@ -252,7 +253,7 @@ init_heap ()
252 printf ("Error: The heap was allocated in upper memory.\n"); 253 printf ("Error: The heap was allocated in upper memory.\n");
253 exit (1); 254 exit (1);
254 } 255 }
255 256#endif
256 data_region_end = data_region_base; 257 data_region_end = data_region_base;
257 real_data_region_end = data_region_end; 258 real_data_region_end = data_region_end;
258 } 259 }
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 168a0fb87b3..8dd4f406881 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -464,12 +464,12 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
464 } 464 }
465 if (event->uChar.AsciiChar == 0) 465 if (event->uChar.AsciiChar == 0)
466 return 0; 466 return 0;
467 XSETINT (emacs_ev->code, event->uChar.AsciiChar); 467 emacs_ev->code = event->uChar.AsciiChar;
468 } 468 }
469 else 469 else
470 { 470 {
471 emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT; 471 emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT;
472 XSETINT (emacs_ev->code, event->wVirtualKeyCode); 472 emacs_ev->code = event->wVirtualKeyCode;
473 } 473 }
474 474
475 XSETFRAME (emacs_ev->frame_or_window, get_frame ()); 475 XSETFRAME (emacs_ev->frame_or_window, get_frame ());
@@ -524,8 +524,8 @@ w32_console_mouse_position (FRAME_PTR *f,
524 *part = 0; 524 *part = 0;
525 SELECTED_FRAME ()->mouse_moved = 0; 525 SELECTED_FRAME ()->mouse_moved = 0;
526 526
527 *x = movement_pos.X; 527 XSETINT(*x, movement_pos.X);
528 *y = movement_pos.Y; 528 XSETINT(*y, movement_pos.Y);
529 *time = movement_time; 529 *time = movement_time;
530 530
531 UNBLOCK_INPUT; 531 UNBLOCK_INPUT;
@@ -593,9 +593,9 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
593 if (but_change & mask) 593 if (but_change & mask)
594 { 594 {
595 if (i < NUM_TRANSLATED_MOUSE_BUTTONS) 595 if (i < NUM_TRANSLATED_MOUSE_BUTTONS)
596 XSETINT (emacs_ev->code, emacs_button_translation[i]); 596 emacs_ev->code = emacs_button_translation[i];
597 else 597 else
598 XSETINT (emacs_ev->code, i); 598 emacs_ev->code = i;
599 break; 599 break;
600 } 600 }
601 601
diff --git a/src/w32proc.c b/src/w32proc.c
index edd286e50d0..842869726df 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -82,7 +82,7 @@ Lisp_Object Vw32_start_process_inherit_error_mode;
82 avoids the inefficiency of frequently reading small amounts of data. 82 avoids the inefficiency of frequently reading small amounts of data.
83 This is primarily necessary for handling DOS processes on Windows 95, 83 This is primarily necessary for handling DOS processes on Windows 95,
84 but is useful for W32 processes on both Windows 95 and NT as well. */ 84 but is useful for W32 processes on both Windows 95 and NT as well. */
85Lisp_Object Vw32_pipe_read_delay; 85int w32_pipe_read_delay;
86 86
87/* Control conversion of upper case file names to lower case. 87/* Control conversion of upper case file names to lower case.
88 nil means no, t means yes. */ 88 nil means no, t means yes. */
@@ -367,7 +367,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
367 cp->pid = -cp->pid; 367 cp->pid = -cp->pid;
368 368
369 /* pid must fit in a Lisp_Int */ 369 /* pid must fit in a Lisp_Int */
370 cp->pid = (cp->pid & VALMASK); 370 cp->pid = XUINT (make_number (cp->pid));
371 371
372 *pPid = cp->pid; 372 *pPid = cp->pid;
373 373
@@ -2202,7 +2202,7 @@ When non-nil, they inherit their error mode setting from Emacs, which stops
2202them blocking when trying to access unmounted drives etc. */); 2202them blocking when trying to access unmounted drives etc. */);
2203 Vw32_start_process_inherit_error_mode = Qt; 2203 Vw32_start_process_inherit_error_mode = Qt;
2204 2204
2205 DEFVAR_INT ("w32-pipe-read-delay", &Vw32_pipe_read_delay, 2205 DEFVAR_INT ("w32-pipe-read-delay", &w32_pipe_read_delay,
2206 doc: /* Forced delay before reading subprocess output. 2206 doc: /* Forced delay before reading subprocess output.
2207This is done to improve the buffering of subprocess output, by 2207This is done to improve the buffering of subprocess output, by
2208avoiding the inefficiency of frequently reading small amounts of data. 2208avoiding the inefficiency of frequently reading small amounts of data.
@@ -2211,7 +2211,7 @@ If positive, the value is the number of milliseconds to sleep before
2211reading the subprocess output. If negative, the magnitude is the number 2211reading the subprocess output. If negative, the magnitude is the number
2212of time slices to wait (effectively boosting the priority of the child 2212of time slices to wait (effectively boosting the priority of the child
2213process temporarily). A value of zero disables waiting entirely. */); 2213process temporarily). A value of zero disables waiting entirely. */);
2214 Vw32_pipe_read_delay = 50; 2214 w32_pipe_read_delay = 50;
2215 2215
2216 DEFVAR_LISP ("w32-downcase-file-names", &Vw32_downcase_file_names, 2216 DEFVAR_LISP ("w32-downcase-file-names", &Vw32_downcase_file_names,
2217 doc: /* Non-nil means convert all-upper case file names to lower case. 2217 doc: /* Non-nil means convert all-upper case file names to lower case.
diff --git a/src/w32term.c b/src/w32term.c
index 3a2ef2e1c19..9629595561c 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -177,7 +177,7 @@ int last_scroll_bar_drag_pos;
177static RECT last_mouse_glyph; 177static RECT last_mouse_glyph;
178static Lisp_Object last_mouse_press_frame; 178static Lisp_Object last_mouse_press_frame;
179 179
180Lisp_Object Vw32_num_mouse_buttons; 180int w32_num_mouse_buttons;
181 181
182Lisp_Object Vw32_swap_mouse_buttons; 182Lisp_Object Vw32_swap_mouse_buttons;
183 183
@@ -4360,10 +4360,16 @@ w32_read_socket (sd, expected, hold_quit)
4360 4360
4361 /* If the contents of the global variable help_echo_string 4361 /* If the contents of the global variable help_echo_string
4362 has changed, generate a HELP_EVENT. */ 4362 has changed, generate a HELP_EVENT. */
4363#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE.
4364 But it was originally changed to this to fix a bug, so I have
4365 not removed it completely in case the bug is still there. */
4363 if (help_echo_string != previous_help_echo_string || 4366 if (help_echo_string != previous_help_echo_string ||
4364 (!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved)) 4367 (!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved))
4368#else /* This is what xterm.c does. */
4369 if (!NILP (help_echo_string)
4370 || !NILP (previous_help_echo_string))
4365 do_help = 1; 4371 do_help = 1;
4366 4372#endif
4367 break; 4373 break;
4368 4374
4369 case WM_LBUTTONDOWN: 4375 case WM_LBUTTONDOWN:
@@ -4784,7 +4790,7 @@ w32_read_socket (sd, expected, hold_quit)
4784 4790
4785 if (do_help > 0) 4791 if (do_help > 0)
4786 { 4792 {
4787 if (help_echo_string == Qnil) 4793 if (NILP (help_echo_string))
4788 { 4794 {
4789 help_echo_object = help_echo_window = Qnil; 4795 help_echo_object = help_echo_window = Qnil;
4790 help_echo_pos = -1; 4796 help_echo_pos = -1;
@@ -6460,9 +6466,9 @@ syms_of_w32term ()
6460 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); 6466 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
6461 6467
6462 DEFVAR_INT ("w32-num-mouse-buttons", 6468 DEFVAR_INT ("w32-num-mouse-buttons",
6463 &Vw32_num_mouse_buttons, 6469 &w32_num_mouse_buttons,
6464 doc: /* Number of physical mouse buttons. */); 6470 doc: /* Number of physical mouse buttons. */);
6465 Vw32_num_mouse_buttons = Qnil; 6471 w32_num_mouse_buttons = 2;
6466 6472
6467 DEFVAR_LISP ("w32-swap-mouse-buttons", 6473 DEFVAR_LISP ("w32-swap-mouse-buttons",
6468 &Vw32_swap_mouse_buttons, 6474 &Vw32_swap_mouse_buttons,
diff --git a/src/window.c b/src/window.c
index 8a2c16598ec..03ca22dd525 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3272,6 +3272,10 @@ If FRAME is nil, search only the selected frame
3272 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil, 3272 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil,
3273 which means search visible and iconified frames. 3273 which means search visible and iconified frames.
3274 3274
3275If a full-width window on a splittable frame is available to display
3276the buffer, it may be split, subject to the value of the variable
3277`split-height-threshold'.
3278
3275If `even-window-heights' is non-nil, window heights will be evened out 3279If `even-window-heights' is non-nil, window heights will be evened out
3276if displaying the buffer causes two vertically adjacent windows to be 3280if displaying the buffer causes two vertically adjacent windows to be
3277displayed. */) 3281displayed. */)
@@ -3587,7 +3591,8 @@ DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "",
3587WINDOW defaults to selected one and SIZE to half its size. 3591WINDOW defaults to selected one and SIZE to half its size.
3588If optional third arg HORFLAG is non-nil, split side by side 3592If optional third arg HORFLAG is non-nil, split side by side
3589and put SIZE columns in the first of the pair. In that case, 3593and put SIZE columns in the first of the pair. In that case,
3590SIZE includes that window's scroll bar, or the divider column to its right. */) 3594SIZE includes that window's scroll bar, or the divider column to its right.
3595Returns the newly-created window. */)
3591 (window, size, horflag) 3596 (window, size, horflag)
3592 Lisp_Object window, size, horflag; 3597 Lisp_Object window, size, horflag;
3593{ 3598{
@@ -6594,7 +6599,7 @@ See also `same-window-buffer-names'. */);
6594 next_screen_context_lines = 2; 6599 next_screen_context_lines = 2;
6595 6600
6596 DEFVAR_INT ("split-height-threshold", &split_height_threshold, 6601 DEFVAR_INT ("split-height-threshold", &split_height_threshold,
6597 doc: /* *display-buffer would prefer to split the largest window if this large. 6602 doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'.
6598If there is only one window, it is split regardless of this value. */); 6603If there is only one window, it is split regardless of this value. */);
6599 split_height_threshold = 500; 6604 split_height_threshold = 500;
6600 6605
diff --git a/src/xdisp.c b/src/xdisp.c
index 7f5b38e550b..7c2a850fe49 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2730,19 +2730,10 @@ next_overlay_change (pos)
2730 int noverlays; 2730 int noverlays;
2731 int endpos; 2731 int endpos;
2732 Lisp_Object *overlays; 2732 Lisp_Object *overlays;
2733 int len;
2734 int i; 2733 int i;
2735 2734
2736 /* Get all overlays at the given position. */ 2735 /* Get all overlays at the given position. */
2737 len = 10; 2736 GET_OVERLAYS_AT (pos, overlays, noverlays, &endpos, 1);
2738 overlays = (Lisp_Object *) alloca (len * sizeof *overlays);
2739 noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1);
2740 if (noverlays > len)
2741 {
2742 len = noverlays;
2743 overlays = (Lisp_Object *) alloca (len * sizeof *overlays);
2744 noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1);
2745 }
2746 2737
2747 /* If any of these overlays ends before endpos, 2738 /* If any of these overlays ends before endpos,
2748 use its ending point instead. */ 2739 use its ending point instead. */
@@ -20832,7 +20823,7 @@ note_mouse_highlight (f, x, y)
20832 Lisp_Object object; 20823 Lisp_Object object;
20833 Lisp_Object mouse_face = Qnil, overlay = Qnil, position; 20824 Lisp_Object mouse_face = Qnil, overlay = Qnil, position;
20834 Lisp_Object *overlay_vec = NULL; 20825 Lisp_Object *overlay_vec = NULL;
20835 int len, noverlays; 20826 int noverlays;
20836 struct buffer *obuf; 20827 struct buffer *obuf;
20837 int obegv, ozv, same_region; 20828 int obegv, ozv, same_region;
20838 20829
@@ -20919,19 +20910,8 @@ note_mouse_highlight (f, x, y)
20919 20910
20920 if (BUFFERP (object)) 20911 if (BUFFERP (object))
20921 { 20912 {
20922 /* Put all the overlays we want in a vector in overlay_vec. 20913 /* Put all the overlays we want in a vector in overlay_vec. */
20923 Store the length in len. If there are more than 40, make 20914 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0);
20924 enough space for all, and try again. */
20925 len = 40;
20926 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
20927 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
20928 if (noverlays > len)
20929 {
20930 len = noverlays;
20931 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
20932 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL,0);
20933 }
20934
20935 /* Sort overlays into increasing priority order. */ 20915 /* Sort overlays into increasing priority order. */
20936 noverlays = sort_overlays (overlay_vec, noverlays, w); 20916 noverlays = sort_overlays (overlay_vec, noverlays, w);
20937 } 20917 }
diff --git a/src/xfaces.c b/src/xfaces.c
index 9e49833c736..bae9b569f1a 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -3860,7 +3860,7 @@ Otherwise check for the existence of a global face. */)
3860DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face, 3860DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face,
3861 Sinternal_copy_lisp_face, 4, 4, 0, 3861 Sinternal_copy_lisp_face, 4, 4, 0,
3862 doc: /* Copy face FROM to TO. 3862 doc: /* Copy face FROM to TO.
3863If FRAME it t, copy the global face definition of FROM to the 3863If FRAME is t, copy the global face definition of FROM to the
3864global face definition of TO. Otherwise, copy the frame-local 3864global face definition of TO. Otherwise, copy the frame-local
3865definition of FROM on FRAME to the frame-local definition of TO 3865definition of FROM on FRAME to the frame-local definition of TO
3866on NEW-FRAME, or FRAME if NEW-FRAME is nil. 3866on NEW-FRAME, or FRAME if NEW-FRAME is nil.
@@ -4687,8 +4687,8 @@ DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute,
4687 doc: /* Return face attribute KEYWORD of face SYMBOL. 4687 doc: /* Return face attribute KEYWORD of face SYMBOL.
4688If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid 4688If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid
4689face attribute name, signal an error. 4689face attribute name, signal an error.
4690If the optional argument FRAME is given, report on face FACE in that 4690If the optional argument FRAME is given, report on face SYMBOL in that
4691frame. If FRAME is t, report on the defaults for face FACE (for new 4691frame. If FRAME is t, report on the defaults for face SYMBOL (for new
4692frames). If FRAME is omitted or nil, use the selected frame. */) 4692frames). If FRAME is omitted or nil, use the selected frame. */)
4693 (symbol, keyword, frame) 4693 (symbol, keyword, frame)
4694 Lisp_Object symbol, keyword, frame; 4694 Lisp_Object symbol, keyword, frame;
@@ -5238,10 +5238,10 @@ with the default face for display, can be represented in a way that's
5238 \(1) different in appearance than the default face, and 5238 \(1) different in appearance than the default face, and
5239 \(2) `close in spirit' to what the attributes specify, if not exact. 5239 \(2) `close in spirit' to what the attributes specify, if not exact.
5240 5240
5241Point (2) implies that a `:weight black' attribute will be satisified 5241Point (2) implies that a `:weight black' attribute will be satisfied
5242by any terminal that can display bold, and a `:foreground "yellow"' as 5242by any terminal that can display bold, and a `:foreground "yellow"' as
5243long as the terminal can display a yellowish color, but `:slant italic' 5243long as the terminal can display a yellowish color, but `:slant italic'
5244will _not_ be satisified by the tty display code's automatic 5244will _not_ be satisfied by the tty display code's automatic
5245substitution of a `dim' face for italic. */) 5245substitution of a `dim' face for italic. */)
5246 (attributes, frame) 5246 (attributes, frame)
5247 Lisp_Object attributes, frame; 5247 Lisp_Object attributes, frame;
@@ -5449,8 +5449,8 @@ clear_face_gcs (c)
5449} 5449}
5450 5450
5451 5451
5452/* Free all realized faces in face cache C, including basic faces. C 5452/* Free all realized faces in face cache C, including basic faces.
5453 may be null. If faces are freed, make sure the frame's current 5453 C may be null. If faces are freed, make sure the frame's current
5454 matrix is marked invalid, so that a display caused by an expose 5454 matrix is marked invalid, so that a display caused by an expose
5455 event doesn't try to use faces we destroyed. */ 5455 event doesn't try to use faces we destroyed. */
5456 5456
@@ -7306,24 +7306,8 @@ face_at_buffer_position (w, pos, region_beg, region_end,
7306 /* Look at properties from overlays. */ 7306 /* Look at properties from overlays. */
7307 { 7307 {
7308 int next_overlay; 7308 int next_overlay;
7309 int len;
7310
7311 /* First try with room for 40 overlays. */
7312 len = 40;
7313 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
7314 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
7315 &next_overlay, NULL, 0);
7316
7317 /* If there are more than 40, make enough space for all, and try
7318 again. */
7319 if (noverlays > len)
7320 {
7321 len = noverlays;
7322 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
7323 noverlays = overlays_at (pos, 0, &overlay_vec, &len,
7324 &next_overlay, NULL, 0);
7325 }
7326 7309
7310 GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0);
7327 if (next_overlay < endpos) 7311 if (next_overlay < endpos)
7328 endpos = next_overlay; 7312 endpos = next_overlay;
7329 } 7313 }
diff --git a/src/xfns.c b/src/xfns.c
index 3b0b2884246..56593453b2c 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5506,6 +5506,11 @@ Chinese, Japanese, and Korean. */);
5506#endif /* USE_X_TOOLKIT */ 5506#endif /* USE_X_TOOLKIT */
5507 5507
5508#ifdef USE_GTK 5508#ifdef USE_GTK
5509 /* Provide x-toolkit also for GTK. Internally GTK does not use Xt so it
5510 is not an X toolkit in that sense (USE_X_TOOLKIT is not defined).
5511 But for a user it is a toolkit for X, and indeed, configure
5512 accepts --with-x-toolkit=gtk. */
5513 Fprovide (intern ("x-toolkit"), Qnil);
5509 Fprovide (intern ("gtk"), Qnil); 5514 Fprovide (intern ("gtk"), Qnil);
5510 5515
5511 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, 5516 DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string,