Boost logo

Boost :

From: Hartmut Kaiser (hartmutkaiser_at_[hidden])
Date: 2003-06-19 10:51:22

Hartmut Kaiser wrote:

> > However, it seems to be confused by the preprocessor library.
> > Since the
> > includes sometime have the form:
> >
> > #include BOOST_PP_ITERATE()
> >
> > the 'bcp' tool does not find them. For example,
> > "boost/preprocessor/iteration/detail/iter directory is needed by
> > boost/function.hpp but is not included.
> Is it overkill to use Wave for this? It would solve the
> mentioned problem by correctly preprocessing the inspected sources.

Here is the (main) code, which uses Wave to output the file names of all
successfully opened include files (this needs some filtering to avoid
double output of the same file):

    #include "wave/cpp_context.hpp"

    using namespace std;
    struct trace_include_files {
        opened_include_file(string const &filename,
            size_t include_depth)
            // print indented filename
            for (size_t i = 0; i < include_depth; ++i)
                cout << " ";
            cout << filename << endl;

    // open the file to inspect
    ifstream instream(filename);
    string instring;

        instring = string(
        typedef wave::context<
> context_t;

    // construct the wave::context object
    context_t ctx (instring.begin(), instring.end(), filename);
    context_t::iterator_t first = ctx.begin();
    context_t::iterator_t last = ctx.end();

    // iterate over the generated pp tokens
        while (first != last)
            ++first; // ignore the generated tokens

I've left off the initializing of the include search pathes ...
Pretty neat, huh?

Regards Hartmut

Boost list run by bdawes at, gregod at, cpdaniel at, john at