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