XenevaOS
Loading...
Searching...
No Matches
doomtype.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// Simple basic typedefs, isolated here to make it easier
17// separating modules.
18//
19
20
21#ifndef __DOOMTYPE__
22#define __DOOMTYPE__
23
24// #define macros to provide functions missing in Windows.
25// Outside Windows, we use strings.h for str[n]casecmp.
26
27
28#ifdef _WIN32
29
30#define strcasecmp _stricmp
31#define strncasecmp _strnicmp
32
33#else
34
35#include <strings.h>
36#include <stdbool.h>
37#endif
38
39
40//
41// The packed attribute forces structures to be packed into the minimum
42// space necessary. If this is not done, the compiler may align structure
43// fields differently to optimize memory access, inflating the overall
44// structure size. It is important to use the packed attribute on certain
45// structures where alignment is important, particularly data read/written
46// to disk.
47//
48
49#ifdef __GNUC__
50#define PACKEDATTR __attribute__((packed))
51#else
52#define PACKEDATTR
53#endif
54
55// C99 integer types; with gcc we just use this. Other compilers
56// should add conditional statements that define the C99 types.
57
58// What is really wanted here is stdint.h; however, some old versions
59// of Solaris don't have stdint.h and only have inttypes.h (the
60// pre-standardisation version). inttypes.h is also in the C99
61// standard and defined to include stdint.h, so include this.
62
63#include <inttypes.h>
64
65#if defined(__cplusplus) || defined(__bool_true_false_are_defined)
66
67//boolean is cast to int* in doom. so to keep size the same, make boolean an int.
68typedef unsigned int boolean;
69
70#else
71
72#ifndef __bool_true_false_are_defined
73typedef enum
74{
75 false = 0,
76 true = 1,
77 undef = 0xFFFFFFFF
79#endif
80
81#endif
82
83typedef uint8_t byte;
84
85#include <limits.h>
86
87#if defined(_WIN32) || defined(__DJGPP__)
88
89#define DIR_SEPARATOR '\\'
90#define DIR_SEPARATOR_S "\\"
91#define PATH_SEPARATOR ';'
92
93#else
94
95#define DIR_SEPARATOR '/'
96#define DIR_SEPARATOR_S "/"
97#define PATH_SEPARATOR ':'
98
99#endif
100
101#define arrlen(array) (sizeof(array) / sizeof(*array))
102
103#endif
104
unsigned char uint8_t
Definition acefiex.h:161
boolean
Definition doomtype.h:74
@ undef
Definition doomtype.h:77
uint8_t byte
Definition doomtype.h:83