diff options
author | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2017-07-21 09:37:32 (GMT) |
---|---|---|
committer | Adrián Medraño Calvo <adrian@medranocalvo.com> | 2017-07-21 11:40:49 (GMT) |
commit | f10a85adccccb3efccfc84a7d4ca12cc66c7fb1c (patch) | |
tree | 8769ca4130b57ade60673f72aa70439e335d7d3e /generic/tkbltInt.h | |
parent | 75db3cd1d501700e657da43148197665f71d7a70 (diff) | |
download | blt-f10a85adccccb3efccfc84a7d4ca12cc66c7fb1c.zip blt-f10a85adccccb3efccfc84a7d4ca12cc66c7fb1c.tar.gz blt-f10a85adccccb3efccfc84a7d4ca12cc66c7fb1c.tar.bz2 |
Add cmath and printf wrappers for Windows
Needed for compiling with MSVC 2010.
Diffstat (limited to 'generic/tkbltInt.h')
-rw-r--r-- | generic/tkbltInt.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/generic/tkbltInt.h b/generic/tkbltInt.h new file mode 100644 index 0000000..f13603a --- /dev/null +++ b/generic/tkbltInt.h @@ -0,0 +1,72 @@ +/* + * Copyright 2017 Patzschke+Rasp Software GmbH + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __TKBLT_INT_H__ + +#if defined(_MSC_VER) + +#include <limits> + +#if !defined(NAN) +#define NAN (std::numeric_limits<double>::quiet_NaN()) +#endif + +#if !defined(isnan) +#define isnan(x) _isnan(x) +#endif + +#if !defined(isfinite) +#define isfinite(x) _finite(x) +#endif + +#if !defined(isinf) +#define isinf(x) !_finite(x) +#endif + +#if !defined(numeric_limits) +#define numeric_limits(x) _numeric_limits(x) +#endif + +#if _MSC_VER < 1900 +#define snprintf _snprintf +#else +#include <stdio.h> //sprintf +#endif + +#endif /* _MSC_VER */ + +/* + * Silence warnings about unused parameters while keeping the parameter name. + */ +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__MSC_VER__) +# define UNUSED(x) __pragma(warning(suppress:4100)) x +#elif defined(__cplusplus) +# define UNUSED(x) +#else +# define UNUSED(x) x +#endif + +#endif /* __TKBLT_INT_H__ */ |