Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
posix_types.h
Go to the documentation of this file.
1/* Copyright (C) 2010 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * lightweight header that defines POSIX types.
25 */
26
27#ifndef INCLUDED_POSIX_TYPES
28#define INCLUDED_POSIX_TYPES
29
30// this header defines e.g. ssize_t and int8_t without pulling in all
31// POSIX declarations.
32// included from lib/types.h in place of posix.h; this helps avoid conflicts
33// due to incompatible winsock definitions.
34
35#include "lib/sysdep/os.h" // OS_WIN
36
37// (must come before any system headers because it fixes off_t)
38#if OS_WIN
40#else
41
42// unix/linux/glibc/gcc says that this macro has to be defined when including
43// stdint.h from C++ for stdint.h to define SIZE_MAX and friends
44# ifndef __STDC_LIMIT_MACROS
45# define __STDC_LIMIT_MACROS
46# endif
47
48# include <math.h>
49# include <wchar.h>
50# include <sys/types.h>
51# include <stddef.h>
52# include <limits.h>
53# include <stdint.h>
54
55// but sometimes it still doesn't get defined, so define it ourselves
56# ifndef SIZE_MAX
57# define SIZE_MAX ((size_t)-1)
58# endif
59
60# include <unistd.h>
61
62#endif // #if !OS_WIN
63
64#endif // #ifndef INCLUDED_POSIX_TYPES