root/bdm/libconfig/wincompat.h @ 278

Revision 278, 2.3 kB (checked in by smidl, 15 years ago)

props

  • Property svn:eol-style set to native
Line 
1/* ----------------------------------------------------------------------------
2   libconfig - A library for processing structured configuration files
3   Copyright (C) 2005-2008  Mark A Lindner
4 
5   This file is part of libconfig.
6   
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public License
9   as published by the Free Software Foundation; either version 2.1 of
10   the License, or (at your option) any later version.
11   
12   This library is distributed in the hope that it will be useful, but
13   WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Lesser General Public License for more details.
16   
17   You should have received a copy of the GNU Library General Public
18   License along with this library; if not, see
19   <http://www.gnu.org/licenses/>.
20   ----------------------------------------------------------------------------
21*/
22
23#ifndef __wincompat_h
24#define __wincompat_h
25
26#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
27
28#ifdef _MSC_VER
29#pragma warning (disable: 4996)
30#endif
31
32#define WIN32_LEAN_AND_MEAN
33#include <windows.h>
34
35#define atoll     _atoi64
36#define snprintf  _snprintf
37
38#ifndef __MINGW32__
39#define strtoull  _strtoui64
40#endif // __MINGW32__
41
42#endif
43
44#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
45     || defined(__MINGW32__))
46
47// Why does gcc on MinGW use the Visual C++ style format directives
48// for 64-bit integers? Inquiring minds want to know....
49
50#define INT64_FMT "%I64d"
51#define UINT64_FMT "%I64u"
52
53#define INT64_HEX_FMT "%I64X"
54
55#else // defined(WIN32) || defined(__MINGW32__)
56
57#define INT64_FMT "%lld"
58#define UINT64_FMT "%llu"
59
60#define INT64_HEX_FMT "%llX"
61
62#endif // defined(WIN32) || defined(__MINGW32__)
63
64#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \
65  && ! defined(__MINGW32__)
66
67#define INT64_CONST(I)  (I ## i64)
68#define UINT64_CONST(I) (I ## Ui64)
69
70#ifndef INT32_MAX
71#define INT32_MAX (2147483647)
72#endif
73
74#ifndef INT32_MIN
75#define INT32_MIN (-2147483647-1)
76#endif
77
78#else // defined(WIN32) && ! defined(__MINGW32__)
79
80#define INT64_CONST(I)  (I ## LL)
81#define UINT64_CONST(I) (I ## ULL)
82
83#endif // defined(WIN32) && ! defined(__MINGW32__)
84
85#endif // __wincompat_h
Note: See TracBrowser for help on using the browser.