- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# wincompat.h

    00001 /* ----------------------------------------------------------------------------
    00002    libconfig - A library for processing structured configuration files
    00003    Copyright (C) 2005-2008  Mark A Lindner
    00004
    00005    This file is part of libconfig.
    00006
    00007    This library is free software; you can redistribute it and/or
    00008    modify it under the terms of the GNU Lesser General Public License
    00009    as published by the Free Software Foundation; either version 2.1 of
    00010    the License, or (at your option) any later version.
    00011
    00012    This library is distributed in the hope that it will be useful, but
    00013    WITHOUT ANY WARRANTY; without even the implied warranty of
    00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015    Lesser General Public License for more details.
    00016
    00017    You should have received a copy of the GNU Library General Public
    00018    License along with this library; if not, see
    00019    <http://www.gnu.org/licenses/>.
    00020    ----------------------------------------------------------------------------
    00021 */
    00022
    00023 #ifndef __wincompat_h
    00024 #define __wincompat_h
    00025
    00026 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
    00027
    00028 #ifdef _MSC_VER
    00029 #pragma warning (disable: 4996)
    00030 #endif
    00031
    00032 #define WIN32_LEAN_AND_MEAN
    00033 #include <windows.h>
    00034
    00035 #define atoll     _atoi64
    00036 #define snprintf  _snprintf
    00037
    00038 #ifndef __MINGW32__
    00039 #define strtoull  _strtoui64
    00040 #endif // __MINGW32__
    00041
    00042 #endif
    00043
    00044 #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
    00045      || defined(__MINGW32__))
    00046
    00047 // Why does gcc on MinGW use the Visual C++ style format directives
    00048 // for 64-bit integers? Inquiring minds want to know....
    00049
    00050 #define INT64_FMT "%I64d"
    00051 #define UINT64_FMT "%I64u"
    00052
    00053 #define INT64_HEX_FMT "%I64X"
    00054
    00055 #else // defined(WIN32) || defined(__MINGW32__)
    00056
    00057 #define INT64_FMT "%lld"
    00058 #define UINT64_FMT "%llu"
    00059
    00060 #define INT64_HEX_FMT "%llX"
    00061
    00062 #endif // defined(WIN32) || defined(__MINGW32__)
    00063
    00064 #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) \
    00065   && ! defined(__MINGW32__)
    00066
    00067 #define INT64_CONST(I)  (I ## i64)
    00068 #define UINT64_CONST(I) (I ## Ui64)
    00069
    00070 #ifndef INT32_MAX
    00071 #define INT32_MAX (2147483647)
    00072 #endif
    00073
    00074 #ifndef INT32_MIN
    00075 #define INT32_MIN (-2147483647-1)
    00076 #endif
    00077
    00078 #else // defined(WIN32) && ! defined(__MINGW32__)
    00079
    00080 #define INT64_CONST(I)  (I ## LL)
    00081 #define UINT64_CONST(I) (I ## ULL)
    00082
    00083 #endif // defined(WIN32) && ! defined(__MINGW32__)
    00084
    00085 #endif // __wincompat_h