1 /*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3 Definition of the various language support constants
7 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
8 Software License, Version 1.0. (See accompanying file
9 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 =============================================================================*/
11 #if !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
12 #define LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED
14 #include <boost/wave/wave_config.hpp>
16 // this must occur after all of the includes and before any code appears
17 #ifdef BOOST_HAS_ABI_HEADERS
18 #include BOOST_ABI_PREFIX
21 ///////////////////////////////////////////////////////////////////////////////
25 enum language_support {
26 // support flags for C++98
27 support_normal = 0x01,
28 support_cpp = support_normal,
30 support_option_long_long = 0x02,
32 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
33 // support flags for C99
34 support_option_variadics = 0x04,
35 support_c99 = support_option_variadics | support_option_long_long | 0x08,
37 #if BOOST_WAVE_SUPPORT_CPP0X != 0
38 support_cpp0x = support_option_variadics | support_option_long_long | 0x10,
39 support_cpp11 = support_cpp0x,
42 support_option_mask = 0xFFC0,
43 support_option_emit_contnewlines = 0x0040,
44 support_option_insert_whitespace = 0x0080,
45 support_option_preserve_comments = 0x0100,
46 support_option_no_character_validation = 0x0200,
47 support_option_convert_trigraphs = 0x0400,
48 support_option_single_line = 0x0800,
49 support_option_prefer_pp_numbers = 0x1000,
50 support_option_emit_line_directives = 0x2000,
51 support_option_include_guard_detection = 0x4000,
52 support_option_emit_pragma_directives = 0x8000
55 ///////////////////////////////////////////////////////////////////////////////
59 // Extract, if the language to support is C++98
61 ///////////////////////////////////////////////////////////////////////////////
63 need_cpp(language_support language)
65 return (language & ~support_option_mask) == support_cpp;
68 ///////////////////////////////////////////////////////////////////////////////
72 // Extract, if the language to support is C++11
74 ///////////////////////////////////////////////////////////////////////////////
75 #if BOOST_WAVE_SUPPORT_CPP0X != 0
78 need_cpp0x(language_support language)
80 return (language & ~support_option_mask) == support_cpp0x;
86 need_cpp0x(language_support language)
93 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
94 ///////////////////////////////////////////////////////////////////////////////
98 // Extract, if the language to support is C99
100 ///////////////////////////////////////////////////////////////////////////////
102 need_c99(language_support language)
104 return (language & ~support_option_mask) == support_c99;
107 #else // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
109 ///////////////////////////////////////////////////////////////////////////////
111 need_variadics(language_support language)
116 ///////////////////////////////////////////////////////////////////////////////
117 inline language_support
118 enable_variadics(language_support language, bool enable = true)
123 //////////////////////////////////////////////////////////////////////////////
125 need_c99(language_support language)
130 #endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
132 ///////////////////////////////////////////////////////////////////////////////
134 // get_support_options
136 // Set preserve comments support in the language to support
138 ///////////////////////////////////////////////////////////////////////////////
139 inline language_support
140 get_support_options(language_support language)
142 return static_cast<language_support>(language & support_option_mask);
145 ///////////////////////////////////////////////////////////////////////////////
147 // set_support_options
149 // Set language option (for fine tuning of lexer behavior)
151 ///////////////////////////////////////////////////////////////////////////////
152 inline language_support
153 set_support_options(language_support language, language_support option)
155 return static_cast<language_support>(
156 (language & ~support_option_mask) | (option & support_option_mask));
159 ///////////////////////////////////////////////////////////////////////////////
160 // Get and set different language options
161 #define BOOST_WAVE_NEED_OPTION(option) \
162 inline bool need_ ## option(language_support language) \
164 return (language & support_option_ ## option) ? true : false; \
168 #define BOOST_WAVE_ENABLE_OPTION(option) \
169 inline language_support \
170 enable_ ## option(language_support language, bool enable = true) \
173 return static_cast<language_support>(language | support_option_ ## option); \
174 return static_cast<language_support>(language & ~support_option_ ## option); \
178 #define BOOST_WAVE_OPTION(option) \
179 BOOST_WAVE_NEED_OPTION(option) \
180 BOOST_WAVE_ENABLE_OPTION(option) \
183 ///////////////////////////////////////////////////////////////////////////////
184 BOOST_WAVE_OPTION(long_long) // support_option_long_long
185 BOOST_WAVE_OPTION(no_character_validation) // support_option_no_character_validation
186 BOOST_WAVE_OPTION(preserve_comments) // support_option_preserve_comments
187 BOOST_WAVE_OPTION(prefer_pp_numbers) // support_option_prefer_pp_numbers
188 BOOST_WAVE_OPTION(emit_line_directives) // support_option_emit_line_directives
189 BOOST_WAVE_OPTION(single_line) // support_option_single_line
190 BOOST_WAVE_OPTION(convert_trigraphs) // support_option_convert_trigraphs
191 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
192 BOOST_WAVE_OPTION(include_guard_detection) // support_option_include_guard_detection
194 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
195 BOOST_WAVE_OPTION(variadics) // support_option_variadics
197 #if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0
198 BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives
200 BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace
201 BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines
203 #undef BOOST_WAVE_NEED_OPTION
204 #undef BOOST_WAVE_ENABLE_OPTION
205 #undef BOOST_WAVE_OPTION
207 ///////////////////////////////////////////////////////////////////////////////
211 // the suffix header occurs after all of the code
212 #ifdef BOOST_HAS_ABI_HEADERS
213 #include BOOST_ABI_SUFFIX
216 #endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)