diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2004-05-18 19:12:15 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2004-05-18 19:12:15 +0000 |
commit | c23670f81e059ebe645c88575f4ddfa67f26bf6b (patch) | |
tree | 71667a6ceaa877ccf3953abedfa7b0fd5f0f5369 /src | |
parent | d9858e4f1889a61b216ae1f99053846362067ccc (diff) | |
parent | a7f7f2540f02834ad128d0c9357a4dbd8222dff4 (diff) | |
download | emacs-c23670f81e059ebe645c88575f4ddfa67f26bf6b.tar.gz |
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/.gdbinit | 12 | ||||
-rw-r--r-- | src/ChangeLog | 191 | ||||
-rw-r--r-- | src/alloc.c | 32 | ||||
-rw-r--r-- | src/blockinput.h | 3 | ||||
-rw-r--r-- | src/buffer.h | 19 | ||||
-rw-r--r-- | src/ccl.c | 4 | ||||
-rw-r--r-- | src/charset.c | 26 | ||||
-rw-r--r-- | src/data.c | 2 | ||||
-rw-r--r-- | src/emacs.c | 1 | ||||
-rw-r--r-- | src/image.c | 475 | ||||
-rw-r--r-- | src/keyboard.c | 22 | ||||
-rw-r--r-- | src/lisp.h | 52 | ||||
-rw-r--r-- | src/macfns.c | 4 | ||||
-rw-r--r-- | src/macmenu.c | 3 | ||||
-rw-r--r-- | src/macterm.c | 24 | ||||
-rw-r--r-- | src/macterm.h | 14 | ||||
-rw-r--r-- | src/msdos.c | 33 | ||||
-rw-r--r-- | src/print.c | 35 | ||||
-rw-r--r-- | src/process.c | 15 | ||||
-rw-r--r-- | src/regex.c | 2 | ||||
-rw-r--r-- | src/textprop.c | 23 | ||||
-rw-r--r-- | src/w32.c | 14 | ||||
-rw-r--r-- | src/w32console.c | 26 | ||||
-rw-r--r-- | src/w32fns.c | 156 | ||||
-rw-r--r-- | src/w32heap.c | 3 | ||||
-rw-r--r-- | src/w32inevt.c | 12 | ||||
-rw-r--r-- | src/w32proc.c | 8 | ||||
-rw-r--r-- | src/w32term.c | 16 | ||||
-rw-r--r-- | src/window.c | 9 | ||||
-rw-r--r-- | src/xdisp.c | 28 | ||||
-rw-r--r-- | src/xfaces.c | 32 | ||||
-rw-r--r-- | src/xfns.c | 5 |
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 define xvectype xgetptr $ set $size = ((struct Lisp_Vector *) $ptr)->size - output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size + output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag echo \n end document xvectype @@ -199,7 +199,7 @@ end define xstring xgetptr $ print (struct Lisp_String *) $ptr - output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size : $->size_byte) + output ($->size > 1000) ? 0 : ($->data[0])@($->size_byte < 0 ? $->size & ~gdb_array_mark_flag : $->size_byte) echo \n end document xstring @@ -210,7 +210,7 @@ end define xvector xgetptr $ print (struct Lisp_Vector *) $ptr - output ($->size > 50) ? 0 : ($->contents[0])@($->size) + output ($->size > 50) ? 0 : ($->contents[0])@($->size & ~gdb_array_mark_flag) echo \n end document xvector @@ -289,7 +289,7 @@ end define xboolvector xgetptr $ print (struct Lisp_Bool_Vector *) $ptr - output ($->size > 256) ? 0 : ($->data[0])@(($->size + 7)/ 8) + output ($->size > 256) ? 0 : ($->data[0])@((($->size & ~gdb_array_mark_flag) + 7)/ 8) echo \n end document xboolvector @@ -377,7 +377,7 @@ define xprintsym set $sym = (struct Lisp_Symbol *) $ptr xgetptr $sym->xname set $sym_name = (struct Lisp_String *) $ptr - output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size : $sym_name->size_byte) + output ($sym_name->data[0])@($sym_name->size_byte < 0 ? $sym_name->size & ~gdb_array_mark_flag : $sym_name->size_byte) end document xprintsym Print argument as a symbol. @@ -395,7 +395,7 @@ define xbacktrace if $type == Lisp_Vectorlike xgetptr (*$bt->function) set $size = ((struct Lisp_Vector *) $ptr)->size - output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size + output ($size & PVEC_FLAG) ? (enum pvec_type) ($size & PVEC_TYPE_MASK) : $size & ~gdb_array_mark_flag else printf "Lisp type %d", $type end diff --git a/src/ChangeLog b/src/ChangeLog index fad84ff38f5..7425754e042 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,186 @@ +2004-05-18 Eli Zaretskii <eliz@gnu.org> + + * lisp.h (DECL_ALIGN): Remove restriction on MS-DOS systems. + + * msdos.c (syms_of_msdos): Initialize dos-unsupported-char-glyph + with make_number. + (IT_write_glyphs): Extract glyph from dos-unsupported-char-glyph + with XINT. + +2004-05-18 Kim F. Storm <storm@cua.dk> + + * blockinput.h (INPUT_BLOCKED_P): New macros. + + * keyboard.c (Frecursive_edit): Return immediately if input blocked. + (Ftop_level): Unblock input if blocked. + + * buffer.h (GET_OVERLAYS_AT): New macro. + * msdos.c (IT_note_mouse_highlight): Use it. + * textprop.c (get_char_property_and_overlay): Use it. + * xdisp.c (next_overlay_change, note_mouse_highlight): Use it. + * xfaces.c (face_at_buffer_position): Use it. + + * print.c (print_object): Increase buf size. + +2004-05-17 Jason Rumney <jasonr@gnu.org> + + * w32fns.c (Fw32_register_hot_key, Fw32_unregister_hot_key) + (Fw32_toggle_lock_key) [USE_LISP_UNION_TYPE]: Cast from + Lisp_Object using i member. + (w32_quit_key): Rename from Vw32_quit_key, and make an int. + (syms_of_w32fns, globals_of_w32fns): Use Lisp_Object and int + consistently. + + * w32proc.c (create_child): Use make_number instead of masking pid. + + * w32fns.c (w32_color_map_lookup): Return a Lisp_Object. + (x_to_w32_charset, w32_to_x_charset, w32_to_all_x_charsets): + Use EQ to compare Lisp_Objects. + (w32_parse_hot_key): Use int for lisp_modifiers consistently. + + * w32term.c (w32_num_mouse_buttons): Rename from + Vw32_num_mouse_buttons and make it an int. + + * w32.c (init_environment): Use it. + + * w32fns.c (w32_wnd_proc): Likewise. + + * w32proc.c (w32_pipe_read_delay): Rename from + Vw32_pipe_read_delay and make it an int. + + * w32.c (_sys_read_ahead): Use it. + + * lisp.h (egetenv) [USE_CRT_DLL]: Remove condition. + + * w32proc.c (create_child) [USE_LSB_TAG]: Don't try to mask pid. + + * w32inevt.c (w32_console_mouse_position, do_mouse_event) + (key_event): Don't mix Lisp_Object and int. + + * w32heap.c (init_heap) [USE_LSB_TAG]: Don't check heap location. + + * keyboard.c (kbd_buffer_get_event): Don't use event->code and + modifiers in language change event. + +2004-05-17 Kim F. Storm <storm@cua.dk> + + * alloc.c (mark_object): Ignore Lisp_Misc_Free objects. + Such objects may be freed markers which still exist on an undo list. + +2004-05-16 Juanma Barranquero <lektu@terra.es> + + * data.c (Fset_default): Make argument names match their use in + docstring. + +2004-05-15 Andreas Schwab <schwab@suse.de> + + * emacs.c (gdb_array_mark_flag): Define. + * .gdbinit: Mask off gdb_array_mark_flag from vector sizes. + +2004-05-15 Eli Zaretskii <eliz@gnu.org> + + * lisp.h (DECL_ALIGN) [MSDOS]: Don't define DECL_ALIGN to use + __attribute__((__aligned__)), so that USE_LSB_TAG would not become + defined for the MS-DOS build. + +2004-05-14 Stefan Monnier <monnier@iro.umontreal.ca> + + * w32fns.c (Fw32_define_rgb_color): Avoid XSET. + +2004-05-14 Kenichi Handa <handa@m17n.org> + + * ccl.c (Fccl_execute_on_string): Fix setting elements of STATUS. + +2004-05-14 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * lisp.h (Vx_resource_name, Vx_resource_class): Move from xfns.c + section to frame.c section. + (Fxw_display_color_p, Fx_file_dialog): Declare if + HAVE_WINDOW_SYSTEM defined. + * macfns.c (Fx_create_frame): Fix int/Lisp_Object mixup. + * macmenu.c (set_frame_menubar): Use NILP to test a lisp value. + * macterm.c (mac_get_emulated_btn, mac_event_to_emacs_modifiers) + (mac_get_mouse_btn): Use NILP and EQ to test/compare lisp values. + (XTread_socket): Fix int/Lisp_Object mixup. + (mac_check_for_quit_char): Fix pointer/Lisp_Object mixup. + * macterm.h (struct frame, struct face, struct image) + (display_x_get_resource, Fx_display_color_p) + (Fx_display_grayscale_p, Fx_display_planes, x_free_gcs): + Add prototypes. + +2004-05-14 Kim F. Storm <storm@cua.dk> + + * process.c (wait_reading_process_input): Make reentrant. + Make Available and Connecting non-static. Save and restore value + of waiting_for_user_input_p. + +2004-05-13 Kim F. Storm <storm@cua.dk> + + * keyboard.c (mark_kboards): Don't mark x and y members + that are overloaded in selection request events. + +2004-05-13 Stefan Monnier <monnier@iro.umontreal.ca> + + * lisp.h (USE_LSB_TAG): Make it the default when it is known to work. + +2004-05-13 Glenn Morris <gmorris@ast.cam.ac.uk> + + * window.c (Fdisplay_buffer, Fsplit_window) + (split-height-threshold): Doc fix. + +2004-05-13 Juanma Barranquero <lektu@terra.es> + + * xfaces.c (Ftty_supports_face_attributes_p) + (Finternal_copy_lisp_face): Fix typo in docstring. + (Finternal_get_lisp_face_attribute): Fix docstring. + +2004-05-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xfns.c (syms_of_xfns): Provide x-toolkit also for GTK. + +2004-05-11 Steven Tamm <steventamm@mac.com> + + * macfns.c (Fx_create_frame): Default to using tool-bar by + setting tool-bar-lines to 1 in default-frame-alist. + +2004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * image.c (xpm_scan, xpm_make_color_table_v, xpm_put_color_table_v) + (xpm_get_color_table_v, xpm_make_color_table_h) + (xpm_put_color_table_h, xpm_get_color_table_h) + (xpm_str_to_color_key, xpm_load_image, xpm_load) + (syms_of_image): Support XPM on Carbon Emacs. Does not + depend on libXpm, but only supports XPM version 3 without extensions. + +2004-05-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c (x_flush, XTframe_up_to_date): Use FRAME_MAC_P + instead of FRAME_X_P + +2004-05-11 Kim F. Storm <storm@cua.dk> + + * process.c (read_process_output): Grow decoding_buf when needed; + this could cause a crash in allocate_string and compact_small_strings. + +2004-04-29 Jim Blandy <jimb@redhat.com> + + * regex.c (mutually_exclusive_p): In 'case wordbeg', compare op2 + against proper opcode. + +2004-05-10 Juanma Barranquero <lektu@terra.es> + + * process.c (Fstart_process): Fix docstring. + + * charset.c (Fget_unused_iso_final_char): Fix typos in docstring. + (Fchar_bytes, Fchar_width, Fstring_width, Fchar_direction) + (Fsplit_char, Fchar_charset): Make argument names match their use + in docstring. + +2004-05-10 Richard M. Stallman <rms@gnu.org> + + * print.c (print_preprocess): Use being_printed, loop_count and + halftail to detect overdeep nesting and cyclic cdr chains. + 2004-05-10 Andreas Schwab <schwab@suse.de> * lisp.h: Declare Fmake_symbolic_link. @@ -115,8 +298,8 @@ 2004-05-02 Eli Zaretskii <eliz@gnu.org> - * syntax.h (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY_INT): Avoid - compiler warnings. + * syntax.h (SET_RAW_SYNTAX_ENTRY, SYNTAX_ENTRY_INT): + Avoid compiler warnings. * Makefile.in (region-cache.o): Depend on config.h. @@ -1461,7 +1644,7 @@ 2004-02-09 Sam Steingold <sds@gnu.org> - * w32term.c (w32_draw_fringe_bitmap): Fixed a typo in the last patch. + * w32term.c (w32_draw_fringe_bitmap): Fix a typo in the last patch. 2004-02-09 Kim F. Storm <storm@cua.dk> @@ -8193,7 +8376,7 @@ * msdos.c (croak): Add `void' to definition. - * sysdep.c [MSDOS] (request_sigio, unrequest_sigio): + * sysdep.c (request_sigio, unrequest_sigio) [MSDOS]: Don't define them, they are defined in msdos.c. * 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) free_ablock = ablock; /* Update busy count. */ ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase)); - + if (2 > (long) ABLOCKS_BUSY (abase)) { /* All the blocks are free. */ int i = 0, aligned = (long) ABLOCKS_BUSY (abase); @@ -4467,6 +4467,17 @@ returns nil, because real GC can't be done. */) mark_kboards (); mark_ttys (); +#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES + mark_stack (); +#endif + +#ifdef USE_GTK + { + extern void xg_mark_data (); + xg_mark_data (); + } +#endif + /* Look thru every buffer's undo list for elements that update markers that were not marked, and delete them. */ @@ -4510,17 +4521,6 @@ returns nil, because real GC can't be done. */) } } -#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES - mark_stack (); -#endif - -#ifdef USE_GTK - { - extern void xg_mark_data (); - xg_mark_data (); - } -#endif - gc_sweep (); /* Clear the mark bits that we set in certain root slots. */ @@ -4978,6 +4978,14 @@ mark_object (arg) break; case Lisp_Misc: + if (XMISCTYPE (obj) == Lisp_Misc_Free) + { + /* This is (probably) a freed marker which may still exist on + a buffer undo list, so accept it here, as check below will + fail (not live). KFS 2004-05-17 */ + XMARKER (obj)->gcmarkbit = 1; + break; + } CHECK_ALLOCATED_AND_LIVE (live_misc_p); if (XMARKER (obj)->gcmarkbit) 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; #define TOTALLY_UNBLOCK_INPUT (interrupt_input_blocked = 0) #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT +/* In critical section ? */ +#define INPUT_BLOCKED_P (interrupt_input_blocked > 0) + /* Defined in keyboard.c */ /* Don't use a prototype here; it causes trouble in some files. */ extern 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)); extern void fix_overlays_before P_ ((struct buffer *, EMACS_INT, EMACS_INT)); extern void mmap_set_vars P_ ((int)); +/* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. + If NEXTP is non-NULL, return next overlay there. + See overlay_at arg CHANGE_REQ for meaning of CHRQ arg. */ + +#define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq) \ + do { \ + int maxlen = 40; \ + overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \ + noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ + nextp, NULL, chrq); \ + if (noverlays > maxlen) \ + { \ + maxlen = noverlays; \ + overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \ + noverlays = overlays_at (posn, 0, &overlays, &maxlen, \ + nextp, NULL, chrq); \ + } \ + } while (0) + EXFUN (Fbuffer_name, 1); EXFUN (Fget_file_buffer, 1); EXFUN (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. */ produced = ccl_driver (&ccl, SDATA (str), outbuf, SBYTES (str), outbufsize, (int *) 0); for (i = 0; i < 8; i++) - XSET (AREF (status, i), Lisp_Int, ccl.reg[i]); - XSETINT (AREF (status, 8), ccl.ic); + ASET (status, i, make_number (ccl.reg[i])); + ASET (status, 8, make_number (ccl.ic)); UNGCPRO; 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 @@ /* Basic multilingual character support. Copyright (C) 1995, 1997, 1998 Electrotechnical Laboratory, JAPAN. Licensed to the Free Software Foundation. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2004 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -730,7 +730,7 @@ It includes a generic character for a charset not yet defined. */) DEFUN ("get-unused-iso-final-char", Fget_unused_iso_final_char, Sget_unused_iso_final_char, 2, 2, 0, - doc: /* Return an unsed ISO's final char for a charset of DIMENISION and CHARS. + doc: /* Return an unused ISO's final char for a charset of DIMENSION and CHARS. DIMENSION is the number of bytes to represent a character: 1 or 2. CHARS is the number of characters in a dimension: 94 or 96. @@ -1028,9 +1028,9 @@ Internal use only. */) } DEFUN ("split-char", Fsplit_char, Ssplit_char, 1, 1, 0, - doc: /* Return list of charset and one or two position-codes of CHAR. -If CHAR is invalid as a character code, -return a list of symbol `unknown' and CHAR. */) + doc: /* Return list of charset and one or two position-codes of CH. +If CH is invalid as a character code, +return a list of symbol `unknown' and CH. */) (ch) Lisp_Object ch; { @@ -1048,7 +1048,7 @@ return a list of symbol `unknown' and CHAR. */) } DEFUN ("char-charset", Fchar_charset, Schar_charset, 1, 1, 0, - doc: /* Return charset of CHAR. */) + doc: /* Return charset of CH. */) (ch) Lisp_Object ch; { @@ -1179,7 +1179,7 @@ The conversion is done based on `nonascii-translation-table' (which see) } DEFUN ("char-bytes", Fchar_bytes, Schar_bytes, 1, 1, 0, - doc: /* Return 1 regardless of the argument CHAR. */) + doc: /* Return 1 regardless of the argument CH. */) (ch) Lisp_Object ch; { @@ -1223,7 +1223,7 @@ char_bytes (c) : 4)))) DEFUN ("char-width", Fchar_width, Schar_width, 1, 1, 0, - doc: /* Return width of CHAR when displayed in the current buffer. + doc: /* Return width of CH when displayed in the current buffer. The width is measured by how many columns it occupies on the screen. Tab is taken to occupy `tab-width' columns. */) (ch) @@ -1406,18 +1406,18 @@ When calculating width of a multibyte character in STRING, only the base leading-code is considered; the validity of the following bytes is not checked. Tabs in STRING are always taken to occupy `tab-width' columns. */) - (str) - Lisp_Object str; + (string) + Lisp_Object string; { Lisp_Object val; - CHECK_STRING (str); - XSETFASTINT (val, lisp_string_width (str, -1, NULL, NULL)); + CHECK_STRING (string); + XSETFASTINT (val, lisp_string_width (string, -1, NULL, NULL)); return val; } DEFUN ("char-direction", Fchar_direction, Schar_direction, 1, 1, 0, - doc: /* Return the direction of CHAR. + doc: /* Return the direction of CH. The returned value is 0 for left-to-right and 1 for right-to-left. */) (ch) 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. */) } DEFUN ("set-default", Fset_default, Sset_default, 2, 2, 0, - doc: /* Set SYMBOL's default value to VAL. SYMBOL and VAL are evaluated. + doc: /* Set SYMBOL's default value to VALUE. SYMBOL and VALUE are evaluated. The default value is seen in buffers that do not have their own values for this variable. */) (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; EMACS_INT gdb_data_seg_bits = 0; #endif EMACS_INT PVEC_FLAG = PSEUDOVECTOR_FLAG; +EMACS_INT gdb_array_mark_flag = ARRAY_MARK_FLAG; /* Command line args from shell, as list of strings. */ Lisp_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) XPM images ***********************************************************************/ -#ifdef HAVE_XPM +#if defined (HAVE_XPM) || defined (MAC_OS) static int xpm_image_p P_ ((Lisp_Object object)); static int xpm_load P_ ((struct frame *f, struct image *img)); static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); +#endif /* HAVE_XPM || MAC_OS */ + +#ifdef HAVE_XPM #ifdef HAVE_NTGUI /* Indicate to xpm.h that we don't have Xlib. */ #define FOR_MSW @@ -3208,7 +3211,9 @@ static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); #else #include "X11/xpm.h" #endif /* HAVE_NTGUI */ +#endif /* HAVE_XPM */ +#if defined (HAVE_XPM) || defined (MAC_OS) /* The symbol `xpm' identifying XPM-format images. */ Lisp_Object Qxpm; @@ -3536,10 +3541,13 @@ xpm_image_p (object) || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value))); } +#endif /* HAVE_XPM || MAC_OS */ /* Load image IMG which will be displayed on frame F. Value is non-zero if successful. */ +#ifdef HAVE_XPM + static int xpm_load (f, img) struct frame *f; @@ -3771,6 +3779,467 @@ xpm_load (f, img) #endif /* HAVE_XPM */ +#ifdef MAC_OS + +/* XPM support functions for Mac OS where libxpm is not available. + Only XPM version 3 (without any extensions) is supported. */ + +static int xpm_scan P_ ((unsigned char **, unsigned char *, + unsigned char **, int *)); +static Lisp_Object xpm_make_color_table_v + P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, unsigned char *, int))); +static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *, + int, Lisp_Object)); +static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, + unsigned char *, int)); +static Lisp_Object xpm_make_color_table_h + P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, unsigned char *, int))); +static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *, + int, Lisp_Object)); +static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, + unsigned char *, int)); +static int xpm_str_to_color_key P_ ((char *)); +static int xpm_load_image P_ ((struct frame *, struct image *, + unsigned char *, unsigned char *)); + +/* Tokens returned from xpm_scan. */ + +enum xpm_token +{ + XPM_TK_IDENT = 256, + XPM_TK_STRING, + XPM_TK_EOF +}; + +/* Scan an XPM data and return a character (< 256) or a token defined + by enum xpm_token above. *S and END are the start (inclusive) and + the end (exclusive) addresses of the data, respectively. Advance + *S while scanning. If token is either XPM_TK_IDENT or + XPM_TK_STRING, *BEG and *LEN are set to the start address and the + length of the corresponding token, respectively. */ + +static int +xpm_scan (s, end, beg, len) + unsigned char **s, *end, **beg; + int *len; +{ + int c; + + while (*s < end) + { + /* Skip white-space. */ + while (*s < end && (c = *(*s)++, isspace (c))) + ; + + /* gnus-pointer.xpm uses '-' in its identifier. + sb-dir-plus.xpm uses '+' in its identifier. */ + if (isalpha (c) || c == '_' || c == '-' || c == '+') + { + *beg = *s - 1; + while (*s < end && + (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+')) + ++*s; + *len = *s - *beg; + return XPM_TK_IDENT; + } + else if (c == '"') + { + *beg = *s; + while (*s < end && **s != '"') + ++*s; + *len = *s - *beg; + if (*s < end) + ++*s; + return XPM_TK_STRING; + } + else if (c == '/') + { + if (*s < end && **s == '*') + { + /* C-style comment. */ + ++*s; + do + { + while (*s < end && *(*s)++ != '*') + ; + } + while (*s < end && **s != '/'); + if (*s < end) + ++*s; + } + else + return c; + } + else + return c; + } + + return XPM_TK_EOF; +} + +/* Functions for color table lookup in XPM data. A Key is a string + specifying the color of each pixel in XPM data. A value is either + an integer that specifies a pixel color, Qt that specifies + transparency, or Qnil for the unspecified color. If the length of + the key string is one, a vector is used as a table. Otherwise, a + hash table is used. */ + +static Lisp_Object +xpm_make_color_table_v (put_func, get_func) + void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); + Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); +{ + *put_func = xpm_put_color_table_v; + *get_func = xpm_get_color_table_v; + return Fmake_vector (make_number (256), Qnil); +} + +static void +xpm_put_color_table_v (color_table, chars_start, chars_len, color) + Lisp_Object color_table; + unsigned char *chars_start; + int chars_len; + Lisp_Object color; +{ + XVECTOR (color_table)->contents[*chars_start] = color; +} + +static Lisp_Object +xpm_get_color_table_v (color_table, chars_start, chars_len) + Lisp_Object color_table; + unsigned char *chars_start; + int chars_len; +{ + return XVECTOR (color_table)->contents[*chars_start]; +} + +static Lisp_Object +xpm_make_color_table_h (put_func, get_func) + void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); + Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); +{ + *put_func = xpm_put_color_table_h; + *get_func = xpm_get_color_table_h; + return make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), + make_float (DEFAULT_REHASH_SIZE), + make_float (DEFAULT_REHASH_THRESHOLD), + Qnil, Qnil, Qnil); +} + +static void +xpm_put_color_table_h (color_table, chars_start, chars_len, color) + Lisp_Object color_table; + unsigned char *chars_start; + int chars_len; + Lisp_Object color; +{ + struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); + unsigned hash_code; + Lisp_Object chars = make_unibyte_string (chars_start, chars_len); + + hash_lookup (table, chars, &hash_code); + hash_put (table, chars, color, hash_code); +} + +static Lisp_Object +xpm_get_color_table_h (color_table, chars_start, chars_len) + Lisp_Object color_table; + unsigned char *chars_start; + int chars_len; +{ + struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); + int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len), + NULL); + + return i >= 0 ? HASH_VALUE (table, i) : Qnil; +} + +enum xpm_color_key { + XPM_COLOR_KEY_S, + XPM_COLOR_KEY_M, + XPM_COLOR_KEY_G4, + XPM_COLOR_KEY_G, + XPM_COLOR_KEY_C +}; + +static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; + +static int +xpm_str_to_color_key (s) + char *s; +{ + int i; + + for (i = 0; + i < sizeof xpm_color_key_strings / sizeof xpm_color_key_strings[0]; + i++) + if (strcmp (xpm_color_key_strings[i], s) == 0) + return i; + return -1; +} + +static int +xpm_load_image (f, img, contents, end) + struct frame *f; + struct image *img; + unsigned char *contents, *end; +{ + unsigned char *s = contents, *beg, *str; + unsigned char buffer[BUFSIZ]; + int width, height, x, y; + int num_colors, chars_per_pixel; + int len, LA1; + void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object); + Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int); + Lisp_Object frame, color_symbols, color_table; + int best_key, have_mask = 0; + XImagePtr ximg = NULL, mask_img = NULL; + +#define match() \ + LA1 = xpm_scan (&s, end, &beg, &len) + +#define expect(TOKEN) \ + if (LA1 != (TOKEN)) \ + goto failure; \ + else \ + match () + +#define expect_ident(IDENT) \ + if (LA1 == XPM_TK_IDENT \ + && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \ + match (); \ + else \ + goto failure + + if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0)) + goto failure; + s += 9; + match(); + expect_ident ("static"); + expect_ident ("char"); + expect ('*'); + expect (XPM_TK_IDENT); + expect ('['); + expect (']'); + expect ('='); + expect ('{'); + expect (XPM_TK_STRING); + if (len >= BUFSIZ) + goto failure; + memcpy (buffer, beg, len); + buffer[len] = '\0'; + if (sscanf (buffer, "%d %d %d %d", &width, &height, + &num_colors, &chars_per_pixel) != 4 + || width <= 0 || height <= 0 + || num_colors <= 0 || chars_per_pixel <= 0) + goto failure; + expect (','); + + XSETFRAME (frame, f); + if (!NILP (Fxw_display_color_p (frame))) + best_key = XPM_COLOR_KEY_C; + else if (!NILP (Fx_display_grayscale_p (frame))) + best_key = (XFASTINT (Fx_display_planes (frame)) > 2 + ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4); + else + best_key = XPM_COLOR_KEY_M; + + color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL); + if (chars_per_pixel == 1) + color_table = xpm_make_color_table_v (&put_color_table, + &get_color_table); + else + color_table = xpm_make_color_table_h (&put_color_table, + &get_color_table); + + while (num_colors-- > 0) + { + unsigned char *color, *max_color; + int key, next_key, max_key = 0; + Lisp_Object symbol_color = Qnil, color_val; + XColor cdef; + + expect (XPM_TK_STRING); + if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel) + goto failure; + memcpy (buffer, beg + chars_per_pixel, len - chars_per_pixel); + buffer[len - chars_per_pixel] = '\0'; + + str = strtok (buffer, " \t"); + if (str == NULL) + goto failure; + key = xpm_str_to_color_key (str); + if (key < 0) + goto failure; + do + { + color = strtok (NULL, " \t"); + if (color == NULL) + goto failure; + + while (str = strtok (NULL, " \t")) + { + next_key = xpm_str_to_color_key (str); + if (next_key >= 0) + break; + color[strlen (color)] = ' '; + } + + if (key == XPM_COLOR_KEY_S) + { + if (NILP (symbol_color)) + symbol_color = build_string (color); + } + else if (max_key < key && key <= best_key) + { + max_key = key; + max_color = color; + } + key = next_key; + } + while (str); + + color_val = Qnil; + if (!NILP (color_symbols) && !NILP (symbol_color)) + { + Lisp_Object specified_color = Fassoc (symbol_color, color_symbols); + + if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) + if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0) + color_val = Qt; + else if (x_defined_color (f, SDATA (XCDR (specified_color)), + &cdef, 0)) + color_val = make_number (cdef.pixel); + } + if (NILP (color_val) && max_key > 0) + if (xstricmp (max_color, "None") == 0) + color_val = Qt; + else if (x_defined_color (f, max_color, &cdef, 0)) + color_val = make_number (cdef.pixel); + if (!NILP (color_val)) + (*put_color_table) (color_table, beg, chars_per_pixel, color_val); + + expect (','); + } + + if (!x_create_x_image_and_pixmap (f, width, height, 0, + &ximg, &img->pixmap) + || !x_create_x_image_and_pixmap (f, width, height, 1, + &mask_img, &img->mask)) + { + image_error ("Out of memory (%s)", img->spec, Qnil); + goto error; + } + + for (y = 0; y < height; y++) + { + expect (XPM_TK_STRING); + str = beg; + if (len < width * chars_per_pixel) + goto failure; + for (x = 0; x < width; x++, str += chars_per_pixel) + { + Lisp_Object color_val = + (*get_color_table) (color_table, str, chars_per_pixel); + + XPutPixel (ximg, x, y, + (INTEGERP (color_val) ? XINT (color_val) + : FRAME_FOREGROUND_PIXEL (f))); + XPutPixel (mask_img, x, y, + (!EQ (color_val, Qt) ? PIX_MASK_DRAW (f) + : (have_mask = 1, PIX_MASK_RETAIN (f)))); + } + if (y + 1 < height) + expect (','); + } + + img->width = width; + img->height = height; + + x_put_x_image (f, ximg, img->pixmap, width, height); + x_destroy_x_image (ximg); + if (have_mask) + { + x_put_x_image (f, mask_img, img->mask, width, height); + x_destroy_x_image (mask_img); + } + else + { + x_destroy_x_image (mask_img); + Free_Pixmap (FRAME_X_DISPLAY (f), img->mask); + img->mask = NO_PIXMAP; + } + + return 1; + + failure: + image_error ("Invalid XPM file (%s)", img->spec, Qnil); + error: + x_destroy_x_image (ximg); + x_destroy_x_image (mask_img); + x_clear_image (f, img); + return 0; + +#undef match +#undef expect +#undef expect_ident +} + +static int +xpm_load (f, img) + struct frame *f; + struct image *img; +{ + int success_p = 0; + Lisp_Object file_name; + + /* If IMG->spec specifies a file name, create a non-file spec from it. */ + file_name = image_spec_value (img->spec, QCfile, NULL); + if (STRINGP (file_name)) + { + Lisp_Object file; + unsigned char *contents; + int size; + struct gcpro gcpro1; + + file = x_find_image_file (file_name); + GCPRO1 (file); + if (!STRINGP (file)) + { + image_error ("Cannot find image file `%s'", file_name, Qnil); + UNGCPRO; + return 0; + } + + contents = slurp_file (SDATA (file), &size); + if (contents == NULL) + { + image_error ("Error loading XPM image `%s'", img->spec, Qnil); + UNGCPRO; + return 0; + } + + success_p = xpm_load_image (f, img, contents, contents + size); + xfree (contents); + UNGCPRO; + } + else + { + Lisp_Object data; + + data = image_spec_value (img->spec, QCdata, NULL); + success_p = xpm_load_image (f, img, SDATA (data), + SDATA (data) + SBYTES (data)); + } + + return success_p; +} + +#endif /* MAC_OS */ + + /*********************************************************************** Color table @@ -7447,7 +7916,7 @@ syms_of_image () Qxbm = intern ("xbm"); staticpro (&Qxbm); -#ifdef HAVE_XPM +#if defined (HAVE_XPM) || defined (MAC_OS) Qxpm = intern ("xpm"); staticpro (&Qxpm); #endif @@ -7517,7 +7986,7 @@ init_image () define_image_type (&xbm_type); define_image_type (&pbm_type); -#ifdef HAVE_XPM +#if defined (HAVE_XPM) || defined (MAC_OS) IF_LIB_AVAILABLE(init_xpm_functions) define_image_type (&xpm_type); #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. */) int count = SPECPDL_INDEX (); Lisp_Object buffer; + /* If we enter while input is blocked, don't lock up here. + This may happen through the debugger during redisplay. */ + if (INPUT_BLOCKED_P) + return Qnil; + command_loop_level++; update_mode_lines = 1; @@ -1281,6 +1286,12 @@ DEFUN ("top-level", Ftop_level, Stop_level, 0, 0, "", if (display_hourglass_p) cancel_hourglass (); #endif + + /* Unblock input if we enter with input blocked. This may happen if + redisplay traps e.g. during tool-bar update with input blocked. */ + while (INPUT_BLOCKED_P) + UNBLOCK_INPUT; + return Fthrow (Qtop_level, Qnil); } @@ -3964,9 +3975,7 @@ kbd_buffer_get_event (kbp, used_mouse_menu) else if (event->kind == LANGUAGE_CHANGE_EVENT) { /* Make an event (language-change (FRAME CHARSET LCID)). */ - obj = Fcons (event->modifiers, Qnil); - obj = Fcons (event->code, obj); - obj = Fcons (event->frame_or_window, obj); + obj = Fcons (event->frame_or_window, Qnil); obj = Fcons (Qlanguage_change, Fcons (obj, Qnil)); kbd_fetch_ptr = event + 1; } @@ -11548,8 +11557,11 @@ mark_kboards () { if (event == kbd_buffer + KBD_BUFFER_SIZE) event = kbd_buffer; - mark_object (event->x); - mark_object (event->y); + if (event->kind != SELECTION_REQUEST_EVENT) + { + mark_object (event->x); + mark_object (event->y); + } mark_object (event->frame_or_window); mark_object (event->arg); } 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 #define BOOL_VECTOR_BITS_PER_CHAR 8 /***** Select the tagging scheme. *****/ +/* There are basically two options that control the tagging scheme: + - NO_UNION_TYPE says that Lisp_Object should be an integer instead + of a union. + - USE_LSB_TAG means that we can assume the least 3 bits of pointers are + always 0, and we can thus use them to hold tag bits, without + restricting our addressing space. + + If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus + restricting our possible address range. Currently USE_LSB_TAG is not + allowed together with a union. This is not due to any fundamental + technical (or political ;-) problem: nobody wrote the code to do it yet. + + USE_LSB_TAG not only requires the least 3 bits of pointers returned by + malloc to be 0 but also needs to be able to impose a mult-of-8 alignment + on the few static Lisp_Objects used: all the defsubr as well + as the two special buffers buffer_defaults and buffer_local_symbols. */ /* First, try and define DECL_ALIGN(type,var) which declares a static variable VAR of type TYPE with the added requirement that it be TYPEBITS-aligned. */ -#if defined USE_LSB_TAG && !defined DECL_ALIGN +#ifndef DECL_ALIGN /* What compiler directive should we use for non-gcc compilers? -stef */ # if defined (__GNUC__) # define DECL_ALIGN(type, var) \ type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var -# else -# error "USE_LSB_TAG used without defining DECL_ALIGN" # endif #endif -#ifndef USE_LSB_TAG +/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ +#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX +/* We also need to be able to specify mult-of-8 alignment on static vars. */ +# if defined DECL_ALIGN +/* We currently do not support USE_LSB_TAG with a union Lisp_Object. */ +# if defined NO_UNION_TYPE +# define USE_LSB_TAG +# endif +# endif +#endif + /* Just remove the alignment annotation if we don't use it. */ -#undef DECL_ALIGN -#define DECL_ALIGN(type, var) type var +#ifndef DECL_ALIGN +# ifdef USE_LSB_TAG +# error "USE_LSB_TAG used without defining DECL_ALIGN" +# endif +# define DECL_ALIGN(type, var) type var #endif @@ -2857,6 +2884,10 @@ extern int indented_beyond_p P_ ((int, int, double)); extern void syms_of_indent P_ ((void)); /* defined in frame.c */ +#ifdef HAVE_WINDOW_SYSTEM +extern Lisp_Object Vx_resource_name; +extern Lisp_Object Vx_resource_class; +#endif /* HAVE_WINDOW_SYSTEM */ extern Lisp_Object Qvisible; extern void store_frame_param P_ ((struct frame *, Lisp_Object, Lisp_Object)); extern void store_in_alist P_ ((Lisp_Object *, Lisp_Object, Lisp_Object)); @@ -3079,11 +3110,12 @@ extern int getloadavg P_ ((double *, int)); #ifdef HAVE_X_WINDOWS /* Defined in xfns.c */ extern void syms_of_xfns P_ ((void)); -extern Lisp_Object Vx_resource_name; -extern Lisp_Object Vx_resource_class; +#endif /* HAVE_X_WINDOWS */ +#ifdef HAVE_WINDOW_SYSTEM +/* Defined in xfns.c, w32fns.c, or macfns.c */ EXFUN (Fxw_display_color_p, 1); EXFUN (Fx_file_dialog, 4); -#endif /* HAVE_X_WINDOWS */ +#endif /* HAVE_WINDOW_SYSTEM */ /* Defined in xsmfns.c */ extern void syms_of_xsmfns P_ ((void)); @@ -3109,9 +3141,7 @@ extern void xfree P_ ((POINTER_TYPE *)); extern char *xstrdup P_ ((const char *)); -#ifndef USE_CRT_DLL extern char *egetenv P_ ((char *)); -#endif /* Set up the name of the machine we're running on. */ extern 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. */) if (!NILP (parent)) { - f->output_data.mac->parent_desc = (Window) parent; + f->output_data.mac->parent_desc = (Window) XFASTINT (parent); f->output_data.mac->explicit_parent = 1; } else @@ -2708,7 +2708,7 @@ This function is an internal primitive--use `make-frame' instead. */) x_default_parameter (f, parms, Qmenu_bar_lines, make_number (1), "menuBar", "MenuBar", RES_TYPE_NUMBER); - x_default_parameter (f, parms, Qtool_bar_lines, make_number (0), + x_default_parameter (f, parms, Qtool_bar_lines, make_number (1), "toolBar", "ToolBar", RES_TYPE_NUMBER); x_default_parameter (f, parms, Qbuffer_predicate, Qnil, "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) for (i = 0; i < previous_menu_items_used; i++) if (menu_items_used == i - || (!Fequal (previous_items[i], XVECTOR (menu_items)->contents[i]))) + || (NILP (Fequal (previous_items[i], + XVECTOR (menu_items)->contents[i])))) break; if (i == menu_items_used && i == previous_menu_items_used && i != 0) { 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) FOR_EACH_FRAME (rest, frame) x_flush (XFRAME (frame)); } - else if (FRAME_X_P (f)) + else if (FRAME_MAC_P (f)) XFlush (FRAME_MAC_DISPLAY (f)); UNBLOCK_INPUT; #endif /* TARGET_API_MAC_CARBON */ @@ -1410,7 +1410,7 @@ static void XTframe_up_to_date (f) struct frame *f; { - if (FRAME_X_P (f)) + if (FRAME_MAC_P (f)) { struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); @@ -7033,8 +7033,8 @@ static int mac_get_emulated_btn ( UInt32 modifiers ) { int result = 0; - if (Vmac_emulate_three_button_mouse != Qnil) { - int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse); + if (!NILP (Vmac_emulate_three_button_mouse)) { + int cmdIs3 = !EQ (Vmac_emulate_three_button_mouse, Qreverse); if (modifiers & controlKey) result = cmdIs3 ? 2 : 1; else if (modifiers & optionKey) @@ -7052,7 +7052,7 @@ mac_event_to_emacs_modifiers (EventRef eventRef) UInt32 mods = 0; GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, sizeof (UInt32), NULL, &mods); - if (Vmac_emulate_three_button_mouse != Qnil && + if (!NILP (Vmac_emulate_three_button_mouse) && GetEventClass(eventRef) == kEventClassMouse) { mods &= ~(optionKey & cmdKey); @@ -7071,7 +7071,7 @@ mac_get_mouse_btn (EventRef ref) switch (result) { case kEventMouseButtonPrimary: - if (Vmac_emulate_three_button_mouse == Qnil) + if (NILP (Vmac_emulate_three_button_mouse)) return 0; else { UInt32 mods = 0; @@ -8227,7 +8227,7 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit) inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ - XSETINT (inev.x, tracked_scroll_bar->left + 2); + XSETINT (inev.x, XFASTINT (tracked_scroll_bar->left) + 2); XSETINT (inev.y, mouse_loc.v - 24); tracked_scroll_bar->dragging = Qnil; mouse_tracking_in_progress = mouse_tracking_none; @@ -8312,6 +8312,8 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit) else { Lisp_Object window; + int x = mouse_loc.h; + int y = mouse_loc.v; XSETFRAME (inev.frame_or_window, mwp->mFP); if (er.what == mouseDown) @@ -8319,14 +8321,14 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit) = mouse_tracking_mouse_movement; else mouse_tracking_in_progress = mouse_tracking_none; - window = window_from_coordinates (mwp->mFP, inev.x, inev.y, 0, 0, 0, 1); + window = window_from_coordinates (mwp->mFP, x, y, 0, 0, 0, 1); if (EQ (window, mwp->mFP->tool_bar_window)) { if (er.what == mouseDown) - handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 1, 0); + handle_tool_bar_click (mwp->mFP, x, y, 1, 0); else - handle_tool_bar_click (mwp->mFP, inev.x, inev.y, 0, + handle_tool_bar_click (mwp->mFP, x, y, 0, #if USE_CARBON_EVENTS mac_event_to_emacs_modifiers (eventRef) #else @@ -9024,7 +9026,7 @@ mac_check_for_quit_char () EVENT_INIT (e); e.kind = ASCII_KEYSTROKE_EVENT; e.code = quit_char; - e.arg = NULL; + e.arg = Qnil; e.modifiers = NULL; e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 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 { text from glomming up against the scroll bar */ #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) - -struct frame * check_x_frame (Lisp_Object); +struct frame; +struct face; +struct image; + +Lisp_Object display_x_get_resource P_ ((struct x_display_info *, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object)); +struct frame *check_x_frame P_ ((Lisp_Object)); +EXFUN (Fx_display_color_p, 1); +EXFUN (Fx_display_grayscale_p, 1); +EXFUN (Fx_display_planes, 1); +extern void x_free_gcs P_ ((struct frame *)); void activate_scroll_bars (FRAME_PTR); void 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 IT_write_glyphs (struct glyph *str, int str_len) { unsigned char *screen_buf, *screen_bp, *screen_buf_end, *bp; - int unsupported_face = FAST_GLYPH_FACE (Vdos_unsupported_char_glyph); - unsigned unsupported_char= FAST_GLYPH_CHAR (Vdos_unsupported_char_glyph); + int unsupported_face = 0; + unsigned unsupported_char = '\177'; int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); register int sl = str_len; register int tlen = GLYPH_TABLE_LENGTH; @@ -978,6 +978,13 @@ IT_write_glyphs (struct glyph *str, int str_len) if (str_len <= 0) return; + /* Set up the unsupported character glyph */ + if (!NILP (Vdos_unsupported_char_glyph)) + { + unsupported_char = FAST_GLYPH_CHAR (XINT (Vdos_unsupported_char_glyph)); + unsupported_face = FAST_GLYPH_FACE (XINT (Vdos_unsupported_char_glyph)); + } + screen_buf = screen_bp = alloca (str_len * 2); screen_buf_end = screen_buf + str_len * 2; sf = SELECTED_FRAME(); @@ -1042,7 +1049,7 @@ IT_write_glyphs (struct glyph *str, int str_len) if (! CHAR_VALID_P (ch, 0)) { g = !NILP (Vdos_unsupported_char_glyph) - ? Vdos_unsupported_char_glyph + ? XINT (Vdos_unsupported_char_glyph) : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g)); ch = FAST_GLYPH_CHAR (g); } @@ -1572,7 +1579,7 @@ IT_note_mouse_highlight (struct frame *f, int x, int y) { extern Lisp_Object Qmouse_face; Lisp_Object mouse_face, overlay, position, *overlay_vec; - int len, noverlays, obegv, ozv;; + int noverlays, obegv, ozv;; struct buffer *obuf; /* 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) /* Is this char mouse-active or does it have help-echo? */ XSETINT (position, pos); - /* Put all the overlays we want in a vector in overlay_vec. - Store the length in len. If there are more than 10, make - enough space for all, and try again. */ - len = 10; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0); - if (noverlays > len) - { - len = noverlays; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, - 0, &overlay_vec, &len, NULL, NULL, 0); - } - + /* Put all the overlays we want in a vector in overlay_vec. */ + GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); /* Sort overlays into increasing priority order. */ noverlays = sort_overlays (overlay_vec, noverlays, w); @@ -5292,7 +5287,7 @@ syms_of_msdos () DEFVAR_LISP ("dos-unsupported-char-glyph", &Vdos_unsupported_char_glyph, doc: /* *Glyph to display instead of chars not supported by current codepage. This variable is used only by MSDOS terminals. */); - Vdos_unsupported_char_glyph = '\177'; + Vdos_unsupported_char_glyph = make_number ('\177'); #endif #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. */) if (SBYTES (object) == SCHARS (object)) STRING_SET_UNIBYTE (object); - /* Note that this won't make prepare_to_modify_buffer call + /* Note that this won't make prepare_to_modify_buffer call ask-user-about-supersession-threat because this buffer does not visit a file. */ Ferase_buffer (); @@ -929,7 +929,7 @@ DEFUN ("redirect-debugging-output", Fredirect_debugging_output, Sredirect_debugg doc: /* Redirect debugging output (stderr stream) to file FILE. If FILE is nil, reset target to the initial stderr stream. Optional arg APPEND non-nil (interactively, with prefix arg) means -append to existing target file. */) +append to existing target file. */) (file, append) Lisp_Object file, append; { @@ -1280,6 +1280,26 @@ print_preprocess (obj) { int i; EMACS_INT size; + int loop_count = 0; + Lisp_Object halftail; + + /* Avoid infinite recursion for circular nested structure + in the case where Vprint_circle is nil. */ + if (NILP (Vprint_circle)) + { + for (i = 0; i < print_depth; i++) + if (EQ (obj, being_printed[i])) + return; + being_printed[print_depth] = obj; + } + + /* Give up if we go so deep that print_object will get an error. */ + /* See similar code in print_object. */ + if (print_depth >= PRINT_CIRCLE) + return; + + print_depth++; + halftail = obj; loop: if (STRINGP (obj) || CONSP (obj) || VECTORP (obj) @@ -1340,8 +1360,15 @@ print_preprocess (obj) break; case Lisp_Cons: + /* Use HALFTAIL and LOOP_COUNT to detect circular lists, + just as in print_object. */ + if (loop_count && EQ (obj, halftail)) + break; print_preprocess (XCAR (obj)); obj = XCDR (obj); + loop_count++; + if (!(loop_count & 1)) + halftail = XCDR (halftail); goto loop; case Lisp_Vectorlike: @@ -1356,6 +1383,7 @@ print_preprocess (obj) break; } } + print_depth--; } static void @@ -1372,7 +1400,7 @@ print_object (obj, printcharfun, escapeflag) register Lisp_Object printcharfun; int escapeflag; { - char buf[30]; + char buf[40]; QUIT; @@ -1426,6 +1454,7 @@ print_object (obj, printcharfun, escapeflag) print_depth++; + /* See similar code in print_preprocess. */ if (print_depth > PRINT_CIRCLE) error ("Apparently circular structure being printed"); #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 (); DEFUN ("start-process", Fstart_process, Sstart_process, 3, MANY, 0, doc: /* Start a program in a subprocess. Return the process object for it. NAME is name for process. It is modified if necessary to make it unique. -BUFFER is the buffer or (buffer-name) to associate with the process. +BUFFER is the buffer (or buffer name) to associate with the process. Process output goes at end of that buffer, unless you specify an output stream or filter function to handle the output. BUFFER may be also nil, meaning that this process is not associated with any buffer. -Third arg is program file name. It is searched for in PATH. +PROGRAM is the program file name. It is searched for in PATH. Remaining arguments are strings to give program as arguments. usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) @@ -4018,8 +4018,8 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) int do_display; { register int channel, nfds; - static SELECT_TYPE Available; - static SELECT_TYPE Connecting; + SELECT_TYPE Available; + SELECT_TYPE Connecting; int check_connect, check_delay, no_avail; int xerrno; Lisp_Object proc; @@ -4030,6 +4030,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) /* Either nil or a cons cell, the car of which is of interest and may be changed outside of this routine. */ Lisp_Object wait_for_cell = Qnil; + int saved_waiting_for_user_input_p = waiting_for_user_input_p; FD_ZERO (&Available); FD_ZERO (&Connecting); @@ -4643,7 +4644,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) } /* end for each file descriptor */ } /* end while exit conditions not met */ - waiting_for_user_input_p = 0; + waiting_for_user_input_p = saved_waiting_for_user_input_p; /* If calling from keyboard input, do not quit since we want to return C-g as an input character. @@ -4894,6 +4895,8 @@ read_process_output (proc, channel) } carryover = nbytes - coding->consumed; + if (SCHARS (p->decoding_buf) < carryover) + p->decoding_buf = make_uninit_string (carryover); bcopy (chars + coding->consumed, SDATA (p->decoding_buf), carryover); XSETINT (p->decoding_carryover, carryover); @@ -4998,6 +5001,8 @@ read_process_output (proc, channel) } } carryover = nbytes - coding->consumed; + if (SCHARS (p->decoding_buf) < carryover) + p->decoding_buf = make_uninit_string (carryover); bcopy (chars + coding->consumed, SDATA (p->decoding_buf), carryover); 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) case wordbeg: case syntaxspec: return ((re_opcode_t) *p1 == notsyntaxspec - && p1[1] == (op2 == wordend ? Sword : p2[1])); + && p1[1] == (op2 == wordbeg ? Sword : p2[1])); case wordbound: 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) } if (BUFFERP (object)) { - int posn = XINT (position); int noverlays; - Lisp_Object *overlay_vec, tem; - int len; + Lisp_Object *overlay_vec; struct buffer *obuf = current_buffer; set_buffer_temp (XBUFFER (object)); - /* First try with room for 40 overlays. */ - len = 40; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - - noverlays = overlays_at (posn, 0, &overlay_vec, &len, - NULL, NULL, 0); - - /* If there are more than 40, - make enough space for all, and try again. */ - if (noverlays > len) - { - len = noverlays; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (posn, 0, &overlay_vec, &len, - NULL, NULL, 0); - } + GET_OVERLAYS_AT (XINT (position), overlay_vec, noverlays, NULL, 0); noverlays = sort_overlays (overlay_vec, noverlays, w); set_buffer_temp (obuf); @@ -668,7 +651,7 @@ get_char_property_and_overlay (position, prop, object, overlay) /* Now check the overlays in order of decreasing priority. */ while (--noverlays >= 0) { - tem = Foverlay_get (overlay_vec[noverlays], prop); + Lisp_Object tem = Foverlay_get (overlay_vec[noverlays], prop); if (!NILP (tem)) { 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 (); extern Lisp_Object Vw32_downcase_file_names; extern Lisp_Object Vw32_generate_fake_inodes; extern Lisp_Object Vw32_get_true_file_attributes; -extern Lisp_Object Vw32_num_mouse_buttons; +extern int w32_num_mouse_buttons; /* @@ -1094,7 +1094,7 @@ init_environment (char ** argv) /* Determine if there is a middle mouse button, to allow parse_button to decide whether right mouse events should be mouse-2 or mouse-3. */ - XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS)); + w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS); init_user_info (); } @@ -1627,7 +1627,7 @@ static WIN32_FIND_DATA dir_find_data; /* Support shares on a network resource as subdirectories of a read-only root directory. */ static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE; -HANDLE open_unc_volume (char *); +HANDLE open_unc_volume (const char *); char *read_unc_volume (HANDLE, char *, int); void close_unc_volume (HANDLE); @@ -1740,7 +1740,7 @@ readdir (DIR *dirp) } HANDLE -open_unc_volume (char *path) +open_unc_volume (const char *path) { NETRESOURCE nr; HANDLE henum; @@ -1797,7 +1797,7 @@ close_unc_volume (HANDLE henum) } DWORD -unc_volume_file_attributes (char *path) +unc_volume_file_attributes (const char *path) { HANDLE henum; DWORD attrs; @@ -3486,7 +3486,7 @@ sys_pipe (int * phandles) } /* From ntproc.c */ -extern Lisp_Object Vw32_pipe_read_delay; +extern int w32_pipe_read_delay; /* Function to do blocking read of one byte, needed to implement select. It is only allowed on sockets and pipes. */ @@ -3526,7 +3526,7 @@ _sys_read_ahead (int fd) shell on NT is very slow if we don't do this. */ if (rc > 0) { - int wait = XINT (Vw32_pipe_read_delay); + int wait = w32_pipe_read_delay; if (wait > 0) 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; static void move_cursor (int row, int col); static void clear_to_end (void); -static void clear_frame (void); -static void clear_end_of_line (int); +void clear_frame (void); +void clear_end_of_line (int); static void ins_del_lines (int vpos, int n); -static void insert_glyphs (struct glyph *start, int len); -static void write_glyphs (struct glyph *string, int len); -static void delete_glyphs (int n); +void insert_glyphs (struct glyph *start, int len); +void write_glyphs (struct glyph *string, int len); +void delete_glyphs (int n); void w32_sys_ring_bell (void); -static void reset_terminal_modes (void); -static void set_terminal_modes (void); -static void set_terminal_window (int size); -static void update_begin (struct frame * f); -static void update_end (struct frame * f); +void reset_terminal_modes (void); +void set_terminal_modes (void); +void set_terminal_window (int size); +void update_begin (struct frame * f); +void update_end (struct frame * f); static WORD w32_face_attributes (struct frame *f, int face_id); static COORD cursor_coords; @@ -103,7 +103,7 @@ ctrl_c_handler (unsigned long type) #define PICK_FRAME() (updating_frame ? updating_frame : SELECTED_FRAME ()) /* Move the cursor to (row, col). */ -void +static void move_cursor (int row, int col) { cursor_coords.X = col; @@ -116,7 +116,7 @@ move_cursor (int row, int col) } /* Clear from cursor to end of screen. */ -void +static void clear_to_end (void) { struct frame * f = PICK_FRAME (); @@ -240,7 +240,7 @@ ins_del_lines (int vpos, int n) #define LEFT 1 #define RIGHT 0 -void +static void scroll_line (int dist, int direction) { /* 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 @@ /* Graphical user interface functions for the Microsoft W32 API. - Copyright (C) 1989, 92, 93, 94, 95, 1996, 1997, 1998, 1999, 2000, 2001 + Copyright (C) 1989, 92, 93, 94, 95, 96, 97, 98, 1999, 2000, 01, 2004 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -88,7 +88,7 @@ Lisp_Object Vw32_pass_alt_to_system; Lisp_Object Vw32_alt_is_meta; /* If non-zero, the windows virtual key code for an alternative quit key. */ -Lisp_Object Vw32_quit_key; +int w32_quit_key; /* Non nil if left window key events are passed on to Windows (this only affects whether "tapping" the key opens the Start menu). */ @@ -132,11 +132,11 @@ Lisp_Object Vw32_enable_palette; /* Control how close left/right button down events must be to be converted to a middle button down event. */ -Lisp_Object Vw32_mouse_button_tolerance; +int w32_mouse_button_tolerance; /* Minimum interval between mouse movement (and scroll bar drag) events that are passed on to the event loop. */ -Lisp_Object Vw32_mouse_move_interval; +int w32_mouse_move_interval; /* Flag to indicate if XBUTTON events should be passed on to Windows. */ int w32_pass_extra_mouse_buttons_to_system; @@ -235,7 +235,7 @@ Lisp_Object Qw32_charset_unicode; #endif /* The ANSI codepage. */ -Lisp_Object Vw32_ansi_code_page; +int w32_ansi_code_page; /* Prefix for system colors. */ #define SYSTEM_COLOR_PREFIX "System" @@ -283,7 +283,7 @@ int image_cache_refcount, dpyinfo_refcount; /* From w32term.c. */ -extern Lisp_Object Vw32_num_mouse_buttons; +extern int w32_num_mouse_buttons; extern Lisp_Object Vw32_recognize_altgr; extern HWND w32_system_caret_hwnd; @@ -465,7 +465,7 @@ if the entry is new. */) CHECK_NUMBER (blue); CHECK_STRING (name); - XSET (rgb, Lisp_Int, RGB(XUINT (red), XUINT (green), XUINT (blue))); + XSETINT (rgb, RGB(XUINT (red), XUINT (green), XUINT (blue))); BLOCK_INPUT; @@ -828,7 +828,7 @@ w32_to_x_color (rgb) return Qnil; } -COLORREF +static Lisp_Object w32_color_map_lookup (colorname) char *colorname; { @@ -847,7 +847,7 @@ w32_color_map_lookup (colorname) if (lstrcmpi (SDATA (tem), colorname) == 0) { - ret = XUINT (Fcdr (elt)); + ret = Fcdr (elt); break; } @@ -910,7 +910,7 @@ add_system_logical_colors_to_map (system_colors) } -COLORREF +static Lisp_Object x_to_w32_color (colorname) char * colorname; { @@ -970,7 +970,8 @@ x_to_w32_color (colorname) if (i == 2) { UNBLOCK_INPUT; - return (colorval); + XSETINT (ret, colorval); + return ret; } color = end; } @@ -1023,7 +1024,8 @@ x_to_w32_color (colorname) if (*end != '\0') break; UNBLOCK_INPUT; - return (colorval); + XSETINT (ret, colorval); + return ret; } if (*end != '/') break; @@ -1064,7 +1066,8 @@ x_to_w32_color (colorname) if (*end != '\0') break; UNBLOCK_INPUT; - return (colorval); + XSETINT (ret, colorval); + return ret; } if (*end != '/') break; @@ -2418,6 +2421,10 @@ Lisp_Object w32_grabbed_keys; #define HOTKEY_VK_CODE(k) (XFASTINT (k) & 255) #define HOTKEY_MODIFIERS(k) (XFASTINT (k) >> 8) +#define RAW_HOTKEY_ID(k) ((k) & 0xbfff) +#define RAW_HOTKEY_VK_CODE(k) ((k) & 255) +#define RAW_HOTKEY_MODIFIERS(k) ((k) >> 8) + /* Register hot-keys for reserved key combinations when Emacs has keyboard focus, since this is the only way Emacs can receive key combinations like Alt-Tab which are used by the system. */ @@ -2499,20 +2506,20 @@ w32_msg_pump (deferred_msg * msg_buf) focus_window = GetFocus (); if (focus_window != NULL) RegisterHotKey (focus_window, - HOTKEY_ID (msg.wParam), - HOTKEY_MODIFIERS (msg.wParam), - HOTKEY_VK_CODE (msg.wParam)); + RAW_HOTKEY_ID (msg.wParam), + RAW_HOTKEY_MODIFIERS (msg.wParam), + RAW_HOTKEY_VK_CODE (msg.wParam)); /* Reply is not expected. */ break; case WM_EMACS_UNREGISTER_HOT_KEY: focus_window = GetFocus (); if (focus_window != NULL) - UnregisterHotKey (focus_window, HOTKEY_ID (msg.wParam)); + UnregisterHotKey (focus_window, RAW_HOTKEY_ID (msg.wParam)); /* Mark item as erased. NB: this code must be thread-safe. The next line is okay because the cons cell is never made into garbage and is not relocated by GC. */ - XSETCAR ((Lisp_Object) msg.lParam, Qnil); + XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) abort (); break; @@ -2520,7 +2527,7 @@ w32_msg_pump (deferred_msg * msg_buf) { int vk_code = (int) msg.wParam; int cur_state = (GetKeyState (vk_code) & 1); - Lisp_Object new_state = (Lisp_Object) msg.lParam; + Lisp_Object new_state = (Lisp_Object) ((EMACS_INT) msg.lParam); /* NB: This code must be thread-safe. It is safe to call NILP because symbols are not relocated by GC, @@ -2710,7 +2717,7 @@ post_character_message (hwnd, msg, wParam, lParam, modifiers) c = make_ctrl_char (c) & 0377; if (c == quit_char || (wmsg.dwModifiers == 0 && - XFASTINT (Vw32_quit_key) && wParam == XFASTINT (Vw32_quit_key))) + w32_quit_key && wParam == w32_quit_key)) { Vquit_flag = Qt; @@ -3120,7 +3127,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) are used together, but only if user has two button mouse. */ case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: - if (XINT (Vw32_num_mouse_buttons) > 2) + if (w32_num_mouse_buttons > 2) goto handle_plain_button; { @@ -3170,7 +3177,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) /* Hold onto message for now. */ mouse_button_timer = SetTimer (hwnd, MOUSE_BUTTON_ID, - XINT (Vw32_mouse_button_tolerance), NULL); + w32_mouse_button_tolerance, NULL); saved_mouse_button_msg.msg.hwnd = hwnd; saved_mouse_button_msg.msg.message = msg; saved_mouse_button_msg.msg.wParam = wParam; @@ -3183,7 +3190,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) case WM_LBUTTONUP: case WM_RBUTTONUP: - if (XINT (Vw32_num_mouse_buttons) > 2) + if (w32_num_mouse_buttons > 2) goto handle_plain_button; { @@ -3279,7 +3286,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) track_mouse_window = hwnd; } case WM_VSCROLL: - if (XINT (Vw32_mouse_move_interval) <= 0 + if (w32_mouse_move_interval <= 0 || (msg == WM_MOUSEMOVE && button_state == 0)) { wmsg.dwModifiers = w32_get_modifiers (); @@ -3295,7 +3302,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam) if (saved_mouse_move_msg.msg.hwnd == 0) mouse_move_timer = SetTimer (hwnd, MOUSE_MOVE_ID, - XINT (Vw32_mouse_move_interval), NULL); + w32_mouse_move_interval, NULL); /* Hold onto message for now. */ saved_mouse_move_msg.msg.hwnd = hwnd; @@ -4772,46 +4779,46 @@ x_to_w32_charset (lpcs) w32_charset = Fcar (Fcdr (this_entry)); /* Translate Lisp symbol to number. */ - if (w32_charset == Qw32_charset_ansi) + if (EQ (w32_charset, Qw32_charset_ansi)) return ANSI_CHARSET; - if (w32_charset == Qw32_charset_symbol) + if (EQ (w32_charset, Qw32_charset_symbol)) return SYMBOL_CHARSET; - if (w32_charset == Qw32_charset_shiftjis) + if (EQ (w32_charset, Qw32_charset_shiftjis)) return SHIFTJIS_CHARSET; - if (w32_charset == Qw32_charset_hangeul) + if (EQ (w32_charset, Qw32_charset_hangeul)) return HANGEUL_CHARSET; - if (w32_charset == Qw32_charset_chinesebig5) + if (EQ (w32_charset, Qw32_charset_chinesebig5)) return CHINESEBIG5_CHARSET; - if (w32_charset == Qw32_charset_gb2312) + if (EQ (w32_charset, Qw32_charset_gb2312)) return GB2312_CHARSET; - if (w32_charset == Qw32_charset_oem) + if (EQ (w32_charset, Qw32_charset_oem)) return OEM_CHARSET; #ifdef JOHAB_CHARSET - if (w32_charset == Qw32_charset_johab) + if (EQ (w32_charset, Qw32_charset_johab)) return JOHAB_CHARSET; - if (w32_charset == Qw32_charset_easteurope) + if (EQ (w32_charset, Qw32_charset_easteurope)) return EASTEUROPE_CHARSET; - if (w32_charset == Qw32_charset_turkish) + if (EQ (w32_charset, Qw32_charset_turkish)) return TURKISH_CHARSET; - if (w32_charset == Qw32_charset_baltic) + if (EQ (w32_charset, Qw32_charset_baltic)) return BALTIC_CHARSET; - if (w32_charset == Qw32_charset_russian) + if (EQ (w32_charset, Qw32_charset_russian)) return RUSSIAN_CHARSET; - if (w32_charset == Qw32_charset_arabic) + if (EQ (w32_charset, Qw32_charset_arabic)) return ARABIC_CHARSET; - if (w32_charset == Qw32_charset_greek) + if (EQ (w32_charset, Qw32_charset_greek)) return GREEK_CHARSET; - if (w32_charset == Qw32_charset_hebrew) + if (EQ (w32_charset, Qw32_charset_hebrew)) return HEBREW_CHARSET; - if (w32_charset == Qw32_charset_vietnamese) + if (EQ (w32_charset, Qw32_charset_vietnamese)) return VIETNAMESE_CHARSET; - if (w32_charset == Qw32_charset_thai) + if (EQ (w32_charset, Qw32_charset_thai)) return THAI_CHARSET; - if (w32_charset == Qw32_charset_mac) + if (EQ (w32_charset, Qw32_charset_mac)) return MAC_CHARSET; #endif /* JOHAB_CHARSET */ #ifdef UNICODE_CHARSET - if (w32_charset == Qw32_charset_unicode) + if (EQ (w32_charset, Qw32_charset_unicode)) return UNICODE_CHARSET; #endif @@ -4937,8 +4944,8 @@ w32_to_x_charset (fncharset) /* Look for Same charset and a valid codepage (or non-int which means ignore). */ - if (w32_charset == charset_type - && (!INTEGERP (codepage) || codepage == CP_DEFAULT + if (EQ (w32_charset, charset_type) + && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT || IsValidCodePage (XINT (codepage)))) { /* If we don't have a match already, then this is the @@ -5095,8 +5102,8 @@ w32_to_all_x_charsets (fncharset) /* Look for Same charset and a valid codepage (or non-int which means ignore). */ - if (w32_charset == charset_type - && (!INTEGERP (codepage) || codepage == CP_DEFAULT + if (EQ (w32_charset, charset_type) + && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT || IsValidCodePage (XINT (codepage)))) { retval = Fcons (x_charset, retval); @@ -6145,6 +6152,9 @@ w32_find_ccl_program (fontp) } } +/* directory-files from dired.c. */ +Lisp_Object Fdirectory_files P_((Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); + /* Find BDF files in a specified directory. (use GCPRO when calling, as this calls lisp to get a directory listing). */ @@ -6158,7 +6168,7 @@ w32_find_bdf_fonts_in_dir (Lisp_Object directory) return Qnil; filelist = Fdirectory_files (directory, Qt, - build_string (".*\\.[bB][dD][fF]"), Qt); + build_string (".*\\.[bB][dD][fF]"), Qt); for ( ; CONSP(filelist); filelist = XCDR (filelist)) { @@ -7945,7 +7955,7 @@ lookup_vk_code (char *key) /* Convert a one-element vector style key sequence to a hot key definition. */ -static int +static Lisp_Object w32_parse_hot_key (key) Lisp_Object key; { @@ -7977,7 +7987,7 @@ w32_parse_hot_key (key) if (SYMBOLP (c)) { c = parse_modifiers (c); - lisp_modifiers = Fcar (Fcdr (c)); + lisp_modifiers = XINT (Fcar (Fcdr (c))); c = Fcar (c); if (!SYMBOLP (c)) abort (); @@ -8046,8 +8056,13 @@ The return value is the hotkey-id if registered, otherwise nil. */) /* Notify input thread about new hot-key definition, so that it takes effect without needing to switch focus. */ +#ifdef USE_LISP_UNION_TYPE + PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, + (WPARAM) key.i, 0); +#else PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY, (WPARAM) key, 0); +#endif } return key; @@ -8070,8 +8085,14 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key, { /* Notify input thread about hot-key definition being removed, so that it takes effect without needing focus switch. */ +#ifdef USE_LISP_UNION_TYPE + if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, + (WPARAM) XINT (XCAR (item)), (LPARAM) item.i)) +#else if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY, - (WPARAM) XINT (XCAR (item)), (LPARAM) item)) + (WPARAM) XINT (XCAR (item)), (LPARAM) item.i)) + +#endif { MSG msg; 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. */) if (!dwWindowsThreadId) return make_number (w32_console_toggle_lock_key (vk_code, new_state)); +#ifdef USE_LISP_UNION_TYPE + if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, + (WPARAM) vk_code, (LPARAM) new_state.i)) +#else if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY, - (WPARAM) vk_code, (LPARAM) new_state)) + (WPARAM) vk_code, (LPARAM) new_state.i)) +#endif { MSG msg; 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. */); When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */); Vw32_alt_is_meta = Qt; - DEFVAR_INT ("w32-quit-key", &Vw32_quit_key, - doc: /* If non-zero, the virtual key code for an alternative quit key. */); - XSETINT (Vw32_quit_key, 0); + DEFVAR_INT ("w32-quit-key", &w32_quit_key, + doc: /* If non-zero, the virtual key code for an alternative quit key. */); + w32_quit_key = 0; DEFVAR_LISP ("w32-pass-lwindow-to-system", &Vw32_pass_lwindow_to_system, @@ -8440,9 +8466,9 @@ When non-nil, the Start menu is opened by tapping the key. */); When non-nil, the Start menu is opened by tapping the key. */); Vw32_pass_rwindow_to_system = Qt; - DEFVAR_INT ("w32-phantom-key-code", + DEFVAR_LISP ("w32-phantom-key-code", &Vw32_phantom_key_code, - doc: /* Virtual key code used to generate \"phantom\" key presses. + doc: /* Virtual key code used to generate \"phantom\" key presses. Value is a number between 0 and 255. Phantom 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 `w32-pass-rwindow-to-system' is nil. */); /* Although 255 is technically not a valid key code, it works and means that this hack won't interfere with any real key code. */ - Vw32_phantom_key_code = 255; + XSETINT (Vw32_phantom_key_code, 255); DEFVAR_LISP ("w32-enable-num-lock", &Vw32_enable_num_lock, @@ -8505,21 +8531,21 @@ Any other value will cause the key to be ignored. */); Vw32_enable_palette = Qt; DEFVAR_INT ("w32-mouse-button-tolerance", - &Vw32_mouse_button_tolerance, + &w32_mouse_button_tolerance, doc: /* Analogue of double click interval for faking middle mouse events. The value is the minimum time in milliseconds that must elapse between left/right button down events before they are considered distinct events. If both mouse buttons are depressed within this interval, a middle mouse button down event is generated instead. */); - XSETINT (Vw32_mouse_button_tolerance, GetDoubleClickTime () / 2); + w32_mouse_button_tolerance = GetDoubleClickTime () / 2; DEFVAR_INT ("w32-mouse-move-interval", - &Vw32_mouse_move_interval, + &w32_mouse_move_interval, doc: /* Minimum interval between mouse move events. The value is the minimum time in milliseconds that must elapse between successive mouse move (or scroll bar drag) events before they are reported as lisp events. */); - XSETINT (Vw32_mouse_move_interval, 0); + w32_mouse_move_interval = 0; DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system", &w32_pass_extra_mouse_buttons_to_system, @@ -8800,9 +8826,9 @@ void globals_of_w32fns () GetProcAddress (user32_lib, "GetClipboardSequenceNumber"); DEFVAR_INT ("w32-ansi-code-page", - &Vw32_ansi_code_page, + &w32_ansi_code_page, doc: /* The ANSI code page used by the system. */); - XSETINT (Vw32_ansi_code_page, GetACP ()); + w32_ansi_code_page = GetACP (); } #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 () exit (1); } +#if defined (NO_UNION_TYPE) && !defined (USE_LSB_TAG) /* Ensure that the addresses don't use the upper tag bits since the Lisp type goes there. */ if (((unsigned long) data_region_base & ~VALMASK) != 0) @@ -252,7 +253,7 @@ init_heap () printf ("Error: The heap was allocated in upper memory.\n"); exit (1); } - +#endif data_region_end = data_region_base; real_data_region_end = data_region_end; } 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) } if (event->uChar.AsciiChar == 0) return 0; - XSETINT (emacs_ev->code, event->uChar.AsciiChar); + emacs_ev->code = event->uChar.AsciiChar; } else { emacs_ev->kind = NON_ASCII_KEYSTROKE_EVENT; - XSETINT (emacs_ev->code, event->wVirtualKeyCode); + emacs_ev->code = event->wVirtualKeyCode; } XSETFRAME (emacs_ev->frame_or_window, get_frame ()); @@ -524,8 +524,8 @@ w32_console_mouse_position (FRAME_PTR *f, *part = 0; SELECTED_FRAME ()->mouse_moved = 0; - *x = movement_pos.X; - *y = movement_pos.Y; + XSETINT(*x, movement_pos.X); + XSETINT(*y, movement_pos.Y); *time = movement_time; UNBLOCK_INPUT; @@ -593,9 +593,9 @@ do_mouse_event (MOUSE_EVENT_RECORD *event, if (but_change & mask) { if (i < NUM_TRANSLATED_MOUSE_BUTTONS) - XSETINT (emacs_ev->code, emacs_button_translation[i]); + emacs_ev->code = emacs_button_translation[i]; else - XSETINT (emacs_ev->code, i); + emacs_ev->code = i; break; } 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; avoids the inefficiency of frequently reading small amounts of data. This is primarily necessary for handling DOS processes on Windows 95, but is useful for W32 processes on both Windows 95 and NT as well. */ -Lisp_Object Vw32_pipe_read_delay; +int w32_pipe_read_delay; /* Control conversion of upper case file names to lower case. nil means no, t means yes. */ @@ -367,7 +367,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app, cp->pid = -cp->pid; /* pid must fit in a Lisp_Int */ - cp->pid = (cp->pid & VALMASK); + cp->pid = XUINT (make_number (cp->pid)); *pPid = cp->pid; @@ -2202,7 +2202,7 @@ When non-nil, they inherit their error mode setting from Emacs, which stops them blocking when trying to access unmounted drives etc. */); Vw32_start_process_inherit_error_mode = Qt; - DEFVAR_INT ("w32-pipe-read-delay", &Vw32_pipe_read_delay, + DEFVAR_INT ("w32-pipe-read-delay", &w32_pipe_read_delay, doc: /* Forced delay before reading subprocess output. This is done to improve the buffering of subprocess output, by avoiding 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 reading the subprocess output. If negative, the magnitude is the number of time slices to wait (effectively boosting the priority of the child process temporarily). A value of zero disables waiting entirely. */); - Vw32_pipe_read_delay = 50; + w32_pipe_read_delay = 50; DEFVAR_LISP ("w32-downcase-file-names", &Vw32_downcase_file_names, 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; static RECT last_mouse_glyph; static Lisp_Object last_mouse_press_frame; -Lisp_Object Vw32_num_mouse_buttons; +int w32_num_mouse_buttons; Lisp_Object Vw32_swap_mouse_buttons; @@ -4360,10 +4360,16 @@ w32_read_socket (sd, expected, hold_quit) /* If the contents of the global variable help_echo_string has changed, generate a HELP_EVENT. */ +#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE. + But it was originally changed to this to fix a bug, so I have + not removed it completely in case the bug is still there. */ if (help_echo_string != previous_help_echo_string || (!NILP (help_echo_string) && !STRINGP (help_echo_string) && f->mouse_moved)) +#else /* This is what xterm.c does. */ + if (!NILP (help_echo_string) + || !NILP (previous_help_echo_string)) do_help = 1; - +#endif break; case WM_LBUTTONDOWN: @@ -4784,7 +4790,7 @@ w32_read_socket (sd, expected, hold_quit) if (do_help > 0) { - if (help_echo_string == Qnil) + if (NILP (help_echo_string)) { help_echo_object = help_echo_window = Qnil; help_echo_pos = -1; @@ -6460,9 +6466,9 @@ syms_of_w32term () Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); DEFVAR_INT ("w32-num-mouse-buttons", - &Vw32_num_mouse_buttons, + &w32_num_mouse_buttons, doc: /* Number of physical mouse buttons. */); - Vw32_num_mouse_buttons = Qnil; + w32_num_mouse_buttons = 2; DEFVAR_LISP ("w32-swap-mouse-buttons", &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 unless `pop-up-frames' or `display-buffer-reuse-frames' is non-nil, which means search visible and iconified frames. +If a full-width window on a splittable frame is available to display +the buffer, it may be split, subject to the value of the variable +`split-height-threshold'. + If `even-window-heights' is non-nil, window heights will be evened out if displaying the buffer causes two vertically adjacent windows to be displayed. */) @@ -3587,7 +3591,8 @@ DEFUN ("split-window", Fsplit_window, Ssplit_window, 0, 3, "", WINDOW defaults to selected one and SIZE to half its size. If optional third arg HORFLAG is non-nil, split side by side and put SIZE columns in the first of the pair. In that case, -SIZE includes that window's scroll bar, or the divider column to its right. */) +SIZE includes that window's scroll bar, or the divider column to its right. +Returns the newly-created window. */) (window, size, horflag) Lisp_Object window, size, horflag; { @@ -6594,7 +6599,7 @@ See also `same-window-buffer-names'. */); next_screen_context_lines = 2; DEFVAR_INT ("split-height-threshold", &split_height_threshold, - doc: /* *display-buffer would prefer to split the largest window if this large. + doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'. If there is only one window, it is split regardless of this value. */); split_height_threshold = 500; 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) int noverlays; int endpos; Lisp_Object *overlays; - int len; int i; /* Get all overlays at the given position. */ - len = 10; - overlays = (Lisp_Object *) alloca (len * sizeof *overlays); - noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1); - if (noverlays > len) - { - len = noverlays; - overlays = (Lisp_Object *) alloca (len * sizeof *overlays); - noverlays = overlays_at (pos, 0, &overlays, &len, &endpos, NULL, 1); - } + GET_OVERLAYS_AT (pos, overlays, noverlays, &endpos, 1); /* If any of these overlays ends before endpos, use its ending point instead. */ @@ -20832,7 +20823,7 @@ note_mouse_highlight (f, x, y) Lisp_Object object; Lisp_Object mouse_face = Qnil, overlay = Qnil, position; Lisp_Object *overlay_vec = NULL; - int len, noverlays; + int noverlays; struct buffer *obuf; int obegv, ozv, same_region; @@ -20919,19 +20910,8 @@ note_mouse_highlight (f, x, y) if (BUFFERP (object)) { - /* Put all the overlays we want in a vector in overlay_vec. - Store the length in len. If there are more than 40, make - enough space for all, and try again. */ - len = 40; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0); - if (noverlays > len) - { - len = noverlays; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL,0); - } - + /* Put all the overlays we want in a vector in overlay_vec. */ + GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); /* Sort overlays into increasing priority order. */ noverlays = sort_overlays (overlay_vec, noverlays, w); } 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. */) DEFUN ("internal-copy-lisp-face", Finternal_copy_lisp_face, Sinternal_copy_lisp_face, 4, 4, 0, doc: /* Copy face FROM to TO. -If FRAME it t, copy the global face definition of FROM to the +If FRAME is t, copy the global face definition of FROM to the global face definition of TO. Otherwise, copy the frame-local definition of FROM on FRAME to the frame-local definition of TO on NEW-FRAME, or FRAME if NEW-FRAME is nil. @@ -4687,8 +4687,8 @@ DEFUN ("internal-get-lisp-face-attribute", Finternal_get_lisp_face_attribute, doc: /* Return face attribute KEYWORD of face SYMBOL. If SYMBOL does not name a valid Lisp face or KEYWORD isn't a valid face attribute name, signal an error. -If the optional argument FRAME is given, report on face FACE in that -frame. If FRAME is t, report on the defaults for face FACE (for new +If the optional argument FRAME is given, report on face SYMBOL in that +frame. If FRAME is t, report on the defaults for face SYMBOL (for new frames). If FRAME is omitted or nil, use the selected frame. */) (symbol, keyword, frame) Lisp_Object symbol, keyword, frame; @@ -5238,10 +5238,10 @@ with the default face for display, can be represented in a way that's \(1) different in appearance than the default face, and \(2) `close in spirit' to what the attributes specify, if not exact. -Point (2) implies that a `:weight black' attribute will be satisified +Point (2) implies that a `:weight black' attribute will be satisfied by any terminal that can display bold, and a `:foreground "yellow"' as long as the terminal can display a yellowish color, but `:slant italic' -will _not_ be satisified by the tty display code's automatic +will _not_ be satisfied by the tty display code's automatic substitution of a `dim' face for italic. */) (attributes, frame) Lisp_Object attributes, frame; @@ -5449,8 +5449,8 @@ clear_face_gcs (c) } -/* Free all realized faces in face cache C, including basic faces. C - may be null. If faces are freed, make sure the frame's current +/* Free all realized faces in face cache C, including basic faces. + C may be null. If faces are freed, make sure the frame's current matrix is marked invalid, so that a display caused by an expose event doesn't try to use faces we destroyed. */ @@ -7306,24 +7306,8 @@ face_at_buffer_position (w, pos, region_beg, region_end, /* Look at properties from overlays. */ { int next_overlay; - int len; - - /* First try with room for 40 overlays. */ - len = 40; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, 0, &overlay_vec, &len, - &next_overlay, NULL, 0); - - /* If there are more than 40, make enough space for all, and try - again. */ - if (noverlays > len) - { - len = noverlays; - overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); - noverlays = overlays_at (pos, 0, &overlay_vec, &len, - &next_overlay, NULL, 0); - } + GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0); if (next_overlay < endpos) endpos = next_overlay; } 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. */); #endif /* USE_X_TOOLKIT */ #ifdef USE_GTK + /* Provide x-toolkit also for GTK. Internally GTK does not use Xt so it + is not an X toolkit in that sense (USE_X_TOOLKIT is not defined). + But for a user it is a toolkit for X, and indeed, configure + accepts --with-x-toolkit=gtk. */ + Fprovide (intern ("x-toolkit"), Qnil); Fprovide (intern ("gtk"), Qnil); DEFVAR_LISP ("gtk-version-string", &Vgtk_version_string, |