Fix various win32 code blemishes:
[p5sagit/p5-mst-13.2.git] / win32 / win32.h
CommitLineData
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
12#define WIN32_LEAN_AND_MEAN
13#include <windows.h>
14
68dc0745 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 */
0a753a76 19
20#include <dirent.h>
21#include <io.h>
22#include <process.h>
23#include <stdio.h>
24#include <direct.h>
25
68dc0745 26/* For UNIX compatibility. */
0a753a76 27
3e3baf6d 28#ifdef __BORLANDC__
29
30#define _access access
31#define _chdir chdir
32#include <sys/types.h>
33
84902520 34#ifndef DllMain
35#define DllMain DllEntryPoint
36#endif
37
3e3baf6d 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
0a753a76 50typedef long uid_t;
51typedef long gid_t;
52
3e3baf6d 53#endif
0a753a76 54
d55594ae 55#ifdef __cplusplus
56extern "C" {
57#endif
58
0a753a76 59extern uid_t getuid(void);
60extern gid_t getgid(void);
61extern uid_t geteuid(void);
62extern gid_t getegid(void);
0a753a76 63extern int setuid(uid_t uid);
64extern int setgid(gid_t gid);
3e3baf6d 65
0a753a76 66extern int kill(int pid, int sig);
67
d55594ae 68#ifdef __cplusplus
69}
70#endif
71
72
3e3baf6d 73extern char *staticlinkmodules[];
74
75/* if USE_WIN32_RTL_ENV is not defined, Perl uses direct Win32 calls
76 * to read the environment, bypassing the runtime's (usually broken)
77 * facilities for accessing the same. See note in util.c/my_setenv().
78 */
79/*#define USE_WIN32_RTL_ENV */
0551aaa8 80
81#ifndef USE_WIN32_RTL_ENV
2bc71ef8 82#include <stdlib.h>
83#ifndef EXT
84#include "EXTERN.h"
85#endif
0551aaa8 86#undef getenv
87#define getenv win32_getenv
2bc71ef8 88EXT char *win32_getenv(const char *name);
0551aaa8 89#endif
90
d55594ae 91#ifdef __cplusplus
92extern "C" {
93#endif
94
95
84902520 96EXT void Perl_win32_init(int *argcp, char ***argvp);
97
0a753a76 98#define USE_SOCKETS_AS_HANDLES
99#ifndef USE_SOCKETS_AS_HANDLES
d55594ae 100
0a753a76 101extern FILE *myfdopen(int, char *);
102
103#undef fdopen
104#define fdopen myfdopen
68dc0745 105#endif /* USE_SOCKETS_AS_HANDLES */
0a753a76 106
68dc0745 107#define STANDARD_C 1 /* Perl5 likes standard C. */
108#define DOSISH 1 /* Take advantage of DOSish code in Perl5. */
0a753a76 109
3e3baf6d 110#define OP_BINARY O_BINARY /* Mistake in in pp_sys.c. */
0a753a76 111
0a753a76 112#undef pipe
3e3baf6d 113#define pipe(fd) win32_pipe((fd), 512, O_BINARY) /* the pipe call is a bit different */
0a753a76 114
115#undef pause
116#define pause() sleep((32767L << 16) + 32767)
117
118
119#undef times
120#define times mytimes
121
122#undef alarm
123#define alarm myalarm
124
125struct tms {
126 long tms_utime;
127 long tms_stime;
128 long tms_cutime;
129 long tms_cstime;
68dc0745 130};
c90c0ff4 131
0a753a76 132unsigned int sleep(unsigned int);
3e3baf6d 133char *win32PerlLibPath(void);
b4793f7f 134char *win32SiteLibPath(void);
0a753a76 135int mytimes(struct tms *timebuf);
136unsigned int myalarm(unsigned int sec);
d55594ae 137int do_aspawn(void* really, void ** mark, void ** arglast);
0a753a76 138int do_spawn(char *cmd);
6890e559 139char do_exec(char *cmd);
ad2e33dc 140void init_os_extras(void);
0a753a76 141
d55594ae 142#ifdef __cplusplus
143}
144#endif
145
68dc0745 146typedef char * caddr_t; /* In malloc.c (core address). */
0a753a76 147
68dc0745 148/*
149 * Extension Library, only good for VC
150 */
0a753a76 151
152#define DllExport __declspec(dllexport)
3e3baf6d 153#define DllImport __declspec(dllimport)
0a753a76 154
68dc0745 155/*
156 * handle socket stuff, assuming socket is always available
157 */
0a753a76 158
159#include <sys/socket.h>
160#include <netdb.h>
161
3e3baf6d 162#ifdef _MSC_VER
0a753a76 163#pragma warning(disable: 4018 4035 4101 4102 4244 4245 4761)
3e3baf6d 164#endif
0a753a76 165
d55594ae 166#ifdef __cplusplus
167extern "C" {
168#endif
169
3fe9a6f1 170int IsWin95(void);
171int IsWinNT(void);
172
d55594ae 173#ifdef __cplusplus
174}
175#endif
176
177
3fe9a6f1 178#ifndef VER_PLATFORM_WIN32_WINDOWS /* VC-2.0 headers dont have this */
179#define VER_PLATFORM_WIN32_WINDOWS 1
180#endif
181
68dc0745 182#endif /* _INC_WIN32_PERL5 */