Mercurial > hg > xemacs-beta
comparison src/nt.h @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 4f6ba8f1fb3d |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
24 /* #define FULL_DEBUG */ | 24 /* #define FULL_DEBUG */ |
25 | 25 |
26 #ifndef INCLUDED_nt_h_ | 26 #ifndef INCLUDED_nt_h_ |
27 #define INCLUDED_nt_h_ | 27 #define INCLUDED_nt_h_ |
28 | 28 |
29 #include "syswindows.h" | |
30 | |
29 #ifdef DEBUG_XEMACS | 31 #ifdef DEBUG_XEMACS |
30 #define DebPrint(stuff) _DebPrint stuff | 32 #define DebPrint(stuff) _DebPrint stuff |
31 #else | 33 #else |
32 #define DebPrint(stuff) | 34 #define DebPrint(stuff) |
33 #endif | 35 #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 */ | |
77 | 36 |
78 /* ------------------------------------------------------------------------- */ | 37 /* ------------------------------------------------------------------------- */ |
79 | 38 |
80 /* child_process.status values */ | 39 /* child_process.status values */ |
81 enum { | 40 enum { |
111 unsigned flags; | 70 unsigned flags; |
112 HANDLE hnd; | 71 HANDLE hnd; |
113 child_process * cp; | 72 child_process * cp; |
114 } filedesc; | 73 } filedesc; |
115 | 74 |
116 extern filedesc fd_info [ MAXDESC ]; | 75 extern filedesc fd_info []; |
117 | 76 |
118 /* fd_info flag definitions */ | 77 /* fd_info flag definitions */ |
119 #define FILE_READ 0x0001 | 78 #define FILE_READ 0x0001 |
120 #define FILE_WRITE 0x0002 | 79 #define FILE_WRITE 0x0002 |
121 #define FILE_BINARY 0x0010 | 80 #define FILE_BINARY 0x0010 |
145 extern LPBYTE nt_get_resource (char * key, LPDWORD type); | 104 extern LPBYTE nt_get_resource (char * key, LPDWORD type); |
146 | 105 |
147 void set_process_dir (const char * dir); | 106 void set_process_dir (const char * dir); |
148 time_t convert_time (FILETIME ft); | 107 time_t convert_time (FILETIME ft); |
149 | 108 |
150 extern void init_ntproc (); | 109 extern void init_ntproc (void); |
151 extern void term_ntproc (); | 110 extern void term_ntproc (int unused); |
111 | |
112 /* ----------------------------------------------------------------- */ | |
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); | |
152 | 149 |
153 #endif /* INCLUDED_nt_h_ */ | 150 #endif /* INCLUDED_nt_h_ */ |