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 | |
97 | #ifdef __BORLANDC__ /* Microsoft Visual 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 | |
117 | #else |
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 | |
127 | /* compatibility stuff for other compilers goes here */ |
0a753a76 |
128 | |
3e3baf6d |
129 | #endif |
0a753a76 |
130 | |
390b85e7 |
131 | START_EXTERN_C |
f3986ebb |
132 | |
133 | /* For UNIX compatibility. */ |
134 | |
0a753a76 |
135 | extern uid_t getuid(void); |
136 | extern gid_t getgid(void); |
137 | extern uid_t geteuid(void); |
138 | extern gid_t getegid(void); |
0a753a76 |
139 | extern int setuid(uid_t uid); |
140 | extern int setgid(gid_t gid); |
141 | extern int kill(int pid, int sig); |
161b471a |
142 | extern void *sbrk(int need); |
d55594ae |
143 | |
f3986ebb |
144 | #undef Stat |
145 | #define Stat win32_stat |
3e3baf6d |
146 | |
f3986ebb |
147 | #undef init_os_extras |
148 | #define init_os_extras Perl_init_os_extras |
390b85e7 |
149 | |
22239a37 |
150 | DllExport void Perl_win32_init(int *argcp, char ***argvp); |
151 | DllExport void Perl_init_os_extras(void); |
0551aaa8 |
152 | |
f3986ebb |
153 | #ifndef USE_SOCKETS_AS_HANDLES |
154 | extern FILE * my_fdopen(int, char *); |
d55594ae |
155 | #endif |
f3986ebb |
156 | extern int my_fclose(FILE *); |
157 | extern int do_aspawn(void* really, void ** mark, void ** arglast); |
158 | extern int do_spawn(char *cmd); |
159 | extern char do_exec(char *cmd); |
acbc2db6 |
160 | extern char * win32PerlLibPath(char *sfx,...); |
f3986ebb |
161 | extern int IsWin95(void); |
162 | extern int IsWinNT(void); |
d55594ae |
163 | |
f3986ebb |
164 | extern char * staticlinkmodules[]; |
390b85e7 |
165 | |
166 | END_EXTERN_C |
d55594ae |
167 | |
68dc0745 |
168 | typedef char * caddr_t; /* In malloc.c (core address). */ |
0a753a76 |
169 | |
68dc0745 |
170 | /* |
68dc0745 |
171 | * handle socket stuff, assuming socket is always available |
172 | */ |
0a753a76 |
173 | #include <sys/socket.h> |
174 | #include <netdb.h> |
175 | |
bbc8f9de |
176 | #ifdef MYMALLOC |
177 | #define EMBEDMYMALLOC /**/ |
178 | /* #define USE_PERL_SBRK /**/ |
179 | /* #define PERL_SBRK_VIA_MALLOC /**/ |
180 | #endif |
181 | |
c31fac66 |
182 | #if defined(PERLDLL) && !defined(PERL_CORE) |
bbc8f9de |
183 | #define PERL_CORE |
184 | #endif |
185 | |
a868473f |
186 | #ifdef USE_BINMODE_SCRIPTS |
187 | #define PERL_SCRIPT_MODE "rb" |
188 | EXT void win32_strip_return(struct sv *sv); |
189 | #else |
190 | #define PERL_SCRIPT_MODE "r" |
191 | #define win32_strip_return(sv) NOOP |
192 | #endif |
193 | |
c53bd28a |
194 | /* |
195 | * Now Win32 specific per-thread data stuff |
196 | */ |
197 | |
198 | #ifdef USE_THREADS |
199 | #ifndef USE_DECLSPEC_THREAD |
200 | #define HAVE_THREAD_INTERN |
201 | |
202 | struct thread_intern |
203 | { |
204 | char Wstrerror_buffer[512]; |
205 | struct servent Wservent; |
206 | }; |
207 | #endif |
208 | #endif |
209 | |
68dc0745 |
210 | #endif /* _INC_WIN32_PERL5 */ |