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 | ||
a835ef8a NIS |
12 | #ifdef __GNUC__ |
13 | #define __declspec(x) | |
14 | typedef long long __int64; | |
15 | #define Win32_Winsock | |
16 | #endif | |
17 | ||
c69f112c NIS |
18 | |
19 | ||
0a753a76 | 20 | #define WIN32_LEAN_AND_MEAN |
21 | #include <windows.h> | |
22 | ||
68dc0745 | 23 | #ifdef WIN32_LEAN_AND_MEAN /* C file is NOT a Perl5 original. */ |
24 | #define CONTEXT PERL_CONTEXT /* Avoid conflict of CONTEXT defs. */ | |
25 | #define index strchr /* Why 'index'? */ | |
26 | #endif /*WIN32_LEAN_AND_MEAN */ | |
0a753a76 | 27 | |
28 | #include <dirent.h> | |
29 | #include <io.h> | |
30 | #include <process.h> | |
31 | #include <stdio.h> | |
32 | #include <direct.h> | |
390b85e7 GS |
33 | #include <stdlib.h> |
34 | #ifndef EXT | |
35 | #include "EXTERN.h" | |
36 | #endif | |
37 | ||
c69f112c NIS |
38 | struct tms { |
39 | long tms_utime; | |
40 | long tms_stime; | |
41 | long tms_cutime; | |
42 | long tms_cstime; | |
43 | }; | |
44 | ||
390b85e7 GS |
45 | #ifndef START_EXTERN_C |
46 | #ifdef __cplusplus | |
47 | # define START_EXTERN_C extern "C" { | |
48 | # define END_EXTERN_C } | |
49 | # define EXTERN_C extern "C" | |
50 | #else | |
51 | # define START_EXTERN_C | |
52 | # define END_EXTERN_C | |
53 | # define EXTERN_C | |
54 | #endif | |
55 | #endif | |
56 | ||
57 | #define STANDARD_C 1 | |
58 | #define DOSISH 1 /* no escaping our roots */ | |
59 | #define OP_BINARY O_BINARY /* mistake in in pp_sys.c? */ | |
f3986ebb GS |
60 | #define DllExport __declspec(dllexport) |
61 | #define DllImport __declspec(dllimport) | |
0a753a76 | 62 | |
f3986ebb GS |
63 | /* Define USE_SOCKETS_AS_HANDLES to enable emulation of windows sockets as |
64 | * real filehandles. XXX Should always be defined (the other version is untested) */ | |
65 | #define USE_SOCKETS_AS_HANDLES | |
66 | ||
67 | /* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls | |
68 | * to read the environment, bypassing the runtime's (usually broken) | |
69 | * facilities for accessing the same. See note in util.c/my_setenv(). */ | |
70 | /*#define USE_WIN32_RTL_ENV */ | |
0a753a76 | 71 | |
f3986ebb GS |
72 | /* Define USE_FIXED_OSFHANDLE to fix VC's _open_osfhandle() on W95. |
73 | * Can only enable it if not using the DLL CRT (it doesn't expose internals) */ | |
74 | #if defined(_MSC_VER) && !defined(_DLL) && defined(_M_IX86) | |
75 | #define USE_FIXED_OSFHANDLE | |
76 | #endif | |
77 | ||
78 | #ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers dont have this */ | |
79 | #define VER_PLATFORM_WIN32_WINDOWS 1 | |
80 | #endif | |
81 | ||
82 | /* Compiler-specific stuff. */ | |
83 | ||
84 | #ifdef __BORLANDC__ /* Microsoft Visual C++ */ | |
3e3baf6d TB |
85 | |
86 | #define _access access | |
87 | #define _chdir chdir | |
88 | #include <sys/types.h> | |
89 | ||
84902520 TB |
90 | #ifndef DllMain |
91 | #define DllMain DllEntryPoint | |
92 | #endif | |
93 | ||
3e3baf6d TB |
94 | #pragma warn -ccc |
95 | #pragma warn -rch | |
96 | #pragma warn -sig | |
97 | #pragma warn -pia | |
98 | #pragma warn -par | |
99 | #pragma warn -aus | |
100 | #pragma warn -use | |
101 | #pragma warn -csu | |
102 | #pragma warn -pro | |
103 | ||
104 | #else | |
105 | ||
f3986ebb GS |
106 | #ifdef _MSC_VER /* Microsoft Visual C++ */ |
107 | ||
0a753a76 | 108 | typedef long uid_t; |
109 | typedef long gid_t; | |
f3986ebb GS |
110 | #pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761) |
111 | ||
112 | #endif /* _MSC_VER */ | |
113 | ||
114 | /* compatibility stuff for other compilers goes here */ | |
0a753a76 | 115 | |
3e3baf6d | 116 | #endif |
0a753a76 | 117 | |
390b85e7 | 118 | START_EXTERN_C |
f3986ebb GS |
119 | |
120 | /* For UNIX compatibility. */ | |
121 | ||
0a753a76 | 122 | extern uid_t getuid(void); |
123 | extern gid_t getgid(void); | |
124 | extern uid_t geteuid(void); | |
125 | extern gid_t getegid(void); | |
0a753a76 | 126 | extern int setuid(uid_t uid); |
127 | extern int setgid(gid_t gid); | |
128 | extern int kill(int pid, int sig); | |
161b471a | 129 | extern void *sbrk(int need); |
d55594ae | 130 | |
f3986ebb GS |
131 | #undef Stat |
132 | #define Stat win32_stat | |
3e3baf6d | 133 | |
f3986ebb GS |
134 | #undef init_os_extras |
135 | #define init_os_extras Perl_init_os_extras | |
390b85e7 | 136 | |
f3986ebb GS |
137 | EXT void Perl_win32_init(int *argcp, char ***argvp); |
138 | EXT void Perl_init_os_extras(void); | |
0551aaa8 | 139 | |
f3986ebb GS |
140 | #ifndef USE_SOCKETS_AS_HANDLES |
141 | extern FILE * my_fdopen(int, char *); | |
d55594ae | 142 | #endif |
f3986ebb GS |
143 | extern int my_fclose(FILE *); |
144 | extern int do_aspawn(void* really, void ** mark, void ** arglast); | |
145 | extern int do_spawn(char *cmd); | |
146 | extern char do_exec(char *cmd); | |
acbc2db6 | 147 | extern char * win32PerlLibPath(char *sfx,...); |
f3986ebb GS |
148 | extern int IsWin95(void); |
149 | extern int IsWinNT(void); | |
d55594ae | 150 | |
f3986ebb | 151 | extern char * staticlinkmodules[]; |
390b85e7 GS |
152 | |
153 | END_EXTERN_C | |
d55594ae | 154 | |
68dc0745 | 155 | typedef char * caddr_t; /* In malloc.c (core address). */ |
0a753a76 | 156 | |
68dc0745 | 157 | /* |
68dc0745 | 158 | * handle socket stuff, assuming socket is always available |
159 | */ | |
0a753a76 | 160 | #include <sys/socket.h> |
161 | #include <netdb.h> | |
162 | ||
bbc8f9de NIS |
163 | #ifdef MYMALLOC |
164 | #define EMBEDMYMALLOC /**/ | |
165 | /* #define USE_PERL_SBRK /**/ | |
166 | /* #define PERL_SBRK_VIA_MALLOC /**/ | |
167 | #endif | |
168 | ||
c31fac66 | 169 | #if defined(PERLDLL) && !defined(PERL_CORE) |
bbc8f9de NIS |
170 | #define PERL_CORE |
171 | #endif | |
172 | ||
a868473f NIS |
173 | #ifdef USE_BINMODE_SCRIPTS |
174 | #define PERL_SCRIPT_MODE "rb" | |
175 | EXT void win32_strip_return(struct sv *sv); | |
176 | #else | |
177 | #define PERL_SCRIPT_MODE "r" | |
178 | #define win32_strip_return(sv) NOOP | |
179 | #endif | |
180 | ||
68dc0745 | 181 | #endif /* _INC_WIN32_PERL5 */ |