8cf8b7c01ccde01176e7cfd603ddda441430ff81
[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 #pragma warn -ccc
35 #pragma warn -rch
36 #pragma warn -sig
37 #pragma warn -pia
38 #pragma warn -par
39 #pragma warn -aus
40 #pragma warn -use
41 #pragma warn -csu
42 #pragma warn -pro
43
44 #else
45
46 typedef long            uid_t;
47 typedef long            gid_t;
48
49 #endif
50
51 extern  uid_t   getuid(void);
52 extern  gid_t   getgid(void);
53 extern  uid_t   geteuid(void);
54 extern  gid_t   getegid(void);
55 extern  int     setuid(uid_t uid);
56 extern  int     setgid(gid_t gid);
57
58 extern  int     kill(int pid, int sig);
59
60 extern  char    *staticlinkmodules[];
61
62 /* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls
63  * to read the environment, bypassing the runtime's (usually broken)
64  * facilities for accessing the same.  See note in util.c/my_setenv().
65  */
66 /*#define USE_WIN32_RTL_ENV */
67
68 #ifndef USE_WIN32_RTL_ENV
69 #include <stdlib.h>
70 #ifndef EXT
71 #include "EXTERN.h"
72 #endif
73 #undef getenv
74 #define getenv win32_getenv
75 EXT char *win32_getenv(const char *name);
76 #endif
77
78 #define USE_SOCKETS_AS_HANDLES
79 #ifndef USE_SOCKETS_AS_HANDLES
80 extern FILE *myfdopen(int, char *);
81
82 #undef fdopen
83 #define fdopen myfdopen
84 #endif  /* USE_SOCKETS_AS_HANDLES */
85
86 #define  STANDARD_C     1               /* Perl5 likes standard C. */
87 #define  DOSISH         1               /* Take advantage of DOSish code in Perl5. */
88
89 #define  OP_BINARY      O_BINARY        /* Mistake in in pp_sys.c. */
90
91 #undef   pipe
92 #define  pipe(fd)       win32_pipe((fd), 512, O_BINARY) /* the pipe call is a bit different */
93
94 #undef   pause
95 #define  pause()        sleep((32767L << 16) + 32767)
96
97
98 #undef   times
99 #define  times  mytimes
100
101 #undef   alarm
102 #define  alarm  myalarm
103
104 struct tms {
105         long    tms_utime;
106         long    tms_stime;
107         long    tms_cutime;
108         long    tms_cstime;
109 };
110
111 unsigned int sleep(unsigned int);
112 char *win32PerlLibPath(void);
113 char *win32SiteLibPath(void);
114 int mytimes(struct tms *timebuf);
115 unsigned int myalarm(unsigned int sec);
116 int do_aspawn(void* really, void** mark, void** arglast);
117 int do_spawn(char *cmd);
118 char do_exec(char *cmd);
119 void init_os_extras(void);
120
121 typedef  char *         caddr_t;        /* In malloc.c (core address). */
122
123 /*
124  * Extension Library, only good for VC
125  */
126
127 #define DllExport       __declspec(dllexport)
128 #define DllImport       __declspec(dllimport)
129
130 /*
131  * handle socket stuff, assuming socket is always available
132  */
133
134 #include <sys/socket.h>
135 #include <netdb.h>
136
137 #ifdef _MSC_VER
138 #pragma  warning(disable: 4018 4035 4101 4102 4244 4245 4761)
139 #endif
140
141 int IsWin95(void);
142 int IsWinNT(void);
143
144 #ifndef VER_PLATFORM_WIN32_WINDOWS      /* VC-2.0 headers dont have this */
145 #define VER_PLATFORM_WIN32_WINDOWS      1
146 #endif
147
148 #endif /* _INC_WIN32_PERL5 */