Click here to Skip to main content
15,893,564 members
Articles / Programming Languages / C++

Wave: a Standard conformant C++ preprocessor library

Rate me:
Please Sign up or sign in to vote.
4.96/5 (58 votes)
10 Jan 200413 min read 401K   4.4K   81  
Describes a free and fully Standard conformant C++ preprocessor library
/*=============================================================================
    Wave: A Standard compliant C++ preprocessor

    Sample: List include dependencies of a given source file
            Configuration data
        
    Copyright (c) 2001-2004 Hartmut Kaiser
    http://spirit.sourceforge.net/

    Use, modification and distribution is subject to the Boost Software
    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    http://www.boost.org/LICENSE_1_0.txt)

    See Copyright.txt for full acknowledgements.
=============================================================================*/

#if !defined(LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_INCLUDED)
#define LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_INCLUDED

#include <boost/config.hpp>     //  global configuration information

///////////////////////////////////////////////////////////////////////////////
// decide, which C++ lexer to use (choose one!)
//#define WAVE_USE_SLEX_CPP_LEXER         // use the SLex based C++ lexer
#define WAVE_USE_RE2C_CPP_LEXER       // use the Re2C based C++ lexer

#if (defined(WAVE_USE_SLEX_CPP_LEXER) && defined(WAVE_USE_RE2C_CPP_LEXER)) || \
    (!defined(WAVE_USE_SLEX_CPP_LEXER) && !defined(WAVE_USE_RE2C_CPP_LEXER))
#error "Please choose exactly one C++ lexer to use" \
    " (define WAVE_USE_SLEX_CPP_LEXER or WAVE_USE_RE2C_CPP_LEXER)"
#endif

///////////////////////////////////////////////////////////////////////////////
//
//  For all recognized preprocessor statements the output parse trees 
//  formatted as xml are printed. The formatted parse trees are streamed to the 
//  std::ostream given through the WAVE_DUMP_PARSE_TREE constant.
//
//  Undefine the following, if you want to see these parse trees. 
//
//#define WAVE_DUMP_PARSE_TREE
//#define WAVE_DUMP_PARSE_TREE_OUT std::cout

///////////////////////////////////////////////////////////////////////////////
//
//  Use the separation model for the instantiation of the lex_functor object.
//
//  If this is defined, you should explicitly instantiate the lex_functor
//  template with the correct parameters in a separate compilation unit of
//  your program (see the file instantiate_slex_lexer.cpp). 
//
//  To use the lexer inclusion model, undefine the following 
//
#define WAVE_SEPARATE_LEXER_INSTANTIATION

///////////////////////////////////////////////////////////////////////////////
//  Decide, whether to use the separate compilation model for the instantiation 
//  of the grammar objects.
//
//  If this is defined, you should explicitly instantiate the grammar
//  templates with the correct parameters in a separate compilation unit of
//  your program (see the files instantiate_cpp_grammar.cpp). 
//
//  To use the grammar inclusion model, undefine the following 
//
#define WAVE_SEPARATE_GRAMMAR_INSTANTIATION

///////////////////////////////////////////////////////////////////////////////
//  You shouldn't have to change anything below

#if defined(BOOST_MSVC) && !defined(__COMO__)
#pragma warning (disable: 4355) // 'this' used in base member initializer list
#pragma inline_depth(255)
#pragma inline_recursion(on)
#endif // defined(BOOST_MSVC)

///////////////////////////////////////////////////////////////////////////////
//  The Boost.Pool library requires to define the following constant for non-
//  threaded applications
#define BOOST_NO_MT

#endif // !defined(LIST_INCLUDES_HPP_843DB412_3AA8_4BCF_8081_AA4A5FDE0BE7_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


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

Comments and Discussions