Re: [Boost-bugs] [Boost C++ Libraries] #7090: Provide an option to parse only preprocessor directives

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7090: Provide an option to parse only preprocessor directives
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-06 21:42:07


#7090: Provide an option to parse only preprocessor directives
----------------------------------+-----------------------------------------
  Reporter: scrawl123@… | Owner: hkaiser
      Type: Feature Requests | Status: closed
 Milestone: To Be Determined | Component: wave
   Version: Boost 1.49.0 | Severity: Optimization
Resolution: wontfix | Keywords:
----------------------------------+-----------------------------------------

Comment (by scrawl <scrawl123@…>):

 mcpp is 10-15x faster than boost::wave, even though I had to copy my
 source string into a file first because it apparently only takes file
 input and no string from memory.

 Here is quick guide, maybe it will help someone

 {{{
  - build mcpp-2.7.2/src as static lib with -DMCPP_LIB

  - #include "../mcpp/mcpp_lib.h"

  - add this code, in this example my method gets passed a
 std::vector<std::string> of definitions and an std::string include path

                 mcpp_use_mem_buffers(1);

                 int num_args = 4 + definitions.size()*2;
                 char* args[num_args];
                 args[0] = "mcpp";
                 args[1] = "/tmp/test.shader"; // file you want to process
                 args[2] = "-I";

                 std::vector<char> writable(includePath.size()+1);
                 std::copy(includePath.begin(), includePath.end(),
 writable.begin());
                 char* include = &writable[0];

                 args[3] = include;

                 std::vector<char> vectors[definitions.size()];

                 int i=4;
                 int cur=0;
                 for (std::vector<std::string>::iterator it =
 definitions.begin(); it != definitions.end(); ++it)
                 {
                         args[i] = "-D";
                         ++i;

                         std::string val = *it;
                         std::vector<char> writable2(val.size()+1);
                         std::copy(val.begin(), val.end(),
 writable2.begin());
                         vectors[cur] = writable2;

                         args[i] = &vectors[cur][0];
                         ++cur;
                         ++i;
                 }

                 mcpp_lib_main(num_args, args);

                 char* result = mcpp_get_mem_buffer (OUT);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7090#comment:7>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC