[MPL] How to generate pre-generated header files for a mpl::list containing more than 50 entries?
Hello MPL experts,
I want to code a state machine which has a reaction list containing
more than 50 entries.
I found here [http://svn.boost.org/svn/boost/trunk/libs/mpl/preprocessed/]
some python scripts to generate header files for a mpl::list containing
more than
50 entries.
But I cannot manage to generate a single header file. Can someone please
explain to me how to use these scripts? I also didn't find any help in
boost
documention.
Command line messages of the related script were also not helpful for me:
preprocess_list.py
Usage:
preprocess_list.py <mode>
Hi everyone, Hi Klaus, I have had the same question as Klaus for a long time, which bugged me for the same amount of time (which was way too long). I am far from being an MPL expert, however, today I inspected the python-scripts that Klaus pointed to and it seems I found out how to use them. At least I was able to generate the preprocessed header-files. (However, I still need to find out, how to use them when compiling my code instead of generating everything on the fly.) So here is a small bash-script which is able to use the python-scripts for generating the preprocessed header-files.: <code> #! /bin/bash # The directory containing the Boost-source. SOURCE=/tmp/boost_1_55_0 # Change into include-directory of Boost.MPL. pushd ${SOURCE}/boost/mpl # Create hpp-files for each MPL-container with 60 to 100 elements # which will be used during generation. for container in "vector" "list" "set" "map"; do for i in {6..10}; do sed -e "s/50/${i}0/g" \ -e "s/41/$((i-1))1/g" \ -e "s/40/$((i-1))0/g" \ ./${container}/${container}50.hpp \ > ./${container}/${container}${i}0.hpp; done done for container in "vector" "list" "set"; do for i in {6..10}; do sed -e "s/50/${i}0/g" \ -e "s/41/$((i-1))1/g" \ -e "s/40/$((i-1))0/g" \ ./${container}/${container}50_c.hpp \ > ./${container}/${container}${i}0_c.hpp; done done # Leave include-directory of Boost.MPL. popd # Change into source-directory of Boost.MPL. pushd ${SOURCE}/libs/mpl/preprocessed # Create cpp-files for each MPL-container with 60 to 100 elements # which will be used during generation. for container in "vector" "list" "set" "map"; do for i in {6..10}; do sed -e "s/50/${i}0/g" \ -e "s/41/$((i-1))1/g" \ -e "s/40/$((i-1))0/g" \ ./${container}/${container}50.cpp \ > ./${container}/${container}${i}0.cpp; done done for container in "vector" "list" "set"; do for i in {6..10}; do sed -e "s/50/${i}0/g" \ -e "s/41/$((i-1))1/g" \ -e "s/40/$((i-1))0/g" \ ./${container}/${container}50_c.cpp \ > ./${container}/${container}${i}0_c.cpp; done done # Now generate MPL-preprocessed files using the python-scripts. python preprocess_vector.py all ${SOURCE} python preprocess_list.py all ${SOURCE} python preprocess_set.py all ${SOURCE} python preprocess_map.py all ${SOURCE} # Leave source-directory of Boost.MPL. popd </code> It should be obvious what the bash-script does. However, here a small summary in words: Take the "vector50.hpp" file as template and create a copy "vector60.hpp", replacing all occurrences of "50" by "60, of "40" by "50" and of "41" by "51". Do the analogous for files "vector60_c.hpp" with "vector50_c.hpp" as template. Then do the analogous for "vector60.cpp" and "vector60_c.cpp respectively with "vector50.cpp" and "vector50_c.cpp" respectively as template. Repeat these steps for higher numbers in steps of 10 (I did it for vector60, vector70... vector100) and increase the replacement-numbers by 10 for each step. Then you can call the corresponding python-script ("preprocess_vector.py") with first parameter being "all" and second parameter being the path to the Boost-source directory. For other MPL-container-types, just replace "vector" with the container-type. (NOTE: MPL-maps seem not to have the "_c" versions of the header- and source-files!) Probably, this script and explanation (with better words) should move into MPL-documentation. Hope that helps, Deniz Am 12.12.2013 14:43, schrieb Klaus.Kempf@industronic.de:
Hello MPL experts,
I want to code a state machine which has a reaction list containing more than 50 entries.
I found here [http://svn.boost.org/svn/boost/trunk/libs/mpl/preprocessed/] some python scripts to generate header files for a mpl::list containing more than 50 entries.
But I cannot manage to generate a single header file. Can someone please explain to me how to use these scripts? I also didn't find any help in boost documention.
Command line messages of the related script were also not helpful for me: preprocess_list.py
Usage: preprocess_list.py <mode>
[ ] Purpose: updates preprocessed version(s) of the header(s) in "boost\mpl\list\aux_\preprocessed" directory
Example: the following command will re-generate and update all 'apply.hpp' headers:
preprocess_list.py all f:\cvs\boost apply.cpp
What is the meaning of [
] here? And how/where do I have to specify the count of list entries in order to generate the header files "list60.hpp", "list70.hpp" and so on? Many thanks for any help you could provide.
Best regards, Klaus
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Deniz Bahadir
-
Klaus.Kempf@industronic.de