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