Chris@16
|
1 /*=============================================================================
|
Chris@16
|
2 Boost.Wave: A Standard compliant C++ preprocessor library
|
Chris@16
|
3 Definition of the various language support constants
|
Chris@16
|
4
|
Chris@16
|
5 http://www.boost.org/
|
Chris@16
|
6
|
Chris@16
|
7 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost
|
Chris@16
|
8 Software License, Version 1.0. (See accompanying file
|
Chris@16
|
9 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10 =============================================================================*/
|
Chris@16
|
11 #if !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
|
Chris@16
|
12 #define LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED
|
Chris@16
|
13
|
Chris@16
|
14 #include <boost/wave/wave_config.hpp>
|
Chris@16
|
15
|
Chris@16
|
16 // this must occur after all of the includes and before any code appears
|
Chris@16
|
17 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
18 #include BOOST_ABI_PREFIX
|
Chris@16
|
19 #endif
|
Chris@16
|
20
|
Chris@16
|
21 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
22 namespace boost {
|
Chris@16
|
23 namespace wave {
|
Chris@16
|
24
|
Chris@16
|
25 enum language_support {
|
Chris@16
|
26 // support flags for C++98
|
Chris@16
|
27 support_normal = 0x01,
|
Chris@16
|
28 support_cpp = support_normal,
|
Chris@16
|
29
|
Chris@16
|
30 support_option_long_long = 0x02,
|
Chris@16
|
31
|
Chris@16
|
32 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
Chris@16
|
33 // support flags for C99
|
Chris@16
|
34 support_option_variadics = 0x04,
|
Chris@16
|
35 support_c99 = support_option_variadics | support_option_long_long | 0x08,
|
Chris@16
|
36 #endif
|
Chris@16
|
37 #if BOOST_WAVE_SUPPORT_CPP0X != 0
|
Chris@16
|
38 support_cpp0x = support_option_variadics | support_option_long_long | 0x10,
|
Chris@16
|
39 support_cpp11 = support_cpp0x,
|
Chris@16
|
40 #endif
|
Chris@16
|
41
|
Chris@16
|
42 support_option_mask = 0xFFC0,
|
Chris@16
|
43 support_option_emit_contnewlines = 0x0040,
|
Chris@16
|
44 support_option_insert_whitespace = 0x0080,
|
Chris@16
|
45 support_option_preserve_comments = 0x0100,
|
Chris@16
|
46 support_option_no_character_validation = 0x0200,
|
Chris@16
|
47 support_option_convert_trigraphs = 0x0400,
|
Chris@16
|
48 support_option_single_line = 0x0800,
|
Chris@16
|
49 support_option_prefer_pp_numbers = 0x1000,
|
Chris@16
|
50 support_option_emit_line_directives = 0x2000,
|
Chris@16
|
51 support_option_include_guard_detection = 0x4000,
|
Chris@16
|
52 support_option_emit_pragma_directives = 0x8000
|
Chris@16
|
53 };
|
Chris@16
|
54
|
Chris@16
|
55 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
56 //
|
Chris@16
|
57 // need_cpp
|
Chris@16
|
58 //
|
Chris@16
|
59 // Extract, if the language to support is C++98
|
Chris@16
|
60 //
|
Chris@16
|
61 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
62 inline bool
|
Chris@16
|
63 need_cpp(language_support language)
|
Chris@16
|
64 {
|
Chris@16
|
65 return (language & ~support_option_mask) == support_cpp;
|
Chris@16
|
66 }
|
Chris@16
|
67
|
Chris@16
|
68 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
69 //
|
Chris@16
|
70 // need_cpp0x
|
Chris@16
|
71 //
|
Chris@16
|
72 // Extract, if the language to support is C++11
|
Chris@16
|
73 //
|
Chris@16
|
74 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
75 #if BOOST_WAVE_SUPPORT_CPP0X != 0
|
Chris@16
|
76
|
Chris@16
|
77 inline bool
|
Chris@16
|
78 need_cpp0x(language_support language)
|
Chris@16
|
79 {
|
Chris@16
|
80 return (language & ~support_option_mask) == support_cpp0x;
|
Chris@16
|
81 }
|
Chris@16
|
82
|
Chris@16
|
83 #else
|
Chris@16
|
84
|
Chris@16
|
85 inline bool
|
Chris@16
|
86 need_cpp0x(language_support language)
|
Chris@16
|
87 {
|
Chris@16
|
88 return false;
|
Chris@16
|
89 }
|
Chris@16
|
90
|
Chris@16
|
91 #endif
|
Chris@16
|
92
|
Chris@16
|
93 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
Chris@16
|
94 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
95 //
|
Chris@16
|
96 // need_c99
|
Chris@16
|
97 //
|
Chris@16
|
98 // Extract, if the language to support is C99
|
Chris@16
|
99 //
|
Chris@16
|
100 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
101 inline bool
|
Chris@16
|
102 need_c99(language_support language)
|
Chris@16
|
103 {
|
Chris@16
|
104 return (language & ~support_option_mask) == support_c99;
|
Chris@16
|
105 }
|
Chris@16
|
106
|
Chris@16
|
107 #else // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
Chris@16
|
108
|
Chris@16
|
109 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
110 inline bool
|
Chris@16
|
111 need_variadics(language_support language)
|
Chris@16
|
112 {
|
Chris@16
|
113 return false;
|
Chris@16
|
114 }
|
Chris@16
|
115
|
Chris@16
|
116 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
117 inline language_support
|
Chris@16
|
118 enable_variadics(language_support language, bool enable = true)
|
Chris@16
|
119 {
|
Chris@16
|
120 return language;
|
Chris@16
|
121 }
|
Chris@16
|
122
|
Chris@16
|
123 //////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
124 inline bool
|
Chris@16
|
125 need_c99(language_support language)
|
Chris@16
|
126 {
|
Chris@16
|
127 return false;
|
Chris@16
|
128 }
|
Chris@16
|
129
|
Chris@16
|
130 #endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
Chris@16
|
131
|
Chris@16
|
132 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
133 //
|
Chris@16
|
134 // get_support_options
|
Chris@16
|
135 //
|
Chris@16
|
136 // Set preserve comments support in the language to support
|
Chris@16
|
137 //
|
Chris@16
|
138 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
139 inline language_support
|
Chris@16
|
140 get_support_options(language_support language)
|
Chris@16
|
141 {
|
Chris@16
|
142 return static_cast<language_support>(language & support_option_mask);
|
Chris@16
|
143 }
|
Chris@16
|
144
|
Chris@16
|
145 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
146 //
|
Chris@16
|
147 // set_support_options
|
Chris@16
|
148 //
|
Chris@16
|
149 // Set language option (for fine tuning of lexer behavior)
|
Chris@16
|
150 //
|
Chris@16
|
151 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
152 inline language_support
|
Chris@16
|
153 set_support_options(language_support language, language_support option)
|
Chris@16
|
154 {
|
Chris@16
|
155 return static_cast<language_support>(
|
Chris@16
|
156 (language & ~support_option_mask) | (option & support_option_mask));
|
Chris@16
|
157 }
|
Chris@16
|
158
|
Chris@16
|
159 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
160 // Get and set different language options
|
Chris@16
|
161 #define BOOST_WAVE_NEED_OPTION(option) \
|
Chris@16
|
162 inline bool need_ ## option(language_support language) \
|
Chris@16
|
163 { \
|
Chris@16
|
164 return (language & support_option_ ## option) ? true : false; \
|
Chris@16
|
165 } \
|
Chris@16
|
166 /**/
|
Chris@16
|
167
|
Chris@16
|
168 #define BOOST_WAVE_ENABLE_OPTION(option) \
|
Chris@16
|
169 inline language_support \
|
Chris@16
|
170 enable_ ## option(language_support language, bool enable = true) \
|
Chris@16
|
171 { \
|
Chris@16
|
172 if (enable) \
|
Chris@16
|
173 return static_cast<language_support>(language | support_option_ ## option); \
|
Chris@16
|
174 return static_cast<language_support>(language & ~support_option_ ## option); \
|
Chris@16
|
175 } \
|
Chris@16
|
176 /**/
|
Chris@16
|
177
|
Chris@16
|
178 #define BOOST_WAVE_OPTION(option) \
|
Chris@16
|
179 BOOST_WAVE_NEED_OPTION(option) \
|
Chris@16
|
180 BOOST_WAVE_ENABLE_OPTION(option) \
|
Chris@16
|
181 /**/
|
Chris@16
|
182
|
Chris@16
|
183 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
184 BOOST_WAVE_OPTION(long_long) // support_option_long_long
|
Chris@16
|
185 BOOST_WAVE_OPTION(no_character_validation) // support_option_no_character_validation
|
Chris@16
|
186 BOOST_WAVE_OPTION(preserve_comments) // support_option_preserve_comments
|
Chris@16
|
187 BOOST_WAVE_OPTION(prefer_pp_numbers) // support_option_prefer_pp_numbers
|
Chris@16
|
188 BOOST_WAVE_OPTION(emit_line_directives) // support_option_emit_line_directives
|
Chris@16
|
189 BOOST_WAVE_OPTION(single_line) // support_option_single_line
|
Chris@16
|
190 BOOST_WAVE_OPTION(convert_trigraphs) // support_option_convert_trigraphs
|
Chris@16
|
191 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
|
Chris@16
|
192 BOOST_WAVE_OPTION(include_guard_detection) // support_option_include_guard_detection
|
Chris@16
|
193 #endif
|
Chris@16
|
194 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
Chris@16
|
195 BOOST_WAVE_OPTION(variadics) // support_option_variadics
|
Chris@16
|
196 #endif
|
Chris@16
|
197 #if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0
|
Chris@16
|
198 BOOST_WAVE_OPTION(emit_pragma_directives) // support_option_emit_pragma_directives
|
Chris@16
|
199 #endif
|
Chris@16
|
200 BOOST_WAVE_OPTION(insert_whitespace) // support_option_insert_whitespace
|
Chris@16
|
201 BOOST_WAVE_OPTION(emit_contnewlines) // support_option_emit_contnewlines
|
Chris@16
|
202
|
Chris@16
|
203 #undef BOOST_WAVE_NEED_OPTION
|
Chris@16
|
204 #undef BOOST_WAVE_ENABLE_OPTION
|
Chris@16
|
205 #undef BOOST_WAVE_OPTION
|
Chris@16
|
206
|
Chris@16
|
207 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
208 } // namespace wave
|
Chris@16
|
209 } // namespace boost
|
Chris@16
|
210
|
Chris@16
|
211 // the suffix header occurs after all of the code
|
Chris@16
|
212 #ifdef BOOST_HAS_ABI_HEADERS
|
Chris@16
|
213 #include BOOST_ABI_SUFFIX
|
Chris@16
|
214 #endif
|
Chris@16
|
215
|
Chris@16
|
216 #endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
|