Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/wave/language_support.hpp @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 6.5 KB
Line 
1/*=============================================================================
2    Boost.Wave: A Standard compliant C++ preprocessor library
3    Definition of the various language support constants
4   
5    http://www.boost.org/
6
7    Copyright (c) 2001-2007 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
13
14#include <boost/wave/wave_config.hpp>
15
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
19#endif
20
21///////////////////////////////////////////////////////////////////////////////
22namespace boost {
23namespace wave {
24
25enum language_support {
26//  support flags for C++98
27    support_normal = 0x01,
28    support_cpp = support_normal,
29   
30    support_option_long_long = 0x02,
31
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,
36#endif
37
38    support_option_mask = 0xFF00,
39    support_option_preserve_comments = 0x0100,
40    support_option_no_character_validation = 0x0200,
41    support_option_convert_trigraphs = 0x0400,
42    support_option_single_line = 0x0800,
43    support_option_prefer_pp_numbers = 0x1000,
44    support_option_emit_line_directives = 0x2000,
45    support_option_include_guard_detection = 0x4000
46};
47
48///////////////////////////////////////////////////////////////////////////////
49// 
50//  need_cpp
51//
52//      Extract, if the language to support is C++98
53//
54///////////////////////////////////////////////////////////////////////////////
55inline bool
56need_cpp(language_support language) 
57{
58    return (language & ~support_option_mask) == support_cpp;
59}
60
61#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
62///////////////////////////////////////////////////////////////////////////////
63// 
64//  need_c99
65//
66//      Extract, if the language to support is C99
67//
68///////////////////////////////////////////////////////////////////////////////
69inline bool
70need_c99(language_support language) 
71{
72    return (language & ~support_option_mask) == support_c99;
73}
74
75#else  // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
76
77///////////////////////////////////////////////////////////////////////////////
78inline bool 
79need_variadics(language_support language) 
80{
81    return false;
82}
83
84///////////////////////////////////////////////////////////////////////////////
85inline language_support
86enable_variadics(language_support language, bool enable = true)
87{
88    return language;
89}
90
91//////////////////////////////////////////////////////////////////////////////
92inline bool
93need_c99(language_support language) 
94{
95    return false;
96}
97
98#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
99
100///////////////////////////////////////////////////////////////////////////////
101// 
102//  get_support_options
103//
104//      Set preserve comments support in the language to support
105//
106///////////////////////////////////////////////////////////////////////////////
107inline language_support
108get_support_options(language_support language)
109{
110    return static_cast<language_support>(language & support_option_mask);
111}
112
113///////////////////////////////////////////////////////////////////////////////
114// 
115//  set_support_options
116//
117//      Set language option (for fine tuning of lexer behavior)
118//
119///////////////////////////////////////////////////////////////////////////////
120inline language_support
121set_support_options(language_support language, language_support option)
122{
123    return static_cast<language_support>(
124        (language & ~support_option_mask) | (option & support_option_mask));
125}
126
127///////////////////////////////////////////////////////////////////////////////
128//  Get and set different language options
129#define BOOST_WAVE_NEED_OPTION(option)                                        \
130    inline bool need_ ## option(language_support language)                    \
131    {                                                                         \
132        return (language & support_option_ ## option) ? true : false;         \
133    }                                                                         \
134    /**/
135
136#define BOOST_WAVE_ENABLE_OPTION(option)                                      \
137    inline language_support                                                   \
138    enable_ ## option(language_support language, bool enable = true)          \
139    {                                                                         \
140        if (enable)                                                           \
141            return static_cast<language_support>(language | support_option_ ## option); \
142        return static_cast<language_support>(language & ~support_option_ ## option);    \
143    }                                                                         \
144    /**/
145
146#define BOOST_WAVE_OPTION(option)                                             \
147    BOOST_WAVE_NEED_OPTION(option)                                            \
148    BOOST_WAVE_ENABLE_OPTION(option)                                          \
149    /**/
150   
151///////////////////////////////////////////////////////////////////////////////
152BOOST_WAVE_OPTION(long_long)                // support_option_long_long
153BOOST_WAVE_OPTION(preserve_comments)        // support_option_preserve_comments
154BOOST_WAVE_OPTION(prefer_pp_numbers)        // support_option_prefer_pp_numbers
155BOOST_WAVE_OPTION(emit_line_directives)     // support_option_emit_line_directives
156BOOST_WAVE_OPTION(single_line)              // support_option_single_line
157BOOST_WAVE_OPTION(convert_trigraphs)        // support_option_convert_trigraphs
158#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
159BOOST_WAVE_OPTION(include_guard_detection)  // support_option_include_guard_detection
160#endif
161#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
162BOOST_WAVE_OPTION(variadics)                // support_option_variadics
163#endif
164
165#undef BOOST_WAVE_NEED_OPTION
166#undef BOOST_WAVE_ENABLE_OPTION
167#undef BOOST_WAVE_OPTION
168
169///////////////////////////////////////////////////////////////////////////////
170}   // namespace wave
171}   // namespace boost
172
173// the suffix header occurs after all of the code
174#ifdef BOOST_HAS_ABI_HEADERS
175#include BOOST_ABI_SUFFIX
176#endif
177
178#endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
Note: See TracBrowser for help on using the repository browser.