Chris@16: /*============================================================================= Chris@16: Boost.Wave: A Standard compliant C++ preprocessor library Chris@16: Definition of the various language support constants Chris@16: Chris@16: http://www.boost.org/ Chris@16: Chris@16: Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost Chris@16: Software License, Version 1.0. (See accompanying file Chris@16: LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: =============================================================================*/ Chris@16: #if !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED) Chris@16: #define LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: // this must occur after all of the includes and before any code appears Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: #include BOOST_ABI_PREFIX Chris@16: #endif Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: namespace boost { Chris@16: namespace wave { Chris@16: Chris@16: enum language_support { Chris@16: // support flags for C++98 Chris@16: support_normal = 0x01, Chris@16: support_cpp = support_normal, Chris@16: Chris@16: support_option_long_long = 0x02, Chris@16: Chris@16: #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 Chris@16: // support flags for C99 Chris@16: support_option_variadics = 0x04, Chris@16: support_c99 = support_option_variadics | support_option_long_long | 0x08, Chris@16: #endif Chris@16: #if BOOST_WAVE_SUPPORT_CPP0X != 0 Chris@16: support_cpp0x = support_option_variadics | support_option_long_long | 0x10, Chris@16: support_cpp11 = support_cpp0x, Chris@16: #endif Chris@16: Chris@16: support_option_mask = 0xFFC0, Chris@16: support_option_emit_contnewlines = 0x0040, Chris@16: support_option_insert_whitespace = 0x0080, Chris@16: support_option_preserve_comments = 0x0100, Chris@16: support_option_no_character_validation = 0x0200, Chris@16: support_option_convert_trigraphs = 0x0400, Chris@16: support_option_single_line = 0x0800, Chris@16: support_option_prefer_pp_numbers = 0x1000, Chris@16: support_option_emit_line_directives = 0x2000, Chris@16: support_option_include_guard_detection = 0x4000, Chris@16: support_option_emit_pragma_directives = 0x8000 Chris@16: }; Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // need_cpp Chris@16: // Chris@16: // Extract, if the language to support is C++98 Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline bool Chris@16: need_cpp(language_support language) Chris@16: { Chris@16: return (language & ~support_option_mask) == support_cpp; Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // need_cpp0x Chris@16: // Chris@16: // Extract, if the language to support is C++11 Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: #if BOOST_WAVE_SUPPORT_CPP0X != 0 Chris@16: Chris@16: inline bool Chris@16: need_cpp0x(language_support language) Chris@16: { Chris@16: return (language & ~support_option_mask) == support_cpp0x; Chris@16: } Chris@16: Chris@16: #else Chris@16: Chris@16: inline bool Chris@16: need_cpp0x(language_support language) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: Chris@16: #endif Chris@16: Chris@16: #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // need_c99 Chris@16: // Chris@16: // Extract, if the language to support is C99 Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline bool Chris@16: need_c99(language_support language) Chris@16: { Chris@16: return (language & ~support_option_mask) == support_c99; Chris@16: } Chris@16: Chris@16: #else // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline bool Chris@16: need_variadics(language_support language) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline language_support Chris@16: enable_variadics(language_support language, bool enable = true) Chris@16: { Chris@16: return language; Chris@16: } Chris@16: Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: inline bool Chris@16: need_c99(language_support language) Chris@16: { Chris@16: return false; Chris@16: } Chris@16: Chris@16: #endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // get_support_options Chris@16: // Chris@16: // Set preserve comments support in the language to support Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline language_support Chris@16: get_support_options(language_support language) Chris@16: { Chris@16: return static_cast(language & support_option_mask); Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // set_support_options Chris@16: // Chris@16: // Set language option (for fine tuning of lexer behavior) Chris@16: // Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: inline language_support Chris@16: set_support_options(language_support language, language_support option) Chris@16: { Chris@16: return static_cast( Chris@16: (language & ~support_option_mask) | (option & support_option_mask)); Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: // Get and set different language options Chris@16: #define BOOST_WAVE_NEED_OPTION(option) \ Chris@16: inline bool need_ ## option(language_support language) \ Chris@16: { \ Chris@16: return (language & support_option_ ## option) ? true : false; \ Chris@16: } \ Chris@16: /**/ Chris@16: Chris@16: #define BOOST_WAVE_ENABLE_OPTION(option) \ Chris@16: inline language_support \ Chris@16: enable_ ## option(language_support language, bool enable = true) \ Chris@16: { \ Chris@16: if (enable) \ Chris@16: return static_cast(language | support_option_ ## option); \ Chris@16: return static_cast(language & ~support_option_ ## option); \ Chris@16: } \ Chris@16: /**/ Chris@16: Chris@16: #define BOOST_WAVE_OPTION(option) \ Chris@16: BOOST_WAVE_NEED_OPTION(option) \ Chris@16: BOOST_WAVE_ENABLE_OPTION(option) \ Chris@16: /**/ Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: BOOST_WAVE_OPTION(long_long) // support_option_long_long Chris@16: BOOST_WAVE_OPTION(no_character_validation) // support_option_no_character_validation Chris@16: BOOST_WAVE_OPTION(preserve_comments) // support_option_preserve_comments Chris@16: BOOST_WAVE_OPTION(prefer_pp_numbers) // support_option_prefer_pp_numbers Chris@16: BOOST_WAVE_OPTION(emit_line_directives) // support_option_emit_line_directives Chris@16: BOOST_WAVE_OPTION(single_line) // support_option_single_line Chris@16: BOOST_WAVE_OPTION(convert_trigraphs) // support_option_convert_trigraphs Chris@16: #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 Chris@16: BOOST_WAVE_OPTION(include_guard_detection) // support_option_include_guard_detection Chris@16: #endif Chris@16: #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 Chris@16: BOOST_WAVE_OPTION(variadics) // support_option_variadics Chris@16: #endif Chris@16: #if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0 Chris@16: BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives Chris@16: #endif Chris@16: BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace Chris@16: BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines Chris@16: Chris@16: #undef BOOST_WAVE_NEED_OPTION Chris@16: #undef BOOST_WAVE_ENABLE_OPTION Chris@16: #undef BOOST_WAVE_OPTION Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: } // namespace wave Chris@16: } // namespace boost Chris@16: Chris@16: // the suffix header occurs after all of the code Chris@16: #ifdef BOOST_HAS_ABI_HEADERS Chris@16: #include BOOST_ABI_SUFFIX Chris@16: #endif Chris@16: Chris@16: #endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)