/
de_platform.h
92 lines (73 loc) · 1.98 KB
/
de_platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* DE1: $Id$
* Copyright (C) 2003, 2004 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not: http://www.opensource.org/
*/
/*
* de_platform.h: Platform Independence
*
* Define either WIN32 or UNIX when compiling.
*
* Use this header file in source files which can be compiled on any
* platform but still use some platform specific code.
*/
#ifndef __DOOMSDAY_PLATFORM__
#define __DOOMSDAY_PLATFORM__
#include "dd_types.h"
/*
* The Win32 Platform
*/
#if defined(WIN32)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <io.h>
#define INTEGER64 __int64
#define DIR_SEP_CHAR '\\'
#define DIR_SEP_STR "\\"
#define DIR_WRONG_SEP_CHAR '/'
#endif // WIN32
/*
* The Unix Platform
*/
#if defined(UNIX)
#include <string.h>
#include <errno.h>
typedef long long int INTEGER64;
typedef unsigned int DWORD;
/*
* Networking.
*/
#define INVALID_SOCKET (-1)
#define SOCKET_ERROR (-1)
/*
* File system routines.
*/
#define _getdrive() (0)
#define _chdrive(x)
#define _getcwd getcwd
#define _chdir chdir
#define DIR_SEP_CHAR '/'
#define DIR_SEP_STR "/"
#define DIR_WRONG_SEP_CHAR '\\'
#include "Unix/sys_path.h"
/*
* Replacements for the Win32 findfirst/next routines.
*/
#include "Unix/sys_findfile.h"
#define _A_SUBDIR A_SUBDIR
#define _findfirst myfindfirst
#define _findnext myfindnext
#define _findend myfindend
#endif // UNIX
#endif // __DOOMSDAY_PLATFORM__