Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Wave: a Standard conformant C++ preprocessor library

, 10 Jan 2004
Describes a free and fully Standard conformant C++ preprocessor library
wave_preprocessor_demo.zip
wave_preprocessor_demo1.zip
wave_preprocessor_src.zip
wave
doc
theme
bkd.gif
bkd2.gif
bullet.gif
l_arr.gif
l_arr_disabled.gif
r_arr.gif
r_arr_disabled.gif
uc.gif
u_arr.gif
wave.gif
test
boost-build.jam
cpp_tokens
Jamfile.v2
list_includes
project-root.jam
wave
Jamfile
Jamfile.v2
runtests.sh
test_files
wave
cpplexer
re2clex
cpp.re
test
lextest.in
lextest.output
run_tests.sh
test_lexer.in
test_lexer.output
slex
test
lextest.in
lextest.re2c.output
lextest.slex.output
run_tests.sh
grammars
idllexer
re2clex
idl.re
util
wave_preprocessor_src1.zip
bkd.gif
bkd2.gif
bullet.gif
l_arr.gif
l_arr_disabled.gif
r_arr.gif
r_arr_disabled.gif
u_arr.gif
uc.gif
wave.gif
boost-build.jam
Jamfile.v2
project-root.jam
Jamfile
Jamfile.v2
runtests.sh
cpp.re
lextest.in
lextest.output
run_tests.sh
test_lexer.in
test_lexer.output
lextest.in
lextest.re2c.output
lextest.slex.output
run_tests.sh
/*=============================================================================
    Wave: A Standard compliant C++ preprocessor

    Definition of the various language support constants
    
    Copyright (c) 2001-2003 Hartmut Kaiser
    http://spirit.sourceforge.net/

    Permission to copy, use, modify, sell and distribute this software
    is granted provided this copyright notice appears in all copies.
    This software is provided "as is" without express or implied
    warranty, and with no claim as to its suitability for any purpose.

    See Copyright.txt for full copyright notices and acknowledgements.
=============================================================================*/
#if !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)
#define LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED

///////////////////////////////////////////////////////////////////////////////
namespace wave {

enum language_support {
//  support flags for C++98
    support_normal = 0x01,
    support_cpp = support_normal,
    
#if defined(WAVE_SUPPORT_VARIADICS_PLACEMARKERS)
//  support flags for C99
    support_variadics = 0x02,
    support_c99 = support_variadics,
    
#if defined(WAVE_ENABLE_CPP0X_EXTENSIONS)
//  support flags for the experimental C++0x features
    support_extensions = 0x04,
    support_cpp0x = support_normal | support_variadics | support_extensions,
#endif // defined(WAVE_ENABLE_CPP0X_EXTENSIONS)
#endif // defined(WAVE_SUPPORT_VARIADICS_PLACEMARKERS)
};

///////////////////////////////////////////////////////////////////////////////
//  
//  need_cpp
//
//      Extract, if the language to support is C++98
//
///////////////////////////////////////////////////////////////////////////////
inline bool
need_cpp(language_support language) 
{
    return language == support_cpp;
}

#if defined(WAVE_SUPPORT_VARIADICS_PLACEMARKERS)

///////////////////////////////////////////////////////////////////////////////
//  
//  need_variadics
//
//      Extract, if the language to support needs variadics support
//
///////////////////////////////////////////////////////////////////////////////
inline bool 
need_variadics(language_support language) 
{
    return language & support_variadics;
}

///////////////////////////////////////////////////////////////////////////////
//  
//  enable_variadics
//
//      Set variadics support in the language to support
//
///////////////////////////////////////////////////////////////////////////////
inline language_support
enable_variadics(language_support language, bool enable = true)
{
    if (enable)
        return static_cast<language_support>(language | support_variadics);
    return static_cast<language_support>(language & ~support_variadics);
}

///////////////////////////////////////////////////////////////////////////////
//  
//  need_c99
//
//      Extract, if the language to support is C99
//
///////////////////////////////////////////////////////////////////////////////
inline bool
need_c99(language_support language) 
{
    return language == support_c99;
}

///////////////////////////////////////////////////////////////////////////////
//  
//  enable_c99
//
//      Set, whether to support C99 (alternatively C++98 is supported)
//
///////////////////////////////////////////////////////////////////////////////
inline language_support
enable_c99(bool enable = true)
{
    return enable ? support_c99 : support_normal;
}

#if defined(WAVE_ENABLE_CPP0X_EXTENSIONS)
///////////////////////////////////////////////////////////////////////////////
//  
//  need_cpp0x
//
//      Extract, if the language to support is C++0x
//
///////////////////////////////////////////////////////////////////////////////
inline bool
need_cpp0x(language_support language) 
{
    return language == support_cpp0x;
}

///////////////////////////////////////////////////////////////////////////////
//  
//  enable_c99
//
//      Set, whether to support the C++0x features (alternatively C++98 is 
//      supported)
//
///////////////////////////////////////////////////////////////////////////////
inline language_support
enable_cpp0x(bool enable = true)
{
    return enable ? support_cpp0x : support_normal;
}

#endif // defined(WAVE_ENABLE_CPP0X_EXTENSIONS)
#endif // defined(WAVE_SUPPORT_VARIADICS_PLACEMARKERS)

///////////////////////////////////////////////////////////////////////////////
}   // namespace wave

#endif // !defined(LANGUAGE_SUPPORT_HPP_93EDD057_2DEF_44BC_BC9F_FDABB9F51AFA_INCLUDED)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Hartmut Kaiser

United States United States
Actively involved in Boost and the development of the Spirit parser construction framework.

| Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 11 Jan 2004
Article Copyright 2003 by Hartmut Kaiser
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid