Commit | Line | Data |
f4257e4d |
1 | --- win32-o.h 2006-04-28 00:29:04.000000000 +0400 |
2 | +++ win32.h 2006-04-28 19:34:28.000000000 +0400 |
3 | @@ -1,498 +1,579 @@ |
4 | -/* Time-stamp: <01/08/01 20:59:54 keuchel@w2k> */ |
5 | - |
6 | /* WIN32.H |
7 | * |
8 | * (c) 1995 Microsoft Corporation. All rights reserved. |
9 | * Developed by hip communications inc., http://info.hip.com/info/ |
10 | * |
11 | * You may distribute under the terms of either the GNU General Public |
12 | * License or the Artistic License, as specified in the README file. |
13 | */ |
14 | - |
15 | #ifndef _INC_WIN32_PERL5 |
16 | #define _INC_WIN32_PERL5 |
17 | |
18 | #ifndef _WIN32_WINNT |
19 | # define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */ |
20 | #endif |
21 | |
22 | #if defined(PERL_IMPLICIT_SYS) |
23 | # define DYNAMIC_ENV_FETCH |
24 | -# define ENV_HV_NAME "___ENV_HV_NAME___" |
25 | # define HAS_GETENV_LEN |
26 | # define prime_env_iter() |
27 | # define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */ |
28 | # define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */ |
29 | # ifdef PERL_GLOBAL_STRUCT |
30 | # error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS |
31 | # endif |
32 | # define win32_get_privlib PerlEnv_lib_path |
33 | # define win32_get_sitelib PerlEnv_sitelib_path |
34 | # define win32_get_vendorlib PerlEnv_vendorlib_path |
35 | #endif |
36 | |
37 | #ifdef __GNUC__ |
38 | # ifndef __int64 /* some versions seem to #define it already */ |
39 | # define __int64 long long |
40 | # endif |
41 | # define Win32_Winsock |
42 | +#ifdef __cplusplus |
43 | +/* Mingw32 gcc -xc++ objects to __attribute((unused)) at least */ |
44 | +#undef PERL_UNUSED_DECL |
45 | +#define PERL_UNUSED_DECL |
46 | #endif |
47 | +#endif |
48 | + |
49 | |
50 | /* Define DllExport akin to perl's EXT, |
51 | * If we are in the DLL or mimicing the DLL for Win95 work round |
52 | * then Export the symbol, |
53 | * otherwise import it. |
54 | */ |
55 | |
56 | /* now even GCC supports __declspec() */ |
57 | |
58 | #if defined(PERLDLL) || defined(WIN95FIX) |
59 | #define DllExport |
60 | /*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */ |
61 | #else |
62 | #define DllExport __declspec(dllimport) |
63 | #endif |
64 | |
65 | #define WIN32_LEAN_AND_MEAN |
66 | #include <windows.h> |
67 | |
68 | #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ |
69 | #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ |
70 | #endif /*WIN32_LEAN_AND_MEAN */ |
71 | |
72 | #ifndef TLS_OUT_OF_INDEXES |
73 | #define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF |
74 | #endif |
75 | |
76 | #include <dirent.h> |
77 | -#ifndef UNDER_CE |
78 | #include <io.h> |
79 | #include <process.h> |
80 | -#include <direct.h> |
81 | -#include <fcntl.h> |
82 | -#endif |
83 | #include <stdio.h> |
84 | +#include <direct.h> |
85 | #include <stdlib.h> |
86 | +#include <stddef.h> |
87 | +#include <fcntl.h> |
88 | #ifndef EXT |
89 | #include "EXTERN.h" |
90 | #endif |
91 | |
92 | struct tms { |
93 | long tms_utime; |
94 | long tms_stime; |
95 | long tms_cutime; |
96 | long tms_cstime; |
97 | }; |
98 | |
99 | #ifndef SYS_NMLN |
100 | #define SYS_NMLN 257 |
101 | #endif |
102 | |
103 | struct utsname { |
104 | char sysname[SYS_NMLN]; |
105 | char nodename[SYS_NMLN]; |
106 | char release[SYS_NMLN]; |
107 | char version[SYS_NMLN]; |
108 | char machine[SYS_NMLN]; |
109 | }; |
110 | |
111 | #ifndef START_EXTERN_C |
112 | #undef EXTERN_C |
113 | #ifdef __cplusplus |
114 | # define START_EXTERN_C extern "C" { |
115 | # define END_EXTERN_C } |
116 | # define EXTERN_C extern "C" |
117 | #else |
118 | # define START_EXTERN_C |
119 | # define END_EXTERN_C |
120 | # define EXTERN_C |
121 | #endif |
122 | #endif |
123 | |
124 | #define STANDARD_C 1 |
125 | #define DOSISH 1 /* no escaping our roots */ |
126 | #define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */ |
127 | |
128 | /* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as |
129 | * real filehandles. XXX Should always be defined (the other version is untested) */ |
130 | - |
131 | #define USE_SOCKETS_AS_HANDLES |
132 | |
133 | /* read() and write() aren't transparent for socket handles */ |
134 | #define PERL_SOCK_SYSREAD_IS_RECV |
135 | #define PERL_SOCK_SYSWRITE_IS_SEND |
136 | |
137 | #define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ |
138 | |
139 | -/* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls |
140 | - * to read the environment, bypassing the runtime's (usually broken) |
141 | - * facilities for accessing the same. See note in util.c/my_setenv(). */ |
142 | -/*#define USE_WIN32_RTL_ENV */ |
143 | - |
144 | /* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95. |
145 | It now uses some black magic to work seamlessly with the DLL CRT and |
146 | works with MSVC++ 4.0+ or GCC/Mingw32 |
147 | -- BKS 1-24-2000 */ |
148 | #if (defined(_M_IX86) && _MSC_VER >= 1000) || defined(__MINGW32__) |
149 | #define USE_FIXED_OSFHANDLE |
150 | #endif |
151 | |
152 | +/* Define PERL_WIN32_SOCK_DLOAD to have Perl dynamically load the winsock |
153 | + DLL when needed. Don't use if your compiler supports delayloading (ie, VC++ 6.0) |
154 | + -- BKS 5-29-2000 */ |
155 | +#if !(defined(_M_IX86) && _MSC_VER >= 1200) |
156 | +#define PERL_WIN32_SOCK_DLOAD |
157 | +#endif |
158 | #define ENV_IS_CASELESS |
159 | |
160 | +#define PIPESOCK_MODE "b" /* pipes, sockets default to binmode */ |
161 | + |
162 | #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ |
163 | #define VER_PLATFORM_WIN32_WINDOWS 1 |
164 | #endif |
165 | |
166 | #ifndef FILE_SHARE_DELETE /* VC-4.0 headers don't have this */ |
167 | #define FILE_SHARE_DELETE 0x00000004 |
168 | #endif |
169 | |
170 | /* access() mode bits */ |
171 | #ifndef R_OK |
172 | # define R_OK 4 |
173 | # define W_OK 2 |
174 | # define X_OK 1 |
175 | # define F_OK 0 |
176 | #endif |
177 | |
178 | +/* for waitpid() */ |
179 | +#ifndef WNOHANG |
180 | +# define WNOHANG 1 |
181 | +#endif |
182 | + |
183 | #define PERL_GET_CONTEXT_DEFINED |
184 | |
185 | /* Compiler-specific stuff. */ |
186 | |
187 | #ifdef __BORLANDC__ /* Borland C++ */ |
188 | |
189 | +#if (__BORLANDC__ <= 0x520) |
190 | #define _access access |
191 | #define _chdir chdir |
192 | +#endif |
193 | + |
194 | #define _getpid getpid |
195 | #define wcsicmp _wcsicmp |
196 | #include <sys/types.h> |
197 | |
198 | #ifndef DllMain |
199 | #define DllMain DllEntryPoint |
200 | #endif |
201 | |
202 | #pragma warn -ccc /* "condition is always true/false" */ |
203 | #pragma warn -rch /* "unreachable code" */ |
204 | #pragma warn -sig /* "conversion may lose significant digits" */ |
205 | #pragma warn -pia /* "possibly incorrect assignment" */ |
206 | #pragma warn -par /* "parameter 'foo' is never used" */ |
207 | #pragma warn -aus /* "'foo' is assigned a value that is never used" */ |
208 | #pragma warn -use /* "'foo' is declared but never used" */ |
209 | #pragma warn -csu /* "comparing signed and unsigned values" */ |
210 | -#pragma warn -pro /* "call to function with no prototype" */ |
211 | -#pragma warn -stu /* "undefined structure 'foo'" */ |
212 | |
213 | /* Borland C thinks that a pointer to a member variable is 12 bytes in size. */ |
214 | #define PERL_MEMBER_PTR_SIZE 12 |
215 | |
216 | +#define isnan _isnan |
217 | + |
218 | #endif |
219 | |
220 | #ifdef _MSC_VER /* Microsoft Visual C++ */ |
221 | |
222 | -#ifndef _MODE_T_DEFINED_ |
223 | -typedef unsigned long mode_t; |
224 | -#define _MODE_T_DEFINED_ |
225 | -#endif |
226 | - |
227 | -#pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) |
228 | +typedef long uid_t; |
229 | +typedef long gid_t; |
230 | +typedef unsigned short mode_t; |
231 | +#pragma warning(disable: 4102) /* "unreferenced label" */ |
232 | |
233 | /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */ |
234 | #define PERL_MEMBER_PTR_SIZE 16 |
235 | |
236 | +#define isnan _isnan |
237 | + |
238 | +#if _MSC_VER < 1300 |
239 | +/* VC6 has broken NaN semantics: NaN == NaN returns true instead of false */ |
240 | +#define NAN_COMPARE_BROKEN 1 |
241 | +#endif |
242 | + |
243 | #endif /* _MSC_VER */ |
244 | |
245 | #ifdef __MINGW32__ /* Minimal Gnu-Win32 */ |
246 | |
247 | typedef long uid_t; |
248 | typedef long gid_t; |
249 | #ifndef _environ |
250 | #define _environ environ |
251 | #endif |
252 | #define flushall _flushall |
253 | #define fcloseall _fcloseall |
254 | - |
255 | -#endif /* __MINGW32__ */ |
256 | +#define isnan _isnan /* ...same libraries as MSVC */ |
257 | |
258 | #ifndef _O_NOINHERIT |
259 | # define _O_NOINHERIT 0x0080 |
260 | # ifndef _NO_OLDNAMES |
261 | # define O_NOINHERIT _O_NOINHERIT |
262 | # endif |
263 | #endif |
264 | |
265 | +/* <stdint.h>, pulled in by <io.h> as of mingw-runtime-3.3, typedef's |
266 | + * (u)intptr_t but doesn't set the _(U)INTPTR_T_DEFINED defines */ |
267 | +#ifdef _STDINT_H |
268 | +# ifndef _INTPTR_T_DEFINED |
269 | +# define _INTPTR_T_DEFINED |
270 | +# endif |
271 | +# ifndef _UINTPTR_T_DEFINED |
272 | +# define _UINTPTR_T_DEFINED |
273 | +# endif |
274 | +#endif |
275 | + |
276 | +#endif /* __MINGW32__ */ |
277 | + |
278 | /* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */ |
279 | #ifndef CP_UTF8 |
280 | # define CP_UTF8 65001 |
281 | #endif |
282 | |
283 | /* compatibility stuff for other compilers goes here */ |
284 | |
285 | #ifndef _INTPTR_T_DEFINED |
286 | typedef int intptr_t; |
287 | # define _INTPTR_T_DEFINED |
288 | #endif |
289 | |
290 | #ifndef _UINTPTR_T_DEFINED |
291 | typedef unsigned int uintptr_t; |
292 | # define _UINTPTR_T_DEFINED |
293 | #endif |
294 | |
295 | START_EXTERN_C |
296 | |
297 | +/* For UNIX compatibility. */ |
298 | + |
299 | +extern uid_t getuid(void); |
300 | +extern gid_t getgid(void); |
301 | +extern uid_t geteuid(void); |
302 | +extern gid_t getegid(void); |
303 | +extern int setuid(uid_t uid); |
304 | +extern int setgid(gid_t gid); |
305 | +extern int kill(int pid, int sig); |
306 | +#ifndef USE_PERL_SBRK |
307 | +extern void *sbrk(ptrdiff_t need); |
308 | +# define HAS_SBRK_PROTO |
309 | +#endif |
310 | +extern char * getlogin(void); |
311 | +extern int chown(const char *p, uid_t o, gid_t g); |
312 | +extern int mkstemp(const char *path); |
313 | + |
314 | #undef Stat |
315 | #define Stat win32_stat |
316 | |
317 | #undef init_os_extras |
318 | #define init_os_extras Perl_init_os_extras |
319 | |
320 | DllExport void Perl_win32_init(int *argcp, char ***argvp); |
321 | DllExport void Perl_win32_term(void); |
322 | -DllExport void Perl_init_os_extras(); |
323 | +DllExport void Perl_init_os_extras(void); |
324 | DllExport void win32_str_os_error(void *sv, DWORD err); |
325 | DllExport int RunPerl(int argc, char **argv, char **env); |
326 | |
327 | typedef struct { |
328 | HANDLE childStdIn; |
329 | HANDLE childStdOut; |
330 | HANDLE childStdErr; |
331 | /* |
332 | * the following correspond to the fields of the same name |
333 | * in the STARTUPINFO structure. Embedders can use these to |
334 | * control the spawning process' look. |
335 | * Example - to hide the window of the spawned process: |
336 | * dwFlags = STARTF_USESHOWWINDOW; |
337 | * wShowWindow = SW_HIDE; |
338 | */ |
339 | DWORD dwFlags; |
340 | DWORD dwX; |
341 | DWORD dwY; |
342 | DWORD dwXSize; |
343 | DWORD dwYSize; |
344 | DWORD dwXCountChars; |
345 | DWORD dwYCountChars; |
346 | DWORD dwFillAttribute; |
347 | WORD wShowWindow; |
348 | } child_IO_table; |
349 | |
350 | DllExport void win32_get_child_IO(child_IO_table* ptr); |
351 | +DllExport HWND win32_create_message_window(); |
352 | |
353 | #ifndef USE_SOCKETS_AS_HANDLES |
354 | extern FILE * my_fdopen(int, char *); |
355 | #endif |
356 | - |
357 | extern int my_fclose(FILE *); |
358 | -extern int do_aspawn(void *really, void **mark, void **sp); |
359 | -extern int do_spawn(char *cmd); |
360 | -extern int do_spawn_nowait(char *cmd); |
361 | +extern int my_fstat(int fd, Stat_t *sbufptr); |
362 | extern char * win32_get_privlib(const char *pl); |
363 | extern char * win32_get_sitelib(const char *pl); |
364 | extern char * win32_get_vendorlib(const char *pl); |
365 | extern int IsWin95(void); |
366 | extern int IsWinNT(void); |
367 | extern void win32_argv2utf8(int argc, char** argv); |
368 | |
369 | #ifdef PERL_IMPLICIT_SYS |
370 | extern void win32_delete_internal_host(void *h); |
371 | #endif |
372 | |
373 | extern char * staticlinkmodules[]; |
374 | |
375 | END_EXTERN_C |
376 | |
377 | +typedef char * caddr_t; /* In malloc.c (core address). */ |
378 | + |
379 | /* |
380 | * handle socket stuff, assuming socket is always available |
381 | */ |
382 | - |
383 | #include <sys/socket.h> |
384 | #include <netdb.h> |
385 | |
386 | #ifdef MYMALLOC |
387 | #define EMBEDMYMALLOC /**/ |
388 | /* #define USE_PERL_SBRK /**/ |
389 | /* #define PERL_SBRK_VIA_MALLOC /**/ |
390 | #endif |
391 | |
392 | #if defined(PERLDLL) && !defined(PERL_CORE) |
393 | #define PERL_CORE |
394 | #endif |
395 | |
396 | #ifdef PERL_TEXTMODE_SCRIPTS |
397 | # define PERL_SCRIPT_MODE "r" |
398 | #else |
399 | # define PERL_SCRIPT_MODE "rb" |
400 | #endif |
401 | |
402 | -#ifndef Sighandler_t |
403 | -typedef Signal_t (*Sighandler_t) (int); |
404 | -#define Sighandler_t Sighandler_t |
405 | -#endif |
406 | - |
407 | /* |
408 | * Now Win32 specific per-thread data stuff |
409 | */ |
410 | |
411 | +/* Leave the first couple ids after WM_USER unused because they |
412 | + * might be used by an embedding application, and on Windows |
413 | + * version before 2000 we might end up eating those messages |
414 | + * if they were not meant for us. |
415 | + */ |
416 | +#define WM_USER_MIN (WM_USER+30) |
417 | +#define WM_USER_MESSAGE (WM_USER_MIN) |
418 | +#define WM_USER_KILL (WM_USER_MIN+1) |
419 | +#define WM_USER_MAX (WM_USER_MIN+1) |
420 | + |
421 | struct thread_intern { |
422 | /* XXX can probably use one buffer instead of several */ |
423 | char Wstrerror_buffer[512]; |
424 | struct servent Wservent; |
425 | char Wgetlogin_buffer[128]; |
426 | -# ifdef USE_SOCKETS_AS_HANDLES |
427 | - int Winit_socktype; |
428 | -# endif |
429 | # ifdef HAVE_DES_FCRYPT |
430 | char Wcrypt_buffer[30]; |
431 | # endif |
432 | # ifdef USE_RTL_THREAD_API |
433 | void * retv; /* slot for thread return value */ |
434 | # endif |
435 | BOOL Wuse_showwindow; |
436 | WORD Wshowwindow; |
437 | }; |
438 | |
439 | #define HAVE_INTERP_INTERN |
440 | typedef struct { |
441 | long num; |
442 | DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
443 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
444 | } child_tab; |
445 | |
446 | +#ifdef USE_ITHREADS |
447 | +typedef struct { |
448 | + long num; |
449 | + DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
450 | + HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
451 | + HWND message_hwnds[MAXIMUM_WAIT_OBJECTS]; |
452 | +} pseudo_child_tab; |
453 | +#endif |
454 | + |
455 | +#ifndef Sighandler_t |
456 | +typedef Signal_t (*Sighandler_t) (int); |
457 | +#define Sighandler_t Sighandler_t |
458 | +#endif |
459 | + |
460 | struct interp_intern { |
461 | char * perlshell_tokens; |
462 | char ** perlshell_vec; |
463 | long perlshell_items; |
464 | struct av * fdpid; |
465 | child_tab * children; |
466 | #ifdef USE_ITHREADS |
467 | DWORD pseudo_id; |
468 | - child_tab * pseudo_children; |
469 | + pseudo_child_tab * pseudo_children; |
470 | #endif |
471 | void * internal_host; |
472 | struct thread_intern thr_intern; |
473 | + HWND message_hwnd; |
474 | UINT timerid; |
475 | unsigned poll_count; |
476 | Sighandler_t sigtable[SIG_SIZE]; |
477 | }; |
478 | |
479 | DllExport int win32_async_check(pTHX); |
480 | |
481 | #define WIN32_POLL_INTERVAL 32768 |
482 | #define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending) win32_async_check(aTHX) |
483 | |
484 | #define w32_perlshell_tokens (PL_sys_intern.perlshell_tokens) |
485 | #define w32_perlshell_vec (PL_sys_intern.perlshell_vec) |
486 | #define w32_perlshell_items (PL_sys_intern.perlshell_items) |
487 | #define w32_fdpid (PL_sys_intern.fdpid) |
488 | #define w32_children (PL_sys_intern.children) |
489 | #define w32_num_children (w32_children->num) |
490 | #define w32_child_pids (w32_children->pids) |
491 | #define w32_child_handles (w32_children->handles) |
492 | #define w32_pseudo_id (PL_sys_intern.pseudo_id) |
493 | #define w32_pseudo_children (PL_sys_intern.pseudo_children) |
494 | #define w32_num_pseudo_children (w32_pseudo_children->num) |
495 | #define w32_pseudo_child_pids (w32_pseudo_children->pids) |
496 | #define w32_pseudo_child_handles (w32_pseudo_children->handles) |
497 | +#define w32_pseudo_child_message_hwnds (w32_pseudo_children->message_hwnds) |
498 | #define w32_internal_host (PL_sys_intern.internal_host) |
499 | #define w32_timerid (PL_sys_intern.timerid) |
500 | +#define w32_message_hwnd (PL_sys_intern.message_hwnd) |
501 | #define w32_sighandler (PL_sys_intern.sigtable) |
502 | #define w32_poll_count (PL_sys_intern.poll_count) |
503 | #define w32_do_async (w32_poll_count++ > WIN32_POLL_INTERVAL) |
504 | #define w32_strerror_buffer (PL_sys_intern.thr_intern.Wstrerror_buffer) |
505 | #define w32_getlogin_buffer (PL_sys_intern.thr_intern.Wgetlogin_buffer) |
506 | #define w32_crypt_buffer (PL_sys_intern.thr_intern.Wcrypt_buffer) |
507 | #define w32_servent (PL_sys_intern.thr_intern.Wservent) |
508 | -#define w32_init_socktype (PL_sys_intern.thr_intern.Winit_socktype) |
509 | #define w32_use_showwindow (PL_sys_intern.thr_intern.Wuse_showwindow) |
510 | -#define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow) |
511 | +#define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow) |
512 | |
513 | #ifdef USE_ITHREADS |
514 | # define PERL_WAIT_FOR_CHILDREN \ |
515 | STMT_START { \ |
516 | if (w32_pseudo_children && w32_num_pseudo_children) { \ |
517 | long children = w32_num_pseudo_children; \ |
518 | WaitForMultipleObjects(children, \ |
519 | w32_pseudo_child_handles, \ |
520 | TRUE, INFINITE); \ |
521 | while (children) \ |
522 | CloseHandle(w32_pseudo_child_handles[--children]); \ |
523 | } \ |
524 | } STMT_END |
525 | #endif |
526 | |
527 | #if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) |
528 | #ifdef PERL_CORE |
529 | |
530 | /* C doesn't like repeat struct definitions */ |
531 | +#if defined(__MINGW32__) && (__MINGW32_MAJOR_VERSION>=3) |
532 | +#undef _CRTIMP |
533 | +#endif |
534 | #ifndef _CRTIMP |
535 | #define _CRTIMP __declspec(dllimport) |
536 | #endif |
537 | |
538 | /* |
539 | * Control structure for lowio file handles |
540 | */ |
541 | typedef struct { |
542 | intptr_t osfhnd;/* underlying OS file HANDLE */ |
543 | char osfile; /* attributes of file (e.g., open in text mode?) */ |
544 | char pipech; /* one char buffer for handles opened on pipes */ |
545 | int lockinitflag; |
546 | CRITICAL_SECTION lock; |
547 | } ioinfo; |
548 | |
549 | |
550 | /* |
551 | * Array of arrays of control structures for lowio files. |
552 | */ |
553 | EXTERN_C _CRTIMP ioinfo* __pioinfo[]; |
554 | |
555 | /* |
556 | * Definition of IOINFO_L2E, the log base 2 of the number of elements in each |
557 | * array of ioinfo structs. |
558 | */ |
559 | #define IOINFO_L2E 5 |
560 | |
561 | /* |
562 | * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array |
563 | */ |
564 | #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) |
565 | |
566 | /* |
567 | * Access macros for getting at an ioinfo struct and its fields from a |
568 | * file handle |
569 | */ |
570 | #define _pioinfo(i) (__pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1))) |
571 | #define _osfhnd(i) (_pioinfo(i)->osfhnd) |
572 | #define _osfile(i) (_pioinfo(i)->osfile) |
573 | #define _pipech(i) (_pioinfo(i)->pipech) |
574 | |
575 | /* since we are not doing a dup2(), this works fine */ |
576 | #define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = (intptr_t)osfh) |
577 | #endif |
578 | #endif |
579 | |
580 | /* IO.xs and POSIX.xs define PERLIO_NOT_STDIO to 1 */ |
581 | #if defined(PERL_EXT_IO) || defined(PERL_EXT_POSIX) |
582 | #undef PERLIO_NOT_STDIO |
583 | #endif |
584 | #define PERLIO_NOT_STDIO 0 |
585 | |
586 | #include "perlio.h" |
587 | |
588 | /* |
589 | * This provides a layer of functions and macros to ensure extensions will |
590 | * get to use the same RTL functions as the core. |
591 | */ |
592 | #include "win32iop.h" |
593 | |
594 | +#define EXEC_ARGV_CAST(x) ((const char *const *) x) |
595 | + |
596 | +#if !defined(ECONNABORTED) && defined(WSAECONNABORTED) |
597 | +#define ECONNABORTED WSAECONNABORTED |
598 | +#endif |
599 | +#if !defined(ECONNRESET) && defined(WSAECONNRESET) |
600 | +#define ECONNRESET WSAECONNRESET |
601 | +#endif |
602 | +#if !defined(EAFNOSUPPORT) && defined(WSAEAFNOSUPPORT) |
603 | +#define EAFNOSUPPORT WSAEAFNOSUPPORT |
604 | +#endif |
605 | +/* Why not needed for ECONNREFUSED? --abe */ |
606 | + |
607 | +DllExport void *win32_signal_context(void); |
608 | +#define PERL_GET_SIG_CONTEXT win32_signal_context() |
609 | + |
610 | #ifdef _WIN_CE |
611 | #define Win_GetModuleHandle XCEGetModuleHandleA |
612 | #define Win_GetProcAddress XCEGetProcAddressA |
613 | #define Win_GetModuleFileName XCEGetModuleFileNameA |
614 | #define Win_CreateSemaphore CreateSemaphoreW |
615 | #else |
616 | #define Win_GetModuleHandle GetModuleHandle |
617 | #define Win_GetProcAddress GetProcAddress |
618 | #define Win_GetModuleFileName GetModuleFileName |
619 | #define Win_CreateSemaphore CreateSemaphore |
620 | #endif |
621 | |
622 | #endif /* _INC_WIN32_PERL5 */ |
623 | |