Line data Source code
1 :
2 : /* Copyright (c) 2005-2013, Stefan Eilemann <eile@equalizergraphics.com>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : /** Includes key system header files and defines essential base macros. */
19 : #ifndef LUNCHBOX_OS_H
20 : #define LUNCHBOX_OS_H
21 :
22 : #include <lunchbox/defines.h>
23 : #include <lunchbox/compiler.h>
24 :
25 : #ifdef _WIN32
26 : # ifndef WIN32
27 : # define WIN32
28 : # endif
29 : # ifndef WIN32_API
30 : # define WIN32_API
31 : # endif
32 : # ifndef _MSC_VER
33 : # define USE_SYS_TYPES_FD_SET
34 : # endif
35 : # ifndef _WIN32_WINNT // Hopefully to higher than 0x500...
36 : # define _WIN32_WINNT 0x501 // => XP, for WM_XBUTTONDOWN and others
37 : # endif
38 : # ifndef _USE_MATH_DEFINES
39 : # define _USE_MATH_DEFINES
40 : # endif
41 : # ifndef WIN32_LEAN_AND_MEAN
42 : # define WIN32_LEAN_AND_MEAN
43 : # endif
44 : # ifndef NOMINMAX
45 : # define NOMINMAX
46 : # endif
47 : # include <winsock2.h>
48 : # include <windows.h>
49 : # include <windef.h>
50 : #endif
51 :
52 : #include <cmath>
53 : #include <cstdio>
54 : #include <cstdlib>
55 :
56 : #ifndef _MSC_VER
57 : # include <stdint.h>
58 : # include <sys/param.h> // for MIN/MAX
59 : # include <strings.h>
60 : #endif
61 :
62 : #ifdef __APPLE__
63 : # include <crt_externs.h>
64 : # define environ (*_NSGetEnviron())
65 : #elif !defined(_WIN32)
66 : extern "C" char **environ;
67 : #endif
68 :
69 : namespace lunchbox
70 : {
71 : /** OS-independent call to bzero(3). @version 1.7.1 */
72 1341 : static inline void setZero( void* ptr, const size_t size )
73 : {
74 : #ifdef _WIN32
75 : ::memset( ptr, 0, size );
76 : #else
77 1341 : ::bzero( ptr, size );
78 : #endif
79 1341 : }
80 : }
81 :
82 : #endif //LUNCHBOX_OS_H
|