| 1 | // config.hpp ---------------------------------------------------------------// |
| 2 | |
| 3 | // Copyright 2012 Vicente J. Botet Escriba |
| 4 | |
| 5 | // Distributed under the Boost Software License, Version 1.0. |
| 6 | // See http://www.boost.org/LICENSE_1_0.txt |
| 7 | |
| 8 | |
| 9 | #ifndef BOOST_RATIO_CONFIG_HPP |
| 10 | #define BOOST_RATIO_CONFIG_HPP |
| 11 | |
| 12 | #include <boost/config.hpp> |
| 13 | #include <boost/cstdint.hpp> |
| 14 | |
| 15 | |
| 16 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) |
| 17 | # if ! defined BOOST_NO_CXX11_U16STRING |
| 18 | # define BOOST_NO_CXX11_U16STRING |
| 19 | # endif |
| 20 | # if ! defined BOOST_NO_CXX11_U32STRING |
| 21 | # define BOOST_NO_CXX11_U32STRING |
| 22 | # endif |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | #if !defined BOOST_RATIO_VERSION |
| 27 | #define BOOST_RATIO_VERSION 1 |
| 28 | #else |
| 29 | #if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2 |
| 30 | #error "BOOST_RATIO_VERSION must be 1 or 2" |
| 31 | #endif |
| 32 | #endif |
| 33 | |
| 34 | #if BOOST_RATIO_VERSION==1 |
| 35 | #if ! defined BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 |
| 36 | #define BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 |
| 37 | #endif |
| 38 | #endif |
| 39 | |
| 40 | #if BOOST_RATIO_VERSION==2 |
| 41 | #if ! defined BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 |
| 42 | #define BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 |
| 43 | #endif |
| 44 | #endif |
| 45 | |
| 46 | #ifdef INTMAX_C |
| 47 | #define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a) |
| 48 | #else |
| 49 | #define BOOST_RATIO_INTMAX_C(a) a##LL |
| 50 | #endif |
| 51 | |
| 52 | #ifdef UINTMAX_C |
| 53 | #define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a) |
| 54 | #else |
| 55 | #define BOOST_RATIO_UINTMAX_C(a) a##ULL |
| 56 | #endif |
| 57 | |
| 58 | #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL) |
| 59 | |
| 60 | |
| 61 | #ifndef BOOST_NO_CXX11_STATIC_ASSERT |
| 62 | #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) |
| 63 | #elif defined(BOOST_RATIO_USES_STATIC_ASSERT) |
| 64 | #include <boost/static_assert.hpp> |
| 65 | #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) |
| 66 | #elif defined(BOOST_RATIO_USES_MPL_ASSERT) |
| 67 | #include <boost/mpl/assert.hpp> |
| 68 | #include <boost/mpl/bool.hpp> |
| 69 | #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \ |
| 70 | BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) |
| 71 | #else |
| 72 | //~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT) |
| 73 | #define BOOST_RATIO_CONCAT(A,B) A##B |
| 74 | #define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B) |
| 75 | #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1] |
| 76 | //~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) |
| 77 | #endif |
| 78 | |
| 79 | #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT) |
| 80 | #define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add" |
| 81 | #define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub" |
| 82 | #define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul" |
| 83 | #define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div" |
| 84 | #define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range" |
| 85 | #define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0" |
| 86 | #define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range" |
| 87 | #endif |
| 88 | |
| 89 | |
| 90 | //#define BOOST_RATIO_EXTENSIONS |
| 91 | |
| 92 | #endif // header |
| 93 | |