Mercurial > emacs
annotate src/w32.h @ 95579:bf49392d93fe
(tags-verify-table): Be careful to use and update
tags-file-name and tags-table-list from the right buffer.
(tags-table-check-computed-list, tags-table-extend-computed-list)
(find-tag-noselect): Use with-current-buffer.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 05 Jun 2008 05:55:37 +0000 |
parents | 29adfc9354e7 |
children | d6a4488883dc |
rev | line source |
---|---|
29604
7d541d1ca075
(EMACS_W32_H): Renamed from _NT_H_
Jason Rumney <jasonr@gnu.org>
parents:
21606
diff
changeset
|
1 #ifndef EMACS_W32_H |
7d541d1ca075
(EMACS_W32_H): Renamed from _NT_H_
Jason Rumney <jasonr@gnu.org>
parents:
21606
diff
changeset
|
2 #define EMACS_W32_H |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
3 |
9803 | 4 /* Support routines for the NT version of Emacs. |
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
72287
diff
changeset
|
5 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005, |
79759 | 6 2006, 2007, 2008 Free Software Foundation, Inc. |
9803 | 7 |
8 This file is part of GNU Emacs. | |
9 | |
94994
29adfc9354e7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79759
diff
changeset
|
10 GNU Emacs is free software: you can redistribute it and/or modify |
9803 | 11 it under the terms of the GNU General Public License as published by |
94994
29adfc9354e7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79759
diff
changeset
|
12 the Free Software Foundation, either version 3 of the License, or |
29adfc9354e7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79759
diff
changeset
|
13 (at your option) any later version. |
9803 | 14 |
15 GNU Emacs is distributed in the hope that it will be useful, | |
16 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 GNU General Public License for more details. | |
19 | |
20 You should have received a copy of the GNU General Public License | |
94994
29adfc9354e7
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
79759
diff
changeset
|
21 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
9803 | 22 |
34697
ba9de1745e36
(w32_strerror): New extern.
Andrew Innes <andrewi@gnu.org>
parents:
29604
diff
changeset
|
23 |
9803 | 24 /* File descriptor set emulation. */ |
25 | |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
26 /* MSVC runtime library has limit of 64 descriptors by default */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
27 #define FD_SETSIZE 64 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
28 typedef struct { |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
29 unsigned int bits[FD_SETSIZE / 32]; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
30 } fd_set; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
31 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
32 /* standard access macros */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
33 #define FD_SET(n, p) \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
34 do { \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
35 if ((n) < FD_SETSIZE) { \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
36 (p)->bits[(n)/32] |= (1 << (n)%32); \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
37 } \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
38 } while (0) |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
39 #define FD_CLR(n, p) \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
40 do { \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
41 if ((n) < FD_SETSIZE) { \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
42 (p)->bits[(n)/32] &= ~(1 << (n)%32); \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
43 } \ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
44 } while (0) |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
45 #define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0) |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
46 #define FD_ZERO(p) memset((p), 0, sizeof(fd_set)) |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
47 |
9803 | 48 #define SELECT_TYPE fd_set |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
49 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
50 /* ------------------------------------------------------------------------- */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
51 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
52 /* child_process.status values */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
53 enum { |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
54 STATUS_READ_ERROR = -1, |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
55 STATUS_READ_READY, |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
56 STATUS_READ_IN_PROGRESS, |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
57 STATUS_READ_FAILED, |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
58 STATUS_READ_SUCCEEDED, |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
59 STATUS_READ_ACKNOWLEDGED |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
60 }; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
61 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
62 /* This structure is used for both pipes and sockets; for |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
63 a socket, the process handle in pi is NULL. */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
64 typedef struct _child_process |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
65 { |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
66 int fd; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
67 int pid; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
68 HANDLE char_avail; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
69 HANDLE char_consumed; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
70 HANDLE thrd; |
19705
8f868d8be49a
Remove debugging macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
71 HWND hwnd; |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
72 PROCESS_INFORMATION procinfo; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
73 volatile int status; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
74 char chr; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
75 } child_process; |
9803 | 76 |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
77 #define MAXDESC FD_SETSIZE |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
78 #define MAX_CHILDREN MAXDESC/2 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
79 #define CHILD_ACTIVE(cp) ((cp)->char_avail != NULL) |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
80 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
81 /* parallel array of private info on file handles */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
82 typedef struct |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
83 { |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
84 unsigned flags; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
85 HANDLE hnd; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
86 child_process * cp; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
87 } filedesc; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
88 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
89 extern filedesc fd_info [ MAXDESC ]; |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
90 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
91 /* fd_info flag definitions */ |
21606
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
92 #define FILE_READ 0x0001 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
93 #define FILE_WRITE 0x0002 |
71888
f07726615400
(FILE_LISTEN): New filedesc flag value.
Kim F. Storm <storm@cua.dk>
parents:
68651
diff
changeset
|
94 #define FILE_LISTEN 0x0004 |
21606
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
95 #define FILE_BINARY 0x0010 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
96 #define FILE_LAST_CR 0x0020 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
97 #define FILE_AT_EOF 0x0040 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
98 #define FILE_SEND_SIGCHLD 0x0080 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
99 #define FILE_PIPE 0x0100 |
8f5ea092125c
(FILE_SEND_SIGCHLD): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
19705
diff
changeset
|
100 #define FILE_SOCKET 0x0200 |
45093
2d293a5868cf
* s/ms-w32.h (HAVE_SELECT): Define.
Jason Rumney <jasonr@gnu.org>
parents:
34697
diff
changeset
|
101 #define FILE_NDELAY 0x0400 |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
102 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
103 extern child_process * new_child (void); |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
104 extern void delete_child (child_process *cp); |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
105 |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
106 /* ------------------------------------------------------------------------- */ |
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
107 |
34697
ba9de1745e36
(w32_strerror): New extern.
Andrew Innes <andrewi@gnu.org>
parents:
29604
diff
changeset
|
108 /* Equivalent of strerror for W32 error codes. */ |
ba9de1745e36
(w32_strerror): New extern.
Andrew Innes <andrewi@gnu.org>
parents:
29604
diff
changeset
|
109 extern char * w32_strerror (int error_no); |
ba9de1745e36
(w32_strerror): New extern.
Andrew Innes <andrewi@gnu.org>
parents:
29604
diff
changeset
|
110 |
72287
875a47d81ba5
Add prototype for w32_valid_pointer_p.
Eli Zaretskii <eliz@gnu.org>
parents:
71900
diff
changeset
|
111 /* Validate a pointer. */ |
875a47d81ba5
Add prototype for w32_valid_pointer_p.
Eli Zaretskii <eliz@gnu.org>
parents:
71900
diff
changeset
|
112 extern int w32_valid_pointer_p (void *, int); |
875a47d81ba5
Add prototype for w32_valid_pointer_p.
Eli Zaretskii <eliz@gnu.org>
parents:
71900
diff
changeset
|
113 |
19705
8f868d8be49a
Remove debugging macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
114 /* Get long (aka "true") form of file name, if it exists. */ |
8f868d8be49a
Remove debugging macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
115 extern BOOL w32_get_long_filename (char * name, char * buf, int size); |
9803 | 116 |
117 /* Prepare our standard handles for proper inheritance by child processes. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48888
diff
changeset
|
118 extern void prepare_standard_handles (int in, int out, |
9803 | 119 int err, HANDLE handles[4]); |
120 | |
121 /* Reset our standard handles to their original state. */ | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48888
diff
changeset
|
122 extern void reset_standard_handles (int in, int out, |
9803 | 123 int err, HANDLE handles[4]); |
124 | |
13426
8074deaef2f4
(nt_get_resource): Prototype defined.
Geoff Voelker <voelker@cs.washington.edu>
parents:
9803
diff
changeset
|
125 /* Return the string resource associated with KEY of type TYPE. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15248
diff
changeset
|
126 extern LPBYTE w32_get_resource (char * key, LPDWORD type); |
13426
8074deaef2f4
(nt_get_resource): Prototype defined.
Geoff Voelker <voelker@cs.washington.edu>
parents:
9803
diff
changeset
|
127 |
60092
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
128 extern void init_ntproc (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
129 extern void term_ntproc (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
130 extern void globals_of_w32 (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
131 extern void syms_of_w32term (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
132 extern void syms_of_w32fns (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
133 extern void globals_of_w32fns (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
134 extern void syms_of_w32select (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
135 extern void globals_of_w32select (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
136 extern void term_w32select (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
137 extern void syms_of_w32menu (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
138 extern void globals_of_w32menu (void); |
04686828d0da
2004-11-08 Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
Jason Rumney <jasonr@gnu.org>
parents:
52401
diff
changeset
|
139 extern void syms_of_fontset (void); |
15142
6879c02a290c
Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14186
diff
changeset
|
140 |
71900
307ddb85a388
(_sys_read_ahead, _sys_wait_accept): Add prototypes.
Kim F. Storm <storm@cua.dk>
parents:
71888
diff
changeset
|
141 extern int _sys_read_ahead (int fd); |
307ddb85a388
(_sys_read_ahead, _sys_wait_accept): Add prototypes.
Kim F. Storm <storm@cua.dk>
parents:
71888
diff
changeset
|
142 extern int _sys_wait_accept (int fd); |
307ddb85a388
(_sys_read_ahead, _sys_wait_accept): Add prototypes.
Kim F. Storm <storm@cua.dk>
parents:
71888
diff
changeset
|
143 |
29604
7d541d1ca075
(EMACS_W32_H): Renamed from _NT_H_
Jason Rumney <jasonr@gnu.org>
parents:
21606
diff
changeset
|
144 #endif /* EMACS_W32_H */ |
52401 | 145 |
146 /* arch-tag: 02c36b00-312b-4c4d-a1d9-f905c5e968f0 | |
147 (do not change this comment) */ |