
Arkadiy Vertleyb wrote:
"Tobias Schwinger" <tschwinger@neoscientists.org> wrote
While having CVS access could be a good thing in general, it's probably
easier to
use a ZIP, this time.
For some reason it generates empty files...
What I did was to replace vector.hpp, copy preprocess.pl into libs/typeof/tools, and run the pipe version of your example. It reported files being written, but all it wrote was copyright info...
Yeah it's all my fault, sorry. I just found out I messed up the preprocessing code by changing the name of a macro (but not everywhere). vector.hpp (from line 24 on) should read: #if defined(BOOST_TYPEOF_PP_INCLUDE_EXTERNAL) # undef BOOST_TYPEOF_PP_INCLUDE_EXTERNAL // <-- this line was bad # undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED The ZIP has been updated with a corrected version too.
My knowledge of perl is equal to zero :-(
Then I should probably demystify that script for you: The script beautifies and stores the code contained within. After preprocessing the perl interpreter sees something like that as the main program: $sewer = <<'some_crypic_end_marker' < code from external files we #include and which we don't wanna store stands here > some_cryptic_end_marker ; $sewer = ''; &write_down("my_preprocessed_file.hpp",<<'some_crypric_end_marker' < the preprocessed code we want to keep > [...] some_cryptic_end_marker ); &write_down("another_preprocessed_file.hpp",<<'some_crypric_end_marker' < more preprocessed code we want to keep > [...] some_cryptic_end_marker ); [...] Which discards an inline section, a.k.a. a here-document: a string literal spanning multiple lines (of C++ in this case). And then invokes the subroutine 'write_down' with its first argument being the file name and the second argument being the content to store (another here-document). The subroutine write_down runs a regex over the code (passed in via the second parameter) to remove all the stuff we don't want our preprocessed code to contain and stores it in a file with a license header. That's all (the rest in there is just portable path twiddling and error handling)! -- Tobias