annotate src/w32.h @ 16677:e5d1cfd4d29c

(menu-bar-tools-menu): Add items Debugger, Compile and Search Files.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 Dec 1996 22:23:58 +0000
parents 481b7874a1e9
children 8f868d8be49a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
1 #ifndef _NT_H_
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
2 #define _NT_H_
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
3
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 /* Support routines for the NT version of Emacs.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 Copyright (C) 1994 Free Software Foundation, Inc.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 This file is part of GNU Emacs.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 GNU Emacs is free software; you can redistribute it and/or modify
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 it under the terms of the GNU General Public License as published by
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 the Free Software Foundation; either version 2, or (at your option)
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 any later version.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 GNU Emacs is distributed in the hope that it will be useful,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 GNU General Public License for more details.
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13426
diff changeset
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13426
diff changeset
22 Boston, MA 02111-1307, USA. */
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
24 /* #define FULL_DEBUG */
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
25 #define EMACSDEBUG
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
26
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
27 #ifdef EMACSDEBUG
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
28 #define DebPrint(stuff) _DebPrint stuff
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
29 #else
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
30 #define DebPrint(stuff)
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
31 #endif
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
32
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 /* File descriptor set emulation. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
35 /* 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
36 #define FD_SETSIZE 64
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
37 typedef struct {
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
38 unsigned int bits[FD_SETSIZE / 32];
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
39 } fd_set;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
40
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
41 /* standard access macros */
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
42 #define FD_SET(n, p) \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
43 do { \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
44 if ((n) < FD_SETSIZE) { \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
45 (p)->bits[(n)/32] |= (1 << (n)%32); \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
46 } \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
47 } while (0)
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
48 #define FD_CLR(n, p) \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
49 do { \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
50 if ((n) < FD_SETSIZE) { \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
51 (p)->bits[(n)/32] &= ~(1 << (n)%32); \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
52 } \
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
53 } while (0)
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
54 #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
55 #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
56
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 #define SELECT_TYPE fd_set
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
58
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
59 /* ------------------------------------------------------------------------- */
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 /* child_process.status values */
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
62 enum {
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
63 STATUS_READ_ERROR = -1,
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
64 STATUS_READ_READY,
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
65 STATUS_READ_IN_PROGRESS,
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
66 STATUS_READ_FAILED,
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
67 STATUS_READ_SUCCEEDED,
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
68 STATUS_READ_ACKNOWLEDGED
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
69 };
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
70
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
71 /* 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
72 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
73 typedef struct _child_process
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
74 {
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
75 int fd;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
76 int pid;
15248
e9d9c86ed820 (struct _child_process): New member is_dos_process.
Karl Heuer <kwzh@gnu.org>
parents: 15142
diff changeset
77 int is_dos_process;
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
78 HANDLE char_avail;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
79 HANDLE char_consumed;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
80 HANDLE thrd;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
81 PROCESS_INFORMATION procinfo;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
82 volatile int status;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
83 char chr;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
84 } child_process;
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
86 #define MAXDESC FD_SETSIZE
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
87 #define MAX_CHILDREN MAXDESC/2
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
88 #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
89
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
90 /* 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
91 typedef struct
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
92 {
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
93 unsigned flags;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
94 HANDLE hnd;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
95 child_process * cp;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
96 } filedesc;
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
97
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
98 extern filedesc fd_info [ MAXDESC ];
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
99
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
100 /* fd_info flag definitions */
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
101 #define FILE_READ 0x0001
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
102 #define FILE_WRITE 0x0002
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
103 #define FILE_BINARY 0x0010
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
104 #define FILE_PIPE 0x0100
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
105 #define FILE_SOCKET 0x0200
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 extern child_process * new_child (void);
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
108 extern void delete_child (child_process *cp);
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
109
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
110 /* ------------------------------------------------------------------------- */
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
111
9803
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 /* Prepare our standard handles for proper inheritance by child processes. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 extern void prepare_standard_handles (int in, int out,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 int err, HANDLE handles[4]);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 /* Reset our standard handles to their original state. */
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 extern void reset_standard_handles (int in, int out,
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 int err, HANDLE handles[4]);
fa698fd10c05 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120
13426
8074deaef2f4 (nt_get_resource): Prototype defined.
Geoff Voelker <voelker@cs.washington.edu>
parents: 9803
diff changeset
121 /* 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
122 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
123
15142
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
124 extern void init_ntproc ();
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
125 extern void term_ntproc ();
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
126
6879c02a290c Check to see if already included.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14186
diff changeset
127 #endif /* _NT_H_ */