Mercurial > hg > xemacs-beta
comparison src/nt.h @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | de805c49cfc1 |
children |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
1 #ifndef _NT_H_ | |
2 #define _NT_H_ | |
3 | |
1 /* Support routines for the NT version of XEmacs. | 4 /* Support routines for the NT version of XEmacs. |
2 Copyright (C) 1994 Free Software Foundation, Inc. | 5 Copyright (C) 1994 Free Software Foundation, Inc. |
3 | 6 |
4 This file is part of XEmacs. | 7 This file is part of XEmacs. |
5 | 8 |
21 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ | 24 /* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */ |
22 /* Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ | 25 /* Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */ |
23 | 26 |
24 /* #define FULL_DEBUG */ | 27 /* #define FULL_DEBUG */ |
25 | 28 |
26 #ifndef INCLUDED_nt_h_ | |
27 #define INCLUDED_nt_h_ | |
28 | |
29 #include "syswindows.h" | |
30 | |
31 #ifdef DEBUG_XEMACS | 29 #ifdef DEBUG_XEMACS |
32 #define DebPrint(stuff) _DebPrint stuff | 30 #define DebPrint(stuff) _DebPrint stuff |
33 #else | 31 #else |
34 #define DebPrint(stuff) | 32 #define DebPrint(stuff) |
35 #endif | 33 #endif |
34 | |
35 #define R_OK 4 | |
36 #define W_OK 2 | |
37 #ifdef X_OK | |
38 #undef X_OK | |
39 #endif | |
40 #define X_OK 1 | |
41 #define F_OK 0 | |
42 | |
43 /* File descriptor set emulation. */ | |
44 | |
45 #if 0 /* These are defined in winsock.h. | |
46 FD_SETSIZE is defined 64. Let's not full the runtime. */ | |
47 | |
48 /* The MSVC multithreaded statically-linked runtime library has limit | |
49 of 256 descriptors by default (the single-threaded static library | |
50 has a limit of 64 descriptors, and the DLL versions both have a | |
51 limit of 512). Beware. Should this be set to 512? */ | |
52 #define FD_SETSIZE 256 | |
53 typedef struct { | |
54 unsigned int bits[FD_SETSIZE / 32]; | |
55 } fd_set; | |
56 | |
57 /* standard access macros */ | |
58 #define FD_SET(n, p) \ | |
59 do { \ | |
60 if ((n) < FD_SETSIZE) { \ | |
61 (p)->bits[(n)/32] |= (1 << (n)%32); \ | |
62 } \ | |
63 } while (0) | |
64 #define FD_CLR(n, p) \ | |
65 do { \ | |
66 if ((n) < FD_SETSIZE) { \ | |
67 (p)->bits[(n)/32] &= ~(1 << (n)%32); \ | |
68 } \ | |
69 } while (0) | |
70 #define FD_ISSET(n, p) ((n) < FD_SETSIZE ? ((p)->bits[(n)/32] & (1 << (n)%32)) : 0) | |
71 #define FD_ZERO(p) memset((p), 0, sizeof(fd_set)) | |
72 | |
73 #define SELECT_TYPE fd_set | |
74 #define MAXDESC FD_SETSIZE | |
75 | |
76 #endif /* 0 */ | |
36 | 77 |
37 /* ------------------------------------------------------------------------- */ | 78 /* ------------------------------------------------------------------------- */ |
38 | 79 |
39 /* child_process.status values */ | 80 /* child_process.status values */ |
40 enum { | 81 enum { |
70 unsigned flags; | 111 unsigned flags; |
71 HANDLE hnd; | 112 HANDLE hnd; |
72 child_process * cp; | 113 child_process * cp; |
73 } filedesc; | 114 } filedesc; |
74 | 115 |
75 extern filedesc fd_info []; | 116 extern filedesc fd_info [ MAXDESC ]; |
76 | 117 |
77 /* fd_info flag definitions */ | 118 /* fd_info flag definitions */ |
78 #define FILE_READ 0x0001 | 119 #define FILE_READ 0x0001 |
79 #define FILE_WRITE 0x0002 | 120 #define FILE_WRITE 0x0002 |
80 #define FILE_BINARY 0x0010 | 121 #define FILE_BINARY 0x0010 |
104 extern LPBYTE nt_get_resource (char * key, LPDWORD type); | 145 extern LPBYTE nt_get_resource (char * key, LPDWORD type); |
105 | 146 |
106 void set_process_dir (const char * dir); | 147 void set_process_dir (const char * dir); |
107 time_t convert_time (FILETIME ft); | 148 time_t convert_time (FILETIME ft); |
108 | 149 |
109 extern void init_ntproc (void); | 150 extern void init_ntproc (); |
110 extern void term_ntproc (int unused); | 151 extern void term_ntproc (); |
111 | 152 |
112 /* ----------------------------------------------------------------- */ | 153 #endif /* _NT_H_ */ |
113 /* Useful routines for manipulating memory-mapped files. */ | |
114 | |
115 typedef struct file_data | |
116 { | |
117 const char *name; | |
118 unsigned long size; | |
119 HANDLE file; | |
120 HANDLE file_mapping; | |
121 char *file_base; | |
122 } file_data; | |
123 | |
124 #define OFFSET_TO_RVA(var,section) \ | |
125 (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData)) | |
126 | |
127 #define RVA_TO_OFFSET(var,section) \ | |
128 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress)) | |
129 | |
130 #define RVA_TO_PTR(var,section,filedata) \ | |
131 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base)) | |
132 | |
133 int open_input_file (file_data *p_file, const char *name); | |
134 int open_output_file (file_data *p_file, const char *name, unsigned long size); | |
135 void close_file_data (file_data *p_file); | |
136 void mswindows_executable_type (const char * filename, int * is_dos_app, | |
137 int * is_cygnus_app); | |
138 | |
139 /* In process-nt.c */ | |
140 extern int compare_env (const void *strp1, const void *strp2); | |
141 | |
142 void mswindows_set_errno (unsigned long win32_error); | |
143 void mswindows_set_last_errno (void); | |
144 | |
145 void wait_for_termination (HANDLE pid); | |
146 | |
147 int mswindows_fstat (int handle, struct stat *buffer); | |
148 int mswindows_stat (const char * path, struct stat * buf); | |
149 | |
150 #endif /* INCLUDED_nt_h_ */ |