blob: e509e9bf37428ac2152396bad66fd476d5537a4b [file] [log] [blame]
Franklin Weia855d622017-01-21 15:18:31 -05001/*
2 * win32 compatibility header. Takes care of some legacy code issues
3 * and incompatibilities at the source level.
4 *
5 * Written by Ryan C. Gordon (icculus@clutteredmind.org)
6 *
7 * Please do NOT harrass Ken Silverman about any code modifications
8 * (including this file) to BUILD.
9 */
10
11/*
12 * "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
13 * Ken Silverman's official web site: "http://www.advsys.net/ken"
14 * See the included license file "BUILDLIC.TXT" for license info.
15 * This file IS NOT A PART OF Ken Silverman's original release
16 */
17
18
19
20#ifndef _INCLUDE_WIN32_COMPAT_H_
21#define _INCLUDE_WIN32_COMPAT_H_
22
23#if (!defined PLATFORM_WIN32)
24#error PLATFORM_WIN32 is not defined.
25#endif
26
27#define PLATFORM_SUPPORTS_SDL
28
29#include <stdio.h>
30
31#if (!defined _MSC_VER)
32 #include <unistd.h>
33#else
34 #include <fcntl.h>
35 #include <SYS\STAT.H>
36#endif
37
38#include <stdlib.h>
39#include <io.h>
40#include <direct.h>
41#include <conio.h>
42#include <dos.h>
43#include <assert.h>
44#include <string.h>
45
46#define kmalloc(x) malloc(x)
47#define kkmalloc(x) malloc(x)
48#define kfree(x) free(x)
49#define kkfree(x) free(x)
50
51#ifdef FP_OFF
52#undef FP_OFF
53#endif
54
55#define FP_OFF(x) ((long) (x))
56
57/* !!! This might be temporary. */
58#define printext16 printext256
59#define printext16_noupdate printext256_noupdate
60
61#ifndef max
62#define max(x, y) (((x) > (y)) ? (x) : (y))
63#endif
64
65#ifndef min
66#define min(x, y) (((x) < (y)) ? (x) : (y))
67#endif
68
69#if (defined __WATCOMC__)
70#define inline
71#pragma intrinsic(min);
72#pragma intrinsic(max);
73#define __int64 long long
74#endif
75
76#if (defined _MSC_VER)
77#if ((!defined _INTEGRAL_MAX_BITS) || (_INTEGRAL_MAX_BITS < 64))
78#error __int64 type not supported
79#endif
80
81#define open _open
82#define O_BINARY _O_BINARY
83#define O_RDONLY _O_RDONLY
84#define O_WRONLY _O_WRONLY
85#define O_RDWR _O_RDWR
86#define O_TRUNC _O_TRUNC
87#define O_CREAT _O_CREAT
88#define S_IREAD _S_IREAD
89#define S_IWRITE _S_IWRITE
90#define S_IRDWR _S_IRDWR
91#endif /* defined _MSC_VER */
92
93#define snprintf _snprintf
94
95#define strncasecmp strnicmp
96
97//Damn you Microsoft, how hard would it REALLY be to support C99 ?!??!?!
98#define inline
99#include "windows/inttypes.h"
100
101#endif
102
103/* end of win32_compat.h ... */
104
105
106