aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-04-09 00:38:22 +0000
committerMiles Bader2006-04-09 00:38:22 +0000
commit49d395cd57e646162e7f646a8561a416abacac82 (patch)
treed7fabed45dfc19d6bff30024f82613f372b97951 /src
parentb6828792a25d042ede1ed164389531e30cc3e202 (diff)
parent1b155fbd766b0a0f78fca5de62dd16a3542883f1 (diff)
downloademacs-49d395cd57e646162e7f646a8561a416abacac82.tar.gz
emacs-49d395cd57e646162e7f646a8561a416abacac82.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-54
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 190-203) - Update from CVS - Undo incorrect merge of etc/images/README from Gnus 5.10 - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 74-80) - Update from CVS - Update from CVS: README: Addition from 5.10.6 tar ball.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog61
-rw-r--r--src/alloc.c20
-rw-r--r--src/editfns.c34
-rw-r--r--src/image.c11
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h34
-rw-r--r--src/macterm.c4
-rw-r--r--src/process.c96
-rw-r--r--src/process.h19
-rw-r--r--src/w32fns.c15
10 files changed, 208 insertions, 88 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 3c309679cdb..a4db51e7ca1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,64 @@
12006-04-08 Eli Zaretskii <eliz@gnu.org>
2
3 * w32fns.c (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements
4 if a menu is active on this frame.
5
62006-04-08 Dan Nicolaescu <dann@ics.uci.edu>
7
8 * lisp.h (report_file_error): Mark as NO_RETURN.
9
102006-04-08 Eli Zaretskii <eliz@gnu.org>
11
12 * alloc.c [STDC_HEADERS]: Include stddef.h.
13
14 * lisp.h (PSEUDOVECSIZE): Fix last change.
15
162006-04-08 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * process.h (struct Lisp_Process): Replace Lisp_Objects `pid',
19 `raw_status_high', and `raw_status_low' with plain integers, and move
20 them to the end of the structure.
21
22 * alloc.c (allocate_process): Use PSEUDOVECSIZE to initialize the
23 pseudovector's size field so only the Lisp_Object fields get GC'd.
24
25 * process.c (update_status, make_process, Fdelete_process)
26 (Fprocess_status, list_processes_1, start_process_unwind)
27 (create_process, Fmake_network_process, server_accept_connection)
28 (wait_reading_process_output, send_process, Fprocess_running_child_p)
29 (process_send_signal, proc_encode_coding_system, Fprocess_send_eof)
30 (sigchld_handler, status_notify): Adjust to new non-Lisp fields for
31 `pid' and `raw_status'.
32 (Fprocess_id, Fsignal_process): Same, and additionally use floats when
33 representing PIDs that are larger than most-positive-fixnum.
34
35 * keymap.c (describe_map): Only use XINT if we checked INTEGERP.
36
37 * lisp.h (OFFSETOF, PSEUDOVECSIZE): New macros.
38
392006-04-08 Eli Zaretskii <eliz@gnu.org>
40
41 * w32fns.c (Fx_show_tip): Add 3 to the 5th arg of SetWindowPos.
42
432006-04-03 Paul Eggert <eggert@cs.ucla.edu>
44
45 * editfns.c (TM_YEAR_IN_ASCTIME_RANGE): New macro, identical to
46 ../lib-src/b2m.c and ../lib-src/editfns.c.
47 (Fcurrent_time_string): Use it.
48 Document that the year might not consume 4 columns if it's outside
49 the range 1000-9999.
50 Check for asctime failure.
51 Don't assume that the output string length is always exactly 24.
52
532006-04-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
54
55 * macterm.c (XTread_socket): Initialize variable `f' before its use.
56
572006-04-03 Kenichi Handa <handa@m17n.org>
58
59 * image.c: Include "charset.h" and "coding.h".
60 (x_find_image_file): Return an encoded file name.
61
12006-04-01 Eli Zaretskii <eliz@gnu.org> 622006-04-01 Eli Zaretskii <eliz@gnu.org>
2 63
3 * configure: Regenerated. 64 * configure: Regenerated.
diff --git a/src/alloc.c b/src/alloc.c
index 549f14625e6..7fd1560708a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -23,6 +23,10 @@ Boston, MA 02110-1301, USA. */
23#include <stdio.h> 23#include <stdio.h>
24#include <limits.h> /* For CHAR_BIT. */ 24#include <limits.h> /* For CHAR_BIT. */
25 25
26#ifdef STDC_HEADERS
27#include <stddef.h> /* For offsetof, used by PSEUDOVECSIZE. */
28#endif
29
26#ifdef ALLOC_DEBUG 30#ifdef ALLOC_DEBUG
27#undef INLINE 31#undef INLINE
28#endif 32#endif
@@ -3003,13 +3007,17 @@ allocate_frame ()
3003struct Lisp_Process * 3007struct Lisp_Process *
3004allocate_process () 3008allocate_process ()
3005{ 3009{
3006 EMACS_INT len = VECSIZE (struct Lisp_Process); 3010 /* Memory-footprint of the object in nb of Lisp_Object fields. */
3007 struct Lisp_Vector *v = allocate_vectorlike (len, MEM_TYPE_PROCESS); 3011 EMACS_INT memlen = VECSIZE (struct Lisp_Process);
3012 /* Size if we only count the actual Lisp_Object fields (which need to be
3013 traced by the GC). */
3014 EMACS_INT lisplen = PSEUDOVECSIZE (struct Lisp_Process, pid);
3015 struct Lisp_Vector *v = allocate_vectorlike (memlen, MEM_TYPE_PROCESS);
3008 EMACS_INT i; 3016 EMACS_INT i;
3009 3017
3010 for (i = 0; i < len; ++i) 3018 for (i = 0; i < lisplen; ++i)
3011 v->contents[i] = Qnil; 3019 v->contents[i] = Qnil;
3012 v->size = len; 3020 v->size = lisplen;
3013 3021
3014 return (struct Lisp_Process *) v; 3022 return (struct Lisp_Process *) v;
3015} 3023}
@@ -5515,6 +5523,10 @@ mark_object (arg)
5515 if (size & PSEUDOVECTOR_FLAG) 5523 if (size & PSEUDOVECTOR_FLAG)
5516 size &= PSEUDOVECTOR_SIZE_MASK; 5524 size &= PSEUDOVECTOR_SIZE_MASK;
5517 5525
5526 /* Note that this size is not the memory-footprint size, but only
5527 the number of Lisp_Object fields that we should trace.
5528 The distinction is used e.g. by Lisp_Process which places extra
5529 non-Lisp_Object fields at the end of the structure. */
5518 for (i = 0; i < size; i++) /* and then mark its elements */ 5530 for (i = 0; i < size; i++) /* and then mark its elements */
5519 mark_object (ptr->contents[i]); 5531 mark_object (ptr->contents[i]);
5520 } 5532 }
diff --git a/src/editfns.c b/src/editfns.c
index 59401fdfecd..b0e79057988 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -74,6 +74,13 @@ extern char **environ;
74 74
75#define TM_YEAR_BASE 1900 75#define TM_YEAR_BASE 1900
76 76
77/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes
78 asctime to have well-defined behavior. */
79#ifndef TM_YEAR_IN_ASCTIME_RANGE
80# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \
81 (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE)
82#endif
83
77extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, 84extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
78 const struct tm *, int)); 85 const struct tm *, int));
79static int tm_diff P_ ((struct tm *, struct tm *)); 86static int tm_diff P_ ((struct tm *, struct tm *));
@@ -1831,7 +1838,8 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1831DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0, 1838DEFUN ("current-time-string", Fcurrent_time_string, Scurrent_time_string, 0, 1, 0,
1832 doc: /* Return the current time, as a human-readable string. 1839 doc: /* Return the current time, as a human-readable string.
1833Programs can use this function to decode a time, 1840Programs can use this function to decode a time,
1834since the number of columns in each field is fixed. 1841since the number of columns in each field is fixed
1842if the year is in the range 1000-9999.
1835The format is `Sun Sep 16 01:03:52 1973'. 1843The format is `Sun Sep 16 01:03:52 1973'.
1836However, see also the functions `decode-time' and `format-time-string' 1844However, see also the functions `decode-time' and `format-time-string'
1837which provide a much more powerful and general facility. 1845which provide a much more powerful and general facility.
@@ -1845,31 +1853,23 @@ but this is considered obsolete. */)
1845 Lisp_Object specified_time; 1853 Lisp_Object specified_time;
1846{ 1854{
1847 time_t value; 1855 time_t value;
1848 char buf[30];
1849 struct tm *tm; 1856 struct tm *tm;
1850 register char *tem; 1857 register char *tem;
1851 1858
1852 if (! lisp_time_argument (specified_time, &value, NULL)) 1859 if (! lisp_time_argument (specified_time, &value, NULL))
1853 error ("Invalid time specification"); 1860 error ("Invalid time specification");
1854 /* Do not use ctime, since it has undefined behavior with 1861
1855 out-of-range time stamps. This avoids a core dump triggered by 1862 /* Convert to a string, checking for out-of-range time stamps.
1856 (current-time-string '(2814749767106 0)) on 64-bit Solaris 8. See 1863 Don't use 'ctime', as that might dump core if VALUE is out of
1857 <http://www.opengroup.org/austin/mailarchives/ag/msg09294.html> 1864 range. */
1858 for more details about this portability problem. */
1859 tm = localtime (&value); 1865 tm = localtime (&value);
1860 /* Checking for out-of-range time stamps avoids buffer overruns that 1866 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm))))
1861 cause core dump on some systems (e.g., 64-bit Solaris), and also
1862 preserves the historic behavior of always returning a fixed-size
1863 24-character string. */
1864 if (! (tm && -999 - TM_YEAR_BASE <= tm->tm_year
1865 && tm->tm_year <= 9999 - TM_YEAR_BASE))
1866 error ("Specified time is not representable"); 1867 error ("Specified time is not representable");
1867 tem = asctime (tm);
1868 1868
1869 strncpy (buf, tem, 24); 1869 /* Remove the trailing newline. */
1870 buf[24] = 0; 1870 tem[strlen (tem) - 1] = '\0';
1871 1871
1872 return build_string (buf); 1872 return build_string (tem);
1873} 1873}
1874 1874
1875/* Yield A - B, measured in seconds. 1875/* Yield A - B, measured in seconds.
diff --git a/src/image.c b/src/image.c
index d8a1bc8028b..6f2e93a591a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -39,6 +39,8 @@ Boston, MA 02110-1301, USA. */
39#include "blockinput.h" 39#include "blockinput.h"
40#include "systime.h" 40#include "systime.h"
41#include <epaths.h> 41#include <epaths.h>
42#include "charset.h"
43#include "coding.h"
42 44
43 45
44#ifdef HAVE_X_WINDOWS 46#ifdef HAVE_X_WINDOWS
@@ -2246,8 +2248,8 @@ static unsigned char *slurp_file P_ ((char *, int *));
2246 2248
2247 2249
2248/* Find image file FILE. Look in data-directory, then 2250/* Find image file FILE. Look in data-directory, then
2249 x-bitmap-file-path. Value is the full name of the file found, or 2251 x-bitmap-file-path. Value is the encoded full name of the file
2250 nil if not found. */ 2252 found, or nil if not found. */
2251 2253
2252Lisp_Object 2254Lisp_Object
2253x_find_image_file (file) 2255x_find_image_file (file)
@@ -2267,7 +2269,10 @@ x_find_image_file (file)
2267 if (fd == -1) 2269 if (fd == -1)
2268 file_found = Qnil; 2270 file_found = Qnil;
2269 else 2271 else
2270 close (fd); 2272 {
2273 file_found = ENCODE_FILE (file_found);
2274 close (fd);
2275 }
2271 2276
2272 UNGCPRO; 2277 UNGCPRO;
2273 return file_found; 2278 return file_found;
diff --git a/src/keymap.c b/src/keymap.c
index 5e01566efaa..e5122c84efc 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3362,7 +3362,7 @@ describe_map (map, prefix, elt_describer, partial, shadow,
3362 if (INTEGERP (vect[i].event)) 3362 if (INTEGERP (vect[i].event))
3363 { 3363 {
3364 while (i + 1 < slots_used 3364 while (i + 1 < slots_used
3365 && XINT (vect[i + 1].event) == XINT (vect[i].event) + 1 3365 && EQ (vect[i+1].event, make_number (XINT (vect[i].event) + 1))
3366 && !NILP (Fequal (vect[i + 1].definition, definition)) 3366 && !NILP (Fequal (vect[i + 1].definition, definition))
3367 && vect[i].shadowed == vect[i + 1].shadowed) 3367 && vect[i].shadowed == vect[i + 1].shadowed)
3368 i++; 3368 i++;
diff --git a/src/lisp.h b/src/lisp.h
index 915c2943348..2356c40b731 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -298,7 +298,11 @@ enum pvec_type
298#endif 298#endif
299}; 299};
300 300
301/* For convenience, we also store the number of elements in these bits. */ 301/* For convenience, we also store the number of elements in these bits.
302 Note that this size is not necessarily the memory-footprint size, but
303 only the number of Lisp_Object fields (that need to be traced by the GC).
304 The distinction is used e.g. by Lisp_Process which places extra
305 non-Lisp_Object fields at the end of the structure. */
302#define PSEUDOVECTOR_SIZE_MASK 0x1ff 306#define PSEUDOVECTOR_SIZE_MASK 0x1ff
303 307
304/* Number of bits to put in each character in the internal representation 308/* Number of bits to put in each character in the internal representation
@@ -705,12 +709,12 @@ struct Lisp_String
705 unsigned char *data; 709 unsigned char *data;
706 }; 710 };
707 711
708/* If a struct is made to look like a vector, this macro returns the length 712#ifdef offsetof
709 of the shortest vector that would hold that struct. */ 713#define OFFSETOF(type,field) offsetof(type,field)
710#define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \ 714#else
711 - sizeof (Lisp_Object)) \ 715#define OFFSETOF(type,field) \
712 + sizeof(Lisp_Object) - 1) /* round up */ \ 716 ((int)((char*)&((type*)0)->field - (char*)0))
713 / sizeof (Lisp_Object)) 717#endif
714 718
715struct Lisp_Vector 719struct Lisp_Vector
716 { 720 {
@@ -719,6 +723,20 @@ struct Lisp_Vector
719 Lisp_Object contents[1]; 723 Lisp_Object contents[1];
720 }; 724 };
721 725
726/* If a struct is made to look like a vector, this macro returns the length
727 of the shortest vector that would hold that struct. */
728#define VECSIZE(type) ((sizeof (type) - (sizeof (struct Lisp_Vector) \
729 - sizeof (Lisp_Object)) \
730 + sizeof(Lisp_Object) - 1) /* round up */ \
731 / sizeof (Lisp_Object))
732
733/* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
734 at the end and we need to compute the number of Lisp_Object fields (the
735 ones that the GC needs to trace). */
736#define PSEUDOVECSIZE(type, nonlispfield) \
737 ((OFFSETOF(type, nonlispfield) - OFFSETOF(struct Lisp_Vector, contents[0])) \
738 / sizeof (Lisp_Object))
739
722/* A char-table is a kind of vectorlike, with contents are like a 740/* A char-table is a kind of vectorlike, with contents are like a
723 vector but with a few other slots. For some purposes, it makes 741 vector but with a few other slots. For some purposes, it makes
724 sense to handle a char-table with type struct Lisp_Vector. An 742 sense to handle a char-table with type struct Lisp_Vector. An
@@ -2880,7 +2898,7 @@ EXFUN (Ffile_readable_p, 1);
2880EXFUN (Ffile_executable_p, 1); 2898EXFUN (Ffile_executable_p, 1);
2881EXFUN (Fread_file_name, 6); 2899EXFUN (Fread_file_name, 6);
2882extern Lisp_Object close_file_unwind P_ ((Lisp_Object)); 2900extern Lisp_Object close_file_unwind P_ ((Lisp_Object));
2883extern void report_file_error P_ ((const char *, Lisp_Object)); 2901extern void report_file_error P_ ((const char *, Lisp_Object)) NO_RETURN;
2884extern int internal_delete_file P_ ((Lisp_Object)); 2902extern int internal_delete_file P_ ((Lisp_Object));
2885extern void syms_of_fileio P_ ((void)); 2903extern void syms_of_fileio P_ ((void));
2886extern void init_fileio_once P_ ((void)); 2904extern void init_fileio_once P_ ((void));
diff --git a/src/macterm.c b/src/macterm.c
index f09b4918fb9..472fe3d28c8 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -10476,6 +10476,8 @@ XTread_socket (sd, expected, hold_quit)
10476 10476
10477 ObscureCursor (); 10477 ObscureCursor ();
10478 10478
10479 f = mac_focus_frame (dpyinfo);
10480
10479 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 10481 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
10480 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)) 10482 && !EQ (f->tool_bar_window, dpyinfo->mouse_face_window))
10481 { 10483 {
@@ -10521,7 +10523,7 @@ XTread_socket (sd, expected, hold_quit)
10521 inev.modifiers |= (extra_keyboard_modifiers 10523 inev.modifiers |= (extra_keyboard_modifiers
10522 & (meta_modifier | alt_modifier 10524 & (meta_modifier | alt_modifier
10523 | hyper_modifier | super_modifier)); 10525 | hyper_modifier | super_modifier));
10524 XSETFRAME (inev.frame_or_window, mac_focus_frame (dpyinfo)); 10526 XSETFRAME (inev.frame_or_window, f);
10525 break; 10527 break;
10526 10528
10527 case kHighLevelEvent: 10529 case kHighLevelEvent:
diff --git a/src/process.c b/src/process.c
index 9b47f1cae31..eab9daa6bdd 100644
--- a/src/process.c
+++ b/src/process.c
@@ -414,10 +414,10 @@ update_status (p)
414 struct Lisp_Process *p; 414 struct Lisp_Process *p;
415{ 415{
416 union { int i; WAITTYPE wt; } u; 416 union { int i; WAITTYPE wt; } u;
417 u.i = XFASTINT (p->raw_status_low) + (XFASTINT (p->raw_status_high) << 16); 417 eassert (p->raw_status_new);
418 u.i = p->raw_status;
418 p->status = status_convert (u.wt); 419 p->status = status_convert (u.wt);
419 p->raw_status_low = Qnil; 420 p->raw_status_new = 0;
420 p->raw_status_high = Qnil;
421} 421}
422 422
423/* Convert a process status word in Unix format to 423/* Convert a process status word in Unix format to
@@ -619,11 +619,10 @@ make_process (name)
619 619
620 XSETINT (p->infd, -1); 620 XSETINT (p->infd, -1);
621 XSETINT (p->outfd, -1); 621 XSETINT (p->outfd, -1);
622 XSETFASTINT (p->pid, 0);
623 XSETFASTINT (p->tick, 0); 622 XSETFASTINT (p->tick, 0);
624 XSETFASTINT (p->update_tick, 0); 623 XSETFASTINT (p->update_tick, 0);
625 p->raw_status_low = Qnil; 624 p->pid = 0;
626 p->raw_status_high = Qnil; 625 p->raw_status_new = 0;
627 p->status = Qrun; 626 p->status = Qrun;
628 p->mark = Fmake_marker (); 627 p->mark = Fmake_marker ();
629 628
@@ -790,8 +789,7 @@ nil, indicating the current buffer's process. */)
790 process = get_process (process); 789 process = get_process (process);
791 p = XPROCESS (process); 790 p = XPROCESS (process);
792 791
793 p->raw_status_low = Qnil; 792 p->raw_status_new = 0;
794 p->raw_status_high = Qnil;
795 if (NETCONN1_P (p)) 793 if (NETCONN1_P (p))
796 { 794 {
797 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil)); 795 p->status = Fcons (Qexit, Fcons (make_number (0), Qnil));
@@ -841,7 +839,7 @@ nil, indicating the current buffer's process. */)
841 return process; 839 return process;
842 840
843 p = XPROCESS (process); 841 p = XPROCESS (process);
844 if (!NILP (p->raw_status_low)) 842 if (p->raw_status_new)
845 update_status (p); 843 update_status (p);
846 status = p->status; 844 status = p->status;
847 if (CONSP (status)) 845 if (CONSP (status))
@@ -866,7 +864,7 @@ If PROCESS has not yet exited or died, return 0. */)
866 register Lisp_Object process; 864 register Lisp_Object process;
867{ 865{
868 CHECK_PROCESS (process); 866 CHECK_PROCESS (process);
869 if (!NILP (XPROCESS (process)->raw_status_low)) 867 if (XPROCESS (process)->raw_status_new)
870 update_status (XPROCESS (process)); 868 update_status (XPROCESS (process));
871 if (CONSP (XPROCESS (process)->status)) 869 if (CONSP (XPROCESS (process)->status))
872 return XCAR (XCDR (XPROCESS (process)->status)); 870 return XCAR (XCDR (XPROCESS (process)->status));
@@ -881,7 +879,9 @@ For a network connection, this value is nil. */)
881 register Lisp_Object process; 879 register Lisp_Object process;
882{ 880{
883 CHECK_PROCESS (process); 881 CHECK_PROCESS (process);
884 return XPROCESS (process)->pid; 882 return (XPROCESS (process)->pid
883 ? make_fixnum_or_float (XPROCESS (process)->pid)
884 : Qnil);
885} 885}
886 886
887DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0, 887DEFUN ("process-name", Fprocess_name, Sprocess_name, 1, 1, 0,
@@ -1363,7 +1363,7 @@ list_processes_1 (query_only)
1363 Finsert (1, &p->name); 1363 Finsert (1, &p->name);
1364 Findent_to (i_status, minspace); 1364 Findent_to (i_status, minspace);
1365 1365
1366 if (!NILP (p->raw_status_low)) 1366 if (p->raw_status_new)
1367 update_status (p); 1367 update_status (p);
1368 symbol = p->status; 1368 symbol = p->status;
1369 if (CONSP (p->status)) 1369 if (CONSP (p->status))
@@ -1735,7 +1735,7 @@ start_process_unwind (proc)
1735 abort (); 1735 abort ();
1736 1736
1737 /* Was PROC started successfully? */ 1737 /* Was PROC started successfully? */
1738 if (XINT (XPROCESS (proc)->pid) <= 0) 1738 if (XPROCESS (proc)->pid <= 0)
1739 remove_process (proc); 1739 remove_process (proc);
1740 1740
1741 return Qnil; 1741 return Qnil;
@@ -1946,7 +1946,7 @@ create_process (process, new_argv, current_dir)
1946 in the table after this function has returned; if it does 1946 in the table after this function has returned; if it does
1947 it might cause call-process to hang and subsequent asynchronous 1947 it might cause call-process to hang and subsequent asynchronous
1948 processes to get their return values scrambled. */ 1948 processes to get their return values scrambled. */
1949 XSETINT (XPROCESS (process)->pid, -1); 1949 XPROCESS (process)->pid = -1;
1950 1950
1951 BLOCK_INPUT; 1951 BLOCK_INPUT;
1952 1952
@@ -2137,7 +2137,7 @@ create_process (process, new_argv, current_dir)
2137 else 2137 else
2138 { 2138 {
2139 /* vfork succeeded. */ 2139 /* vfork succeeded. */
2140 XSETFASTINT (XPROCESS (process)->pid, pid); 2140 XPROCESS (process)->pid = pid;
2141 2141
2142#ifdef WINDOWSNT 2142#ifdef WINDOWSNT
2143 register_child (pid, inchannel); 2143 register_child (pid, inchannel);
@@ -3350,7 +3350,7 @@ usage: (make-network-process &rest ARGS) */)
3350 p->kill_without_query = Qt; 3350 p->kill_without_query = Qt;
3351 if ((tem = Fplist_get (contact, QCstop), !NILP (tem))) 3351 if ((tem = Fplist_get (contact, QCstop), !NILP (tem)))
3352 p->command = Qt; 3352 p->command = Qt;
3353 p->pid = Qnil; 3353 p->pid = 0;
3354 XSETINT (p->infd, inch); 3354 XSETINT (p->infd, inch);
3355 XSETINT (p->outfd, outch); 3355 XSETINT (p->outfd, outch);
3356 if (is_server && socktype == SOCK_STREAM) 3356 if (is_server && socktype == SOCK_STREAM)
@@ -4066,7 +4066,7 @@ server_accept_connection (server, channel)
4066 p->sentinel = ps->sentinel; 4066 p->sentinel = ps->sentinel;
4067 p->filter = ps->filter; 4067 p->filter = ps->filter;
4068 p->command = Qnil; 4068 p->command = Qnil;
4069 p->pid = Qnil; 4069 p->pid = 0;
4070 XSETINT (p->infd, s); 4070 XSETINT (p->infd, s);
4071 XSETINT (p->outfd, s); 4071 XSETINT (p->outfd, s);
4072 p->status = Qrun; 4072 p->status = Qrun;
@@ -4366,9 +4366,9 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4366 4366
4367 /* Don't wait for output from a non-running process. Just 4367 /* Don't wait for output from a non-running process. Just
4368 read whatever data has already been received. */ 4368 read whatever data has already been received. */
4369 if (wait_proc != 0 && !NILP (wait_proc->raw_status_low)) 4369 if (wait_proc && wait_proc->raw_status_new)
4370 update_status (wait_proc); 4370 update_status (wait_proc);
4371 if (wait_proc != 0 4371 if (wait_proc
4372 && ! EQ (wait_proc->status, Qrun) 4372 && ! EQ (wait_proc->status, Qrun)
4373 && ! EQ (wait_proc->status, Qconnect)) 4373 && ! EQ (wait_proc->status, Qconnect))
4374 { 4374 {
@@ -4752,7 +4752,7 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4752 /* Preserve status of processes already terminated. */ 4752 /* Preserve status of processes already terminated. */
4753 XSETINT (XPROCESS (proc)->tick, ++process_tick); 4753 XSETINT (XPROCESS (proc)->tick, ++process_tick);
4754 deactivate_process (proc); 4754 deactivate_process (proc);
4755 if (!NILP (XPROCESS (proc)->raw_status_low)) 4755 if (XPROCESS (proc)->raw_status_new)
4756 update_status (XPROCESS (proc)); 4756 update_status (XPROCESS (proc));
4757 if (EQ (XPROCESS (proc)->status, Qrun)) 4757 if (EQ (XPROCESS (proc)->status, Qrun))
4758 XPROCESS (proc)->status 4758 XPROCESS (proc)->status
@@ -5293,7 +5293,7 @@ send_process (proc, buf, len, object)
5293 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); 5293 VMS_PROC_STUFF *vs, *get_vms_process_pointer();
5294#endif /* VMS */ 5294#endif /* VMS */
5295 5295
5296 if (! NILP (p->raw_status_low)) 5296 if (p->raw_status_new)
5297 update_status (p); 5297 update_status (p);
5298 if (! EQ (p->status, Qrun)) 5298 if (! EQ (p->status, Qrun))
5299 error ("Process %s not running", SDATA (p->name)); 5299 error ("Process %s not running", SDATA (p->name));
@@ -5550,8 +5550,7 @@ send_process (proc, buf, len, object)
5550 proc = process_sent_to; 5550 proc = process_sent_to;
5551 p = XPROCESS (proc); 5551 p = XPROCESS (proc);
5552#endif 5552#endif
5553 p->raw_status_low = Qnil; 5553 p->raw_status_new = 0;
5554 p->raw_status_high = Qnil;
5555 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil)); 5554 p->status = Fcons (Qexit, Fcons (make_number (256), Qnil));
5556 XSETINT (p->tick, ++process_tick); 5555 XSETINT (p->tick, ++process_tick);
5557 deactivate_process (proc); 5556 deactivate_process (proc);
@@ -5666,7 +5665,7 @@ return t unconditionally. */)
5666 5665
5667 gid = emacs_get_tty_pgrp (p); 5666 gid = emacs_get_tty_pgrp (p);
5668 5667
5669 if (gid == XFASTINT (p->pid)) 5668 if (gid == p->pid)
5670 return Qnil; 5669 return Qnil;
5671 return Qt; 5670 return Qt;
5672} 5671}
@@ -5713,7 +5712,7 @@ process_send_signal (process, signo, current_group, nomsg)
5713 /* If we are using pgrps, get a pgrp number and make it negative. */ 5712 /* If we are using pgrps, get a pgrp number and make it negative. */
5714 if (NILP (current_group)) 5713 if (NILP (current_group))
5715 /* Send the signal to the shell's process group. */ 5714 /* Send the signal to the shell's process group. */
5716 gid = XFASTINT (p->pid); 5715 gid = p->pid;
5717 else 5716 else
5718 { 5717 {
5719#ifdef SIGNALS_VIA_CHARACTERS 5718#ifdef SIGNALS_VIA_CHARACTERS
@@ -5832,7 +5831,7 @@ process_send_signal (process, signo, current_group, nomsg)
5832 if (gid == -1) 5831 if (gid == -1)
5833 /* If we can't get the information, assume 5832 /* If we can't get the information, assume
5834 the shell owns the tty. */ 5833 the shell owns the tty. */
5835 gid = XFASTINT (p->pid); 5834 gid = p->pid;
5836 5835
5837 /* It is not clear whether anything really can set GID to -1. 5836 /* It is not clear whether anything really can set GID to -1.
5838 Perhaps on some system one of those ioctls can or could do so. 5837 Perhaps on some system one of those ioctls can or could do so.
@@ -5842,12 +5841,12 @@ process_send_signal (process, signo, current_group, nomsg)
5842#else /* ! defined (TIOCGPGRP ) */ 5841#else /* ! defined (TIOCGPGRP ) */
5843 /* Can't select pgrps on this system, so we know that 5842 /* Can't select pgrps on this system, so we know that
5844 the child itself heads the pgrp. */ 5843 the child itself heads the pgrp. */
5845 gid = XFASTINT (p->pid); 5844 gid = p->pid;
5846#endif /* ! defined (TIOCGPGRP ) */ 5845#endif /* ! defined (TIOCGPGRP ) */
5847 5846
5848 /* If current_group is lambda, and the shell owns the terminal, 5847 /* If current_group is lambda, and the shell owns the terminal,
5849 don't send any signal. */ 5848 don't send any signal. */
5850 if (EQ (current_group, Qlambda) && gid == XFASTINT (p->pid)) 5849 if (EQ (current_group, Qlambda) && gid == p->pid)
5851 return; 5850 return;
5852 } 5851 }
5853 5852
@@ -5855,8 +5854,7 @@ process_send_signal (process, signo, current_group, nomsg)
5855 { 5854 {
5856#ifdef SIGCONT 5855#ifdef SIGCONT
5857 case SIGCONT: 5856 case SIGCONT:
5858 p->raw_status_low = Qnil; 5857 p->raw_status_new = 0;
5859 p->raw_status_high = Qnil;
5860 p->status = Qrun; 5858 p->status = Qrun;
5861 XSETINT (p->tick, ++process_tick); 5859 XSETINT (p->tick, ++process_tick);
5862 if (!nomsg) 5860 if (!nomsg)
@@ -5875,7 +5873,7 @@ process_send_signal (process, signo, current_group, nomsg)
5875#endif 5873#endif
5876 case SIGKILL: 5874 case SIGKILL:
5877#ifdef VMS 5875#ifdef VMS
5878 sys$forcex (&(XFASTINT (p->pid)), 0, 1); 5876 sys$forcex (&(p->pid), 0, 1);
5879 whoosh: 5877 whoosh:
5880#endif 5878#endif
5881 flush_pending_output (XINT (p->infd)); 5879 flush_pending_output (XINT (p->infd));
@@ -5887,7 +5885,7 @@ process_send_signal (process, signo, current_group, nomsg)
5887 obvious alternative. */ 5885 obvious alternative. */
5888 if (no_pgrp) 5886 if (no_pgrp)
5889 { 5887 {
5890 kill (XFASTINT (p->pid), signo); 5888 kill (p->pid, signo);
5891 return; 5889 return;
5892 } 5890 }
5893 5891
@@ -5900,7 +5898,7 @@ process_send_signal (process, signo, current_group, nomsg)
5900 } 5898 }
5901 else 5899 else
5902 { 5900 {
5903 gid = - XFASTINT (p->pid); 5901 gid = - p->pid;
5904 kill (gid, signo); 5902 kill (gid, signo);
5905 } 5903 }
5906#else /* ! defined (TIOCSIGSEND) */ 5904#else /* ! defined (TIOCSIGSEND) */
@@ -6020,11 +6018,17 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6020 (process, sigcode) 6018 (process, sigcode)
6021 Lisp_Object process, sigcode; 6019 Lisp_Object process, sigcode;
6022{ 6020{
6023 Lisp_Object pid; 6021 pid_t pid;
6024 6022
6025 if (INTEGERP (process)) 6023 if (INTEGERP (process))
6026 { 6024 {
6027 pid = process; 6025 pid = XINT (process);
6026 goto got_it;
6027 }
6028
6029 if (FLOATP (process))
6030 {
6031 pid = (pid_t) XFLOAT (process);
6028 goto got_it; 6032 goto got_it;
6029 } 6033 }
6030 6034
@@ -6033,8 +6037,8 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6033 Lisp_Object tem; 6037 Lisp_Object tem;
6034 if (tem = Fget_process (process), NILP (tem)) 6038 if (tem = Fget_process (process), NILP (tem))
6035 { 6039 {
6036 pid = Fstring_to_number (process, make_number (10)); 6040 pid = XINT (Fstring_to_number (process, make_number (10)));
6037 if (XINT (pid) != 0) 6041 if (pid > 0)
6038 goto got_it; 6042 goto got_it;
6039 } 6043 }
6040 process = tem; 6044 process = tem;
@@ -6047,7 +6051,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6047 6051
6048 CHECK_PROCESS (process); 6052 CHECK_PROCESS (process);
6049 pid = XPROCESS (process)->pid; 6053 pid = XPROCESS (process)->pid;
6050 if (!INTEGERP (pid) || XINT (pid) <= 0) 6054 if (pid <= 0)
6051 error ("Cannot signal process %s", SDATA (XPROCESS (process)->name)); 6055 error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
6052 6056
6053 got_it: 6057 got_it:
@@ -6166,7 +6170,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6166 6170
6167#undef handle_signal 6171#undef handle_signal
6168 6172
6169 return make_number (kill (XINT (pid), XINT (sigcode))); 6173 return make_number (kill (pid, XINT (sigcode)));
6170} 6174}
6171 6175
6172DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0, 6176DEFUN ("process-send-eof", Fprocess_send_eof, Sprocess_send_eof, 0, 1, 0,
@@ -6190,7 +6194,7 @@ text to PROCESS after you call this function. */)
6190 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 6194 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
6191 6195
6192 /* Make sure the process is really alive. */ 6196 /* Make sure the process is really alive. */
6193 if (! NILP (XPROCESS (proc)->raw_status_low)) 6197 if (XPROCESS (proc)->raw_status_new)
6194 update_status (XPROCESS (proc)); 6198 update_status (XPROCESS (proc));
6195 if (! EQ (XPROCESS (proc)->status, Qrun)) 6199 if (! EQ (XPROCESS (proc)->status, Qrun))
6196 error ("Process %s not running", SDATA (XPROCESS (proc)->name)); 6200 error ("Process %s not running", SDATA (XPROCESS (proc)->name));
@@ -6215,7 +6219,7 @@ text to PROCESS after you call this function. */)
6215 for communication with the subprocess, call shutdown to cause EOF. 6219 for communication with the subprocess, call shutdown to cause EOF.
6216 (In some old system, shutdown to socketpair doesn't work. 6220 (In some old system, shutdown to socketpair doesn't work.
6217 Then we just can't win.) */ 6221 Then we just can't win.) */
6218 if (NILP (XPROCESS (proc)->pid) 6222 if (XPROCESS (proc)->pid == 0
6219 || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd)) 6223 || XINT (XPROCESS (proc)->outfd) == XINT (XPROCESS (proc)->infd))
6220 shutdown (XINT (XPROCESS (proc)->outfd), 1); 6224 shutdown (XINT (XPROCESS (proc)->outfd), 1);
6221 /* In case of socketpair, outfd == infd, so don't close it. */ 6225 /* In case of socketpair, outfd == infd, so don't close it. */
@@ -6352,7 +6356,7 @@ sigchld_handler (signo)
6352 { 6356 {
6353 proc = XCDR (XCAR (tail)); 6357 proc = XCDR (XCAR (tail));
6354 p = XPROCESS (proc); 6358 p = XPROCESS (proc);
6355 if (GC_EQ (p->childp, Qt) && XINT (p->pid) == pid) 6359 if (GC_EQ (p->childp, Qt) && p->pid == pid)
6356 break; 6360 break;
6357 p = 0; 6361 p = 0;
6358 } 6362 }
@@ -6364,7 +6368,7 @@ sigchld_handler (signo)
6364 { 6368 {
6365 proc = XCDR (XCAR (tail)); 6369 proc = XCDR (XCAR (tail));
6366 p = XPROCESS (proc); 6370 p = XPROCESS (proc);
6367 if (GC_INTEGERP (p->pid) && XINT (p->pid) == -1) 6371 if (p->pid == -1)
6368 break; 6372 break;
6369 p = 0; 6373 p = 0;
6370 } 6374 }
@@ -6377,8 +6381,8 @@ sigchld_handler (signo)
6377 6381
6378 XSETINT (p->tick, ++process_tick); 6382 XSETINT (p->tick, ++process_tick);
6379 u.wt = w; 6383 u.wt = w;
6380 XSETINT (p->raw_status_low, u.i & 0xffff); 6384 p->raw_status = u.i;
6381 XSETINT (p->raw_status_high, u.i >> 16); 6385 p->raw_status_new = 1;
6382 6386
6383 /* If process has terminated, stop waiting for its output. */ 6387 /* If process has terminated, stop waiting for its output. */
6384 if ((WIFSIGNALED (w) || WIFEXITED (w)) 6388 if ((WIFSIGNALED (w) || WIFEXITED (w))
@@ -6575,7 +6579,7 @@ status_notify (deleting_process)
6575 buffer = p->buffer; 6579 buffer = p->buffer;
6576 6580
6577 /* Get the text to use for the message. */ 6581 /* Get the text to use for the message. */
6578 if (!NILP (p->raw_status_low)) 6582 if (p->raw_status_new)
6579 update_status (p); 6583 update_status (p);
6580 msg = status_message (p); 6584 msg = status_message (p);
6581 6585
diff --git a/src/process.h b/src/process.h
index 9625556888c..c4b4281fedf 100644
--- a/src/process.h
+++ b/src/process.h
@@ -51,8 +51,6 @@ struct Lisp_Process
51 Lisp_Object log; 51 Lisp_Object log;
52 /* Buffer that output is going to */ 52 /* Buffer that output is going to */
53 Lisp_Object buffer; 53 Lisp_Object buffer;
54 /* Number of this process */
55 Lisp_Object pid;
56 /* t if this is a real child process. 54 /* t if this is a real child process.
57 For a net connection, it is a plist based on the arguments to make-network-process. */ 55 For a net connection, it is a plist based on the arguments to make-network-process. */
58 Lisp_Object childp; 56 Lisp_Object childp;
@@ -63,10 +61,6 @@ struct Lisp_Process
63 /* Non-nil means kill silently if Emacs is exited. 61 /* Non-nil means kill silently if Emacs is exited.
64 This is the inverse of the `query-on-exit' flag. */ 62 This is the inverse of the `query-on-exit' flag. */
65 Lisp_Object kill_without_query; 63 Lisp_Object kill_without_query;
66 /* Record the process status in the raw form in which it comes from `wait'.
67 This is to avoid consing in a signal handler. */
68 Lisp_Object raw_status_low;
69 Lisp_Object raw_status_high;
70 /* Symbol indicating status of process. 64 /* Symbol indicating status of process.
71 This may be a symbol: run, open, or closed. 65 This may be a symbol: run, open, or closed.
72 Or it may be a list, whose car is stop, exit or signal 66 Or it may be a list, whose car is stop, exit or signal
@@ -112,6 +106,19 @@ struct Lisp_Process
112 Lisp_Object read_output_delay; 106 Lisp_Object read_output_delay;
113 /* Skip reading this process on next read. */ 107 /* Skip reading this process on next read. */
114 Lisp_Object read_output_skip; 108 Lisp_Object read_output_skip;
109
110 /* After this point, there are no Lisp_Objects any more. */
111
112 /* Number of this process.
113 allocate_process assumes this is the first non-Lisp_Object field.
114 A value 0 is used for pseudo-processes such as network connections. */
115 pid_t pid;
116 /* Record the process status in the raw form in which it comes from `wait'.
117 This is to avoid consing in a signal handler. The `raw_status_new'
118 flag indicates that `raw_status' contains a new status that still
119 needs to be synced to `status'. */
120 int raw_status_new : 1;
121 int raw_status;
115}; 122};
116 123
117/* Every field in the preceding structure except for the first two 124/* Every field in the preceding structure except for the first two
diff --git a/src/w32fns.c b/src/w32fns.c
index bc2e728b49d..95ba34fc1e4 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3298,6 +3298,14 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3298 return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP); 3298 return (msg == WM_XBUTTONDOWN || msg == WM_XBUTTONUP);
3299 3299
3300 case WM_MOUSEMOVE: 3300 case WM_MOUSEMOVE:
3301 /* Ignore mouse movements as long as the menu is active. These
3302 movements are processed by the window manager anyway, and
3303 it's wrong to handle them as if they happened on the
3304 underlying frame. */
3305 f = x_window_to_frame (dpyinfo, hwnd);
3306 if (f && f->output_data.w32->menubar_active)
3307 return 0;
3308
3301 /* If the mouse has just moved into the frame, start tracking 3309 /* If the mouse has just moved into the frame, start tracking
3302 it, so we will be notified when it leaves the frame. Mouse 3310 it, so we will be notified when it leaves the frame. Mouse
3303 tracking only works under W98 and NT4 and later. On earlier 3311 tracking only works under W98 and NT4 and later. On earlier
@@ -7730,9 +7738,12 @@ Text larger than the specified size is clipped. */)
7730 AdjustWindowRect (&rect, f->output_data.w32->dwStyle, 7738 AdjustWindowRect (&rect, f->output_data.w32->dwStyle,
7731 FRAME_EXTERNAL_MENU_BAR (f)); 7739 FRAME_EXTERNAL_MENU_BAR (f));
7732 7740
7733 /* Position and size tooltip, and put it in the topmost group. */ 7741 /* Position and size tooltip, and put it in the topmost group.
7742 The add-on of 3 to the 5th argument is a kludge: without it,
7743 some fonts cause the last character of the tip to be truncated,
7744 for some obscure reason. */
7734 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST, 7745 SetWindowPos (FRAME_W32_WINDOW (f), HWND_TOPMOST,
7735 root_x, root_y, rect.right - rect.left, 7746 root_x, root_y, rect.right - rect.left + 3,
7736 rect.bottom - rect.top, SWP_NOACTIVATE); 7747 rect.bottom - rect.top, SWP_NOACTIVATE);
7737 7748
7738 /* Ensure tooltip is on top of other topmost windows (eg menus). */ 7749 /* Ensure tooltip is on top of other topmost windows (eg menus). */