Commit | Line | Data |
68dc0745 |
1 | /* WIN32.H |
2 | * |
3 | * (c) 1995 Microsoft Corporation. All rights reserved. |
4 | * Developed by hip communications inc., http://info.hip.com/info/ |
5 | * |
6 | * You may distribute under the terms of either the GNU General Public |
7 | * License or the Artistic License, as specified in the README file. |
8 | */ |
0a753a76 |
9 | #ifndef _INC_WIN32_PERL5 |
10 | #define _INC_WIN32_PERL5 |
11 | |
5db10396 |
12 | #ifndef _WIN32_WINNT |
13 | # define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */ |
14 | #endif |
638eceb6 |
15 | |
acfe0abc |
16 | #if defined(PERL_IMPLICIT_SYS) |
e9ee4811 |
17 | # define DYNAMIC_ENV_FETCH |
a6c40364 |
18 | # define HAS_GETENV_LEN |
e9ee4811 |
19 | # define prime_env_iter() |
ab39fa9d |
20 | # define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */ |
c5be433b |
21 | # define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */ |
ab39fa9d |
22 | # ifdef PERL_GLOBAL_STRUCT |
32e30700 |
23 | # error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS |
ab39fa9d |
24 | # endif |
e5a95ffb |
25 | # define win32_get_privlib PerlEnv_lib_path |
ab39fa9d |
26 | # define win32_get_sitelib PerlEnv_sitelib_path |
4ea817c6 |
27 | # define win32_get_vendorlib PerlEnv_vendorlib_path |
9d8a25dc |
28 | #endif |
29 | |
a835ef8a |
30 | #ifdef __GNUC__ |
b7c82df9 |
31 | # ifndef __int64 /* some versions seem to #define it already */ |
32 | # define __int64 long long |
33 | # endif |
db15561c |
34 | # define Win32_Winsock |
1c85e96a |
35 | #ifdef __cplusplus |
36 | /* Mingw32 gcc -xc++ objects to __attribute((unused)) at least */ |
37 | #undef PERL_UNUSED_DECL |
38 | #define PERL_UNUSED_DECL |
a835ef8a |
39 | #endif |
1c85e96a |
40 | #endif |
41 | |
a835ef8a |
42 | |
22239a37 |
43 | /* Define DllExport akin to perl's EXT, |
44 | * If we are in the DLL or mimicing the DLL for Win95 work round |
45 | * then Export the symbol, |
46 | * otherwise import it. |
47 | */ |
48 | |
5db10396 |
49 | /* now even GCC supports __declspec() */ |
50 | |
22239a37 |
51 | #if defined(PERLDLL) || defined(WIN95FIX) |
852c2e52 |
52 | #define DllExport |
53 | /*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */ |
22239a37 |
54 | #else |
55 | #define DllExport __declspec(dllimport) |
56 | #endif |
c69f112c |
57 | |
0a753a76 |
58 | #define WIN32_LEAN_AND_MEAN |
59 | #include <windows.h> |
60 | |
68dc0745 |
61 | #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ |
62 | #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ |
68dc0745 |
63 | #endif /*WIN32_LEAN_AND_MEAN */ |
0a753a76 |
64 | |
eda5ff31 |
65 | #ifndef TLS_OUT_OF_INDEXES |
66 | #define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF |
67 | #endif |
68 | |
0a753a76 |
69 | #include <dirent.h> |
70 | #include <io.h> |
71 | #include <process.h> |
72 | #include <stdio.h> |
73 | #include <direct.h> |
390b85e7 |
74 | #include <stdlib.h> |
7a1f88ac |
75 | #include <fcntl.h> |
390b85e7 |
76 | #ifndef EXT |
77 | #include "EXTERN.h" |
78 | #endif |
79 | |
c69f112c |
80 | struct tms { |
81 | long tms_utime; |
82 | long tms_stime; |
83 | long tms_cutime; |
84 | long tms_cstime; |
85 | }; |
86 | |
b2af26b1 |
87 | #ifndef SYS_NMLN |
88 | #define SYS_NMLN 257 |
89 | #endif |
90 | |
91 | struct utsname { |
92 | char sysname[SYS_NMLN]; |
93 | char nodename[SYS_NMLN]; |
94 | char release[SYS_NMLN]; |
95 | char version[SYS_NMLN]; |
96 | char machine[SYS_NMLN]; |
97 | }; |
98 | |
390b85e7 |
99 | #ifndef START_EXTERN_C |
b3e5c95e |
100 | #undef EXTERN_C |
390b85e7 |
101 | #ifdef __cplusplus |
102 | # define START_EXTERN_C extern "C" { |
103 | # define END_EXTERN_C } |
104 | # define EXTERN_C extern "C" |
105 | #else |
106 | # define START_EXTERN_C |
107 | # define END_EXTERN_C |
108 | # define EXTERN_C |
109 | #endif |
110 | #endif |
111 | |
112 | #define STANDARD_C 1 |
113 | #define DOSISH 1 /* no escaping our roots */ |
114 | #define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */ |
0a753a76 |
115 | |
f3986ebb |
116 | /* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as |
117 | * real filehandles. XXX Should always be defined (the other version is untested) */ |
118 | #define USE_SOCKETS_AS_HANDLES |
119 | |
a7092146 |
120 | /* read() and write() aren't transparent for socket handles */ |
121 | #define PERL_SOCK_SYSREAD_IS_RECV |
122 | #define PERL_SOCK_SYSWRITE_IS_SEND |
123 | |
682fc664 |
124 | #define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ |
a7092146 |
125 | |
9e5f57de |
126 | /* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95. |
127 | It now uses some black magic to work seamlessly with the DLL CRT and |
128 | works with MSVC++ 4.0+ or GCC/Mingw32 |
129 | -- BKS 1-24-2000 */ |
130 | #if (defined(_M_IX86) && _MSC_VER >= 1000) || defined(__MINGW32__) |
f3986ebb |
131 | #define USE_FIXED_OSFHANDLE |
132 | #endif |
133 | |
6940069f |
134 | /* Define PERL_WIN32_SOCK_DLOAD to have Perl dynamically load the winsock |
135 | DLL when needed. Don't use if your compiler supports delayloading (ie, VC++ 6.0) |
136 | -- BKS 5-29-2000 */ |
137 | #if !(defined(_M_IX86) && _MSC_VER >= 1200) |
138 | #define PERL_WIN32_SOCK_DLOAD |
139 | #endif |
902173a3 |
140 | #define ENV_IS_CASELESS |
141 | |
d41de25a |
142 | #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ |
f3986ebb |
143 | #define VER_PLATFORM_WIN32_WINDOWS 1 |
144 | #endif |
145 | |
d41de25a |
146 | #ifndef FILE_SHARE_DELETE /* VC-4.0 headers don't have this */ |
147 | #define FILE_SHARE_DELETE 0x00000004 |
148 | #endif |
149 | |
327c3667 |
150 | /* access() mode bits */ |
151 | #ifndef R_OK |
152 | # define R_OK 4 |
153 | # define W_OK 2 |
154 | # define X_OK 1 |
155 | # define F_OK 0 |
156 | #endif |
157 | |
cc236deb |
158 | /* for waitpid() */ |
159 | #ifndef WNOHANG |
160 | # define WNOHANG 1 |
161 | #endif |
162 | |
c44d3fdb |
163 | #define PERL_GET_CONTEXT_DEFINED |
164 | |
f3986ebb |
165 | /* Compiler-specific stuff. */ |
166 | |
910dfcc8 |
167 | #ifdef __BORLANDC__ /* Borland C++ */ |
3e3baf6d |
168 | |
cb359b41 |
169 | #if (__BORLANDC__ <= 0x520) |
3e3baf6d |
170 | #define _access access |
171 | #define _chdir chdir |
cb359b41 |
172 | #endif |
173 | |
4ce4f76e |
174 | #define _getpid getpid |
26871e0a |
175 | #define wcsicmp _wcsicmp |
3e3baf6d |
176 | #include <sys/types.h> |
177 | |
84902520 |
178 | #ifndef DllMain |
179 | #define DllMain DllEntryPoint |
180 | #endif |
181 | |
189b2af5 |
182 | #pragma warn -ccc /* "condition is always true/false" */ |
183 | #pragma warn -rch /* "unreachable code" */ |
184 | #pragma warn -sig /* "conversion may lose significant digits" */ |
185 | #pragma warn -pia /* "possibly incorrect assignment" */ |
186 | #pragma warn -par /* "parameter 'foo' is never used" */ |
187 | #pragma warn -aus /* "'foo' is assigned a value that is never used" */ |
188 | #pragma warn -use /* "'foo' is declared but never used" */ |
189 | #pragma warn -csu /* "comparing signed and unsigned values" */ |
3e3baf6d |
190 | |
cd183fd9 |
191 | /* Borland C thinks that a pointer to a member variable is 12 bytes in size. */ |
192 | #define PERL_MEMBER_PTR_SIZE 12 |
193 | |
1307044d |
194 | #define isnan _isnan |
195 | |
910dfcc8 |
196 | #endif |
3e3baf6d |
197 | |
f3986ebb |
198 | #ifdef _MSC_VER /* Microsoft Visual C++ */ |
199 | |
0a753a76 |
200 | typedef long uid_t; |
201 | typedef long gid_t; |
a6c40364 |
202 | typedef unsigned short mode_t; |
f3986ebb |
203 | #pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) |
204 | |
0f4eea8f |
205 | /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */ |
cd183fd9 |
206 | #define PERL_MEMBER_PTR_SIZE 16 |
0f4eea8f |
207 | |
5fb4d820 |
208 | #define isnan _isnan |
209 | |
f3986ebb |
210 | #endif /* _MSC_VER */ |
211 | |
910dfcc8 |
212 | #ifdef __MINGW32__ /* Minimal Gnu-Win32 */ |
213 | |
214 | typedef long uid_t; |
215 | typedef long gid_t; |
b1d1613b |
216 | #ifndef _environ |
3730b96e |
217 | #define _environ environ |
b1d1613b |
218 | #endif |
3730b96e |
219 | #define flushall _flushall |
220 | #define fcloseall _fcloseall |
6940069f |
221 | #define isnan _isnan /* ...same libraries as MSVC */ |
910dfcc8 |
222 | |
ac4c12e7 |
223 | #ifndef _O_NOINHERIT |
224 | # define _O_NOINHERIT 0x0080 |
225 | # ifndef _NO_OLDNAMES |
226 | # define O_NOINHERIT _O_NOINHERIT |
227 | # endif |
228 | #endif |
229 | |
910dfcc8 |
230 | #endif /* __MINGW32__ */ |
231 | |
f8fb7c90 |
232 | /* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */ |
233 | #ifndef CP_UTF8 |
234 | # define CP_UTF8 65001 |
235 | #endif |
236 | |
f3986ebb |
237 | /* compatibility stuff for other compilers goes here */ |
0a753a76 |
238 | |
390b85e7 |
239 | START_EXTERN_C |
f3986ebb |
240 | |
241 | /* For UNIX compatibility. */ |
242 | |
0a753a76 |
243 | extern uid_t getuid(void); |
244 | extern gid_t getgid(void); |
245 | extern uid_t geteuid(void); |
246 | extern gid_t getegid(void); |
0a753a76 |
247 | extern int setuid(uid_t uid); |
248 | extern int setgid(gid_t gid); |
249 | extern int kill(int pid, int sig); |
161b471a |
250 | extern void *sbrk(int need); |
e34ffe5a |
251 | extern char * getlogin(void); |
b990f8c8 |
252 | extern int chown(const char *p, uid_t o, gid_t g); |
00b02797 |
253 | extern int mkstemp(const char *path); |
d55594ae |
254 | |
f3986ebb |
255 | #undef Stat |
256 | #define Stat win32_stat |
3e3baf6d |
257 | |
f3986ebb |
258 | #undef init_os_extras |
259 | #define init_os_extras Perl_init_os_extras |
390b85e7 |
260 | |
22239a37 |
261 | DllExport void Perl_win32_init(int *argcp, char ***argvp); |
cb359b41 |
262 | DllExport void Perl_init_os_extras(void); |
c5be433b |
263 | DllExport void win32_str_os_error(void *sv, DWORD err); |
264 | DllExport int RunPerl(int argc, char **argv, char **env); |
0551aaa8 |
265 | |
635bbe87 |
266 | typedef struct { |
267 | HANDLE childStdIn; |
268 | HANDLE childStdOut; |
269 | HANDLE childStdErr; |
f83751a7 |
270 | /* |
271 | * the following correspond to the fields of the same name |
272 | * in the STARTUPINFO structure. Embedders can use these to |
273 | * control the spawning process' look. |
274 | * Example - to hide the window of the spawned process: |
275 | * dwFlags = STARTF_USESHOWWINDOW; |
276 | * wShowWindow = SW_HIDE; |
277 | */ |
278 | DWORD dwFlags; |
279 | DWORD dwX; |
280 | DWORD dwY; |
281 | DWORD dwXSize; |
282 | DWORD dwYSize; |
283 | DWORD dwXCountChars; |
284 | DWORD dwYCountChars; |
285 | DWORD dwFillAttribute; |
286 | WORD wShowWindow; |
635bbe87 |
287 | } child_IO_table; |
288 | |
289 | DllExport void win32_get_child_IO(child_IO_table* ptr); |
290 | |
f3986ebb |
291 | #ifndef USE_SOCKETS_AS_HANDLES |
292 | extern FILE * my_fdopen(int, char *); |
d55594ae |
293 | #endif |
f3986ebb |
294 | extern int my_fclose(FILE *); |
ed59ec62 |
295 | extern int my_fstat(int fd, struct stat *sbufptr); |
c5be433b |
296 | extern int do_aspawn(void *really, void **mark, void **sp); |
297 | extern int do_spawn(char *cmd); |
298 | extern int do_spawn_nowait(char *cmd); |
4ea817c6 |
299 | extern char * win32_get_privlib(const char *pl); |
300 | extern char * win32_get_sitelib(const char *pl); |
301 | extern char * win32_get_vendorlib(const char *pl); |
f3986ebb |
302 | extern int IsWin95(void); |
303 | extern int IsWinNT(void); |
c0932edc |
304 | extern void win32_argv2utf8(int argc, char** argv); |
d55594ae |
305 | |
1c0ca838 |
306 | #ifdef PERL_IMPLICIT_SYS |
307 | extern void win32_delete_internal_host(void *h); |
308 | #endif |
309 | |
f3986ebb |
310 | extern char * staticlinkmodules[]; |
390b85e7 |
311 | |
312 | END_EXTERN_C |
d55594ae |
313 | |
68dc0745 |
314 | typedef char * caddr_t; /* In malloc.c (core address). */ |
0a753a76 |
315 | |
68dc0745 |
316 | /* |
68dc0745 |
317 | * handle socket stuff, assuming socket is always available |
318 | */ |
0a753a76 |
319 | #include <sys/socket.h> |
320 | #include <netdb.h> |
321 | |
bbc8f9de |
322 | #ifdef MYMALLOC |
323 | #define EMBEDMYMALLOC /**/ |
324 | /* #define USE_PERL_SBRK /**/ |
325 | /* #define PERL_SBRK_VIA_MALLOC /**/ |
326 | #endif |
327 | |
c31fac66 |
328 | #if defined(PERLDLL) && !defined(PERL_CORE) |
bbc8f9de |
329 | #define PERL_CORE |
330 | #endif |
331 | |
e68cb057 |
332 | #ifdef PERL_TEXTMODE_SCRIPTS |
c39cd008 |
333 | # define PERL_SCRIPT_MODE "r" |
a868473f |
334 | #else |
c39cd008 |
335 | # define PERL_SCRIPT_MODE "rb" |
a868473f |
336 | #endif |
337 | |
3352bfcb |
338 | /* |
339 | * Now Win32 specific per-thread data stuff |
340 | */ |
341 | |
342 | struct thread_intern { |
343 | /* XXX can probably use one buffer instead of several */ |
344 | char Wstrerror_buffer[512]; |
345 | struct servent Wservent; |
346 | char Wgetlogin_buffer[128]; |
347 | # ifdef USE_SOCKETS_AS_HANDLES |
348 | int Winit_socktype; |
349 | # endif |
350 | # ifdef HAVE_DES_FCRYPT |
351 | char Wcrypt_buffer[30]; |
352 | # endif |
353 | # ifdef USE_RTL_THREAD_API |
354 | void * retv; /* slot for thread return value */ |
355 | # endif |
356 | }; |
357 | |
4d1ff10f |
358 | #ifdef USE_5005THREADS |
3352bfcb |
359 | # ifndef USE_DECLSPEC_THREAD |
360 | # define HAVE_THREAD_INTERN |
361 | # endif /* !USE_DECLSPEC_THREAD */ |
4d1ff10f |
362 | #endif /* USE_5005THREADS */ |
3352bfcb |
363 | |
4b556e6c |
364 | #define HAVE_INTERP_INTERN |
0aaad0ff |
365 | typedef struct { |
366 | long num; |
367 | DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
7766f137 |
368 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
0aaad0ff |
369 | } child_tab; |
370 | |
4b556e6c |
371 | struct interp_intern { |
0aaad0ff |
372 | char * perlshell_tokens; |
373 | char ** perlshell_vec; |
374 | long perlshell_items; |
375 | struct av * fdpid; |
376 | child_tab * children; |
7766f137 |
377 | #ifdef USE_ITHREADS |
378 | DWORD pseudo_id; |
379 | child_tab * pseudo_children; |
380 | #endif |
381 | void * internal_host; |
4d1ff10f |
382 | #ifndef USE_5005THREADS |
3352bfcb |
383 | struct thread_intern thr_intern; |
384 | #endif |
8fb3fcfb |
385 | UINT timerid; |
386 | HANDLE msg_event; |
4b556e6c |
387 | }; |
388 | |
8fb3fcfb |
389 | DllExport int win32_async_check(pTHX); |
390 | |
391 | #define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending) win32_async_check(aTHX) |
4b556e6c |
392 | |
0aaad0ff |
393 | #define w32_perlshell_tokens (PL_sys_intern.perlshell_tokens) |
394 | #define w32_perlshell_vec (PL_sys_intern.perlshell_vec) |
395 | #define w32_perlshell_items (PL_sys_intern.perlshell_items) |
396 | #define w32_fdpid (PL_sys_intern.fdpid) |
397 | #define w32_children (PL_sys_intern.children) |
398 | #define w32_num_children (w32_children->num) |
399 | #define w32_child_pids (w32_children->pids) |
7766f137 |
400 | #define w32_child_handles (w32_children->handles) |
401 | #define w32_pseudo_id (PL_sys_intern.pseudo_id) |
402 | #define w32_pseudo_children (PL_sys_intern.pseudo_children) |
403 | #define w32_num_pseudo_children (w32_pseudo_children->num) |
404 | #define w32_pseudo_child_pids (w32_pseudo_children->pids) |
405 | #define w32_pseudo_child_handles (w32_pseudo_children->handles) |
406 | #define w32_internal_host (PL_sys_intern.internal_host) |
8fb3fcfb |
407 | #define w32_timerid (PL_sys_intern.timerid) |
408 | #define w32_do_async (w32_timerid != 0) |
4d1ff10f |
409 | #ifdef USE_5005THREADS |
3352bfcb |
410 | # define w32_strerror_buffer (thr->i.Wstrerror_buffer) |
411 | # define w32_getlogin_buffer (thr->i.Wgetlogin_buffer) |
412 | # define w32_crypt_buffer (thr->i.Wcrypt_buffer) |
413 | # define w32_servent (thr->i.Wservent) |
414 | # define w32_init_socktype (thr->i.Winit_socktype) |
415 | #else |
416 | # define w32_strerror_buffer (PL_sys_intern.thr_intern.Wstrerror_buffer) |
417 | # define w32_getlogin_buffer (PL_sys_intern.thr_intern.Wgetlogin_buffer) |
418 | # define w32_crypt_buffer (PL_sys_intern.thr_intern.Wcrypt_buffer) |
419 | # define w32_servent (PL_sys_intern.thr_intern.Wservent) |
420 | # define w32_init_socktype (PL_sys_intern.thr_intern.Winit_socktype) |
4d1ff10f |
421 | #endif /* USE_5005THREADS */ |
c53bd28a |
422 | |
7fac1903 |
423 | /* UNICODE<>ANSI translation helpers */ |
424 | /* Use CP_ACP when mode is ANSI */ |
425 | /* Use CP_UTF8 when mode is UTF8 */ |
426 | |
e9ff6d27 |
427 | #define A2WHELPER_LEN(lpa, alen, lpw, nBytes)\ |
c8f3d7f8 |
428 | (lpw[0] = 0, MultiByteToWideChar((IN_BYTES) ? CP_ACP : CP_UTF8, 0, \ |
e9ff6d27 |
429 | lpa, alen, lpw, (nBytes/sizeof(WCHAR)))) |
430 | #define A2WHELPER(lpa, lpw, nBytes) A2WHELPER_LEN(lpa, -1, lpw, nBytes) |
431 | |
432 | #define W2AHELPER_LEN(lpw, wlen, lpa, nChars)\ |
c8f3d7f8 |
433 | (lpa[0] = '\0', WideCharToMultiByte((IN_BYTES) ? CP_ACP : CP_UTF8, 0, \ |
e9ff6d27 |
434 | lpw, wlen, (LPSTR)lpa, nChars,NULL,NULL)) |
435 | #define W2AHELPER(lpw, lpa, nChars) W2AHELPER_LEN(lpw, -1, lpa, nChars) |
7fac1903 |
436 | |
46487f74 |
437 | #define USING_WIDE() (PL_widesyscalls && PerlEnv_os_id() == VER_PLATFORM_WIN32_NT) |
7fac1903 |
438 | |
7766f137 |
439 | #ifdef USE_ITHREADS |
440 | # define PERL_WAIT_FOR_CHILDREN \ |
441 | STMT_START { \ |
442 | if (w32_pseudo_children && w32_num_pseudo_children) { \ |
443 | long children = w32_num_pseudo_children; \ |
444 | WaitForMultipleObjects(children, \ |
445 | w32_pseudo_child_handles, \ |
446 | TRUE, INFINITE); \ |
447 | while (children) \ |
448 | CloseHandle(w32_pseudo_child_handles[--children]); \ |
449 | } \ |
450 | } STMT_END |
451 | #endif |
452 | |
a10b7b7e |
453 | #if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) |
454 | #ifdef PERL_CORE |
455 | |
456 | /* C doesn't like repeat struct definitions */ |
457 | #ifndef _CRTIMP |
458 | #define _CRTIMP __declspec(dllimport) |
459 | #endif |
460 | |
461 | /* |
462 | * Control structure for lowio file handles |
463 | */ |
464 | typedef struct { |
465 | long osfhnd; /* underlying OS file HANDLE */ |
466 | char osfile; /* attributes of file (e.g., open in text mode?) */ |
467 | char pipech; /* one char buffer for handles opened on pipes */ |
468 | int lockinitflag; |
469 | CRITICAL_SECTION lock; |
470 | } ioinfo; |
471 | |
472 | |
473 | /* |
474 | * Array of arrays of control structures for lowio files. |
475 | */ |
476 | EXTERN_C _CRTIMP ioinfo* __pioinfo[]; |
477 | |
478 | /* |
479 | * Definition of IOINFO_L2E, the log base 2 of the number of elements in each |
480 | * array of ioinfo structs. |
481 | */ |
482 | #define IOINFO_L2E 5 |
483 | |
484 | /* |
485 | * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array |
486 | */ |
487 | #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) |
488 | |
489 | /* |
490 | * Access macros for getting at an ioinfo struct and its fields from a |
491 | * file handle |
492 | */ |
493 | #define _pioinfo(i) (__pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1))) |
494 | #define _osfhnd(i) (_pioinfo(i)->osfhnd) |
495 | #define _osfile(i) (_pioinfo(i)->osfile) |
496 | #define _pipech(i) (_pioinfo(i)->pipech) |
497 | |
498 | /* since we are not doing a dup2(), this works fine */ |
499 | #define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = (long)osfh) |
500 | #endif |
501 | #endif |
502 | |
6e22d046 |
503 | /* IO.xs and POSIX.xs define PERLIO_NOT_STDIO to 1 */ |
504 | #if defined(PERL_EXT_IO) || defined(PERL_EXT_POSIX) |
505 | #undef PERLIO_NOT_STDIO |
506 | #endif |
adb71456 |
507 | #define PERLIO_NOT_STDIO 0 |
508 | |
509 | #include "perlio.h" |
510 | |
4f63d024 |
511 | /* |
512 | * This provides a layer of functions and macros to ensure extensions will |
513 | * get to use the same RTL functions as the core. |
514 | */ |
515 | #include "win32iop.h" |
516 | |
b4748376 |
517 | #define EXEC_ARGV_CAST(x) ((const char *const *) x) |
518 | |
4fb841ef |
519 | #if !defined(ECONNABORTED) && defined(WSAECONNABORTED) |
520 | #define ECONNABORTED WSAECONNABORTED |
521 | #endif |
522 | #if !defined(EAFNOSUPPORT) && defined(WSAEAFNOSUPPORT) |
523 | #define EAFNOSUPPORT WSAEAFNOSUPPORT |
524 | #endif |
525 | |
1018e26f |
526 | DllExport PerlInterpreter *win32_signal_context(void); |
527 | #define PERL_GET_SIG_CONTEXT win32_signal_context() |
528 | |
68dc0745 |
529 | #endif /* _INC_WIN32_PERL5 */ |
7a9ec5a3 |
530 | |
8fb3fcfb |
531 | |