1 | /* Time-stamp: <01/08/01 20:59:54 keuchel@w2k> */ |
---|
2 | |
---|
3 | /* WIN32.H |
---|
4 | * |
---|
5 | * (c) 1995 Microsoft Corporation. All rights reserved. |
---|
6 | * Developed by hip communications inc., http://info.hip.com/info/ |
---|
7 | * |
---|
8 | * You may distribute under the terms of either the GNU General Public |
---|
9 | * License or the Artistic License, as specified in the README file. |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef _INC_WIN32_PERL5 |
---|
13 | #define _INC_WIN32_PERL5 |
---|
14 | |
---|
15 | #ifndef _WIN32_WINNT |
---|
16 | # define _WIN32_WINNT 0x0400 /* needed for TryEnterCriticalSection() etc. */ |
---|
17 | #endif |
---|
18 | |
---|
19 | #if defined(PERL_IMPLICIT_SYS) |
---|
20 | # define DYNAMIC_ENV_FETCH |
---|
21 | # define ENV_HV_NAME "___ENV_HV_NAME___" |
---|
22 | # define HAS_GETENV_LEN |
---|
23 | # define prime_env_iter() |
---|
24 | # define WIN32IO_IS_STDIO /* don't pull in custom stdio layer */ |
---|
25 | # define WIN32SCK_IS_STDSCK /* don't pull in custom wsock layer */ |
---|
26 | # ifdef PERL_GLOBAL_STRUCT |
---|
27 | # error PERL_GLOBAL_STRUCT cannot be defined with PERL_IMPLICIT_SYS |
---|
28 | # endif |
---|
29 | # define win32_get_privlib PerlEnv_lib_path |
---|
30 | # define win32_get_sitelib PerlEnv_sitelib_path |
---|
31 | # define win32_get_vendorlib PerlEnv_vendorlib_path |
---|
32 | #endif |
---|
33 | |
---|
34 | #ifdef __GNUC__ |
---|
35 | # ifndef __int64 /* some versions seem to #define it already */ |
---|
36 | # define __int64 long long |
---|
37 | # endif |
---|
38 | # define Win32_Winsock |
---|
39 | #endif |
---|
40 | |
---|
41 | /* Define DllExport akin to perl's EXT, |
---|
42 | * If we are in the DLL or mimicing the DLL for Win95 work round |
---|
43 | * then Export the symbol, |
---|
44 | * otherwise import it. |
---|
45 | */ |
---|
46 | |
---|
47 | /* now even GCC supports __declspec() */ |
---|
48 | |
---|
49 | #if defined(PERLDLL) || defined(WIN95FIX) |
---|
50 | #define DllExport |
---|
51 | /*#define DllExport __declspec(dllexport)*/ /* noises with VC5+sp3 */ |
---|
52 | #else |
---|
53 | #define DllExport __declspec(dllimport) |
---|
54 | #endif |
---|
55 | |
---|
56 | #define WIN32_LEAN_AND_MEAN |
---|
57 | #include <windows.h> |
---|
58 | |
---|
59 | #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ |
---|
60 | #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ |
---|
61 | #endif /*WIN32_LEAN_AND_MEAN */ |
---|
62 | |
---|
63 | #ifndef TLS_OUT_OF_INDEXES |
---|
64 | #define TLS_OUT_OF_INDEXES (DWORD)0xFFFFFFFF |
---|
65 | #endif |
---|
66 | |
---|
67 | #include <dirent.h> |
---|
68 | #ifndef UNDER_CE |
---|
69 | #include <io.h> |
---|
70 | #include <process.h> |
---|
71 | #include <direct.h> |
---|
72 | #include <fcntl.h> |
---|
73 | #endif |
---|
74 | #include <stdio.h> |
---|
75 | #include <stdlib.h> |
---|
76 | #ifndef EXT |
---|
77 | #include "EXTERN.h" |
---|
78 | #endif |
---|
79 | |
---|
80 | struct tms { |
---|
81 | long tms_utime; |
---|
82 | long tms_stime; |
---|
83 | long tms_cutime; |
---|
84 | long tms_cstime; |
---|
85 | }; |
---|
86 | |
---|
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 | |
---|
99 | #ifndef START_EXTERN_C |
---|
100 | #undef EXTERN_C |
---|
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? */ |
---|
115 | |
---|
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 | |
---|
119 | #define USE_SOCKETS_AS_HANDLES |
---|
120 | |
---|
121 | /* read() and write() aren't transparent for socket handles */ |
---|
122 | #define PERL_SOCK_SYSREAD_IS_RECV |
---|
123 | #define PERL_SOCK_SYSWRITE_IS_SEND |
---|
124 | |
---|
125 | #define PERL_NO_FORCE_LINK /* no need for PL_force_link_funcs */ |
---|
126 | |
---|
127 | /* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls |
---|
128 | * to read the environment, bypassing the runtime's (usually broken) |
---|
129 | * facilities for accessing the same. See note in util.c/my_setenv(). */ |
---|
130 | /*#define USE_WIN32_RTL_ENV */ |
---|
131 | |
---|
132 | /* Define USE_FIXED_OSFHANDLE to fix MSVCRT's _open_osfhandle() on W95. |
---|
133 | It now uses some black magic to work seamlessly with the DLL CRT and |
---|
134 | works with MSVC++ 4.0+ or GCC/Mingw32 |
---|
135 | -- BKS 1-24-2000 */ |
---|
136 | #if (defined(_M_IX86) && _MSC_VER >= 1000) || defined(__MINGW32__) |
---|
137 | #define USE_FIXED_OSFHANDLE |
---|
138 | #endif |
---|
139 | |
---|
140 | #define ENV_IS_CASELESS |
---|
141 | |
---|
142 | #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers don't have this */ |
---|
143 | #define VER_PLATFORM_WIN32_WINDOWS 1 |
---|
144 | #endif |
---|
145 | |
---|
146 | #ifndef FILE_SHARE_DELETE /* VC-4.0 headers don't have this */ |
---|
147 | #define FILE_SHARE_DELETE 0x00000004 |
---|
148 | #endif |
---|
149 | |
---|
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 | |
---|
158 | #define PERL_GET_CONTEXT_DEFINED |
---|
159 | |
---|
160 | /* Compiler-specific stuff. */ |
---|
161 | |
---|
162 | #ifdef __BORLANDC__ /* Borland C++ */ |
---|
163 | |
---|
164 | #define _access access |
---|
165 | #define _chdir chdir |
---|
166 | #define _getpid getpid |
---|
167 | #define wcsicmp _wcsicmp |
---|
168 | #include <sys/types.h> |
---|
169 | |
---|
170 | #ifndef DllMain |
---|
171 | #define DllMain DllEntryPoint |
---|
172 | #endif |
---|
173 | |
---|
174 | #pragma warn -ccc /* "condition is always true/false" */ |
---|
175 | #pragma warn -rch /* "unreachable code" */ |
---|
176 | #pragma warn -sig /* "conversion may lose significant digits" */ |
---|
177 | #pragma warn -pia /* "possibly incorrect assignment" */ |
---|
178 | #pragma warn -par /* "parameter 'foo' is never used" */ |
---|
179 | #pragma warn -aus /* "'foo' is assigned a value that is never used" */ |
---|
180 | #pragma warn -use /* "'foo' is declared but never used" */ |
---|
181 | #pragma warn -csu /* "comparing signed and unsigned values" */ |
---|
182 | #pragma warn -pro /* "call to function with no prototype" */ |
---|
183 | #pragma warn -stu /* "undefined structure 'foo'" */ |
---|
184 | |
---|
185 | /* Borland C thinks that a pointer to a member variable is 12 bytes in size. */ |
---|
186 | #define PERL_MEMBER_PTR_SIZE 12 |
---|
187 | |
---|
188 | #endif |
---|
189 | |
---|
190 | #ifdef _MSC_VER /* Microsoft Visual C++ */ |
---|
191 | |
---|
192 | #ifndef _MODE_T_DEFINED_ |
---|
193 | typedef unsigned long mode_t; |
---|
194 | #define _MODE_T_DEFINED_ |
---|
195 | #endif |
---|
196 | |
---|
197 | #pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) |
---|
198 | |
---|
199 | /* Visual C thinks that a pointer to a member variable is 16 bytes in size. */ |
---|
200 | #define PERL_MEMBER_PTR_SIZE 16 |
---|
201 | |
---|
202 | #endif /* _MSC_VER */ |
---|
203 | |
---|
204 | #ifdef __MINGW32__ /* Minimal Gnu-Win32 */ |
---|
205 | |
---|
206 | typedef long uid_t; |
---|
207 | typedef long gid_t; |
---|
208 | #ifndef _environ |
---|
209 | #define _environ environ |
---|
210 | #endif |
---|
211 | #define flushall _flushall |
---|
212 | #define fcloseall _fcloseall |
---|
213 | |
---|
214 | #endif /* __MINGW32__ */ |
---|
215 | |
---|
216 | #ifndef _O_NOINHERIT |
---|
217 | # define _O_NOINHERIT 0x0080 |
---|
218 | # ifndef _NO_OLDNAMES |
---|
219 | # define O_NOINHERIT _O_NOINHERIT |
---|
220 | # endif |
---|
221 | #endif |
---|
222 | |
---|
223 | /* both GCC/Mingw32 and MSVC++ 4.0 are missing this, so we put it here */ |
---|
224 | #ifndef CP_UTF8 |
---|
225 | # define CP_UTF8 65001 |
---|
226 | #endif |
---|
227 | |
---|
228 | /* compatibility stuff for other compilers goes here */ |
---|
229 | |
---|
230 | #ifndef _INTPTR_T_DEFINED |
---|
231 | typedef int intptr_t; |
---|
232 | # define _INTPTR_T_DEFINED |
---|
233 | #endif |
---|
234 | |
---|
235 | #ifndef _UINTPTR_T_DEFINED |
---|
236 | typedef unsigned int uintptr_t; |
---|
237 | # define _UINTPTR_T_DEFINED |
---|
238 | #endif |
---|
239 | |
---|
240 | START_EXTERN_C |
---|
241 | |
---|
242 | #undef Stat |
---|
243 | #define Stat win32_stat |
---|
244 | |
---|
245 | #undef init_os_extras |
---|
246 | #define init_os_extras Perl_init_os_extras |
---|
247 | |
---|
248 | DllExport void Perl_win32_init(int *argcp, char ***argvp); |
---|
249 | DllExport void Perl_win32_term(void); |
---|
250 | DllExport void Perl_init_os_extras(); |
---|
251 | DllExport void win32_str_os_error(void *sv, DWORD err); |
---|
252 | DllExport int RunPerl(int argc, char **argv, char **env); |
---|
253 | |
---|
254 | typedef struct { |
---|
255 | HANDLE childStdIn; |
---|
256 | HANDLE childStdOut; |
---|
257 | HANDLE childStdErr; |
---|
258 | /* |
---|
259 | * the following correspond to the fields of the same name |
---|
260 | * in the STARTUPINFO structure. Embedders can use these to |
---|
261 | * control the spawning process' look. |
---|
262 | * Example - to hide the window of the spawned process: |
---|
263 | * dwFlags = STARTF_USESHOWWINDOW; |
---|
264 | * wShowWindow = SW_HIDE; |
---|
265 | */ |
---|
266 | DWORD dwFlags; |
---|
267 | DWORD dwX; |
---|
268 | DWORD dwY; |
---|
269 | DWORD dwXSize; |
---|
270 | DWORD dwYSize; |
---|
271 | DWORD dwXCountChars; |
---|
272 | DWORD dwYCountChars; |
---|
273 | DWORD dwFillAttribute; |
---|
274 | WORD wShowWindow; |
---|
275 | } child_IO_table; |
---|
276 | |
---|
277 | DllExport void win32_get_child_IO(child_IO_table* ptr); |
---|
278 | |
---|
279 | #ifndef USE_SOCKETS_AS_HANDLES |
---|
280 | extern FILE * my_fdopen(int, char *); |
---|
281 | #endif |
---|
282 | |
---|
283 | extern int my_fclose(FILE *); |
---|
284 | extern int do_aspawn(void *really, void **mark, void **sp); |
---|
285 | extern int do_spawn(char *cmd); |
---|
286 | extern int do_spawn_nowait(char *cmd); |
---|
287 | extern char * win32_get_privlib(const char *pl); |
---|
288 | extern char * win32_get_sitelib(const char *pl); |
---|
289 | extern char * win32_get_vendorlib(const char *pl); |
---|
290 | extern int IsWin95(void); |
---|
291 | extern int IsWinNT(void); |
---|
292 | extern void win32_argv2utf8(int argc, char** argv); |
---|
293 | |
---|
294 | #ifdef PERL_IMPLICIT_SYS |
---|
295 | extern void win32_delete_internal_host(void *h); |
---|
296 | #endif |
---|
297 | |
---|
298 | extern char * staticlinkmodules[]; |
---|
299 | |
---|
300 | END_EXTERN_C |
---|
301 | |
---|
302 | /* |
---|
303 | * handle socket stuff, assuming socket is always available |
---|
304 | */ |
---|
305 | |
---|
306 | #include <sys/socket.h> |
---|
307 | #include <netdb.h> |
---|
308 | |
---|
309 | #ifdef MYMALLOC |
---|
310 | #define EMBEDMYMALLOC /**/ |
---|
311 | /* #define USE_PERL_SBRK /**/ |
---|
312 | /* #define PERL_SBRK_VIA_MALLOC /**/ |
---|
313 | #endif |
---|
314 | |
---|
315 | #if defined(PERLDLL) && !defined(PERL_CORE) |
---|
316 | #define PERL_CORE |
---|
317 | #endif |
---|
318 | |
---|
319 | #ifdef PERL_TEXTMODE_SCRIPTS |
---|
320 | # define PERL_SCRIPT_MODE "r" |
---|
321 | #else |
---|
322 | # define PERL_SCRIPT_MODE "rb" |
---|
323 | #endif |
---|
324 | |
---|
325 | #ifndef Sighandler_t |
---|
326 | typedef Signal_t (*Sighandler_t) (int); |
---|
327 | #define Sighandler_t Sighandler_t |
---|
328 | #endif |
---|
329 | |
---|
330 | /* |
---|
331 | * Now Win32 specific per-thread data stuff |
---|
332 | */ |
---|
333 | |
---|
334 | struct thread_intern { |
---|
335 | /* XXX can probably use one buffer instead of several */ |
---|
336 | char Wstrerror_buffer[512]; |
---|
337 | struct servent Wservent; |
---|
338 | char Wgetlogin_buffer[128]; |
---|
339 | # ifdef USE_SOCKETS_AS_HANDLES |
---|
340 | int Winit_socktype; |
---|
341 | # endif |
---|
342 | # ifdef HAVE_DES_FCRYPT |
---|
343 | char Wcrypt_buffer[30]; |
---|
344 | # endif |
---|
345 | # ifdef USE_RTL_THREAD_API |
---|
346 | void * retv; /* slot for thread return value */ |
---|
347 | # endif |
---|
348 | BOOL Wuse_showwindow; |
---|
349 | WORD Wshowwindow; |
---|
350 | }; |
---|
351 | |
---|
352 | #ifdef USE_5005THREADS |
---|
353 | # ifndef USE_DECLSPEC_THREAD |
---|
354 | # define HAVE_THREAD_INTERN |
---|
355 | # endif /* !USE_DECLSPEC_THREAD */ |
---|
356 | #endif /* USE_5005THREADS */ |
---|
357 | |
---|
358 | #define HAVE_INTERP_INTERN |
---|
359 | typedef struct { |
---|
360 | long num; |
---|
361 | DWORD pids[MAXIMUM_WAIT_OBJECTS]; |
---|
362 | HANDLE handles[MAXIMUM_WAIT_OBJECTS]; |
---|
363 | } child_tab; |
---|
364 | |
---|
365 | struct interp_intern { |
---|
366 | char * perlshell_tokens; |
---|
367 | char ** perlshell_vec; |
---|
368 | long perlshell_items; |
---|
369 | struct av * fdpid; |
---|
370 | child_tab * children; |
---|
371 | #ifdef USE_ITHREADS |
---|
372 | DWORD pseudo_id; |
---|
373 | child_tab * pseudo_children; |
---|
374 | #endif |
---|
375 | void * internal_host; |
---|
376 | #ifndef USE_5005THREADS |
---|
377 | struct thread_intern thr_intern; |
---|
378 | #endif |
---|
379 | UINT timerid; |
---|
380 | unsigned poll_count; |
---|
381 | Sighandler_t sigtable[SIG_SIZE]; |
---|
382 | }; |
---|
383 | |
---|
384 | DllExport int win32_async_check(pTHX); |
---|
385 | |
---|
386 | #define WIN32_POLL_INTERVAL 32768 |
---|
387 | #define PERL_ASYNC_CHECK() if (w32_do_async || PL_sig_pending) win32_async_check(aTHX) |
---|
388 | |
---|
389 | #define w32_perlshell_tokens (PL_sys_intern.perlshell_tokens) |
---|
390 | #define w32_perlshell_vec (PL_sys_intern.perlshell_vec) |
---|
391 | #define w32_perlshell_items (PL_sys_intern.perlshell_items) |
---|
392 | #define w32_fdpid (PL_sys_intern.fdpid) |
---|
393 | #define w32_children (PL_sys_intern.children) |
---|
394 | #define w32_num_children (w32_children->num) |
---|
395 | #define w32_child_pids (w32_children->pids) |
---|
396 | #define w32_child_handles (w32_children->handles) |
---|
397 | #define w32_pseudo_id (PL_sys_intern.pseudo_id) |
---|
398 | #define w32_pseudo_children (PL_sys_intern.pseudo_children) |
---|
399 | #define w32_num_pseudo_children (w32_pseudo_children->num) |
---|
400 | #define w32_pseudo_child_pids (w32_pseudo_children->pids) |
---|
401 | #define w32_pseudo_child_handles (w32_pseudo_children->handles) |
---|
402 | #define w32_internal_host (PL_sys_intern.internal_host) |
---|
403 | #define w32_timerid (PL_sys_intern.timerid) |
---|
404 | #define w32_sighandler (PL_sys_intern.sigtable) |
---|
405 | #define w32_poll_count (PL_sys_intern.poll_count) |
---|
406 | #define w32_do_async (w32_poll_count++ > WIN32_POLL_INTERVAL) |
---|
407 | #ifdef USE_5005THREADS |
---|
408 | # define w32_strerror_buffer (thr->i.Wstrerror_buffer) |
---|
409 | # define w32_getlogin_buffer (thr->i.Wgetlogin_buffer) |
---|
410 | # define w32_crypt_buffer (thr->i.Wcrypt_buffer) |
---|
411 | # define w32_servent (thr->i.Wservent) |
---|
412 | # define w32_init_socktype (thr->i.Winit_socktype) |
---|
413 | # define w32_use_showwindow (thr->i.Wuse_showwindow) |
---|
414 | # define w32_showwindow (thr->i.Wshowwindow) |
---|
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) |
---|
421 | # define w32_use_showwindow (PL_sys_intern.thr_intern.Wuse_showwindow) |
---|
422 | # define w32_showwindow (PL_sys_intern.thr_intern.Wshowwindow) |
---|
423 | #endif /* USE_5005THREADS */ |
---|
424 | |
---|
425 | /* UNICODE<>ANSI translation helpers */ |
---|
426 | /* Use CP_ACP when mode is ANSI */ |
---|
427 | /* Use CP_UTF8 when mode is UTF8 */ |
---|
428 | |
---|
429 | #define A2WHELPER_LEN(lpa, alen, lpw, nBytes)\ |
---|
430 | (lpw[0] = 0, MultiByteToWideChar((IN_BYTES) ? CP_ACP : CP_UTF8, 0, \ |
---|
431 | lpa, alen, lpw, (nBytes/sizeof(WCHAR)))) |
---|
432 | #define A2WHELPER(lpa, lpw, nBytes) A2WHELPER_LEN(lpa, -1, lpw, nBytes) |
---|
433 | |
---|
434 | #define W2AHELPER_LEN(lpw, wlen, lpa, nChars)\ |
---|
435 | (lpa[0] = '\0', WideCharToMultiByte((IN_BYTES) ? CP_ACP : CP_UTF8, 0, \ |
---|
436 | lpw, wlen, (LPSTR)lpa, nChars,NULL,NULL)) |
---|
437 | #define W2AHELPER(lpw, lpa, nChars) W2AHELPER_LEN(lpw, -1, lpa, nChars) |
---|
438 | |
---|
439 | #define USING_WIDE() (0) |
---|
440 | |
---|
441 | #ifdef USE_ITHREADS |
---|
442 | # define PERL_WAIT_FOR_CHILDREN \ |
---|
443 | STMT_START { \ |
---|
444 | if (w32_pseudo_children && w32_num_pseudo_children) { \ |
---|
445 | long children = w32_num_pseudo_children; \ |
---|
446 | WaitForMultipleObjects(children, \ |
---|
447 | w32_pseudo_child_handles, \ |
---|
448 | TRUE, INFINITE); \ |
---|
449 | while (children) \ |
---|
450 | CloseHandle(w32_pseudo_child_handles[--children]); \ |
---|
451 | } \ |
---|
452 | } STMT_END |
---|
453 | #endif |
---|
454 | |
---|
455 | #if defined(USE_FIXED_OSFHANDLE) || defined(PERL_MSVCRT_READFIX) |
---|
456 | #ifdef PERL_CORE |
---|
457 | |
---|
458 | /* C doesn't like repeat struct definitions */ |
---|
459 | #ifndef _CRTIMP |
---|
460 | #define _CRTIMP __declspec(dllimport) |
---|
461 | #endif |
---|
462 | |
---|
463 | /* |
---|
464 | * Control structure for lowio file handles |
---|
465 | */ |
---|
466 | typedef struct { |
---|
467 | intptr_t osfhnd;/* underlying OS file HANDLE */ |
---|
468 | char osfile; /* attributes of file (e.g., open in text mode?) */ |
---|
469 | char pipech; /* one char buffer for handles opened on pipes */ |
---|
470 | int lockinitflag; |
---|
471 | CRITICAL_SECTION lock; |
---|
472 | } ioinfo; |
---|
473 | |
---|
474 | |
---|
475 | /* |
---|
476 | * Array of arrays of control structures for lowio files. |
---|
477 | */ |
---|
478 | EXTERN_C _CRTIMP ioinfo* __pioinfo[]; |
---|
479 | |
---|
480 | /* |
---|
481 | * Definition of IOINFO_L2E, the log base 2 of the number of elements in each |
---|
482 | * array of ioinfo structs. |
---|
483 | */ |
---|
484 | #define IOINFO_L2E 5 |
---|
485 | |
---|
486 | /* |
---|
487 | * Definition of IOINFO_ARRAY_ELTS, the number of elements in ioinfo array |
---|
488 | */ |
---|
489 | #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) |
---|
490 | |
---|
491 | /* |
---|
492 | * Access macros for getting at an ioinfo struct and its fields from a |
---|
493 | * file handle |
---|
494 | */ |
---|
495 | #define _pioinfo(i) (__pioinfo[(i) >> IOINFO_L2E] + ((i) & (IOINFO_ARRAY_ELTS - 1))) |
---|
496 | #define _osfhnd(i) (_pioinfo(i)->osfhnd) |
---|
497 | #define _osfile(i) (_pioinfo(i)->osfile) |
---|
498 | #define _pipech(i) (_pioinfo(i)->pipech) |
---|
499 | |
---|
500 | /* since we are not doing a dup2(), this works fine */ |
---|
501 | #define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = (intptr_t)osfh) |
---|
502 | #endif |
---|
503 | #endif |
---|
504 | |
---|
505 | /* IO.xs and POSIX.xs define PERLIO_NOT_STDIO to 1 */ |
---|
506 | #if defined(PERL_EXT_IO) || defined(PERL_EXT_POSIX) |
---|
507 | #undef PERLIO_NOT_STDIO |
---|
508 | #endif |
---|
509 | #define PERLIO_NOT_STDIO 0 |
---|
510 | |
---|
511 | #include "perlio.h" |
---|
512 | |
---|
513 | /* |
---|
514 | * This provides a layer of functions and macros to ensure extensions will |
---|
515 | * get to use the same RTL functions as the core. |
---|
516 | */ |
---|
517 | #include "win32iop.h" |
---|
518 | |
---|
519 | #endif /* _INC_WIN32_PERL5 */ |
---|
520 | |
---|