aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2010-08-25 14:15:20 +0900
committerKenichi Handa2010-08-25 14:15:20 +0900
commit4e603db3429957e6b26953c177f00a9c9d1c8766 (patch)
tree8206240e3006468bff9dfda5fb3696f80fbcb9f0 /src
parentb60f961f6cdc1095e778ad624657bb57788512af (diff)
parentf6aa6ec68ed936800ef2c3aefa42102e60b654cb (diff)
downloademacs-4e603db3429957e6b26953c177f00a9c9d1c8766.tar.gz
emacs-4e603db3429957e6b26953c177f00a9c9d1c8766.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog198
-rw-r--r--src/Makefile.in9
-rw-r--r--src/alloc.c15
-rw-r--r--src/callproc.c5
-rw-r--r--src/cmds.c41
-rw-r--r--src/composite.c50
-rw-r--r--src/config.in6
-rw-r--r--src/dbusbind.c234
-rw-r--r--src/deps.mk4
-rw-r--r--src/dispnew.c41
-rw-r--r--src/doc.c31
-rw-r--r--src/emacs.c70
-rw-r--r--src/eval.c27
-rw-r--r--src/image.c535
-rw-r--r--src/keyboard.c44
-rw-r--r--src/makefile.w32-in1
-rw-r--r--src/process.c89
-rw-r--r--src/puresize.h9
-rw-r--r--src/s/aix4-2.h4
-rw-r--r--src/s/hpux10-20.h7
-rw-r--r--src/s/ms-w32.h1
-rw-r--r--src/s/unixware.h2
-rw-r--r--src/sysdep.c180
-rw-r--r--src/sysselect.h5
-rw-r--r--src/systty.h124
-rw-r--r--src/term.c3
-rw-r--r--src/unexcoff.c64
-rw-r--r--src/w32fns.c7
-rw-r--r--src/w32menu.c6
-rw-r--r--src/xdisp.c23
30 files changed, 1103 insertions, 732 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0a1a268d962..5ce4c049c77 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,186 @@
12010-08-25 Kenichi Handa <handa@m17n.org>
2
3 * composite.c (composition_compute_stop_pos): Don't break
4 composition at PT.
5 (composition_reseat_it): Likewise. Fix calculation of character
6 position starting a composition.
7 (Fcomposition_get_gstring): Don't limit the number of components
8 for automatic composition.
9
102010-08-25 Kenichi Handa <handa@m17n.org>
11
12 * composite.c (composition_compute_stop_pos): In forward search,
13 pay attention to the possibility that some character after ENDPOS
14 will be composed with charactrs before ENDPOS.
15
162010-08-24 Chong Yidong <cyd@stupidchicken.com>
17
18 * keyboard.c (command_loop_1): Don't clobber primary selection
19 during handle-switch-frame (Bug#6872).
20
212010-08-23 Michael Albinus <michael.albinus@gmx.de>
22
23 * dbusbind.c: Accept UNIX domain sockets as bus address.
24 (Fdbus_close_bus): New function.
25 (Vdbus_registered_buses): New variable.
26 (xd_initialize): Implement string as bus address.
27 (Fdbus_init_bus): Add bus to Vdbus_registered_buses).
28 (Fdbus_get_unique_name, Fdbus_call_method)
29 (Fdbus_call_method_asynchronously, Fdbus_method_return_internal)
30 (Fdbus_method_error_internal, Fdbus_send_signal)
31 (Fdbus_register_signal, Fdbus_register_method): Remove bus type
32 check. This is done in xd_initialize_bus. Adapt doc string, if
33 necessary.
34 (xd_pending_messages, xd_read_queued_messages): Loop over buses in
35 Vdbus_registered_buses.
36 (Vdbus_registered_objects_table): Create hash.
37
382010-08-22 Juri Linkov <juri@jurta.org>
39
40 * keyboard.c (Fexecute_extended_command): Move reading a command name
41 with `completing-read' to a new Elisp function `read-extended-command'.
42 Call it to read a command to `function' (bug#5364, bug#5214).
43
442010-08-22 Chong Yidong <cyd@stupidchicken.com>
45
46 * emacs.c (main): Remove handling of --unibyte arg (Bug#6886).
47
482010-08-22 Andreas Schwab <schwab@linux-m68k.org>
49
50 * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA_LISP
51 instead of SAFE_ALLOCA.
52
532010-08-22 Chong Yidong <cyd@stupidchicken.com>
54
55 * eval.c (Flet, Feval, Fapply, apply_lambda): Use SAFE_ALLOCA
56 (Bug#6214).
57
582010-08-22 Jan Djärv <jan.h.d@swipnet.se>
59
60 * doc.c (Fsnarf_documentation): Set skip_file only if p[1] is S.
61
622010-08-22 Jan Djärv <jan.h.d@swipnet.se>
63
64 * doc.c (Fsnarf_documentation): Initialize skip_file before
65 build-files test.
66
672010-08-22 Peter O'Gorman <pogma@thewrittenword.com> (tiny change)
68
69 * s/hpux10-20.h (HAVE_TERMIOS, NO_TERMIO, ORDINARY_LINK):
70 New definitions.
71 (HAVE_TERMIO): Remove.
72
732010-08-22 Eli Zaretskii <eliz@gnu.org>
74
75 * deps.mk (sysdep.o, msdos.o): Depend on sysselect.h.
76
77 * sysselect.h [WINDOWSNT]: Don't define the FD_* and select stuff
78 for w32.
79
80 * s/ms-w32.h (HAVE_SYS_TIMEB_H): Don't #undef HAVE_SYS_SELECT_H,
81 it's done in nt/config.nt.
82
83 * makefile.w32-in ($(BLD)/sysdep.$(O)): Depend on sysselect.h.
84
85 * unexcoff.c (report_error, make_hdr, write_segment)
86 (copy_text_and_data, copy_sym, mark_x, adjust_lnnoptrs, unexec):
87 Convert argument lists and prototypes to ANSI C.
88 (make_hdr, write_segment): Remove unused variables.
89 (unexec): Remove commented-out line. Initialize `new' to shut up
90 compiler warnings.
91
922010-08-22 Dan Nicolaescu <dann@ics.uci.edu>
93
94 Simplify termio code.
95 All non-MSDOS non-WINDOWSNT platforms define HAVE_TERMIOS, so
96 HAVE_TERMIO code is obsolete.
97 Replace HAVE_TERMIOS conditionals with !DOS_NT.
98 * systty.h: Do not define HAVE_TCATTR.
99 Remove HAVE_TERMIO, HAVE_LTCHARS and HAVE_TCHARS code.
100 Do not define EMACS_HAVE_TTY_PGRP. Only define
101 EMACS_GET_TTY_PGRP for !DOS_NT.
102 * sysdep.c: Include sysselect.h unconditionally. Do not include
103 sys/ioctl.h and termios.h, systty.h does it. Use
104 HAVE_SYS_UTSNAME_H instead of USG as an include guard.
105 (init_baud_rate): Remove HAVE_TERMIO code.
106 (child_setup_tty): Remove HAVE_TERMIO code.
107 (emacs_get_tty, emacs_set_tty): Remove HAVE_TERMIO, HAVE_TCHARS
108 and HAVE_LTCHARS code. Use !DOS_NT instead of HAVE_TCATTR.
109 (new_ltchars, new_tchars): Remove, unused.
110 (init_sys_modes): Remove HAVE_TERMIO, HAVE_TCHARS and HAVE_LTCHARS
111 code. Remove special casing for __mips__, it was a no-op. Remove
112 HAVE_TCATTR conditional, it is implied by HAVE_TERMIOS.
113 (init_sys_modes): Remove HPUX special case.
114 * process.c: Include stdlib.h unconditionally. Do not include
115 fcntl.h, systty.h does it. Remove conditional code for
116 HAVE_SERIAL, it is always true.
117 (process_send_signal): Remove HAVE_TERMIOS conditional, it's
118 always true when SIGNALS_VIA_CHARACTERS is true.
119 (Fcontinue_process, Fprocess_send_eof): Simplify conditionals:
120 !WINDOWSNT means HAVE_TERMIOS.
121 (create_process): Remove HAVE_TERMIOS, it's inside a HAVE_PTYS
122 conditional, which is true for all HAVE_TERMIOS systems.
123 * keyboard.c (init_keyboard): Do not use HAVE_TERMIO, use !DOS_NT
124 instead of HAVE_TERMIOS.
125 * emacs.c (shut_down_emacs): Use !defined DOS_NT instead of
126 EMACS_HAVE_TTY_PGRP.
127 * callproc.c (child_setup): Move EMACS_SET_TTY_PGRP use to the
128 non-MSDOS, non-WINDOWSNT code, it's only defined for such systems
129 anyway.
130
1312010-08-21 Eli Zaretskii <eliz@gnu.org>
132
133 * dispnew.c (buffer_posn_from_coords): Fix off-by-one error in
134 mirroring pixel positions.
135
1362010-08-20 Dan Nicolaescu <dann@ics.uci.edu>
137
138 * alloc.c (malloc_sbrk_used, malloc_sbrk_unused): Remove,
139 write only.
140 (init_alloc_once): Remove writes to malloc_sbrk_unused, and
141 malloc_sbrk_used, nothing uses them.
142
143 * puresize.h: Remove code assuming PNTR_COMPARISON_TYPE is not
144 defined, unconditionally defined in lisp.h.
145
146 * term.c: Do not include <termios.h>, systty.h does it.
147
148 * s/unixware.h (HAVE_TCATTR):
149 * s/aix4-2.h (HAVE_TCATTR): Remove definitions, not needed.
150 systty.h defines it when HAVE_TERMIOS is defined.
151
1522010-08-20 Eli Zaretskii <eliz@gnu.org>
153
154 * dispnew.c (buffer_posn_from_coords): Fix last change for text
155 terminals: add one-character offset for R2L lines.
156
157 * emacs.c <emacs_version>: Add a comment regarding
158 msdos/mainmake.v2's dependency on the syntax of this declaration.
159
1602010-08-20 Eli Zaretskii <eliz@gnu.org>
161
162 * dispnew.c (buffer_posn_from_coords): Fix calculation of buffer
163 position for R2L lines by mirroring the pixel position wrt the
164 text are box. Improve commentary.
165
1662010-08-20 Andreas Schwab <schwab@linux-m68k.org>
167
168 * image.c (imagemagick_clear_image): Remove debugging output.
169
1702010-08-19 Stefan Monnier <monnier@iro.umontreal.ca>
171
172 * cmds.c (Vself_insert_face, Vself_insert_face_command): Remove.
173 (Qpost_self_insert_hook, Vpost_self_insert_hook): New vars.
174 (internal_self_insert): Run Qpost_self_insert_hook rather than handle
175 self-insert-face.
176 (syms_of_cmds): Initialize the new vars.
177
1782010-08-19 Jason Rumney <jasonr@gnu.org>
179
180 * w32menu.c (set_frame_menubar): Remove call to undefined function.
181
182 * w32fns.c (w32_wnd_proc): Don't check context before initializing.
183
12010-08-19 Jan Djärv <jan.h.d@swipnet.se> 1842010-08-19 Jan Djärv <jan.h.d@swipnet.se>
2 185
3 * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary". 186 * nsselect.m (nxatoms_of_nsselect): Use "Selection" and "Secondary".
@@ -33,6 +216,17 @@
33 NXSecondaryPboard = SecondarySelection. 216 NXSecondaryPboard = SecondarySelection.
34 (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677). 217 (syms_of_nsselect): Intern QCLIPBOARD (Bug#6677).
35 218
2192010-08-18 Joakim Verona <joakim@verona.se>
220
221 * image.c: Add support for ImageMagick. When HAVE_IMAGEMAGICK is
222 defined:
223 (imagemagick_image_p): New function to test for ImageMagic image.
224 (imagemagick_load): New function to load ImageMagick image.
225 (imagemagick_load_image): New function, helper for imagemagick_load.
226 (imagemagick-types): New function.
227 (Qimagemagick): New Lisp_object.
228 (imagemagick-render-type): New variable, decides which renderer to use.
229
362010-08-17 Stefan Monnier <monnier@iro.umontreal.ca> 2302010-08-17 Stefan Monnier <monnier@iro.umontreal.ca>
37 231
38 * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL 232 * gtkutil.c (update_frame_tool_bar): Don't assume TOOL_BAR_ITEM_LABEL
@@ -329,10 +523,10 @@
329 523
3302010-08-08 Kenichi Handa <handa@m17n.org> 5242010-08-08 Kenichi Handa <handa@m17n.org>
331 525
332 * charset.c: Include <stdlib.h> 526 * charset.c: Include <stdlib.h>.
333 (struct charset_sort_data): New struct. 527 (struct charset_sort_data): New struct.
334 (charset_compare): New function. 528 (charset_compare): New function.
335 (Fsort_charsets): New funciton. 529 (Fsort_charsets): New function.
336 (syms_of_charset): Declare Fsort_charsets as a Lisp function. 530 (syms_of_charset): Declare Fsort_charsets as a Lisp function.
337 531
338 * coding.c (decode_coding_iso_2022): Fix checking of dimension 532 * coding.c (decode_coding_iso_2022): Fix checking of dimension
diff --git a/src/Makefile.in b/src/Makefile.in
index a8d400c7c39..9ee5631ef70 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,3 +1,4 @@
1
1# Makefile for GNU Emacs. 2# Makefile for GNU Emacs.
2# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 3# Copyright (C) 1985, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, 2002,
3# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 4# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
@@ -222,6 +223,10 @@ CFLAGS_SOUND= @CFLAGS_SOUND@
222RSVG_LIBS= @RSVG_LIBS@ 223RSVG_LIBS= @RSVG_LIBS@
223RSVG_CFLAGS= @RSVG_CFLAGS@ 224RSVG_CFLAGS= @RSVG_CFLAGS@
224 225
226IMAGEMAGICK_LIBS= @IMAGEMAGICK_LIBS@
227IMAGEMAGICK_CFLAGS= @IMAGEMAGICK_CFLAGS@
228
229
225## widget.o if USE_X_TOOLKIT, otherwise empty. 230## widget.o if USE_X_TOOLKIT, otherwise empty.
226WIDGET_OBJ=@WIDGET_OBJ@ 231WIDGET_OBJ=@WIDGET_OBJ@
227 232
@@ -315,7 +320,7 @@ MKDEPDIR=@MKDEPDIR@
315## FIXME? MYCPPFLAGS only referenced in etc/DEBUG. 320## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
316ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \ 321ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \
317 ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \ 322 ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \
318 ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} \ 323 ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${IMAGEMAGICK_CFLAGS} ${DBUS_CFLAGS} \
319 ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \ 324 ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \
320 ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \ 325 ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \
321 ${C_WARNINGS_SWITCH} ${CFLAGS} 326 ${C_WARNINGS_SWITCH} ${CFLAGS}
@@ -590,7 +595,7 @@ SOME_MACHINE_LISP = ../lisp/mouse.elc \
590## duplicated symbols. If the standard libraries were compiled 595## duplicated symbols. If the standard libraries were compiled
591## with GCC, we might need LIB_GCC again after them. 596## with GCC, we might need LIB_GCC again after them.
592LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ 597LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
593 $(RSVG_LIBS) $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 598 $(RSVG_LIBS) ${IMAGEMAGICK_LIBS} $(DBUS_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
594 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \ 599 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) ${GCONF_LIBS} ${LIBSELINUX_LIBS} \
595 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 600 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
596 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC) 601 $(LIB_GCC) $(LIB_MATH) $(LIB_STANDARD) $(LIB_GCC)
diff --git a/src/alloc.c b/src/alloc.c
index 473c5622ab3..1f615a7d505 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -214,16 +214,6 @@ int abort_on_gc;
214 214
215int garbage_collection_messages; 215int garbage_collection_messages;
216 216
217#ifndef VIRT_ADDR_VARIES
218extern
219#endif /* VIRT_ADDR_VARIES */
220int malloc_sbrk_used;
221
222#ifndef VIRT_ADDR_VARIES
223extern
224#endif /* VIRT_ADDR_VARIES */
225int malloc_sbrk_unused;
226
227/* Number of live and free conses etc. */ 217/* Number of live and free conses etc. */
228 218
229static int total_conses, total_markers, total_symbols, total_vector_size; 219static int total_conses, total_markers, total_symbols, total_vector_size;
@@ -6178,11 +6168,6 @@ init_alloc_once (void)
6178 consing_since_gc = 0; 6168 consing_since_gc = 0;
6179 gc_cons_threshold = 100000 * sizeof (Lisp_Object); 6169 gc_cons_threshold = 100000 * sizeof (Lisp_Object);
6180 gc_relative_threshold = 0; 6170 gc_relative_threshold = 0;
6181
6182#ifdef VIRT_ADDR_VARIES
6183 malloc_sbrk_unused = 1<<22; /* A large number */
6184 malloc_sbrk_used = 100000; /* as reasonable as any number */
6185#endif /* VIRT_ADDR_VARIES */
6186} 6171}
6187 6172
6188void 6173void
diff --git a/src/callproc.c b/src/callproc.c
index de28ffa42ef..8c1384df6a1 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1231,8 +1231,6 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1231#else 1231#else
1232 setpgrp (pid, pid); 1232 setpgrp (pid, pid);
1233#endif /* USG */ 1233#endif /* USG */
1234 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
1235 EMACS_SET_TTY_PGRP (0, &pid);
1236 1234
1237#ifdef MSDOS 1235#ifdef MSDOS
1238 pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); 1236 pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env);
@@ -1251,6 +1249,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
1251 report_file_error ("Spawning child process", Qnil); 1249 report_file_error ("Spawning child process", Qnil);
1252 return cpid; 1250 return cpid;
1253#else /* not WINDOWSNT */ 1251#else /* not WINDOWSNT */
1252 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
1253 EMACS_SET_TTY_PGRP (0, &pid);
1254
1254 /* execvp does not accept an environment arg so the only way 1255 /* execvp does not accept an environment arg so the only way
1255 to pass this environment is to set environ. Our caller 1256 to pass this environment is to set environ. Our caller
1256 is responsible for restoring the ambient value of environ. */ 1257 is responsible for restoring the ambient value of environ. */
diff --git a/src/cmds.c b/src/cmds.c
index 4cb6ca199e7..f306ede7ca5 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -37,12 +37,6 @@ Lisp_Object Qkill_forward_chars, Qkill_backward_chars, Vblink_paren_function;
37/* A possible value for a buffer's overwrite-mode variable. */ 37/* A possible value for a buffer's overwrite-mode variable. */
38Lisp_Object Qoverwrite_mode_binary; 38Lisp_Object Qoverwrite_mode_binary;
39 39
40/* Non-nil means put this face on the next self-inserting character. */
41Lisp_Object Vself_insert_face;
42
43/* This is the command that set up Vself_insert_face. */
44Lisp_Object Vself_insert_face_command;
45
46static int internal_self_insert (int, int); 40static int internal_self_insert (int, int);
47 41
48DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, 42DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
@@ -346,6 +340,7 @@ After insertion, the value of `auto-fill-function' is called if the
346 A value of 2 means this did things that call for an undo boundary. */ 340 A value of 2 means this did things that call for an undo boundary. */
347 341
348static Lisp_Object Qexpand_abbrev; 342static Lisp_Object Qexpand_abbrev;
343static Lisp_Object Qpost_self_insert_hook, Vpost_self_insert_hook;
349 344
350static int 345static int
351internal_self_insert (int c, int noautofill) 346internal_self_insert (int c, int noautofill)
@@ -451,10 +446,10 @@ internal_self_insert (int c, int noautofill)
451 && synt != Sword 446 && synt != Sword
452 && NILP (current_buffer->read_only) 447 && NILP (current_buffer->read_only)
453 && PT > BEGV 448 && PT > BEGV
454 && (!NILP (current_buffer->enable_multibyte_characters) 449 && (SYNTAX (!NILP (current_buffer->enable_multibyte_characters)
455 ? SYNTAX (XFASTINT (Fprevious_char ())) == Sword 450 ? XFASTINT (Fprevious_char ())
456 : (SYNTAX (UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ()))) 451 : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
457 == Sword))) 452 == Sword))
458 { 453 {
459 int modiff = MODIFF; 454 int modiff = MODIFF;
460 Lisp_Object sym; 455 Lisp_Object sym;
@@ -514,15 +509,6 @@ internal_self_insert (int c, int noautofill)
514 hairy = 2; 509 hairy = 2;
515 } 510 }
516 511
517 /* If previous command specified a face to use, use it. */
518 if (!NILP (Vself_insert_face)
519 && EQ (current_kboard->Vlast_command, Vself_insert_face_command))
520 {
521 Fput_text_property (make_number (PT - 1), make_number (PT),
522 Qface, Vself_insert_face, Qnil);
523 Vself_insert_face = Qnil;
524 }
525
526 if ((synt == Sclose || synt == Smath) 512 if ((synt == Sclose || synt == Smath)
527 && !NILP (Vblink_paren_function) && INTERACTIVE 513 && !NILP (Vblink_paren_function) && INTERACTIVE
528 && !noautofill) 514 && !noautofill)
@@ -530,6 +516,9 @@ internal_self_insert (int c, int noautofill)
530 call0 (Vblink_paren_function); 516 call0 (Vblink_paren_function);
531 hairy = 2; 517 hairy = 2;
532 } 518 }
519 /* Run hooks for electric keys. */
520 call1 (Vrun_hooks, Qpost_self_insert_hook);
521
533 return hairy; 522 return hairy;
534} 523}
535 524
@@ -550,15 +539,13 @@ syms_of_cmds (void)
550 Qexpand_abbrev = intern_c_string ("expand-abbrev"); 539 Qexpand_abbrev = intern_c_string ("expand-abbrev");
551 staticpro (&Qexpand_abbrev); 540 staticpro (&Qexpand_abbrev);
552 541
553 DEFVAR_LISP ("self-insert-face", &Vself_insert_face, 542 Qpost_self_insert_hook = intern_c_string ("post-self-insert-hook");
554 doc: /* If non-nil, set the face of the next self-inserting character to this. 543 staticpro (&Qpost_self_insert_hook);
555See also `self-insert-face-command'. */);
556 Vself_insert_face = Qnil;
557 544
558 DEFVAR_LISP ("self-insert-face-command", &Vself_insert_face_command, 545 DEFVAR_LISP ("post-self-insert-hook", &Vpost_self_insert_hook,
559 doc: /* This is the command that set up `self-insert-face'. 546 doc: /* Hook run at the end of `self-insert-command'.
560If `last-command' does not equal this value, we ignore `self-insert-face'. */); 547This run is run after inserting the charater. */);
561 Vself_insert_face_command = Qnil; 548 Vpost_self_insert_hook = Qnil;
562 549
563 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function, 550 DEFVAR_LISP ("blink-paren-function", &Vblink_paren_function,
564 doc: /* Function called, if non-nil, whenever a close parenthesis is inserted. 551 doc: /* Function called, if non-nil, whenever a close parenthesis is inserted.
diff --git a/src/composite.c b/src/composite.c
index 392da1ceba1..233f9ac8969 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -969,7 +969,9 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT
969static Lisp_Object _work_val; 969static Lisp_Object _work_val;
970static int _work_char; 970static int _work_char;
971 971
972/* 1 iff the character C is composable. */ 972/* 1 iff the character C is composable. Characters of general
973 category Z? or C? are not composable except for ZWNJ and ZWJ. */
974
973#define CHAR_COMPOSABLE_P(C) \ 975#define CHAR_COMPOSABLE_P(C) \
974 ((C) == 0x200C || (C) == 0x200D \ 976 ((C) == 0x200C || (C) == 0x200D \
975 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ 977 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \
@@ -1028,19 +1030,6 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1028 cmp_it->stop_pos = endpos = start; 1030 cmp_it->stop_pos = endpos = start;
1029 cmp_it->ch = -1; 1031 cmp_it->ch = -1;
1030 } 1032 }
1031 if (NILP (string))
1032 {
1033 /* A composition never strides over PT. */
1034 if (PT > charpos)
1035 {
1036 if (PT < endpos)
1037 cmp_it->stop_pos = endpos = PT;
1038 }
1039 else if (PT < charpos && PT > endpos)
1040 {
1041 cmp_it->stop_pos = endpos = PT - 1;
1042 }
1043 }
1044 if (NILP (current_buffer->enable_multibyte_characters) 1033 if (NILP (current_buffer->enable_multibyte_characters)
1045 || NILP (Vauto_composition_mode)) 1034 || NILP (Vauto_composition_mode))
1046 return; 1035 return;
@@ -1091,6 +1080,16 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1091 } 1080 }
1092 } 1081 }
1093 } 1082 }
1083 if (charpos == endpos)
1084 {
1085 /* We couldn't find a composition point before ENDPOS. But,
1086 some character after ENDPOS may be composed with
1087 characters before ENDPOS. So, we should stop at the safe
1088 point. */
1089 charpos = endpos - MAX_AUTO_COMPOSITION_LOOKBACK;
1090 if (charpos < start)
1091 charpos = start;
1092 }
1094 } 1093 }
1095 else if (charpos > endpos) 1094 else if (charpos > endpos)
1096 { 1095 {
@@ -1223,23 +1222,8 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
1223int 1222int
1224composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) 1223composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string)
1225{ 1224{
1226 if (endpos <= charpos) 1225 if (endpos < 0)
1227 { 1226 endpos = NILP (string) ? BEGV : 0;
1228 if (NILP (string))
1229 {
1230 if (endpos < 0)
1231 endpos = BEGV;
1232 if (endpos < PT && PT < charpos)
1233 endpos = PT;
1234 }
1235 else if (endpos < 0)
1236 endpos = 0;
1237 }
1238 else
1239 {
1240 if (NILP (string) && charpos < PT && PT < endpos)
1241 endpos = PT;
1242 }
1243 1227
1244 if (cmp_it->ch == -2) 1228 if (cmp_it->ch == -2)
1245 { 1229 {
@@ -1301,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
1301 elt = XCAR (val); 1285 elt = XCAR (val);
1302 if (cmp_it->lookback > 0) 1286 if (cmp_it->lookback > 0)
1303 { 1287 {
1304 cpos -= cmp_it->lookback; 1288 cpos = charpos - cmp_it->lookback;
1305 if (STRINGP (string)) 1289 if (STRINGP (string))
1306 bpos = string_char_to_byte (string, cpos); 1290 bpos = string_char_to_byte (string, cpos);
1307 else 1291 else
@@ -1763,8 +1747,6 @@ should be ignored. */)
1763 1747
1764 CHECK_NATNUM (from); 1748 CHECK_NATNUM (from);
1765 CHECK_NATNUM (to); 1749 CHECK_NATNUM (to);
1766 if (XINT (to) > XINT (from) + MAX_COMPOSITION_COMPONENTS)
1767 to = make_number (XINT (from) + MAX_COMPOSITION_COMPONENTS);
1768 if (! FONT_OBJECT_P (font_object)) 1750 if (! FONT_OBJECT_P (font_object))
1769 { 1751 {
1770 struct coding_system *coding; 1752 struct coding_system *coding;
diff --git a/src/config.in b/src/config.in
index ea17a54d913..604a737a8b0 100644
--- a/src/config.in
+++ b/src/config.in
@@ -294,6 +294,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
294/* Define to 1 if netdb.h declares h_errno. */ 294/* Define to 1 if netdb.h declares h_errno. */
295#undef HAVE_H_ERRNO 295#undef HAVE_H_ERRNO
296 296
297/* Define to 1 if using imagemagick. */
298#undef HAVE_IMAGEMAGICK
299
297/* Define to 1 if you have inet sockets. */ 300/* Define to 1 if you have inet sockets. */
298#undef HAVE_INET_SOCKETS 301#undef HAVE_INET_SOCKETS
299 302
@@ -432,6 +435,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
432/* Define to 1 if you have the <mach/mach.h> header file. */ 435/* Define to 1 if you have the <mach/mach.h> header file. */
433#undef HAVE_MACH_MACH_H 436#undef HAVE_MACH_MACH_H
434 437
438/* Define to 1 if you have the `MagickExportImagePixels' function. */
439#undef HAVE_MAGICKEXPORTIMAGEPIXELS
440
435/* Define to 1 if you have the <maillock.h> header file. */ 441/* Define to 1 if you have the <maillock.h> header file. */
436#undef HAVE_MAILLOCK_H 442#undef HAVE_MAILLOCK_H
437 443
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 683d6f047fa..3b6f0e543bb 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -31,6 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31 31
32/* Subroutines. */ 32/* Subroutines. */
33Lisp_Object Qdbus_init_bus; 33Lisp_Object Qdbus_init_bus;
34Lisp_Object Qdbus_close_bus;
34Lisp_Object Qdbus_get_unique_name; 35Lisp_Object Qdbus_get_unique_name;
35Lisp_Object Qdbus_call_method; 36Lisp_Object Qdbus_call_method;
36Lisp_Object Qdbus_call_method_asynchronously; 37Lisp_Object Qdbus_call_method_asynchronously;
@@ -59,6 +60,9 @@ Lisp_Object QCdbus_type_object_path, QCdbus_type_signature;
59Lisp_Object QCdbus_type_array, QCdbus_type_variant; 60Lisp_Object QCdbus_type_array, QCdbus_type_variant;
60Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry; 61Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry;
61 62
63/* Registered buses. */
64Lisp_Object Vdbus_registered_buses;
65
62/* Hash table which keeps function definitions. */ 66/* Hash table which keeps function definitions. */
63Lisp_Object Vdbus_registered_objects_table; 67Lisp_Object Vdbus_registered_objects_table;
64 68
@@ -111,7 +115,7 @@ int xd_in_read_queued_messages = 0;
111 } while (0) 115 } while (0)
112 116
113/* Macros for debugging. In order to enable them, build with 117/* Macros for debugging. In order to enable them, build with
114 "make MYCPPFLAGS='-DDBUS_DEBUG -Wall'". */ 118 "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make". */
115#ifdef DBUS_DEBUG 119#ifdef DBUS_DEBUG
116#define XD_DEBUG_MESSAGE(...) \ 120#define XD_DEBUG_MESSAGE(...) \
117 do { \ 121 do { \
@@ -713,10 +717,10 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
713 } 717 }
714} 718}
715 719
716/* Initialize D-Bus connection. BUS is a Lisp symbol, either :system 720/* Initialize D-Bus connection. BUS is either a Lisp symbol, :system
717 or :session. It tells which D-Bus to initialize. If RAISE_ERROR 721 or :session, or a string denoting the bus address. It tells which
718 is non-zero signal an error when the connection cannot be 722 D-Bus to initialize. If RAISE_ERROR is non-zero, signal an error
719 initialized. */ 723 when the connection cannot be initialized. */
720static DBusConnection * 724static DBusConnection *
721xd_initialize (Lisp_Object bus, int raise_error) 725xd_initialize (Lisp_Object bus, int raise_error)
722{ 726{
@@ -724,34 +728,66 @@ xd_initialize (Lisp_Object bus, int raise_error)
724 DBusError derror; 728 DBusError derror;
725 729
726 /* Parameter check. */ 730 /* Parameter check. */
727 CHECK_SYMBOL (bus); 731 if (!STRINGP (bus))
728 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) 732 {
729 if (raise_error) 733 CHECK_SYMBOL (bus);
730 XD_SIGNAL2 (build_string ("Wrong bus name"), bus); 734 if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
731 else 735 {
732 return NULL; 736 if (raise_error)
737 XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
738 else
739 return NULL;
740 }
733 741
734 /* We do not want to have an autolaunch for the session bus. */ 742 /* We do not want to have an autolaunch for the session bus. */
735 if (EQ (bus, QCdbus_session_bus) 743 if (EQ (bus, QCdbus_session_bus)
736 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL) 744 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
737 if (raise_error) 745 {
738 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 746 if (raise_error)
739 else 747 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
740 return NULL; 748 else
749 return NULL;
750 }
751 }
741 752
742 /* Open a connection to the bus. */ 753 /* Open a connection to the bus. */
743 dbus_error_init (&derror); 754 dbus_error_init (&derror);
744 755
745 if (EQ (bus, QCdbus_system_bus)) 756 if (STRINGP (bus))
746 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror); 757 connection = dbus_connection_open (SDATA (bus), &derror);
747 else 758 else
748 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); 759 if (EQ (bus, QCdbus_system_bus))
760 connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
761 else
762 connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
749 763
750 if (dbus_error_is_set (&derror)) 764 if (dbus_error_is_set (&derror))
751 if (raise_error) 765 {
752 XD_ERROR (derror); 766 if (raise_error)
753 else 767 XD_ERROR (derror);
754 connection = NULL; 768 else
769 connection = NULL;
770 }
771
772 /* If it is not the system or session bus, we must register
773 ourselves. Otherwise, we have called dbus_bus_get, which has
774 configured us to exit if the connection closes - we undo this
775 setting. */
776 if (connection != NULL)
777 {
778 if (STRINGP (bus))
779 dbus_bus_register (connection, &derror);
780 else
781 dbus_connection_set_exit_on_disconnect (connection, FALSE);
782 }
783
784 if (dbus_error_is_set (&derror))
785 {
786 if (raise_error)
787 XD_ERROR (derror);
788 else
789 connection = NULL;
790 }
755 791
756 if (connection == NULL && raise_error) 792 if (connection == NULL && raise_error)
757 XD_SIGNAL2 (build_string ("No connection to bus"), bus); 793 XD_SIGNAL2 (build_string ("No connection to bus"), bus);
@@ -794,7 +830,8 @@ xd_add_watch (DBusWatch *watch, void *data)
794} 830}
795 831
796/* Remove connection file descriptor from input_wait_mask. DATA is 832/* Remove connection file descriptor from input_wait_mask. DATA is
797 the used bus, either QCdbus_system_bus or QCdbus_session_bus. */ 833 the used bus, either a string or QCdbus_system_bus or
834 QCdbus_session_bus. */
798void 835void
799xd_remove_watch (DBusWatch *watch, void *data) 836xd_remove_watch (DBusWatch *watch, void *data)
800{ 837{
@@ -830,15 +867,11 @@ xd_remove_watch (DBusWatch *watch, void *data)
830} 867}
831 868
832DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, 869DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
833 doc: /* Initialize connection to D-Bus BUS. 870 doc: /* Initialize connection to D-Bus BUS. */)
834This is an internal function, it shall not be used outside dbus.el. */)
835 (Lisp_Object bus) 871 (Lisp_Object bus)
836{ 872{
837 DBusConnection *connection; 873 DBusConnection *connection;
838 874
839 /* Check parameters. */
840 CHECK_SYMBOL (bus);
841
842 /* Open a connection to the bus. */ 875 /* Open a connection to the bus. */
843 connection = xd_initialize (bus, TRUE); 876 connection = xd_initialize (bus, TRUE);
844 877
@@ -850,6 +883,28 @@ This is an internal function, it shall not be used outside dbus.el. */)
850 NULL, (void*) XHASH (bus), NULL)) 883 NULL, (void*) XHASH (bus), NULL))
851 XD_SIGNAL1 (build_string ("Cannot add watch functions")); 884 XD_SIGNAL1 (build_string ("Cannot add watch functions"));
852 885
886 /* Add bus to list of registered buses. */
887 Vdbus_registered_buses = Fcons (bus, Vdbus_registered_buses);
888
889 /* Return. */
890 return Qnil;
891}
892
893DEFUN ("dbus-close-bus", Fdbus_close_bus, Sdbus_close_bus, 1, 1, 0,
894 doc: /* Close connection to D-Bus BUS. */)
895 (Lisp_Object bus)
896{
897 DBusConnection *connection;
898
899 /* Open a connection to the bus. */
900 connection = xd_initialize (bus, TRUE);
901
902 /* Decrement reference count to the bus. */
903 dbus_connection_unref (connection);
904
905 /* Remove bus from list of registered buses. */
906 Vdbus_registered_buses = Fdelete (bus, Vdbus_registered_buses);
907
853 /* Return. */ 908 /* Return. */
854 return Qnil; 909 return Qnil;
855} 910}
@@ -862,9 +917,6 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
862 DBusConnection *connection; 917 DBusConnection *connection;
863 const char *name; 918 const char *name;
864 919
865 /* Check parameters. */
866 CHECK_SYMBOL (bus);
867
868 /* Open a connection to the bus. */ 920 /* Open a connection to the bus. */
869 connection = xd_initialize (bus, TRUE); 921 connection = xd_initialize (bus, TRUE);
870 922
@@ -880,7 +932,8 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
880DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0, 932DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0,
881 doc: /* Call METHOD on the D-Bus BUS. 933 doc: /* Call METHOD on the D-Bus BUS.
882 934
883BUS is either the symbol `:system' or the symbol `:session'. 935BUS is either a Lisp symbol, `:system' or `:session', or a string
936denoting the bus address.
884 937
885SERVICE is the D-Bus service name to be used. PATH is the D-Bus 938SERVICE is the D-Bus service name to be used. PATH is the D-Bus
886object path SERVICE is registered at. INTERFACE is an interface 939object path SERVICE is registered at. INTERFACE is an interface
@@ -967,7 +1020,6 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
967 interface = args[3]; 1020 interface = args[3];
968 method = args[4]; 1021 method = args[4];
969 1022
970 CHECK_SYMBOL (bus);
971 CHECK_STRING (service); 1023 CHECK_STRING (service);
972 CHECK_STRING (path); 1024 CHECK_STRING (path);
973 CHECK_STRING (interface); 1025 CHECK_STRING (interface);
@@ -1082,7 +1134,8 @@ DEFUN ("dbus-call-method-asynchronously", Fdbus_call_method_asynchronously,
1082 Sdbus_call_method_asynchronously, 6, MANY, 0, 1134 Sdbus_call_method_asynchronously, 6, MANY, 0,
1083 doc: /* Call METHOD on the D-Bus BUS asynchronously. 1135 doc: /* Call METHOD on the D-Bus BUS asynchronously.
1084 1136
1085BUS is either the symbol `:system' or the symbol `:session'. 1137BUS is either a Lisp symbol, `:system' or `:session', or a string
1138denoting the bus address.
1086 1139
1087SERVICE is the D-Bus service name to be used. PATH is the D-Bus 1140SERVICE is the D-Bus service name to be used. PATH is the D-Bus
1088object path SERVICE is registered at. INTERFACE is an interface 1141object path SERVICE is registered at. INTERFACE is an interface
@@ -1148,7 +1201,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
1148 method = args[4]; 1201 method = args[4];
1149 handler = args[5]; 1202 handler = args[5];
1150 1203
1151 CHECK_SYMBOL (bus);
1152 CHECK_STRING (service); 1204 CHECK_STRING (service);
1153 CHECK_STRING (path); 1205 CHECK_STRING (path);
1154 CHECK_STRING (interface); 1206 CHECK_STRING (interface);
@@ -1271,7 +1323,6 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
1271 serial = args[1]; 1323 serial = args[1];
1272 service = args[2]; 1324 service = args[2];
1273 1325
1274 CHECK_SYMBOL (bus);
1275 CHECK_NUMBER (serial); 1326 CHECK_NUMBER (serial);
1276 CHECK_STRING (service); 1327 CHECK_STRING (service);
1277 GCPRO3 (bus, serial, service); 1328 GCPRO3 (bus, serial, service);
@@ -1363,7 +1414,6 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1363 serial = args[1]; 1414 serial = args[1];
1364 service = args[2]; 1415 service = args[2];
1365 1416
1366 CHECK_SYMBOL (bus);
1367 CHECK_NUMBER (serial); 1417 CHECK_NUMBER (serial);
1368 CHECK_STRING (service); 1418 CHECK_STRING (service);
1369 GCPRO3 (bus, serial, service); 1419 GCPRO3 (bus, serial, service);
@@ -1436,7 +1486,8 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
1436DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0, 1486DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0,
1437 doc: /* Send signal SIGNAL on the D-Bus BUS. 1487 doc: /* Send signal SIGNAL on the D-Bus BUS.
1438 1488
1439BUS is either the symbol `:system' or the symbol `:session'. 1489BUS is either a Lisp symbol, `:system' or `:session', or a string
1490denoting the bus address.
1440 1491
1441SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the 1492SERVICE is the D-Bus service name SIGNAL is sent from. PATH is the
1442D-Bus object path SERVICE is registered at. INTERFACE is an interface 1493D-Bus object path SERVICE is registered at. INTERFACE is an interface
@@ -1480,7 +1531,6 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1480 interface = args[3]; 1531 interface = args[3];
1481 signal = args[4]; 1532 signal = args[4];
1482 1533
1483 CHECK_SYMBOL (bus);
1484 CHECK_STRING (service); 1534 CHECK_STRING (service);
1485 CHECK_STRING (path); 1535 CHECK_STRING (path);
1486 CHECK_STRING (interface); 1536 CHECK_STRING (interface);
@@ -1552,7 +1602,8 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
1552} 1602}
1553 1603
1554/* Check, whether there is pending input in the message queue of the 1604/* Check, whether there is pending input in the message queue of the
1555 D-Bus BUS. BUS is a Lisp symbol, either :system or :session. */ 1605 D-Bus BUS. BUS is either a Lisp symbol, :system or :session, or a
1606 string denoting the bus address. */
1556int 1607int
1557xd_get_dispatch_status (Lisp_Object bus) 1608xd_get_dispatch_status (Lisp_Object bus)
1558{ 1609{
@@ -1572,24 +1623,31 @@ xd_get_dispatch_status (Lisp_Object bus)
1572 ? TRUE : FALSE; 1623 ? TRUE : FALSE;
1573} 1624}
1574 1625
1575/* Check for queued incoming messages from the system and session buses. */ 1626/* Check for queued incoming messages from the buses. */
1576int 1627int
1577xd_pending_messages (void) 1628xd_pending_messages (void)
1578{ 1629{
1630 Lisp_Object busp = Vdbus_registered_buses;
1631
1632 while (!NILP (busp))
1633 {
1634 /* We do not want to have an autolaunch for the session bus. */
1635 if (EQ ((CAR_SAFE (busp)), QCdbus_session_bus)
1636 && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
1637 continue;
1579 1638
1580 /* Vdbus_registered_objects_table will be initialized as hash table 1639 if (xd_get_dispatch_status (CAR_SAFE (busp)))
1581 in dbus.el. When this package isn't loaded yet, it doesn't make 1640 return TRUE;
1582 sense to handle D-Bus messages. */ 1641
1583 return (HASH_TABLE_P (Vdbus_registered_objects_table) 1642 busp = CDR_SAFE (busp);
1584 ? (xd_get_dispatch_status (QCdbus_system_bus) 1643 }
1585 || ((getenv ("DBUS_SESSION_BUS_ADDRESS") != NULL) 1644
1586 ? xd_get_dispatch_status (QCdbus_session_bus) 1645 return FALSE;
1587 : FALSE))
1588 : FALSE);
1589} 1646}
1590 1647
1591/* Read queued incoming message of the D-Bus BUS. BUS is a Lisp 1648/* Read queued incoming message of the D-Bus BUS. BUS is either a
1592 symbol, either :system or :session. */ 1649 Lisp symbol, :system or :session, or a string denoting the bus
1650 address. */
1593static Lisp_Object 1651static Lisp_Object
1594xd_read_message (Lisp_Object bus) 1652xd_read_message (Lisp_Object bus)
1595{ 1653{
@@ -1746,29 +1804,28 @@ xd_read_message (Lisp_Object bus)
1746 RETURN_UNGCPRO (Qnil); 1804 RETURN_UNGCPRO (Qnil);
1747} 1805}
1748 1806
1749/* Read queued incoming messages from the system and session buses. */ 1807/* Read queued incoming messages from all buses. */
1750void 1808void
1751xd_read_queued_messages (void) 1809xd_read_queued_messages (void)
1752{ 1810{
1811 Lisp_Object busp = Vdbus_registered_buses;
1753 1812
1754 /* Vdbus_registered_objects_table will be initialized as hash table 1813 xd_in_read_queued_messages = 1;
1755 in dbus.el. When this package isn't loaded yet, it doesn't make 1814 while (!NILP (busp))
1756 sense to handle D-Bus messages. Furthermore, we ignore all Lisp
1757 errors during the call. */
1758 if (HASH_TABLE_P (Vdbus_registered_objects_table))
1759 { 1815 {
1760 xd_in_read_queued_messages = 1; 1816 /* We ignore all Lisp errors during the call. */
1761 internal_catch (Qdbus_error, xd_read_message, QCdbus_system_bus); 1817 internal_catch (Qdbus_error, xd_read_message, CAR_SAFE (busp));
1762 internal_catch (Qdbus_error, xd_read_message, QCdbus_session_bus); 1818 busp = CDR_SAFE (busp);
1763 xd_in_read_queued_messages = 0;
1764 } 1819 }
1820 xd_in_read_queued_messages = 0;
1765} 1821}
1766 1822
1767DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal, 1823DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
1768 6, MANY, 0, 1824 6, MANY, 0,
1769 doc: /* Register for signal SIGNAL on the D-Bus BUS. 1825 doc: /* Register for signal SIGNAL on the D-Bus BUS.
1770 1826
1771BUS is either the symbol `:system' or the symbol `:session'. 1827BUS is either a Lisp symbol, `:system' or `:session', or a string
1828denoting the bus address.
1772 1829
1773SERVICE is the D-Bus service name used by the sending D-Bus object. 1830SERVICE is the D-Bus service name used by the sending D-Bus object.
1774It can be either a known name or the unique name of the D-Bus object 1831It can be either a known name or the unique name of the D-Bus object
@@ -1822,7 +1879,6 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
1822 signal = args[4]; 1879 signal = args[4];
1823 handler = args[5]; 1880 handler = args[5];
1824 1881
1825 CHECK_SYMBOL (bus);
1826 if (!NILP (service)) CHECK_STRING (service); 1882 if (!NILP (service)) CHECK_STRING (service);
1827 if (!NILP (path)) CHECK_STRING (path); 1883 if (!NILP (path)) CHECK_STRING (path);
1828 CHECK_STRING (interface); 1884 CHECK_STRING (interface);
@@ -1915,7 +1971,8 @@ DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method,
1915 6, 6, 0, 1971 6, 6, 0,
1916 doc: /* Register for method METHOD on the D-Bus BUS. 1972 doc: /* Register for method METHOD on the D-Bus BUS.
1917 1973
1918BUS is either the symbol `:system' or the symbol `:session'. 1974BUS is either a Lisp symbol, `:system' or `:session', or a string
1975denoting the bus address.
1919 1976
1920SERVICE is the D-Bus service name of the D-Bus object METHOD is 1977SERVICE is the D-Bus service name of the D-Bus object METHOD is
1921registered for. It must be a known name. 1978registered for. It must be a known name.
@@ -1933,7 +1990,6 @@ used for composing the returning D-Bus message. */)
1933 DBusError derror; 1990 DBusError derror;
1934 1991
1935 /* Check parameters. */ 1992 /* Check parameters. */
1936 CHECK_SYMBOL (bus);
1937 CHECK_STRING (service); 1993 CHECK_STRING (service);
1938 CHECK_STRING (path); 1994 CHECK_STRING (path);
1939 CHECK_STRING (interface); 1995 CHECK_STRING (interface);
@@ -1978,6 +2034,10 @@ syms_of_dbusbind (void)
1978 staticpro (&Qdbus_init_bus); 2034 staticpro (&Qdbus_init_bus);
1979 defsubr (&Sdbus_init_bus); 2035 defsubr (&Sdbus_init_bus);
1980 2036
2037 Qdbus_close_bus = intern_c_string ("dbus-close-bus");
2038 staticpro (&Qdbus_close_bus);
2039 defsubr (&Sdbus_close_bus);
2040
1981 Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name"); 2041 Qdbus_get_unique_name = intern_c_string ("dbus-get-unique-name");
1982 staticpro (&Qdbus_get_unique_name); 2042 staticpro (&Qdbus_get_unique_name);
1983 defsubr (&Sdbus_get_unique_name); 2043 defsubr (&Sdbus_get_unique_name);
@@ -2074,18 +2134,25 @@ syms_of_dbusbind (void)
2074 QCdbus_type_dict_entry = intern_c_string (":dict-entry"); 2134 QCdbus_type_dict_entry = intern_c_string (":dict-entry");
2075 staticpro (&QCdbus_type_dict_entry); 2135 staticpro (&QCdbus_type_dict_entry);
2076 2136
2137 DEFVAR_LISP ("dbus-registered-buses",
2138 &Vdbus_registered_buses,
2139 doc: /* List of D-Bus buses we are polling for messages. */);
2140 Vdbus_registered_buses = Qnil;
2141
2077 DEFVAR_LISP ("dbus-registered-objects-table", 2142 DEFVAR_LISP ("dbus-registered-objects-table",
2078 &Vdbus_registered_objects_table, 2143 &Vdbus_registered_objects_table,
2079 doc: /* Hash table of registered functions for D-Bus. 2144 doc: /* Hash table of registered functions for D-Bus.
2145
2080There are two different uses of the hash table: for accessing 2146There are two different uses of the hash table: for accessing
2081registered interfaces properties, targeted by signals or method calls, 2147registered interfaces properties, targeted by signals or method calls,
2082and for calling handlers in case of non-blocking method call returns. 2148and for calling handlers in case of non-blocking method call returns.
2083 2149
2084In the first case, the key in the hash table is the list (BUS 2150In the first case, the key in the hash table is the list (BUS
2085INTERFACE MEMBER). BUS is either the symbol `:system' or the symbol 2151INTERFACE MEMBER). BUS is either a Lisp symbol, `:system' or
2086`:session'. INTERFACE is a string which denotes a D-Bus interface, 2152`:session', or a string denoting the bus address. INTERFACE is a
2087and MEMBER, also a string, is either a method, a signal or a property 2153string which denotes a D-Bus interface, and MEMBER, also a string, is
2088INTERFACE is offering. All arguments but BUS must not be nil. 2154either a method, a signal or a property INTERFACE is offering. All
2155arguments but BUS must not be nil.
2089 2156
2090The value in the hash table is a list of quadruple lists 2157The value in the hash table is a list of quadruple lists
2091\((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...). 2158\((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...).
@@ -2097,15 +2164,18 @@ be called when a D-Bus message, which matches the key criteria,
2097arrives (methods and signals), or a cons cell containing the value of 2164arrives (methods and signals), or a cons cell containing the value of
2098the property. 2165the property.
2099 2166
2100In the second case, the key in the hash table is the list (BUS SERIAL). 2167In the second case, the key in the hash table is the list (BUS
2101BUS is either the symbol `:system' or the symbol `:session'. SERIAL 2168SERIAL). BUS is either a Lisp symbol, `:system' or `:session', or a
2102is the serial number of the non-blocking method call, a reply is 2169string denoting the bus address. SERIAL is the serial number of the
2103expected. Both arguments must not be nil. The value in the hash 2170non-blocking method call, a reply is expected. Both arguments must
2104table is HANDLER, the function to be called when the D-Bus reply 2171not be nil. The value in the hash table is HANDLER, the function to
2105message arrives. */); 2172be called when the D-Bus reply message arrives. */);
2106 /* We initialize Vdbus_registered_objects_table in dbus.el, because 2173 {
2107 we need to define a hash table function first. */ 2174 Lisp_Object args[2];
2108 Vdbus_registered_objects_table = Qnil; 2175 args[0] = QCtest;
2176 args[1] = Qequal;
2177 Vdbus_registered_objects_table = Fmake_hash_table (2, args);
2178 }
2109 2179
2110 DEFVAR_LISP ("dbus-debug", &Vdbus_debug, 2180 DEFVAR_LISP ("dbus-debug", &Vdbus_debug,
2111 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */); 2181 doc: /* If non-nil, debug messages of D-Bus bindings are raised. */);
diff --git a/src/deps.mk b/src/deps.mk
index 8eeed3822d0..d00be96744b 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -142,7 +142,7 @@ mktime.o: mktime.c $(config_h)
142msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ 142msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
143 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ 143 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
144 keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \ 144 keyboard.h $(INTERVALS_H) buffer.h commands.h blockinput.h atimer.h \
145 lisp.h $(config_h) 145 lisp.h sysselect.h $(config_h)
146nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ 146nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \
147 dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \ 147 dispextern.h fontset.h $(INTERVALS_H) keyboard.h blockinput.h \
148 atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h) 148 atimer.h systime.h epaths.h termhooks.h coding.h systime.h lisp.h $(config_h)
@@ -176,7 +176,7 @@ syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
176sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ 176sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
177 process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ 177 process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \
178 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ 178 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \
179 $(config_h) composite.h 179 $(config_h) composite.h sysselect.h
180term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \ 180term.o: term.c termchar.h termhooks.h termopts.h lisp.h $(config_h) \
181 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ 181 cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \
182 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ 182 xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \
diff --git a/src/dispnew.c b/src/dispnew.c
index 35893872c73..9344d792f3d 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5351,9 +5351,15 @@ update_frame_line (struct frame *f, int vpos)
5351 ***********************************************************************/ 5351 ***********************************************************************/
5352 5352
5353/* Determine what's under window-relative pixel position (*X, *Y). 5353/* Determine what's under window-relative pixel position (*X, *Y).
5354 Return the object (string or buffer) that's there. 5354 Return the OBJECT (string or buffer) that's there.
5355 Return in *POS the position in that object. 5355 Return in *POS the position in that object.
5356 Adjust *X and *Y to character positions. */ 5356 Adjust *X and *Y to character positions.
5357 Return in *DX and *DY the pixel coordinates of the click,
5358 relative to the top left corner of OBJECT, or relative to
5359 the top left corner of the character glyph at (*X, *Y)
5360 if OBJECT is nil.
5361 Return WIDTH and HEIGHT of the object at (*X, *Y), or zero
5362 if the coordinates point to an empty area of the display. */
5357 5363
5358Lisp_Object 5364Lisp_Object
5359buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height) 5365buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *pos, Lisp_Object *object, int *dx, int *dy, int *width, int *height)
@@ -5366,7 +5372,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5366#ifdef HAVE_WINDOW_SYSTEM 5372#ifdef HAVE_WINDOW_SYSTEM
5367 struct image *img = 0; 5373 struct image *img = 0;
5368#endif 5374#endif
5369 int x0, x1; 5375 int x0, x1, to_x;
5370 5376
5371 /* We used to set current_buffer directly here, but that does the 5377 /* We used to set current_buffer directly here, but that does the
5372 wrong thing with `face-remapping-alist' (bug#2044). */ 5378 wrong thing with `face-remapping-alist' (bug#2044). */
@@ -5377,8 +5383,33 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
5377 start_display (&it, w, startp); 5383 start_display (&it, w, startp);
5378 5384
5379 x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w); 5385 x0 = *x - WINDOW_LEFT_MARGIN_WIDTH (w);
5380 move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, 5386
5381 MOVE_TO_X | MOVE_TO_Y); 5387 /* First, move to the beginning of the row corresponding to *Y. We
5388 need to be in that row to get the correct value of base paragraph
5389 direction for the text at (*X, *Y). */
5390 move_it_to (&it, -1, 0, *y, -1, MOVE_TO_X | MOVE_TO_Y);
5391
5392 /* TO_X is the pixel position that the iterator will compute for the
5393 glyph at *X. We add it.first_visible_x because iterator
5394 positions include the hscroll. */
5395 to_x = x0 + it.first_visible_x;
5396 if (it.bidi_it.paragraph_dir == R2L)
5397 /* For lines in an R2L paragraph, we need to mirror TO_X wrt the
5398 text area. This is because the iterator, even in R2L
5399 paragraphs, delivers glyphs as if they started at the left
5400 margin of the window. (When we actually produce glyphs for
5401 display, we reverse their order in PRODUCE_GLYPHS, but the
5402 iterator doesn't know about that.) The following line adjusts
5403 the pixel position to the iterator geometry, which is what
5404 move_it_* routines use. (The -1 is because in a window whose
5405 text-area width is W, the rightmost pixel position is W-1, and
5406 it should be mirrored into zero pixel position.) */
5407 to_x = window_box_width (w, TEXT_AREA) - to_x - 1;
5408
5409 /* Now move horizontally in the row to the glyph under *X. Second
5410 argument is ZV to prevent move_it_in_display_line from matching
5411 based on buffer positions. */
5412 move_it_in_display_line (&it, ZV, to_x, MOVE_TO_X);
5382 5413
5383 Fset_buffer (old_current_buffer); 5414 Fset_buffer (old_current_buffer);
5384 5415
diff --git a/src/doc.c b/src/doc.c
index 9a7001eb01d..f8ab9d081b9 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -285,8 +285,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
285 to - (get_doc_string_buffer + offset)); 285 to - (get_doc_string_buffer + offset));
286 else 286 else
287 { 287 {
288 /* Let the data determine whether the string is multibyte, 288 /* The data determines whether the string is multibyte. */
289 even if Emacs is running in --unibyte mode. */
290 int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset, 289 int nchars = multibyte_chars_in_text (get_doc_string_buffer + offset,
291 to - (get_doc_string_buffer + offset)); 290 to - (get_doc_string_buffer + offset));
292 return make_string_from_bytes (get_doc_string_buffer + offset, 291 return make_string_from_bytes (get_doc_string_buffer + offset,
@@ -622,24 +621,28 @@ the same file name is found in the `doc-directory'. */)
622 p = buf; 621 p = buf;
623 end = buf + (filled < 512 ? filled : filled - 128); 622 end = buf + (filled < 512 ? filled : filled - 128);
624 while (p != end && *p != '\037') p++; 623 while (p != end && *p != '\037') p++;
625 /* p points to ^_Ffunctionname\n or ^_Vvarname\n. */ 624 /* p points to ^_Ffunctionname\n or ^_Vvarname\n or ^_Sfilename\n. */
626 if (p != end) 625 if (p != end)
627 { 626 {
628 end = strchr (p, '\n'); 627 end = strchr (p, '\n');
629 628
630 /* See if this is a file name, and if it is a file in build-files. */ 629 /* See if this is a file name, and if it is a file in build-files. */
631 if (p[1] == 'S' && end - p > 4 && end[-2] == '.' 630 if (p[1] == 'S')
632 && (end[-1] == 'o' || end[-1] == 'c'))
633 { 631 {
634 int len = end - p - 2; 632 skip_file = 0;
635 char *fromfile = alloca (len + 1); 633 if (end - p > 4 && end[-2] == '.'
636 strncpy (fromfile, &p[2], len); 634 && (end[-1] == 'o' || end[-1] == 'c'))
637 fromfile[len] = 0; 635 {
638 if (fromfile[len-1] == 'c') 636 int len = end - p - 2;
639 fromfile[len-1] = 'o'; 637 char *fromfile = alloca (len + 1);
640 638 strncpy (fromfile, &p[2], len);
641 skip_file = NILP (Fmember (build_string (fromfile), 639 fromfile[len] = 0;
642 Vbuild_files)); 640 if (fromfile[len-1] == 'c')
641 fromfile[len-1] = 'o';
642
643 skip_file = NILP (Fmember (build_string (fromfile),
644 Vbuild_files));
645 }
643 } 646 }
644 647
645 sym = oblookup (Vobarray, p + 2, 648 sym = oblookup (Vobarray, p + 2,
diff --git a/src/emacs.c b/src/emacs.c
index 026a210af50..397d3d9ad27 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -91,6 +91,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
91#endif 91#endif
92#endif 92#endif
93 93
94/* If you change the following line, remember to update
95 msdos/mainmake.v2 which gleans the Emacs version from it! */
94static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; 96static const char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc.";
95static const char emacs_version[] = "24.0.50"; 97static const char emacs_version[] = "24.0.50";
96 98
@@ -1330,68 +1332,6 @@ main (int argc, char **argv)
1330 init_atimer (); 1332 init_atimer ();
1331 running_asynch_code = 0; 1333 running_asynch_code = 0;
1332 1334
1333 /* Handle --unibyte and the EMACS_UNIBYTE envvar,
1334 but not while dumping. */
1335 if (1)
1336 {
1337 int inhibit_unibyte = 0;
1338
1339 /* --multibyte overrides EMACS_UNIBYTE. */
1340 if (argmatch (argv, argc, "-no-unibyte", "--no-unibyte", 4, NULL, &skip_args)
1341 || argmatch (argv, argc, "-multibyte", "--multibyte", 4, NULL, &skip_args)
1342 /* Ignore EMACS_UNIBYTE before dumping. */
1343 || (!initialized && noninteractive))
1344 inhibit_unibyte = 1;
1345
1346 /* --unibyte requests that we set up to do everything with single-byte
1347 buffers and strings. We need to handle this before calling
1348 init_lread, init_editfns and other places that generate Lisp strings
1349 from text in the environment. */
1350 /* Actually this shouldn't be needed as of 20.4 in a generally
1351 unibyte environment. As handa says, environment values
1352 aren't now decoded; also existing buffers are now made
1353 unibyte during startup if .emacs sets unibyte. Tested with
1354 8-bit data in environment variables and /etc/passwd, setting
1355 unibyte and Latin-1 in .emacs. -- Dave Love */
1356 if (argmatch (argv, argc, "-unibyte", "--unibyte", 4, NULL, &skip_args)
1357 || argmatch (argv, argc, "-no-multibyte", "--no-multibyte", 4, NULL, &skip_args)
1358 || (getenv ("EMACS_UNIBYTE") && !inhibit_unibyte))
1359 {
1360 Lisp_Object old_log_max;
1361 Lisp_Object symbol, tail;
1362
1363 symbol = intern_c_string ("enable-multibyte-characters");
1364 Fset_default (symbol, Qnil);
1365
1366 if (initialized)
1367 {
1368 /* Erase pre-dump messages in *Messages* now so no abort. */
1369 old_log_max = Vmessage_log_max;
1370 XSETFASTINT (Vmessage_log_max, 0);
1371 message_dolog ("", 0, 1, 0);
1372 Vmessage_log_max = old_log_max;
1373 }
1374
1375 for (tail = Vbuffer_alist; CONSP (tail);
1376 tail = XCDR (tail))
1377 {
1378 Lisp_Object buffer;
1379
1380 buffer = Fcdr (XCAR (tail));
1381 /* Make a multibyte buffer unibyte. */
1382 if (BUF_Z_BYTE (XBUFFER (buffer)) > BUF_Z (XBUFFER (buffer)))
1383 {
1384 struct buffer *current = current_buffer;
1385
1386 set_buffer_temp (XBUFFER (buffer));
1387 Fset_buffer_multibyte (Qnil);
1388 set_buffer_temp (current);
1389 }
1390 }
1391 message ("Warning: unibyte sessions are obsolete and will disappear");
1392 }
1393 }
1394
1395 no_loadup 1335 no_loadup
1396 = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); 1336 = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
1397 1337
@@ -1790,10 +1730,6 @@ const struct standard_args standard_args[] =
1790 { "-script", "--script", 100, 1 }, 1730 { "-script", "--script", 100, 1 },
1791 { "-daemon", "--daemon", 99, 0 }, 1731 { "-daemon", "--daemon", 99, 0 },
1792 { "-help", "--help", 90, 0 }, 1732 { "-help", "--help", 90, 0 },
1793 { "-no-unibyte", "--no-unibyte", 83, 0 },
1794 { "-multibyte", "--multibyte", 82, 0 },
1795 { "-unibyte", "--unibyte", 81, 0 },
1796 { "-no-multibyte", "--no-multibyte", 80, 0 },
1797 { "-nl", "--no-loadup", 70, 0 }, 1733 { "-nl", "--no-loadup", 70, 0 },
1798 /* -d must come last before the options handled in startup.el. */ 1734 /* -d must come last before the options handled in startup.el. */
1799 { "-d", "--display", 60, 1 }, 1735 { "-d", "--display", 60, 1 },
@@ -2094,7 +2030,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
2094 Vinhibit_redisplay = Qt; 2030 Vinhibit_redisplay = Qt;
2095 2031
2096 /* If we are controlling the terminal, reset terminal modes. */ 2032 /* If we are controlling the terminal, reset terminal modes. */
2097#ifdef EMACS_HAVE_TTY_PGRP 2033#ifndef DOS_NT
2098 { 2034 {
2099 int pgrp = EMACS_GETPGRP (0); 2035 int pgrp = EMACS_GETPGRP (0);
2100 2036
diff --git a/src/eval.c b/src/eval.c
index 5c6b268187b..89d353cf7cb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1011,12 +1011,13 @@ usage: (let VARLIST BODY...) */)
1011 int count = SPECPDL_INDEX (); 1011 int count = SPECPDL_INDEX ();
1012 register int argnum; 1012 register int argnum;
1013 struct gcpro gcpro1, gcpro2; 1013 struct gcpro gcpro1, gcpro2;
1014 USE_SAFE_ALLOCA;
1014 1015
1015 varlist = Fcar (args); 1016 varlist = Fcar (args);
1016 1017
1017 /* Make space to hold the values to give the bound variables */ 1018 /* Make space to hold the values to give the bound variables */
1018 elt = Flength (varlist); 1019 elt = Flength (varlist);
1019 temps = (Lisp_Object *) alloca (XFASTINT (elt) * sizeof (Lisp_Object)); 1020 SAFE_ALLOCA_LISP (temps, XFASTINT (elt));
1020 1021
1021 /* Compute the values and store them in `temps' */ 1022 /* Compute the values and store them in `temps' */
1022 1023
@@ -1049,6 +1050,7 @@ usage: (let VARLIST BODY...) */)
1049 } 1050 }
1050 1051
1051 elt = Fprogn (Fcdr (args)); 1052 elt = Fprogn (Fcdr (args));
1053 SAFE_FREE ();
1052 return unbind_to (count, elt); 1054 return unbind_to (count, elt);
1053} 1055}
1054 1056
@@ -2301,8 +2303,9 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2301 /* Pass a vector of evaluated arguments */ 2303 /* Pass a vector of evaluated arguments */
2302 Lisp_Object *vals; 2304 Lisp_Object *vals;
2303 register int argnum = 0; 2305 register int argnum = 0;
2306 USE_SAFE_ALLOCA;
2304 2307
2305 vals = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); 2308 SAFE_ALLOCA_LISP (vals, XINT (numargs));
2306 2309
2307 GCPRO3 (args_left, fun, fun); 2310 GCPRO3 (args_left, fun, fun);
2308 gcpro3.var = vals; 2311 gcpro3.var = vals;
@@ -2320,6 +2323,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2320 2323
2321 val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); 2324 val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals);
2322 UNGCPRO; 2325 UNGCPRO;
2326 SAFE_FREE ();
2323 goto done; 2327 goto done;
2324 } 2328 }
2325 2329
@@ -2430,8 +2434,9 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2430 register int i, numargs; 2434 register int i, numargs;
2431 register Lisp_Object spread_arg; 2435 register Lisp_Object spread_arg;
2432 register Lisp_Object *funcall_args; 2436 register Lisp_Object *funcall_args;
2433 Lisp_Object fun; 2437 Lisp_Object fun, retval;
2434 struct gcpro gcpro1; 2438 struct gcpro gcpro1;
2439 USE_SAFE_ALLOCA;
2435 2440
2436 fun = args [0]; 2441 fun = args [0];
2437 funcall_args = 0; 2442 funcall_args = 0;
@@ -2470,8 +2475,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2470 { 2475 {
2471 /* Avoid making funcall cons up a yet another new vector of arguments 2476 /* Avoid making funcall cons up a yet another new vector of arguments
2472 by explicitly supplying nil's for optional values */ 2477 by explicitly supplying nil's for optional values */
2473 funcall_args = (Lisp_Object *) alloca ((1 + XSUBR (fun)->max_args) 2478 SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args);
2474 * sizeof (Lisp_Object));
2475 for (i = numargs; i < XSUBR (fun)->max_args;) 2479 for (i = numargs; i < XSUBR (fun)->max_args;)
2476 funcall_args[++i] = Qnil; 2480 funcall_args[++i] = Qnil;
2477 GCPRO1 (*funcall_args); 2481 GCPRO1 (*funcall_args);
@@ -2483,8 +2487,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2483 function itself as well as its arguments. */ 2487 function itself as well as its arguments. */
2484 if (!funcall_args) 2488 if (!funcall_args)
2485 { 2489 {
2486 funcall_args = (Lisp_Object *) alloca ((1 + numargs) 2490 SAFE_ALLOCA_LISP (funcall_args, 1 + numargs);
2487 * sizeof (Lisp_Object));
2488 GCPRO1 (*funcall_args); 2491 GCPRO1 (*funcall_args);
2489 gcpro1.nvars = 1 + numargs; 2492 gcpro1.nvars = 1 + numargs;
2490 } 2493 }
@@ -2500,7 +2503,11 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
2500 } 2503 }
2501 2504
2502 /* By convention, the caller needs to gcpro Ffuncall's args. */ 2505 /* By convention, the caller needs to gcpro Ffuncall's args. */
2503 RETURN_UNGCPRO (Ffuncall (gcpro1.nvars, funcall_args)); 2506 retval = Ffuncall (gcpro1.nvars, funcall_args);
2507 UNGCPRO;
2508 SAFE_FREE ();
2509
2510 return retval;
2504} 2511}
2505 2512
2506/* Run hook variables in various ways. */ 2513/* Run hook variables in various ways. */
@@ -3065,9 +3072,10 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag)
3065 struct gcpro gcpro1, gcpro2, gcpro3; 3072 struct gcpro gcpro1, gcpro2, gcpro3;
3066 register int i; 3073 register int i;
3067 register Lisp_Object tem; 3074 register Lisp_Object tem;
3075 USE_SAFE_ALLOCA;
3068 3076
3069 numargs = Flength (args); 3077 numargs = Flength (args);
3070 arg_vector = (Lisp_Object *) alloca (XINT (numargs) * sizeof (Lisp_Object)); 3078 SAFE_ALLOCA_LISP (arg_vector, XINT (numargs));
3071 args_left = args; 3079 args_left = args;
3072 3080
3073 GCPRO3 (*arg_vector, args_left, fun); 3081 GCPRO3 (*arg_vector, args_left, fun);
@@ -3096,6 +3104,7 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, int eval_flag)
3096 tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil))); 3104 tem = call_debugger (Fcons (Qexit, Fcons (tem, Qnil)));
3097 /* Don't do it again when we return to eval. */ 3105 /* Don't do it again when we return to eval. */
3098 backtrace_list->debug_on_exit = 0; 3106 backtrace_list->debug_on_exit = 0;
3107 SAFE_FREE ();
3099 return tem; 3108 return tem;
3100} 3109}
3101 3110
diff --git a/src/image.c b/src/image.c
index 34d89d2e195..ae4bf2fd937 100644
--- a/src/image.c
+++ b/src/image.c
@@ -583,7 +583,7 @@ Lisp_Object Qxbm;
583 583
584Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data; 584Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
585Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; 585Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
586Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask; 586Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry, QCcrop, QCrotation;
587 587
588/* Other symbols. */ 588/* Other symbols. */
589 589
@@ -7342,6 +7342,510 @@ gif_load (struct frame *f, struct image *img)
7342#endif /* HAVE_GIF */ 7342#endif /* HAVE_GIF */
7343 7343
7344 7344
7345/***********************************************************************
7346 imagemagick
7347***********************************************************************/
7348#if defined (HAVE_IMAGEMAGICK)
7349Lisp_Object Vimagemagick_render_type;
7350
7351/* The symbol `imagemagick' identifying images of this type. */
7352
7353Lisp_Object Qimagemagick;
7354Lisp_Object Vimagemagick_render_type;
7355
7356/* Indices of image specification fields in imagemagick_format, below. */
7357
7358enum imagemagick_keyword_index
7359 {
7360 IMAGEMAGICK_TYPE,
7361 IMAGEMAGICK_DATA,
7362 IMAGEMAGICK_FILE,
7363 IMAGEMAGICK_ASCENT,
7364 IMAGEMAGICK_MARGIN,
7365 IMAGEMAGICK_RELIEF,
7366 IMAGEMAGICK_ALGORITHM,
7367 IMAGEMAGICK_HEURISTIC_MASK,
7368 IMAGEMAGICK_MASK,
7369 IMAGEMAGICK_BACKGROUND,
7370 IMAGEMAGICK_HEIGHT,
7371 IMAGEMAGICK_WIDTH,
7372 IMAGEMAGICK_ROTATION,
7373 IMAGEMAGICK_CROP,
7374 IMAGEMAGICK_LAST
7375 };
7376
7377/* Vector of image_keyword structures describing the format
7378 of valid user-defined image specifications. */
7379
7380static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
7381 {
7382 {":type", IMAGE_SYMBOL_VALUE, 1},
7383 {":data", IMAGE_STRING_VALUE, 0},
7384 {":file", IMAGE_STRING_VALUE, 0},
7385 {":ascent", IMAGE_ASCENT_VALUE, 0},
7386 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
7387 {":relief", IMAGE_INTEGER_VALUE, 0},
7388 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7389 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7390 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7391 {":background", IMAGE_STRING_OR_NIL_VALUE, 0},
7392 {":height", IMAGE_INTEGER_VALUE, 0},
7393 {":width", IMAGE_INTEGER_VALUE, 0},
7394 {":rotation", IMAGE_NUMBER_VALUE, 0},
7395 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
7396 };
7397/* Free X resources of imagemagick image IMG which is used on frame F. */
7398
7399static void
7400imagemagick_clear_image (struct frame *f,
7401 struct image *img)
7402{
7403 x_clear_image (f, img);
7404}
7405
7406
7407
7408/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do
7409 this by calling parse_image_spec and supplying the keywords that
7410 identify the IMAGEMAGICK format. */
7411
7412static int
7413imagemagick_image_p (Lisp_Object object)
7414{
7415 struct image_keyword fmt[IMAGEMAGICK_LAST];
7416 bcopy (imagemagick_format, fmt, sizeof fmt);
7417
7418 if (!parse_image_spec (object, fmt, IMAGEMAGICK_LAST, Qimagemagick))
7419 return 0;
7420
7421 /* Must specify either the :data or :file keyword. */
7422 return fmt[IMAGEMAGICK_FILE].count + fmt[IMAGEMAGICK_DATA].count == 1;
7423}
7424
7425/* The GIF library also defines DrawRectangle, but its never used in Emacs.
7426 Therefore rename the function so it doesnt collide with ImageMagick. */
7427#define DrawRectangle DrawRectangleGif
7428#include <wand/MagickWand.h>
7429
7430/* imagemagick_load_image is a helper function for imagemagick_load,
7431 which does the actual loading given contents and size, apart from
7432 frame and image structures, passed from imagemagick_load.
7433
7434 Uses librimagemagick to do most of the image processing.
7435
7436 non-zero when successful.
7437*/
7438
7439static int
7440imagemagick_load_image (/* Pointer to emacs frame structure. */
7441 struct frame *f,
7442 /* Pointer to emacs image structure. */
7443 struct image *img,
7444 /* String containing the IMAGEMAGICK data to
7445 be parsed. */
7446 unsigned char *contents,
7447 /* Size of data in bytes. */
7448 unsigned int size,
7449 /* Filename, either pass filename or
7450 contents/size. */
7451 unsigned char *filename)
7452{
7453 size_t width;
7454 size_t height;
7455
7456 MagickBooleanType
7457 status;
7458
7459 XImagePtr ximg;
7460 Lisp_Object specified_bg;
7461 XColor background;
7462 int x;
7463 int y;
7464
7465 MagickWand *image_wand;
7466 MagickWand *ping_wand;
7467 PixelIterator *iterator;
7468 PixelWand **pixels;
7469 MagickPixelPacket pixel;
7470 Lisp_Object image;
7471 Lisp_Object value;
7472 Lisp_Object crop, geometry;
7473 long ino;
7474 int desired_width, desired_height;
7475 double rotation;
7476 int imagemagick_rendermethod;
7477 int pixelwidth;
7478 ImageInfo *image_info;
7479 ExceptionInfo *exception;
7480 Image * im_image;
7481
7482
7483 /* Handle image index for image types who can contain more than one
7484 image. Interface :index is same as for GIF. First we "ping" the
7485 image to see how many sub-images it contains. Pinging is faster
7486 than loading the image to find out things about it. */
7487 image = image_spec_value (img->spec, QCindex, NULL);
7488 ino = INTEGERP (image) ? XFASTINT (image) : 0;
7489 ping_wand=NewMagickWand();
7490 MagickSetResolution(ping_wand, 2, 2);
7491 if (filename != NULL)
7492 {
7493 status = MagickPingImage(ping_wand, filename);
7494 }
7495 else
7496 {
7497 status = MagickPingImageBlob(ping_wand, contents, size);
7498 }
7499
7500 if (ino >= MagickGetNumberImages(ping_wand))
7501 {
7502 image_error ("Invalid image number `%s' in image `%s'",
7503 image, img->spec);
7504 UNGCPRO;
7505 return 0;
7506 }
7507
7508 if (MagickGetNumberImages(ping_wand) > 1)
7509 img->data.lisp_val =
7510 Fcons (Qcount,
7511 Fcons (make_number (MagickGetNumberImages(ping_wand)),
7512 img->data.lisp_val));
7513
7514 DestroyMagickWand (ping_wand);
7515 /* Now, after pinging, we know how many images are inside the
7516 file. If its not a bundle, just one. */
7517
7518 if (filename != NULL)
7519 {
7520 image_info=CloneImageInfo((ImageInfo *) NULL);
7521 (void) strcpy(image_info->filename, filename);
7522 image_info -> number_scenes = 1;
7523 image_info -> scene = ino;
7524 exception=AcquireExceptionInfo();
7525
7526 im_image = ReadImage (image_info, exception);
7527 CatchException(exception);
7528
7529 image_wand = NewMagickWandFromImage(im_image);
7530 }
7531 else
7532 {
7533 image_wand = NewMagickWand();
7534 status = MagickReadImageBlob(image_wand, contents, size);
7535 }
7536 image_error ("im read failed", Qnil, Qnil);
7537 if (status == MagickFalse) goto imagemagick_error;
7538
7539 /* If width and/or height is set in the display spec assume we want
7540 to scale to those values. if either h or w is unspecified, the
7541 unspecified should be calculated from the specified to preserve
7542 aspect ratio. */
7543
7544 value = image_spec_value (img->spec, QCwidth, NULL);
7545 desired_width = (INTEGERP (value) ? XFASTINT (value) : -1);
7546 value = image_spec_value (img->spec, QCheight, NULL);
7547 desired_height = (INTEGERP (value) ? XFASTINT (value) : -1);
7548
7549 height = MagickGetImageHeight (image_wand);
7550 width = MagickGetImageWidth (image_wand);
7551
7552 if(desired_width != -1 && desired_height == -1)
7553 {
7554 /* w known, calculate h. */
7555 desired_height = ( (double)desired_width / width ) * height;
7556 }
7557 if(desired_width == -1 && desired_height != -1)
7558 {
7559 /* h known, calculate w. */
7560 desired_width = ( (double)desired_height / height ) * width;
7561 }
7562 if(desired_width != -1 && desired_height != -1)
7563 {
7564 status = MagickScaleImage(image_wand, desired_width, desired_height);
7565 if (status == MagickFalse) {
7566 image_error ("Imagemagick scale failed", Qnil, Qnil);
7567 goto imagemagick_error;
7568 }
7569 }
7570
7571
7572 /* crop behaves similar to image slicing in Emacs but is more memory
7573 efficient */
7574 crop = image_spec_value (img->spec, QCcrop, NULL);
7575
7576 if(CONSP (crop))
7577 {
7578 /*
7579 after some testing, it seems MagickCropImage is the fastest
7580 crop function in ImageMagick. This crop function seems to do
7581 less copying than the alternatives, but it still reads the
7582 entire image into memory before croping, which is aparently
7583 difficult to avoid when using imagemagick. */
7584
7585 int w,h,x,y;
7586 w=XFASTINT(XCAR(crop));
7587 h=XFASTINT(XCAR(XCDR(crop)));
7588 x=XFASTINT(XCAR(XCDR(XCDR(crop))));
7589 y=XFASTINT(XCAR(XCDR(XCDR(XCDR(crop)))));
7590 MagickCropImage(image_wand, w,h, x,y);
7591 }
7592
7593 /* Furthermore :rotation. we need background color and angle for
7594 rotation. */
7595 /*
7596 TODO background handling for rotation specified_bg =
7597 image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP
7598 (specified_bg). */
7599 value = image_spec_value (img->spec, QCrotation, NULL);
7600 if (FLOATP (value))
7601 {
7602 PixelWand* background = NewPixelWand();
7603 PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/
7604
7605 rotation = extract_float (value);
7606
7607 status = MagickRotateImage (image_wand, background, rotation);
7608 DestroyPixelWand (background);
7609 if (status == MagickFalse)
7610 {
7611 image_error ("Imagemagick image rotate failed", Qnil, Qnil);
7612 goto imagemagick_error;
7613 }
7614 }
7615
7616 /* Finaly we are done manipulating the image, figure out resulting
7617 width, height, and then transfer ownerwship to Emacs. */
7618 height = MagickGetImageHeight (image_wand);
7619 width = MagickGetImageWidth (image_wand);
7620 if (status == MagickFalse)
7621 {
7622 image_error ("Imagemagick image get size failed", Qnil, Qnil);
7623 goto imagemagick_error;
7624 }
7625
7626 if (! check_image_size (f, width, height))
7627 {
7628 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7629 goto imagemagick_error;
7630 }
7631
7632 /* We can now get a valid pixel buffer from the imagemagick file, if all
7633 went ok. */
7634
7635 init_color_table ();
7636 imagemagick_rendermethod = (INTEGERP (Vimagemagick_render_type)
7637 ? XFASTINT (Vimagemagick_render_type) : 0);
7638 if (imagemagick_rendermethod == 0)
7639 {
7640 /* Try to create a x pixmap to hold the imagemagick pixmap. */
7641 if (!x_create_x_image_and_pixmap (f, width, height, 0,
7642 &ximg, &img->pixmap))
7643 {
7644 image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil);
7645 goto imagemagick_error;
7646 }
7647
7648 /* Copy imagegmagick image to x with primitive yet robust pixel
7649 pusher loop. This has been tested a lot with many different
7650 images. */
7651
7652 /* Copy pixels from the imagemagick image structure to the x image map. */
7653 iterator = NewPixelIterator (image_wand);
7654 if ((iterator == (PixelIterator *) NULL))
7655 {
7656 image_error ("Imagemagick pixel iterator creation failed",
7657 Qnil, Qnil);
7658 goto imagemagick_error;
7659 }
7660
7661 for (y = 0; y < (long) MagickGetImageHeight(image_wand); y++)
7662 {
7663 pixels = PixelGetNextIteratorRow (iterator, &width);
7664 if ((pixels == (PixelWand **) NULL))
7665 break;
7666 for (x = 0; x < (long) width; x++)
7667 {
7668 PixelGetMagickColor (pixels[x], &pixel);
7669 XPutPixel (ximg, x, y,
7670 lookup_rgb_color (f,
7671 pixel.red,
7672 pixel.green,
7673 pixel.blue));
7674 }
7675 }
7676 DestroyPixelIterator (iterator);
7677 }
7678
7679 if (imagemagick_rendermethod == 1)
7680 {
7681 /* Magicexportimage is normaly faster than pixelpushing. This
7682 method is also well tested. Some aspects of this method are
7683 ad-hoc and needs to be more researched. */
7684 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
7685 char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
7686 /* Try to create a x pixmap to hold the imagemagick pixmap. */
7687 if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
7688 &ximg, &img->pixmap)){
7689 image_error("Imagemagick X bitmap allocation failure", Qnil, Qnil);
7690 goto imagemagick_error;
7691 }
7692
7693
7694 /* Oddly, the below code doesnt seem to work:*/
7695 /* switch(ximg->bitmap_unit){ */
7696 /* case 8: */
7697 /* pixelwidth=CharPixel; */
7698 /* break; */
7699 /* case 16: */
7700 /* pixelwidth=ShortPixel; */
7701 /* break; */
7702 /* case 32: */
7703 /* pixelwidth=LongPixel; */
7704 /* break; */
7705 /* } */
7706 /*
7707 Here im just guessing the format of the bitmap.
7708 happens to work fine for:
7709 - bw djvu images
7710 on rgb display.
7711 seems about 3 times as fast as pixel pushing(not carefully measured)
7712 */
7713 pixelwidth = CharPixel;/*??? TODO figure out*/
7714#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS
7715 MagickExportImagePixels(image_wand,
7716 0, 0,
7717 width, height,
7718 exportdepth,
7719 pixelwidth,
7720 /*&(img->pixmap));*/
7721 ximg->data);
7722#else
7723 image_error("You dont have MagickExportImagePixels, upgrade ImageMagick!",
7724 Qnil, Qnil);
7725#endif
7726 }
7727
7728
7729#ifdef COLOR_TABLE_SUPPORT
7730 /* Remember colors allocated for this image. */
7731 img->colors = colors_in_color_table (&img->ncolors);
7732 free_color_table ();
7733#endif /* COLOR_TABLE_SUPPORT */
7734
7735
7736 img->width = width;
7737 img->height = height;
7738
7739 /* Put the image into the pixmap, then free the X image and its
7740 buffer. */
7741 x_put_x_image (f, ximg, img->pixmap, width, height);
7742 x_destroy_x_image (ximg);
7743
7744
7745 /* Final cleanup. image_wand should be the only resource left. */
7746 DestroyMagickWand (image_wand);
7747
7748 return 1;
7749
7750 imagemagick_error:
7751 /* TODO more cleanup. */
7752 image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
7753 return 0;
7754}
7755
7756
7757/* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if
7758 successful. this function will go into the imagemagick_type structure, and
7759 the prototype thus needs to be compatible with that structure. */
7760
7761static int
7762imagemagick_load (struct frame *f,
7763 struct image *img)
7764{
7765 int success_p = 0;
7766 Lisp_Object file_name;
7767
7768 /* If IMG->spec specifies a file name, create a non-file spec from it. */
7769 file_name = image_spec_value (img->spec, QCfile, NULL);
7770 if (STRINGP (file_name))
7771 {
7772 Lisp_Object file;
7773 unsigned char *contents;
7774 int size;
7775 struct gcpro gcpro1;
7776
7777 file = x_find_image_file (file_name);
7778 GCPRO1 (file);
7779 if (!STRINGP (file))
7780 {
7781 image_error ("Cannot find image file `%s'", file_name, Qnil);
7782 UNGCPRO;
7783 return 0;
7784 }
7785 success_p = imagemagick_load_image (f, img, 0, 0, SDATA(file_name));
7786 UNGCPRO;
7787 }
7788 /* Else its not a file, its a lisp object. Load the image from a
7789 lisp object rather than a file. */
7790 else
7791 {
7792 Lisp_Object data;
7793
7794 data = image_spec_value (img->spec, QCdata, NULL);
7795 success_p = imagemagick_load_image (f, img, SDATA (data),
7796 SBYTES (data), NULL);
7797 }
7798
7799 return success_p;
7800}
7801
7802/* Structure describing the image type `imagemagick'. Its the same
7803 type of structure defined for all image formats, handled by Emacs
7804 image functions. See struct image_type in dispextern.h. */
7805
7806static struct image_type imagemagick_type =
7807 {
7808 /* An identifier showing that this is an image structure for the
7809 IMAGEMAGICK format. */
7810 &Qimagemagick,
7811 /* Handle to a function that can be used to identify a IMAGEMAGICK
7812 file. */
7813 imagemagick_image_p,
7814 /* Handle to function used to load a IMAGEMAGICK file. */
7815 imagemagick_load,
7816 /* Handle to function to free resources for IMAGEMAGICK. */
7817 imagemagick_clear_image,
7818 /* An internal field to link to the next image type in a list of
7819 image types, will be filled in when registering the format. */
7820 NULL
7821 };
7822
7823
7824
7825
7826DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0,
7827 doc: /* Return image file types supported by ImageMagick.
7828 Since ImageMagick recognizes a lot of file-types that clash with Emacs,
7829 such as .c, we want to be able to alter the list at the lisp level. */)
7830 (void)
7831{
7832 Lisp_Object typelist = Qnil;
7833 size_t numf;
7834 ExceptionInfo ex;
7835 char** imtypes = GetMagickList ("*", &numf, &ex);
7836 int i;
7837 Lisp_Object Qimagemagicktype;
7838 for (i = 0; i < numf; i++)
7839 {
7840 Qimagemagicktype = intern (imtypes[i]);
7841 typelist = Fcons (Qimagemagicktype, typelist);
7842 }
7843 return typelist;
7844}
7845
7846#endif /* defined (HAVE_IMAGEMAGICK) */
7847
7848
7345 7849
7346/*********************************************************************** 7850/***********************************************************************
7347 SVG 7851 SVG
@@ -8117,6 +8621,15 @@ of `image-library-alist', which see). */)
8117 return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries); 8621 return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries);
8118#endif 8622#endif
8119 8623
8624#if defined (HAVE_IMAGEMAGICK)
8625 if (EQ (type, Qimagemagick)){
8626 /* MagickWandGenesis() initalizes the imagemagick library. */
8627 MagickWandGenesis();
8628 return CHECK_LIB_AVAILABLE (&imagemagick_type, init_imagemagick_functions,
8629 libraries);
8630 }
8631#endif
8632
8120#ifdef HAVE_GHOSTSCRIPT 8633#ifdef HAVE_GHOSTSCRIPT
8121 if (EQ (type, Qpostscript)) 8634 if (EQ (type, Qpostscript))
8122 return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries); 8635 return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries);
@@ -8202,6 +8715,12 @@ non-numeric, there is no explicit limit on the size of images. */);
8202 staticpro (&QCheuristic_mask); 8715 staticpro (&QCheuristic_mask);
8203 QCindex = intern_c_string (":index"); 8716 QCindex = intern_c_string (":index");
8204 staticpro (&QCindex); 8717 staticpro (&QCindex);
8718 QCgeometry = intern (":geometry");
8719 staticpro (&QCgeometry);
8720 QCcrop = intern (":crop");
8721 staticpro (&QCcrop);
8722 QCrotation = intern (":rotation");
8723 staticpro (&QCrotation);
8205 QCmatrix = intern_c_string (":matrix"); 8724 QCmatrix = intern_c_string (":matrix");
8206 staticpro (&QCmatrix); 8725 staticpro (&QCmatrix);
8207 QCcolor_adjustment = intern_c_string (":color-adjustment"); 8726 QCcolor_adjustment = intern_c_string (":color-adjustment");
@@ -8262,6 +8781,12 @@ non-numeric, there is no explicit limit on the size of images. */);
8262 ADD_IMAGE_TYPE (Qpng); 8781 ADD_IMAGE_TYPE (Qpng);
8263#endif 8782#endif
8264 8783
8784#if defined (HAVE_IMAGEMAGICK)
8785 Qimagemagick = intern ("imagemagick");
8786 staticpro (&Qimagemagick);
8787 ADD_IMAGE_TYPE (Qimagemagick);
8788#endif
8789
8265#if defined (HAVE_RSVG) 8790#if defined (HAVE_RSVG)
8266 Qsvg = intern_c_string ("svg"); 8791 Qsvg = intern_c_string ("svg");
8267 staticpro (&Qsvg); 8792 staticpro (&Qsvg);
@@ -8278,6 +8803,9 @@ non-numeric, there is no explicit limit on the size of images. */);
8278#endif /* HAVE_RSVG */ 8803#endif /* HAVE_RSVG */
8279 8804
8280 defsubr (&Sinit_image_library); 8805 defsubr (&Sinit_image_library);
8806#ifdef HAVE_IMAGEMAGICK
8807 defsubr (&Simagemagick_types);
8808#endif
8281 defsubr (&Sclear_image_cache); 8809 defsubr (&Sclear_image_cache);
8282 defsubr (&Simage_flush); 8810 defsubr (&Simage_flush);
8283 defsubr (&Simage_size); 8811 defsubr (&Simage_size);
@@ -8308,6 +8836,11 @@ The value can also be nil, meaning the cache is never cleared.
8308 8836
8309The function `clear-image-cache' disregards this variable. */); 8837The function `clear-image-cache' disregards this variable. */);
8310 Vimage_cache_eviction_delay = make_number (300); 8838 Vimage_cache_eviction_delay = make_number (300);
8839#ifdef HAVE_IMAGEMAGICK
8840 DEFVAR_LISP ("imagemagick-render-type", &Vimagemagick_render_type,
8841 doc: /* Choose between ImageMagick render methods. */);
8842#endif
8843
8311} 8844}
8312 8845
8313void 8846void
diff --git a/src/keyboard.c b/src/keyboard.c
index 2fd13c4ae24..cac051f7882 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -368,7 +368,7 @@ Lisp_Object Vselect_active_regions;
368 Used by the `select-active-regions' feature. */ 368 Used by the `select-active-regions' feature. */
369Lisp_Object Vsaved_region_selection; 369Lisp_Object Vsaved_region_selection;
370 370
371Lisp_Object Qx_set_selection, QPRIMARY; 371Lisp_Object Qx_set_selection, QPRIMARY, Qhandle_switch_frame;
372 372
373Lisp_Object Qself_insert_command; 373Lisp_Object Qself_insert_command;
374Lisp_Object Qforward_char; 374Lisp_Object Qforward_char;
@@ -1799,10 +1799,11 @@ command_loop_1 (void)
1799 { 1799 {
1800 /* Even if not deactivating the mark, set PRIMARY if 1800 /* Even if not deactivating the mark, set PRIMARY if
1801 `select-active-regions' is non-nil. */ 1801 `select-active-regions' is non-nil. */
1802 if (EQ (Vselect_active_regions, Qonly) 1802 if ((EQ (Vselect_active_regions, Qonly)
1803 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly) 1803 ? EQ (CAR_SAFE (Vtransient_mark_mode), Qonly)
1804 : (!NILP (Vselect_active_regions) 1804 : (!NILP (Vselect_active_regions)
1805 && !NILP (Vtransient_mark_mode))) 1805 && !NILP (Vtransient_mark_mode)))
1806 && !EQ (Vthis_command, Qhandle_switch_frame))
1806 { 1807 {
1807 int beg = XINT (Fmarker_position (current_buffer->mark)); 1808 int beg = XINT (Fmarker_position (current_buffer->mark));
1808 int end = XINT (make_number (PT)); 1809 int end = XINT (make_number (PT));
@@ -10345,13 +10346,12 @@ give to the command you invoke, if it asks for an argument. */)
10345 (Lisp_Object prefixarg) 10346 (Lisp_Object prefixarg)
10346{ 10347{
10347 Lisp_Object function; 10348 Lisp_Object function;
10348 char buf[40];
10349 int saved_last_point_position; 10349 int saved_last_point_position;
10350 Lisp_Object saved_keys, saved_last_point_position_buffer; 10350 Lisp_Object saved_keys, saved_last_point_position_buffer;
10351 Lisp_Object bindings, value; 10351 Lisp_Object bindings, value;
10352 struct gcpro gcpro1, gcpro2, gcpro3; 10352 struct gcpro gcpro1, gcpro2, gcpro3;
10353#ifdef HAVE_WINDOW_SYSTEM 10353#ifdef HAVE_WINDOW_SYSTEM
10354 /* The call to Fcompleting_read wil start and cancel the hourglass, 10354 /* The call to Fcompleting_read will start and cancel the hourglass,
10355 but if the hourglass was already scheduled, this means that no 10355 but if the hourglass was already scheduled, this means that no
10356 hourglass will be shown for the actual M-x command itself. 10356 hourglass will be shown for the actual M-x command itself.
10357 So we restart it if it is already scheduled. Note that checking 10357 So we restart it if it is already scheduled. Note that checking
@@ -10364,31 +10364,9 @@ give to the command you invoke, if it asks for an argument. */)
10364 XVECTOR (this_command_keys)->contents); 10364 XVECTOR (this_command_keys)->contents);
10365 saved_last_point_position_buffer = last_point_position_buffer; 10365 saved_last_point_position_buffer = last_point_position_buffer;
10366 saved_last_point_position = last_point_position; 10366 saved_last_point_position = last_point_position;
10367 buf[0] = 0;
10368 GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer); 10367 GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer);
10369 10368
10370 if (EQ (prefixarg, Qminus)) 10369 function = call0 (intern ("read-extended-command"));
10371 strcpy (buf, "- ");
10372 else if (CONSP (prefixarg) && XINT (XCAR (prefixarg)) == 4)
10373 strcpy (buf, "C-u ");
10374 else if (CONSP (prefixarg) && INTEGERP (XCAR (prefixarg)))
10375 sprintf (buf, "%ld ", (long) XINT (XCAR (prefixarg)));
10376 else if (INTEGERP (prefixarg))
10377 sprintf (buf, "%ld ", (long) XINT (prefixarg));
10378
10379 /* This isn't strictly correct if execute-extended-command
10380 is bound to anything else. Perhaps it should use
10381 this_command_keys? */
10382 strcat (buf, "M-x ");
10383
10384 /* Prompt with buf, and then read a string, completing from and
10385 restricting to the set of all defined commands. Don't provide
10386 any initial input. Save the command read on the extended-command
10387 history list. */
10388 function = Fcompleting_read (build_string (buf),
10389 Vobarray, Qcommandp,
10390 Qt, Qnil, Qextended_command_history, Qnil,
10391 Qnil);
10392 10370
10393#ifdef HAVE_WINDOW_SYSTEM 10371#ifdef HAVE_WINDOW_SYSTEM
10394 if (hstarted) start_hourglass (); 10372 if (hstarted) start_hourglass ();
@@ -11506,11 +11484,11 @@ init_keyboard (void)
11506 Emacs on SIGINT when there are no termcap frames on the 11484 Emacs on SIGINT when there are no termcap frames on the
11507 controlling terminal. */ 11485 controlling terminal. */
11508 signal (SIGINT, interrupt_signal); 11486 signal (SIGINT, interrupt_signal);
11509#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 11487#ifndef DOS_NT
11510 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and 11488 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
11511 SIGQUIT and we can't tell which one it will give us. */ 11489 SIGQUIT and we can't tell which one it will give us. */
11512 signal (SIGQUIT, interrupt_signal); 11490 signal (SIGQUIT, interrupt_signal);
11513#endif /* HAVE_TERMIO */ 11491#endif /* not DOS_NT */
11514 } 11492 }
11515/* Note SIGIO has been undef'd if FIONREAD is missing. */ 11493/* Note SIGIO has been undef'd if FIONREAD is missing. */
11516#ifdef SIGIO 11494#ifdef SIGIO
@@ -11725,6 +11703,8 @@ syms_of_keyboard (void)
11725 staticpro (&Qx_set_selection); 11703 staticpro (&Qx_set_selection);
11726 QPRIMARY = intern_c_string ("PRIMARY"); 11704 QPRIMARY = intern_c_string ("PRIMARY");
11727 staticpro (&QPRIMARY); 11705 staticpro (&QPRIMARY);
11706 Qhandle_switch_frame = intern_c_string ("handle-switch-frame");
11707 staticpro (&Qhandle_switch_frame);
11728 11708
11729 Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char"); 11709 Qinput_method_exit_on_first_char = intern_c_string ("input-method-exit-on-first-char");
11730 staticpro (&Qinput_method_exit_on_first_char); 11710 staticpro (&Qinput_method_exit_on_first_char);
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index fc86ae6cb0c..8d99d6cedfe 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -1357,6 +1357,7 @@ $(BLD)/sysdep.$(O) : \
1357 $(SRC)/frame.h \ 1357 $(SRC)/frame.h \
1358 $(SRC)/keyboard.h \ 1358 $(SRC)/keyboard.h \
1359 $(SRC)/process.h \ 1359 $(SRC)/process.h \
1360 $(SRC)/sysselect.h \
1360 $(SRC)/syssignal.h \ 1361 $(SRC)/syssignal.h \
1361 $(SRC)/systime.h \ 1362 $(SRC)/systime.h \
1362 $(SRC)/systty.h \ 1363 $(SRC)/systty.h \
diff --git a/src/process.c b/src/process.c
index 4a658623077..f348dca7d35 100644
--- a/src/process.c
+++ b/src/process.c
@@ -31,9 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#ifdef HAVE_INTTYPES_H 31#ifdef HAVE_INTTYPES_H
32#include <inttypes.h> 32#include <inttypes.h>
33#endif 33#endif
34#ifdef STDC_HEADERS
35#include <stdlib.h> 34#include <stdlib.h>
36#endif
37 35
38#ifdef HAVE_UNISTD_H 36#ifdef HAVE_UNISTD_H
39#include <unistd.h> 37#include <unistd.h>
@@ -61,9 +59,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
61 59
62#if defined(HAVE_SYS_IOCTL_H) 60#if defined(HAVE_SYS_IOCTL_H)
63#include <sys/ioctl.h> 61#include <sys/ioctl.h>
64#if !defined (O_NDELAY) && defined (HAVE_PTYS) && !defined(USG5)
65#include <fcntl.h>
66#endif /* HAVE_PTYS and no O_NDELAY */
67#if defined(HAVE_NET_IF_H) 62#if defined(HAVE_NET_IF_H)
68#include <net/if.h> 63#include <net/if.h>
69#endif /* HAVE_NET_IF_H */ 64#endif /* HAVE_NET_IF_H */
@@ -182,16 +177,9 @@ extern Lisp_Object QCfilter;
182 177
183extern const char *get_operating_system_release (void); 178extern const char *get_operating_system_release (void);
184 179
185/* Serial processes require termios or Windows. */
186#if defined (HAVE_TERMIOS) || defined (WINDOWSNT)
187#define HAVE_SERIAL
188#endif
189
190#ifdef HAVE_SERIAL
191/* From sysdep.c or w32.c */ 180/* From sysdep.c or w32.c */
192extern int serial_open (char *port); 181extern int serial_open (char *port);
193extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact); 182extern void serial_configure (struct Lisp_Process *p, Lisp_Object contact);
194#endif
195 183
196#ifndef HAVE_H_ERRNO 184#ifndef HAVE_H_ERRNO
197extern int h_errno; 185extern int h_errno;
@@ -1903,7 +1891,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1903 setpgrp (); 1891 setpgrp ();
1904#endif /* USG */ 1892#endif /* USG */
1905#endif /* not HAVE_SETSID */ 1893#endif /* not HAVE_SETSID */
1906#if defined (HAVE_TERMIOS) && defined (LDISC1) 1894#if defined (LDISC1)
1907 if (pty_flag && xforkin >= 0) 1895 if (pty_flag && xforkin >= 0)
1908 { 1896 {
1909 struct termios t; 1897 struct termios t;
@@ -2569,7 +2557,6 @@ OPTION is not a supported option, return nil instead; otherwise return t. */)
2569} 2557}
2570 2558
2571 2559
2572#ifdef HAVE_SERIAL
2573DEFUN ("serial-process-configure", 2560DEFUN ("serial-process-configure",
2574 Fserial_process_configure, 2561 Fserial_process_configure,
2575 Sserial_process_configure, 2562 Sserial_process_configure,
@@ -2865,7 +2852,6 @@ usage: (make-serial-process &rest ARGS) */)
2865 UNGCPRO; 2852 UNGCPRO;
2866 return proc; 2853 return proc;
2867} 2854}
2868#endif /* HAVE_SERIAL */
2869 2855
2870/* Create a network stream/datagram client/server process. Treated 2856/* Create a network stream/datagram client/server process. Treated
2871 exactly like a normal process when reading and writing. Primary 2857 exactly like a normal process when reading and writing. Primary
@@ -5801,9 +5787,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5801 /* If possible, send signals to the entire pgrp 5787 /* If possible, send signals to the entire pgrp
5802 by sending an input character to it. */ 5788 by sending an input character to it. */
5803 5789
5804 /* TERMIOS is the latest and bestest, and seems most likely to
5805 work. If the system has it, use it. */
5806#ifdef HAVE_TERMIOS
5807 struct termios t; 5790 struct termios t;
5808 cc_t *sig_char = NULL; 5791 cc_t *sig_char = NULL;
5809 5792
@@ -5835,65 +5818,6 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
5835 } 5818 }
5836 /* If we can't send the signal with a character, 5819 /* If we can't send the signal with a character,
5837 fall through and send it another way. */ 5820 fall through and send it another way. */
5838#else /* ! HAVE_TERMIOS */
5839
5840 /* On Berkeley descendants, the following IOCTL's retrieve the
5841 current control characters. */
5842#if defined (TIOCGLTC) && defined (TIOCGETC)
5843
5844 struct tchars c;
5845 struct ltchars lc;
5846
5847 switch (signo)
5848 {
5849 case SIGINT:
5850 ioctl (p->infd, TIOCGETC, &c);
5851 send_process (proc, &c.t_intrc, 1, Qnil);
5852 return;
5853 case SIGQUIT:
5854 ioctl (p->infd, TIOCGETC, &c);
5855 send_process (proc, &c.t_quitc, 1, Qnil);
5856 return;
5857#ifdef SIGTSTP
5858 case SIGTSTP:
5859 ioctl (p->infd, TIOCGLTC, &lc);
5860 send_process (proc, &lc.t_suspc, 1, Qnil);
5861 return;
5862#endif /* ! defined (SIGTSTP) */
5863 }
5864
5865#else /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
5866
5867 /* On SYSV descendants, the TCGETA ioctl retrieves the current control
5868 characters. */
5869#ifdef TCGETA
5870 struct termio t;
5871 switch (signo)
5872 {
5873 case SIGINT:
5874 ioctl (p->infd, TCGETA, &t);
5875 send_process (proc, &t.c_cc[VINTR], 1, Qnil);
5876 return;
5877 case SIGQUIT:
5878 ioctl (p->infd, TCGETA, &t);
5879 send_process (proc, &t.c_cc[VQUIT], 1, Qnil);
5880 return;
5881#ifdef SIGTSTP
5882 case SIGTSTP:
5883 ioctl (p->infd, TCGETA, &t);
5884 send_process (proc, &t.c_cc[VSWTCH], 1, Qnil);
5885 return;
5886#endif /* ! defined (SIGTSTP) */
5887 }
5888#else /* ! defined (TCGETA) */
5889 Your configuration files are messed up.
5890 /* If your system configuration files define SIGNALS_VIA_CHARACTERS,
5891 you'd better be using one of the alternatives above! */
5892#endif /* ! defined (TCGETA) */
5893#endif /* ! defined (TIOCGLTC) && defined (TIOCGETC) */
5894 /* In this case, the code above should alway return. */
5895 abort ();
5896#endif /* ! defined HAVE_TERMIOS */
5897 5821
5898 /* The code above may fall through if it can't 5822 /* The code above may fall through if it can't
5899 handle the signal. */ 5823 handle the signal. */
@@ -6065,10 +5989,9 @@ traffic. */)
6065#ifdef WINDOWSNT 5989#ifdef WINDOWSNT
6066 if (fd_info[ p->infd ].flags & FILE_SERIAL) 5990 if (fd_info[ p->infd ].flags & FILE_SERIAL)
6067 PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR); 5991 PurgeComm (fd_info[ p->infd ].hnd, PURGE_RXABORT | PURGE_RXCLEAR);
6068#endif 5992#else /* not WINDOWSNT */
6069#ifdef HAVE_TERMIOS
6070 tcflush (p->infd, TCIFLUSH); 5993 tcflush (p->infd, TCIFLUSH);
6071#endif 5994#endif /* not WINDOWSNT */
6072 } 5995 }
6073 p->command = Qnil; 5996 p->command = Qnil;
6074 return process; 5997 return process;
@@ -6282,10 +6205,10 @@ process has been transmitted to the serial port. */)
6282 send_process (proc, "\004", 1, Qnil); 6205 send_process (proc, "\004", 1, Qnil);
6283 else if (EQ (XPROCESS (proc)->type, Qserial)) 6206 else if (EQ (XPROCESS (proc)->type, Qserial))
6284 { 6207 {
6285#ifdef HAVE_TERMIOS 6208#ifndef WINDOWSNT
6286 if (tcdrain (XPROCESS (proc)->outfd) != 0) 6209 if (tcdrain (XPROCESS (proc)->outfd) != 0)
6287 error ("tcdrain() failed: %s", emacs_strerror (errno)); 6210 error ("tcdrain() failed: %s", emacs_strerror (errno));
6288#endif 6211#endif /* not WINDOWSNT */
6289 /* Do nothing on Windows because writes are blocking. */ 6212 /* Do nothing on Windows because writes are blocking. */
6290 } 6213 }
6291 else 6214 else
@@ -7672,10 +7595,8 @@ The variable takes effect when `start-process' is called. */);
7672 defsubr (&Slist_processes); 7595 defsubr (&Slist_processes);
7673 defsubr (&Sprocess_list); 7596 defsubr (&Sprocess_list);
7674 defsubr (&Sstart_process); 7597 defsubr (&Sstart_process);
7675#ifdef HAVE_SERIAL
7676 defsubr (&Sserial_process_configure); 7598 defsubr (&Sserial_process_configure);
7677 defsubr (&Smake_serial_process); 7599 defsubr (&Smake_serial_process);
7678#endif /* HAVE_SERIAL */
7679 defsubr (&Sset_network_process_option); 7600 defsubr (&Sset_network_process_option);
7680 defsubr (&Smake_network_process); 7601 defsubr (&Smake_network_process);
7681 defsubr (&Sformat_network_address); 7602 defsubr (&Sformat_network_address);
diff --git a/src/puresize.h b/src/puresize.h
index 682e8926135..3c7f92228a0 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -87,7 +87,6 @@ extern EMACS_INT pure[];
87 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure) 87 && (PNTR_COMPARISON_TYPE) XPNTR (obj) >= (PNTR_COMPARISON_TYPE) pure)
88 88
89#else /* not VIRT_ADDR_VARIES */ 89#else /* not VIRT_ADDR_VARIES */
90#ifdef PNTR_COMPARISON_TYPE
91/* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */ 90/* When PNTR_COMPARISON_TYPE is not the default (unsigned int). */
92 91
93extern char my_edata[]; 92extern char my_edata[];
@@ -95,14 +94,6 @@ extern char my_edata[];
95#define PURE_P(obj) \ 94#define PURE_P(obj) \
96 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata) 95 ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) my_edata)
97 96
98#else /* not VIRT_ADDRESS_VARIES, not PNTR_COMPARISON_TYPE */
99
100extern char my_edata[];
101
102#define PURE_P(obj) \
103 (XPNTR (obj) < (unsigned int) my_edata)
104
105#endif /* PNTR_COMPARISON_TYPE */
106#endif /* VIRT_ADDRESS_VARIES */ 97#endif /* VIRT_ADDRESS_VARIES */
107 98
108/* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f 99/* arch-tag: fd9b0a91-a70e-4729-a75a-6bb4ca1ce14f
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 84920f888e1..0a3d48db639 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -55,10 +55,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
55 55
56/* Special items needed to make Emacs run on this system. */ 56/* Special items needed to make Emacs run on this system. */
57 57
58/* The following definition seems to be needed in AIX version 3.1.6.8.
59 It may not have been needed in certain earlier versions. */
60#define HAVE_TCATTR
61
62/* AIX doesn't define this. */ 58/* AIX doesn't define this. */
63#define unix 1 59#define unix 1
64 60
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index ee0fa9abe02..d34ff16104b 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -35,9 +35,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */ 35 if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */
36#define FIRST_PTY_LETTER 'p' 36#define FIRST_PTY_LETTER 'p'
37 37
38/* Define HAVE_TERMIO if the system provides sysV-style ioctls 38#define HAVE_TERMIOS
39 for terminal control. */ 39#define NO_TERMIO
40#define HAVE_TERMIO 40
41#define ORDINARY_LINK
41 42
42/* Define HAVE_PTYS if the system supports pty devices. */ 43/* Define HAVE_PTYS if the system supports pty devices. */
43#define HAVE_PTYS 44#define HAVE_PTYS
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index f61fae57eff..4ae5f32e873 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -106,7 +106,6 @@ struct sigaction {
106#define HAVE_SOUND 1 106#define HAVE_SOUND 1
107#define LISP_FLOAT_TYPE 1 107#define LISP_FLOAT_TYPE 1
108 108
109#undef HAVE_SYS_SELECT_H
110#define HAVE_SYS_TIMEB_H 1 109#define HAVE_SYS_TIMEB_H 1
111#define HAVE_SYS_TIME_H 1 110#define HAVE_SYS_TIME_H 1
112#define HAVE_UNISTD_H 1 111#define HAVE_UNISTD_H 1
diff --git a/src/s/unixware.h b/src/s/unixware.h
index ac989d48e2c..81b1b3d97fa 100644
--- a/src/s/unixware.h
+++ b/src/s/unixware.h
@@ -21,8 +21,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 21
22#include "usg5-4-common.h" 22#include "usg5-4-common.h"
23 23
24/* fnf@cygnus.com says these exist. */
25#define HAVE_TCATTR
26/* #define HAVE_GETWD (appears to be buggy on SVR4.2) */ 24/* #define HAVE_GETWD (appears to be buggy on SVR4.2) */
27#undef HAVE_GETWD 25#undef HAVE_GETWD
28 26
diff --git a/src/sysdep.c b/src/sysdep.c
index 2ae3c509522..e7d35d46bf7 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -35,15 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35#endif 35#endif
36 36
37#include "lisp.h" 37#include "lisp.h"
38/* Including stdlib.h isn't necessarily enough to get srandom
39 declared, e.g. without __USE_XOPEN_EXTENDED with glibc 2. */
40
41/* The w32 build defines select stuff in w32.h, which is included by
42 sys/select.h (included below). */
43#ifndef WINDOWSNT
44#include "sysselect.h" 38#include "sysselect.h"
45#endif
46
47#include "blockinput.h" 39#include "blockinput.h"
48 40
49#ifdef WINDOWSNT 41#ifdef WINDOWSNT
@@ -84,17 +76,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
84#include <fcntl.h> 76#include <fcntl.h>
85#endif 77#endif
86 78
87#ifndef MSDOS
88#include <sys/ioctl.h>
89#endif
90
91#include "systty.h" 79#include "systty.h"
92#include "syswait.h" 80#include "syswait.h"
93 81
94#if defined (USG) 82#ifdef HAVE_SYS_UTSNAME_H
95#include <sys/utsname.h> 83#include <sys/utsname.h>
96#include <memory.h> 84#include <memory.h>
97#endif /* USG */ 85#endif /* HAVE_SYS_UTSNAME_H */
98 86
99#include "keyboard.h" 87#include "keyboard.h"
100#include "frame.h" 88#include "frame.h"
@@ -149,17 +137,6 @@ static const int baud_convert[] =
149 1800, 2400, 4800, 9600, 19200, 38400 137 1800, 2400, 4800, 9600, 19200, 38400
150 }; 138 };
151 139
152#ifdef HAVE_SPEED_T
153#include <termios.h>
154#else
155#if defined (HAVE_LIBNCURSES) && ! defined (NCURSES_OSPEED_T)
156#else
157#if defined (HAVE_TERMIOS_H) && defined (GNU_LINUX)
158#include <termios.h>
159#endif
160#endif
161#endif
162
163int emacs_ospeed; 140int emacs_ospeed;
164 141
165void croak (char *) NO_RETURN; 142void croak (char *) NO_RETURN;
@@ -308,32 +285,11 @@ init_baud_rate (int fd)
308#ifdef DOS_NT 285#ifdef DOS_NT
309 emacs_ospeed = 15; 286 emacs_ospeed = 15;
310#else /* not DOS_NT */ 287#else /* not DOS_NT */
311#ifdef HAVE_TERMIOS
312 struct termios sg; 288 struct termios sg;
313 289
314 sg.c_cflag = B9600; 290 sg.c_cflag = B9600;
315 tcgetattr (fd, &sg); 291 tcgetattr (fd, &sg);
316 emacs_ospeed = cfgetospeed (&sg); 292 emacs_ospeed = cfgetospeed (&sg);
317#else /* not TERMIOS */
318#ifdef HAVE_TERMIO
319 struct termio sg;
320
321 sg.c_cflag = B9600;
322#ifdef HAVE_TCATTR
323 tcgetattr (fd, &sg);
324#else
325 ioctl (fd, TCGETA, &sg);
326#endif
327 emacs_ospeed = sg.c_cflag & CBAUD;
328#else /* neither TERMIOS nor TERMIO */
329 struct sgttyb sg;
330
331 sg.sg_ospeed = B9600;
332 if (ioctl (fd, TIOCGETP, &sg) < 0)
333 abort ();
334 emacs_ospeed = sg.sg_ospeed;
335#endif /* not HAVE_TERMIO */
336#endif /* not HAVE_TERMIOS */
337#endif /* not DOS_NT */ 293#endif /* not DOS_NT */
338 } 294 }
339 295
@@ -417,7 +373,7 @@ wait_for_termination (int pid)
417void 373void
418flush_pending_output (int channel) 374flush_pending_output (int channel)
419{ 375{
420#ifdef HAVE_TERMIOS 376#ifndef DOS_NT
421 /* If we try this, we get hit with SIGTTIN, because 377 /* If we try this, we get hit with SIGTTIN, because
422 the child's tty belongs to the child's pgrp. */ 378 the child's tty belongs to the child's pgrp. */
423#else 379#else
@@ -447,8 +403,6 @@ child_setup_tty (int out)
447 struct emacs_tty s; 403 struct emacs_tty s;
448 404
449 EMACS_GET_TTY (out, &s); 405 EMACS_GET_TTY (out, &s);
450
451#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
452 s.main.c_oflag |= OPOST; /* Enable output postprocessing */ 406 s.main.c_oflag |= OPOST; /* Enable output postprocessing */
453 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */ 407 s.main.c_oflag &= ~ONLCR; /* Disable map of NL to CR-NL on output */
454#ifdef NLDLY 408#ifdef NLDLY
@@ -526,19 +480,7 @@ child_setup_tty (int out)
526 s.main.c_cc[VTIME] = 0; 480 s.main.c_cc[VTIME] = 0;
527#endif 481#endif
528 482
529#else /* not HAVE_TERMIO */
530
531 s.main.sg_flags &= ~(ECHO | CRMOD | ANYP | ALLDELAY | RAW | LCASE
532 | CBREAK | TANDEM);
533 s.main.sg_flags |= LPASS8;
534 s.main.sg_erase = 0377;
535 s.main.sg_kill = 0377;
536 s.lmode = LLITOUT | s.lmode; /* Don't strip 8th bit */
537
538#endif /* not HAVE_TERMIO */
539
540 EMACS_SET_TTY (out, &s, 0); 483 EMACS_SET_TTY (out, &s, 0);
541
542#endif /* not WINDOWSNT */ 484#endif /* not WINDOWSNT */
543} 485}
544#endif /* MSDOS */ 486#endif /* MSDOS */
@@ -841,38 +783,11 @@ int
841emacs_get_tty (int fd, struct emacs_tty *settings) 783emacs_get_tty (int fd, struct emacs_tty *settings)
842{ 784{
843 /* Retrieve the primary parameters - baud rate, character size, etcetera. */ 785 /* Retrieve the primary parameters - baud rate, character size, etcetera. */
844#ifdef HAVE_TCATTR 786#ifndef DOS_NT
845 /* We have those nifty POSIX tcmumbleattr functions. */ 787 /* We have those nifty POSIX tcmumbleattr functions. */
846 memset (&settings->main, 0, sizeof (settings->main)); 788 memset (&settings->main, 0, sizeof (settings->main));
847 if (tcgetattr (fd, &settings->main) < 0) 789 if (tcgetattr (fd, &settings->main) < 0)
848 return -1; 790 return -1;
849
850#else
851#ifdef HAVE_TERMIO
852 /* The SYSV-style interface? */
853 if (ioctl (fd, TCGETA, &settings->main) < 0)
854 return -1;
855
856#else
857#ifndef DOS_NT
858 /* I give up - I hope you have the BSD ioctls. */
859 if (ioctl (fd, TIOCGETP, &settings->main) < 0)
860 return -1;
861#endif /* not DOS_NT */
862#endif
863#endif
864
865 /* Suivant - Do we have to get struct ltchars data? */
866#ifdef HAVE_LTCHARS
867 if (ioctl (fd, TIOCGLTC, &settings->ltchars) < 0)
868 return -1;
869#endif
870
871 /* How about a struct tchars and a wordful of lmode bits? */
872#ifdef HAVE_TCHARS
873 if (ioctl (fd, TIOCGETC, &settings->tchars) < 0
874 || ioctl (fd, TIOCLGET, &settings->lmode) < 0)
875 return -1;
876#endif 791#endif
877 792
878 /* We have survived the tempest. */ 793 /* We have survived the tempest. */
@@ -888,7 +803,7 @@ int
888emacs_set_tty (int fd, struct emacs_tty *settings, int flushp) 803emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
889{ 804{
890 /* Set the primary parameters - baud rate, character size, etcetera. */ 805 /* Set the primary parameters - baud rate, character size, etcetera. */
891#ifdef HAVE_TCATTR 806#ifndef DOS_NT
892 int i; 807 int i;
893 /* We have those nifty POSIX tcmumbleattr functions. 808 /* We have those nifty POSIX tcmumbleattr functions.
894 William J. Smith <wjs@wiis.wang.com> writes: 809 William J. Smith <wjs@wiis.wang.com> writes:
@@ -926,34 +841,6 @@ emacs_set_tty (int fd, struct emacs_tty *settings, int flushp)
926 else 841 else
927 continue; 842 continue;
928 } 843 }
929
930#else
931#ifdef HAVE_TERMIO
932 /* The SYSV-style interface? */
933 if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0)
934 return -1;
935
936#else
937#ifndef DOS_NT
938 /* I give up - I hope you have the BSD ioctls. */
939 if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
940 return -1;
941#endif /* not DOS_NT */
942
943#endif
944#endif
945
946 /* Suivant - Do we have to get struct ltchars data? */
947#ifdef HAVE_LTCHARS
948 if (ioctl (fd, TIOCSLTC, &settings->ltchars) < 0)
949 return -1;
950#endif
951
952 /* How about a struct tchars and a wordful of lmode bits? */
953#ifdef HAVE_TCHARS
954 if (ioctl (fd, TIOCSETC, &settings->tchars) < 0
955 || ioctl (fd, TIOCLSET, &settings->lmode) < 0)
956 return -1;
957#endif 844#endif
958 845
959 /* We have survived the tempest. */ 846 /* We have survived the tempest. */
@@ -976,13 +863,6 @@ unsigned char _sobuf[BUFSIZ+8];
976char _sobuf[BUFSIZ]; 863char _sobuf[BUFSIZ];
977#endif 864#endif
978 865
979#ifdef HAVE_LTCHARS
980static struct ltchars new_ltchars = {-1,-1,-1,-1,-1,-1};
981#endif
982#ifdef HAVE_TCHARS
983static struct tchars new_tchars = {-1,-1,-1,-1,-1,-1};
984#endif
985
986/* Initialize the terminal mode on all tty devices that are currently 866/* Initialize the terminal mode on all tty devices that are currently
987 open. */ 867 open. */
988 868
@@ -1016,7 +896,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1016 896
1017 tty = *tty_out->old_tty; 897 tty = *tty_out->old_tty;
1018 898
1019#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS) 899#if !defined (DOS_NT)
1020 XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]); 900 XSETINT (Vtty_erase_char, tty.main.c_cc[VERASE]);
1021 901
1022 tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */ 902 tty.main.c_iflag |= (IGNBRK); /* Ignore break condition */
@@ -1088,12 +968,11 @@ init_sys_modes (struct tty_display_info *tty_out)
1088 of C-z */ 968 of C-z */
1089#endif /* VSWTCH */ 969#endif /* VSWTCH */
1090 970
1091#if defined (__mips__) || defined (HAVE_TCATTR)
1092#ifdef VSUSP 971#ifdef VSUSP
1093 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off mips handling of C-z. */ 972 tty.main.c_cc[VSUSP] = CDISABLE; /* Turn off handling of C-z. */
1094#endif /* VSUSP */ 973#endif /* VSUSP */
1095#ifdef V_DSUSP 974#ifdef V_DSUSP
1096 tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off mips handling of C-y. */ 975 tty.main.c_cc[V_DSUSP] = CDISABLE; /* Turn off handling of C-y. */
1097#endif /* V_DSUSP */ 976#endif /* V_DSUSP */
1098#ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */ 977#ifdef VDSUSP /* Some systems have VDSUSP, some have V_DSUSP. */
1099 tty.main.c_cc[VDSUSP] = CDISABLE; 978 tty.main.c_cc[VDSUSP] = CDISABLE;
@@ -1129,7 +1008,6 @@ init_sys_modes (struct tty_display_info *tty_out)
1129 tty.main.c_cc[VSTOP] = CDISABLE; 1008 tty.main.c_cc[VSTOP] = CDISABLE;
1130#endif /* VSTOP */ 1009#endif /* VSTOP */
1131 } 1010 }
1132#endif /* mips or HAVE_TCATTR */
1133 1011
1134#ifdef AIX 1012#ifdef AIX
1135 tty.main.c_cc[VSTRT] = CDISABLE; 1013 tty.main.c_cc[VSTRT] = CDISABLE;
@@ -1152,41 +1030,8 @@ init_sys_modes (struct tty_display_info *tty_out)
1152 tty.main.c_iflag &= ~IGNBRK; 1030 tty.main.c_iflag &= ~IGNBRK;
1153 tty.main.c_iflag &= ~BRKINT; 1031 tty.main.c_iflag &= ~BRKINT;
1154#endif 1032#endif
1155#else /* if not HAVE_TERMIO */
1156#ifndef DOS_NT
1157 XSETINT (Vtty_erase_char, tty.main.sg_erase);
1158 tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
1159 if (meta_key)
1160 tty.main.sg_flags |= ANYP;
1161 tty.main.sg_flags |= interrupt_input ? RAW : CBREAK;
1162#endif /* not DOS_NT */ 1033#endif /* not DOS_NT */
1163#endif /* not HAVE_TERMIO */
1164
1165 /* If going to use CBREAK mode, we must request C-g to interrupt
1166 and turn off start and stop chars, etc. If not going to use
1167 CBREAK mode, do this anyway so as to turn off local flow
1168 control for user coming over network on 4.2; in this case,
1169 only t_stopc and t_startc really matter. */
1170#ifndef HAVE_TERMIO
1171#ifdef HAVE_TCHARS
1172 /* Note: if not using CBREAK mode, it makes no difference how we
1173 set this */
1174 tty.tchars = new_tchars;
1175 tty.tchars.t_intrc = quit_char;
1176 if (tty_out->flow_control)
1177 {
1178 tty.tchars.t_startc = '\021';
1179 tty.tchars.t_stopc = '\023';
1180 }
1181 1034
1182 tty.lmode = LDECCTQ | LLITOUT | LPASS8 | LNOFLSH | tty_out->old_tty.lmode;
1183
1184#endif /* HAVE_TCHARS */
1185#endif /* not HAVE_TERMIO */
1186
1187#ifdef HAVE_LTCHARS
1188 tty.ltchars = new_ltchars;
1189#endif /* HAVE_LTCHARS */
1190#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ 1035#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
1191 if (!tty_out->term_initted) 1036 if (!tty_out->term_initted)
1192 internal_terminal_init (); 1037 internal_terminal_init ();
@@ -1205,7 +1050,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1205 if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0); 1050 if (!tty_out->flow_control) ioctl (fileno (tty_out->input), TIOCSTART, 0);
1206#endif 1051#endif
1207 1052
1208#if defined (HAVE_TERMIOS) || defined (HPUX) 1053#if !defined (DOS_NT)
1209#ifdef TCOON 1054#ifdef TCOON
1210 if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON); 1055 if (!tty_out->flow_control) tcflow (fileno (tty_out->input), TCOON);
1211#endif 1056#endif
@@ -2688,7 +2533,7 @@ strsignal (int code)
2688} 2533}
2689#endif /* HAVE_STRSIGNAL */ 2534#endif /* HAVE_STRSIGNAL */
2690 2535
2691#ifdef HAVE_TERMIOS 2536#ifndef DOS_NT
2692/* For make-serial-process */ 2537/* For make-serial-process */
2693int 2538int
2694serial_open (char *port) 2539serial_open (char *port)
@@ -2717,9 +2562,6 @@ serial_open (char *port)
2717 2562
2718 return fd; 2563 return fd;
2719} 2564}
2720#endif /* TERMIOS */
2721
2722#ifdef HAVE_TERMIOS
2723 2565
2724#if !defined (HAVE_CFMAKERAW) 2566#if !defined (HAVE_CFMAKERAW)
2725/* Workaround for targets which are missing cfmakeraw. */ 2567/* Workaround for targets which are missing cfmakeraw. */
@@ -2906,7 +2748,7 @@ serial_configure (struct Lisp_Process *p,
2906 p->childp = childp2; 2748 p->childp = childp2;
2907 2749
2908} 2750}
2909#endif /* TERMIOS */ 2751#endif /* not DOS_NT */
2910 2752
2911/* System depended enumeration of and access to system processes a-la ps(1). */ 2753/* System depended enumeration of and access to system processes a-la ps(1). */
2912 2754
diff --git a/src/sysselect.h b/src/sysselect.h
index ddb3e91f2e3..0c90814390c 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -27,6 +27,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#endif 27#endif
28#endif 28#endif
29 29
30/* The w32 build defines select stuff in w32.h, which is included
31 where w32 needs it, but not where sysselect.h is included. The w32
32 definitions in w32.h are incompatible with the below. */
33#ifndef WINDOWSNT
30#ifdef FD_SET 34#ifdef FD_SET
31#ifdef FD_SETSIZE 35#ifdef FD_SETSIZE
32#define MAXDESC FD_SETSIZE 36#define MAXDESC FD_SETSIZE
@@ -44,6 +48,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
44#define FD_ISSET(n, p) (*(p) & (1 << (n))) 48#define FD_ISSET(n, p) (*(p) & (1 << (n)))
45#define FD_ZERO(p) (*(p) = 0) 49#define FD_ZERO(p) (*(p) = 0)
46#endif /* no FD_SET */ 50#endif /* no FD_SET */
51#endif /* not WINDOWSNT */
47 52
48#if !defined (HAVE_SELECT) 53#if !defined (HAVE_SELECT)
49#define select sys_select 54#define select sys_select
diff --git a/src/systty.h b/src/systty.h
index 39feef9c3d0..8c46411cedb 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -17,34 +17,17 @@ GNU General Public License for more details.
17You should have received a copy of the GNU General Public License 17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#ifdef HAVE_TERMIOS
21#define HAVE_TCATTR
22#endif
23
24
25/* Include the proper files. */ 20/* Include the proper files. */
26#ifdef HAVE_TERMIO 21#ifndef DOS_NT
27#ifndef NO_TERMIO 22#ifndef NO_TERMIO
28#include <termio.h> 23#include <termio.h>
29#endif /* not NO_TERMIO */ 24#endif /* not NO_TERMIO */
30#include <fcntl.h>
31#else /* not HAVE_TERMIO */
32#ifdef HAVE_TERMIOS
33#ifndef NO_TERMIO
34#include <termio.h>
35#endif
36#include <termios.h> 25#include <termios.h>
37#include <fcntl.h> 26#include <fcntl.h>
38#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
39#ifndef DOS_NT
40#include <sgtty.h>
41#endif /* not DOS_NT */ 27#endif /* not DOS_NT */
42#endif /* not HAVE_TERMIOS */
43#endif /* not HAVE_TERMIO */
44 28
45#ifdef __GNU_LIBRARY__ 29#ifdef HAVE_SYS_IOCTL_H
46#include <sys/ioctl.h> 30#include <sys/ioctl.h>
47#include <termios.h>
48#endif 31#endif
49 32
50#ifdef HPUX 33#ifdef HPUX
@@ -74,17 +57,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74#undef SIGIO 57#undef SIGIO
75#endif 58#endif
76 59
77/* On TERMIOS systems, the tcmumbleattr calls take care of these
78 parameters, and it's a bad idea to use them (on AIX, it makes the
79 tty hang for a long time). */
80#if defined (TIOCGLTC) && !defined (HAVE_TERMIOS)
81#define HAVE_LTCHARS
82#endif
83
84#if defined (TIOCGETC) && !defined (HAVE_TERMIOS)
85#define HAVE_TCHARS
86#endif
87
88 60
89/* Try to establish the correct character to disable terminal functions 61/* Try to establish the correct character to disable terminal functions
90 in a system-independent manner. Note that USG (at least) define 62 in a system-independent manner. Note that USG (at least) define
@@ -111,60 +83,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
111#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size))) 83#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TIOCOUTQ, (size)))
112#endif 84#endif
113 85
114#ifdef HAVE_TERMIO
115#ifdef TCOUTQ
116#undef EMACS_OUTQSIZE
117#define EMACS_OUTQSIZE(fd, size) (ioctl ((fd), TCOUTQ, (size)))
118#endif
119#endif
120
121 86
122/* Manipulate a terminal's current process group. */ 87/* Manipulate a terminal's current process group. */
123 88
124/* EMACS_HAVE_TTY_PGRP is true if we can get and set the tty's current 89/* EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
125 controlling process group.
126
127 EMACS_GET_TTY_PGRP(int FD, int *PGID) sets *PGID the terminal FD's
128 current process group. Return -1 if there is an error. 90 current process group. Return -1 if there is an error.
129 91
130 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's 92 EMACS_SET_TTY_PGRP(int FD, int *PGID) sets the terminal FD's
131 current process group to *PGID. Return -1 if there is an error. */ 93 current process group to *PGID. Return -1 if there is an error. */
132 94
133/* HPUX tty process group stuff doesn't work, says the anonymous voice 95#ifndef DOS_NT
134 from the past. */
135#ifndef HPUX
136#ifdef TIOCGPGRP
137#define EMACS_HAVE_TTY_PGRP
138#else
139#ifdef HAVE_TERMIOS
140#define EMACS_HAVE_TTY_PGRP
141#endif /* HAVE_TERMIOS */
142#endif /* TIOCGPGRP */
143#endif /* not HPUX */
144
145#ifdef EMACS_HAVE_TTY_PGRP
146
147#if defined (HAVE_TERMIOS)
148
149#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd))) 96#define EMACS_GET_TTY_PGRP(fd, pgid) (*(pgid) = tcgetpgrp ((fd)))
150#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid))) 97#define EMACS_SET_TTY_PGRP(fd, pgid) (tcsetpgrp ((fd), *(pgid)))
151 98#endif /* not DOS_NT */
152#else /* not HAVE_TERMIOS */
153#ifdef TIOCSPGRP
154
155#define EMACS_GET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCGPGRP, (pgid)))
156#define EMACS_SET_TTY_PGRP(fd, pgid) (ioctl ((fd), TIOCSPGRP, (pgid)))
157
158#endif /* TIOCSPGRP */
159#endif /* HAVE_TERMIOS */
160
161#else /* not EMACS_SET_TTY_PGRP */
162
163/* Just ignore this for now and hope for the best */
164#define EMACS_GET_TTY_PGRP(fd, pgid) 0
165#define EMACS_SET_TTY_PGRP(fd, pgif) 0
166
167#endif /* not EMACS_SET_TTY_PGRP */
168 99
169/* EMACS_GETPGRP (arg) returns the process group of the process. */ 100/* EMACS_GETPGRP (arg) returns the process group of the process. */
170 101
@@ -207,32 +138,11 @@ struct emacs_tty {
207 138
208/* There is always one of the following elements, so there is no need 139/* There is always one of the following elements, so there is no need
209 for dummy get and set definitions. */ 140 for dummy get and set definitions. */
210#ifdef HAVE_TCATTR 141#ifndef DOS_NT
211 struct termios main; 142 struct termios main;
212#else /* not HAVE_TCATTR */ 143#else /* DOS_NT */
213#ifdef HAVE_TERMIO
214 struct termio main;
215#else /* not HAVE_TERMIO */
216#ifdef DOS_NT
217 int main; 144 int main;
218#else /* not DOS_NT */ 145#endif /* DOS_NT */
219 struct sgttyb main;
220#endif /* not DOS_NT */
221#endif /* not HAVE_TERMIO */
222#endif /* not HAVE_TCATTR */
223
224/* If we have TERMIOS, we don't need to do this - they're taken care of
225 by the tc*attr calls. */
226#ifndef HAVE_TERMIOS
227#ifdef HAVE_LTCHARS
228 struct ltchars ltchars;
229#endif /* HAVE_LTCHARS */
230
231#ifdef HAVE_TCHARS
232 struct tchars tchars;
233 int lmode;
234#endif /* HAVE_TCHARS */
235#endif /* not defined HAVE_TERMIOS */
236}; 146};
237 147
238/* Define EMACS_GET_TTY and EMACS_SET_TTY, 148/* Define EMACS_GET_TTY and EMACS_SET_TTY,
@@ -249,7 +159,7 @@ extern int emacs_set_tty (int, struct emacs_tty *, int);
249 159
250/* Define EMACS_TTY_TABS_OK. */ 160/* Define EMACS_TTY_TABS_OK. */
251 161
252#ifdef HAVE_TERMIOS 162#ifndef DOS_NT
253 163
254#ifdef TABDLY 164#ifdef TABDLY
255#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3) 165#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
@@ -257,21 +167,9 @@ extern int emacs_set_tty (int, struct emacs_tty *, int);
257#define EMACS_TTY_TABS_OK(p) 1 167#define EMACS_TTY_TABS_OK(p) 1
258#endif /* not TABDLY */ 168#endif /* not TABDLY */
259 169
260#else /* not def HAVE_TERMIOS */ 170#else /* DOS_NT */
261#ifdef HAVE_TERMIO
262
263#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
264
265#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
266
267#ifdef DOS_NT
268#define EMACS_TTY_TABS_OK(p) 0 171#define EMACS_TTY_TABS_OK(p) 0
269#else /* not DOS_NT */ 172#endif /* DOS_NT */
270#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
271#endif /* not DOS_NT */
272
273#endif /* not def HAVE_TERMIO */
274#endif /* not def HAVE_TERMIOS */
275 173
276/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712 174/* arch-tag: cf4b90bc-be41-401c-be98-40619178a712
277 (do not change this comment) */ 175 (do not change this comment) */
diff --git a/src/term.c b/src/term.c
index 4f326234956..d1279498060 100644
--- a/src/term.c
+++ b/src/term.c
@@ -31,9 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <unistd.h> 31#include <unistd.h>
32#endif 32#endif
33 33
34#if HAVE_TERMIOS_H
35#include <termios.h> /* For TIOCNOTTY. */
36#endif
37#ifdef HAVE_SYS_IOCTL_H 34#ifdef HAVE_SYS_IOCTL_H
38#include <sys/ioctl.h> 35#include <sys/ioctl.h>
39#endif 36#endif
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 3e9786348c3..cb4b8d603b5 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -84,6 +84,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
84#ifdef MSDOS 84#ifdef MSDOS
85#include <fcntl.h> /* for O_RDONLY, O_RDWR */ 85#include <fcntl.h> /* for O_RDONLY, O_RDWR */
86#include <crt0.h> /* for _crt0_startup_flags and its bits */ 86#include <crt0.h> /* for _crt0_startup_flags and its bits */
87#include <sys/exceptn.h>
87static int save_djgpp_startup_flags; 88static int save_djgpp_startup_flags;
88#define filehdr external_filehdr 89#define filehdr external_filehdr
89#define scnhdr external_scnhdr 90#define scnhdr external_scnhdr
@@ -128,7 +129,7 @@ struct aouthdr
128#endif 129#endif
129 130
130 131
131extern char *start_of_data (); /* Start of initialized data */ 132extern char *start_of_data (void); /* Start of initialized data */
132 133
133static long block_copy_start; /* Old executable start point */ 134static long block_copy_start; /* Old executable start point */
134static struct filehdr f_hdr; /* File header */ 135static struct filehdr f_hdr; /* File header */
@@ -153,10 +154,8 @@ static int pagemask;
153#include <setjmp.h> 154#include <setjmp.h>
154#include "lisp.h" 155#include "lisp.h"
155 156
156static 157static void
157report_error (file, fd) 158report_error (const char *file, int fd)
158 char *file;
159 int fd;
160{ 159{
161 if (fd) 160 if (fd)
162 close (fd); 161 close (fd);
@@ -167,20 +166,18 @@ report_error (file, fd)
167#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1 166#define ERROR1(msg,x) report_error_1 (new, msg, x, 0); return -1
168#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1 167#define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
169 168
170static 169static void
171report_error_1 (fd, msg, a1, a2) 170report_error_1 (int fd, const char *msg, int a1, int a2)
172 int fd;
173 char *msg;
174 int a1, a2;
175{ 171{
176 close (fd); 172 close (fd);
177 error (msg, a1, a2); 173 error (msg, a1, a2);
178} 174}
179 175
180static int make_hdr (); 176static int make_hdr (int, int, unsigned, unsigned, unsigned,
181static int copy_text_and_data (); 177 const char *, const char *);
182static int copy_sym (); 178static int copy_text_and_data (int, int);
183static void mark_x (); 179static int copy_sym (int, int, const char *, const char *);
180static void mark_x (const char *);
184 181
185/* **************************************************************** 182/* ****************************************************************
186 * make_hdr 183 * make_hdr
@@ -189,13 +186,9 @@ static void mark_x ();
189 * Modify the text and data sizes. 186 * Modify the text and data sizes.
190 */ 187 */
191static int 188static int
192make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) 189make_hdr (int new, int a_out, unsigned data_start, unsigned bss_start,
193 int new, a_out; 190 unsigned entry_address, const char *a_name, const char *new_name)
194 unsigned data_start, bss_start, entry_address;
195 char *a_name;
196 char *new_name;
197{ 191{
198 int tem;
199 auto struct scnhdr f_thdr; /* Text section header */ 192 auto struct scnhdr f_thdr; /* Text section header */
200 auto struct scnhdr f_dhdr; /* Data section header */ 193 auto struct scnhdr f_dhdr; /* Data section header */
201 auto struct scnhdr f_bhdr; /* Bss section header */ 194 auto struct scnhdr f_bhdr; /* Bss section header */
@@ -363,12 +356,10 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name)
363 356
364} 357}
365 358
366write_segment (new, ptr, end) 359void
367 int new; 360write_segment (int new, const char *ptr, const char *end)
368 register char *ptr, *end;
369{ 361{
370 register int i, nwrite, ret; 362 register int i, nwrite, ret;
371 char buf[80];
372 /* This is the normal amount to write at once. 363 /* This is the normal amount to write at once.
373 It is the size of block that NFS uses. */ 364 It is the size of block that NFS uses. */
374 int writesize = 1 << 13; 365 int writesize = 1 << 13;
@@ -411,8 +402,7 @@ write_segment (new, ptr, end)
411 * Copy the text and data segments from memory to the new a.out 402 * Copy the text and data segments from memory to the new a.out
412 */ 403 */
413static int 404static int
414copy_text_and_data (new, a_out) 405copy_text_and_data (int new, int a_out)
415 int new, a_out;
416{ 406{
417 register char *end; 407 register char *end;
418 register char *ptr; 408 register char *ptr;
@@ -456,9 +446,7 @@ copy_text_and_data (new, a_out)
456 * Copy the relocation information and symbol table from the a.out to the new 446 * Copy the relocation information and symbol table from the a.out to the new
457 */ 447 */
458static int 448static int
459copy_sym (new, a_out, a_name, new_name) 449copy_sym (int new, int a_out, const char *a_name, const char *new_name)
460 int new, a_out;
461 char *a_name, *new_name;
462{ 450{
463 char page[1024]; 451 char page[1024];
464 int n; 452 int n;
@@ -494,8 +482,7 @@ copy_sym (new, a_out, a_name, new_name)
494 * After successfully building the new a.out, mark it executable 482 * After successfully building the new a.out, mark it executable
495 */ 483 */
496static void 484static void
497mark_x (name) 485mark_x (const char *name)
498 char *name;
499{ 486{
500 struct stat sbuf; 487 struct stat sbuf;
501 int um; 488 int um;
@@ -535,10 +522,8 @@ mark_x (name)
535 a reasonable size buffer. But I don't have time to work on such 522 a reasonable size buffer. But I don't have time to work on such
536 things, so I am installing it as submitted to me. -- RMS. */ 523 things, so I am installing it as submitted to me. -- RMS. */
537 524
538adjust_lnnoptrs (writedesc, readdesc, new_name) 525int
539 int writedesc; 526adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
540 int readdesc;
541 char *new_name;
542{ 527{
543 register int nsyms; 528 register int nsyms;
544 register int new; 529 register int new;
@@ -585,11 +570,11 @@ adjust_lnnoptrs (writedesc, readdesc, new_name)
585 * 570 *
586 * driving logic. 571 * driving logic.
587 */ 572 */
588unexec (new_name, a_name, data_start, bss_start, entry_address) 573int
589 char *new_name, *a_name; 574unexec (const char *new_name, const char *a_name,
590 unsigned data_start, bss_start, entry_address; 575 unsigned data_start, unsigned bss_start, unsigned entry_address)
591{ 576{
592 int new, a_out = -1; 577 int new = -1, a_out = -1;
593 578
594 if (a_name && (a_out = open (a_name, O_RDONLY)) < 0) 579 if (a_name && (a_out = open (a_name, O_RDONLY)) < 0)
595 { 580 {
@@ -607,7 +592,6 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
607 ) 592 )
608 { 593 {
609 close (new); 594 close (new);
610 /* unlink (new_name); /* Failed, unlink new a.out */
611 return -1; 595 return -1;
612 } 596 }
613 597
diff --git a/src/w32fns.c b/src/w32fns.c
index 64d0d8cb6d1..f91ad948828 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3109,9 +3109,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3109 HIMC context; 3109 HIMC context;
3110 struct window *w; 3110 struct window *w;
3111 3111
3112 if (!context)
3113 break;
3114
3115 f = x_window_to_frame (dpyinfo, hwnd); 3112 f = x_window_to_frame (dpyinfo, hwnd);
3116 w = XWINDOW (FRAME_SELECTED_WINDOW (f)); 3113 w = XWINDOW (FRAME_SELECTED_WINDOW (f));
3117 3114
@@ -3129,6 +3126,10 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
3129 - WINDOW_MODE_LINE_HEIGHT (w)); 3126 - WINDOW_MODE_LINE_HEIGHT (w));
3130 3127
3131 context = get_ime_context_fn (hwnd); 3128 context = get_ime_context_fn (hwnd);
3129
3130 if (!context)
3131 break;
3132
3132 set_ime_composition_window_fn (context, &form); 3133 set_ime_composition_window_fn (context, &form);
3133 release_ime_context_fn (hwnd, context); 3134 release_ime_context_fn (hwnd, context);
3134 } 3135 }
diff --git a/src/w32menu.c b/src/w32menu.c
index 1146843bec8..0ed9bffe70c 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -420,12 +420,8 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
420 420
421 set_buffer_internal_1 (XBUFFER (buffer)); 421 set_buffer_internal_1 (XBUFFER (buffer));
422 422
423 /* Run the Lucid hook. */ 423 /* Run the hooks. */
424 safe_run_hooks (Qactivate_menubar_hook); 424 safe_run_hooks (Qactivate_menubar_hook);
425 /* If it has changed current-menubar from previous value,
426 really recompute the menubar from the value. */
427 if (! NILP (Vlucid_menu_bar_dirty_flag))
428 call0 (Qrecompute_lucid_menubar);
429 safe_run_hooks (Qmenu_bar_update_hook); 425 safe_run_hooks (Qmenu_bar_update_hook);
430 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); 426 FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f));
431 427
diff --git a/src/xdisp.c b/src/xdisp.c
index d730387a51b..93fdb68eeac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -217,7 +217,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
217 glyph with suitably computed width. Both the blanks and the 217 glyph with suitably computed width. Both the blanks and the
218 stretch glyph are given the face of the background of the line. 218 stretch glyph are given the face of the background of the line.
219 This way, the terminal-specific back-end can still draw the glyphs 219 This way, the terminal-specific back-end can still draw the glyphs
220 left to right, even for R2L lines. */ 220 left to right, even for R2L lines.
221
222 Note one important detail mentioned above: that the bidi reordering
223 engine, driven by the iterator, produces characters in R2L rows
224 starting at the character that will be the rightmost on display.
225 As far as the iterator is concerned, the geometry of such rows is
226 still left to right, i.e. the iterator "thinks" the first character
227 is at the leftmost pixel position. The iterator does not know that
228 PRODUCE_GLYPHS reverses the order of the glyphs that the iterator
229 delivers. This is important when functions from the the move_it_*
230 family are used to get to certain screen position or to match
231 screen coordinates with buffer coordinates: these functions use the
232 iterator geometry, which is left to right even in R2L paragraphs.
233 This works well with most callers of move_it_*, because they need
234 to get to a specific column, and columns are still numbered in the
235 reading order, i.e. the rightmost character in a R2L paragraph is
236 still column zero. But some callers do not get well with this; a
237 notable example is mouse clicks that need to find the character
238 that corresponds to certain pixel coordinates. See
239 buffer_posn_from_coords in dispnew.c for how this is handled. */
221 240
222#include <config.h> 241#include <config.h>
223#include <stdio.h> 242#include <stdio.h>
@@ -10839,7 +10858,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
10839 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; 10858 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED;
10840 int mouse_down_p, rc; 10859 int mouse_down_p, rc;
10841 10860
10842 /* Function note_mouse_highlight is called with negative x(y 10861 /* Function note_mouse_highlight is called with negative X/Y
10843 values when mouse moves outside of the frame. */ 10862 values when mouse moves outside of the frame. */
10844 if (x <= 0 || y <= 0) 10863 if (x <= 0 || y <= 0)
10845 { 10864 {