[inseperable differences up to perl 5.004_02]
[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 #define  WIN32_LEAN_AND_MEAN
13 #include <windows.h>
14
15 #ifdef   WIN32_LEAN_AND_MEAN            /* C file is NOT a Perl5 original. */
16 #define  CONTEXT        PERL_CONTEXT    /* Avoid conflict of CONTEXT defs. */
17 #define  index          strchr          /* Why 'index'? */
18 #endif /*WIN32_LEAN_AND_MEAN */
19
20 #include <dirent.h>
21 #include <io.h>
22 #include <process.h>
23 #include <stdio.h>
24 #include <direct.h>
25
26 /* For UNIX compatibility. */
27
28 #ifdef __BORLANDC__
29
30 #define _access access
31 #define _chdir chdir
32 #include <sys/types.h>
33
34 #ifndef DllMain
35 #define DllMain DllEntryPoint
36 #endif
37
38 #pragma warn -ccc
39 #pragma warn -rch
40 #pragma warn -sig
41 #pragma warn -pia
42 #pragma warn -par
43 #pragma warn -aus
44 #pragma warn -use
45 #pragma warn -csu
46 #pragma warn -pro
47
48 #else
49
50 typedef long            uid_t;
51 typedef long            gid_t;
52
53 #endif
54
55 extern  uid_t   getuid(void);
56 extern  gid_t   getgid(void);
57 extern  uid_t   geteuid(void);
58 extern  gid_t   getegid(void);
59 extern  int     setuid(uid_t uid);
60 extern  int     setgid(gid_t gid);
61
62 extern  int     kill(int pid, int sig);
63
64 extern  char    *staticlinkmodules[];
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  */
70 /*#define USE_WIN32_RTL_ENV */
71
72 #ifndef USE_WIN32_RTL_ENV
73 #include <stdlib.h>
74 #ifndef EXT
75 #include "EXTERN.h"
76 #endif
77 #undef getenv
78 #define getenv win32_getenv
79 EXT char *win32_getenv(const char *name);
80 #endif
81
82 EXT void Perl_win32_init(int *argcp, char ***argvp);
83
84 #define USE_SOCKETS_AS_HANDLES
85 #ifndef USE_SOCKETS_AS_HANDLES
86 extern FILE *myfdopen(int, char *);
87
88 #undef fdopen
89 #define fdopen myfdopen
90 #endif  /* USE_SOCKETS_AS_HANDLES */
91
92 #define  STANDARD_C     1               /* Perl5 likes standard C. */
93 #define  DOSISH         1               /* Take advantage of DOSish code in Perl5. */
94
95 #define  OP_BINARY      O_BINARY        /* Mistake in in pp_sys.c. */
96
97 #undef   pipe
98 #define  pipe(fd)       win32_pipe((fd), 512, O_BINARY) /* the pipe call is a bit different */
99
100 #undef   pause
101 #define  pause()        sleep((32767L << 16) + 32767)
102
103
104 #undef   times
105 #define  times  mytimes
106
107 #undef   alarm
108 #define  alarm  myalarm
109
110 struct tms {
111         long    tms_utime;
112         long    tms_stime;
113         long    tms_cutime;
114         long    tms_cstime;
115 };
116
117 unsigned int sleep(unsigned int);
118 char *win32PerlLibPath(void);
119 char *win32SiteLibPath(void);
120 int mytimes(struct tms *timebuf);
121 unsigned int myalarm(unsigned int sec);
122 int do_aspawn(void* really, void** mark, void** arglast);
123 int do_spawn(char *cmd);
124 char do_exec(char *cmd);
125 void init_os_extras(void);
126
127 typedef  char *         caddr_t;        /* In malloc.c (core address). */
128
129 /*
130  * Extension Library, only good for VC
131  */
132
133 #define DllExport       __declspec(dllexport)
134 #define DllImport       __declspec(dllimport)
135
136 /*
137  * handle socket stuff, assuming socket is always available
138  */
139
140 #include <sys/socket.h>
141 #include <netdb.h>
142
143 #ifdef _MSC_VER
144 #pragma  warning(disable: 4018 4035 4101 4102 4244 4245 4761)
145 #endif
146
147 int IsWin95(void);
148 int IsWinNT(void);
149
150 #ifndef VER_PLATFORM_WIN32_WINDOWS      /* VC-2.0 headers dont have this */
151 #define VER_PLATFORM_WIN32_WINDOWS      1
152 #endif
153
154 #endif /* _INC_WIN32_PERL5 */