GCC + Threads on Win32 - best gcc results yet
[p5sagit/p5-mst-13.2.git] / win32 / win32.h
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  */
9 #ifndef  _INC_WIN32_PERL5
10 #define  _INC_WIN32_PERL5
11
12 #ifdef __GNUC__
13 #define __declspec(x)
14 typedef long long __int64;
15 #define Win32_Winsock
16 #endif
17
18
19
20 #define  WIN32_LEAN_AND_MEAN
21 #include <windows.h>
22
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 */
27
28 #include <dirent.h>
29 #include <io.h>
30 #include <process.h>
31 #include <stdio.h>
32 #include <direct.h>
33 #include <stdlib.h>
34 #ifndef EXT
35 #include "EXTERN.h"
36 #endif
37
38 struct tms {
39         long    tms_utime;
40         long    tms_stime;
41         long    tms_cutime;
42         long    tms_cstime;
43 };
44
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? */
60 #define DllExport       __declspec(dllexport)
61 #define DllImport       __declspec(dllimport)
62
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 */
71
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++ */
85
86 #define _access access
87 #define _chdir chdir
88 #include <sys/types.h>
89
90 #ifndef DllMain
91 #define DllMain DllEntryPoint
92 #endif
93
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
106 #ifdef _MSC_VER                 /* Microsoft Visual C++ */
107
108 typedef long            uid_t;
109 typedef long            gid_t;
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 */
115
116 #endif
117
118 START_EXTERN_C
119
120 /* For UNIX compatibility. */
121
122 extern  uid_t   getuid(void);
123 extern  gid_t   getgid(void);
124 extern  uid_t   geteuid(void);
125 extern  gid_t   getegid(void);
126 extern  int     setuid(uid_t uid);
127 extern  int     setgid(gid_t gid);
128 extern  int     kill(int pid, int sig);
129 extern  void    *sbrk(int need);
130
131 #undef   Stat
132 #define  Stat           win32_stat
133
134 #undef   init_os_extras
135 #define  init_os_extras Perl_init_os_extras
136
137 EXT void                Perl_win32_init(int *argcp, char ***argvp);
138 EXT void                Perl_init_os_extras(void);
139
140 #ifndef USE_SOCKETS_AS_HANDLES
141 extern FILE *           my_fdopen(int, char *);
142 #endif
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);
147 extern char *           win32PerlLibPath(char *sfx,...);
148 extern int              IsWin95(void);
149 extern int              IsWinNT(void);
150
151 extern char *           staticlinkmodules[];
152
153 END_EXTERN_C
154
155 typedef  char *         caddr_t;        /* In malloc.c (core address). */
156
157 /*
158  * handle socket stuff, assuming socket is always available
159  */
160 #include <sys/socket.h>
161 #include <netdb.h>
162
163 #ifdef MYMALLOC
164 #define EMBEDMYMALLOC   /**/
165 /* #define USE_PERL_SBRK        /**/
166 /* #define PERL_SBRK_VIA_MALLOC /**/
167 #endif
168
169 #if defined(PERLDLL) && !defined(PERL_CORE)
170 #define PERL_CORE
171 #endif
172
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
181 #endif /* _INC_WIN32_PERL5 */