Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2006-11-20 12:57:40


Hello Alexey,

using the C++ preprocessor macro to generate map of 150 types works fine and code which uses the
new mapN type compiles and runs fine as well. Just as you described it in the post:

http://lists.boost.org/boost-users/2006/11/23321.php

We have successfully tested it with 115 elements.

Then we tried to switch to the second approach with pregenerated types. The problem we face is
that the python script generates empty headers.

To avoid all errors we just copied <boost_root>\boost\mpl\map\map50.hpp to
<boost_root>\boost\mpl\map\map60.hpp and changed the file accordingly. Here the modified source:

//
// Distributed under 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 http://www.boost.org/libs/mpl for documentation.

// $Source: /cvsroot/boost/boost/boost/mpl/map/map50.hpp,v $
// $Date: 2004/09/02 15:40:59 $
// $Revision: 1.2 $

#if !defined(BOOST_MPL_PREPROCESSING_MODE)
# include <boost/mpl/map/map50.hpp>
#endif

#include <boost/mpl/aux_/config/use_preprocessed.hpp>

#if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \
    && !defined(BOOST_MPL_PREPROCESSING_MODE)

# define BOOST_MPL_PREPROCESSED_HEADER map60.hpp
# include <boost/mpl/map/aux_/include_preprocessed.hpp>

#else

# include <boost/preprocessor/iterate.hpp>

namespace boost { namespace mpl {

# define BOOST_PP_ITERATION_PARAMS_1 \
    (3,(51, 60, <boost/mpl/map/aux_/numbered.hpp>))
# include BOOST_PP_ITERATE()

}}

#endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS

#endif // BOOST_MPL_MAP_MAP60_HPP_INCLUDED

Afterwards we did the same with the CPP file in <boost_root>\libs\mpl\preprocessed\map\:

// Copyright Aleksey Gurtovoy 2003-4004
//
// Distributed under 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 http://www.boost.org/libs/mpl for documentation.

// $Source: /cvsroot/boost/boost/libs/mpl/preprocessed/map/map50.cpp,v $
// $Date: 2004/09/05 09:45:17 $
// $Revision: 1.3 $

#define BOOST_MPL_PREPROCESSING_MODE
#include <boost/config.hpp>
#include <boost/mpl/map/map60.hpp>

gcc is installed and is registered in the PATH variable. OS Win XP, GCC version:
gcc (GCC) 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Calling the python script command like:
$prompt>python ./preprocess_map.py all E:/global_libs/boost_1_33_1 map60.cpp

Produces the output:

E:\global_libs\boost_1_33_1\libs\mpl\preprocessed>gcc -E -C -P -IE:/global_libs/
boost_1_33_1 "-D BOOST_USER_CONFIG=<E:/global_libs/boost_1_33_1/libs/mpl/preproc
essed/include/plain/user.hpp>" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES E:\global_l
ibs\boost_1_33_1\libs\mpl\preprocessed\map\map60.cpp 1>E:\global_libs\boost_1_3
3_1\libs\mpl\preprocessed\map\map60.hpp

E:\global_libs\boost_1_33_1\libs\mpl\preprocessed>gcc -E -C -P -IE:/global_libs/
boost_1_33_1 "-D BOOST_USER_CONFIG=<E:/global_libs/boost_1_33_1/libs/mpl/preproc
essed/include/typeof_based/user.hpp>" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES E:\g
lobal_libs\boost_1_33_1\libs\mpl\preprocessed\map\map60.cpp 1>E:\global_libs\bo
ost_1_33_1\libs\mpl\preprocessed\map\map60.hpp

E:\global_libs\boost_1_33_1\libs\mpl\preprocessed>gcc -E -C -P -IE:/global_libs/
boost_1_33_1 "-D BOOST_USER_CONFIG=<E:/global_libs/boost_1_33_1/libs/mpl/preproc
essed/include/no_ctps/user.hpp>" -D BOOST_MPL_CFG_NO_OWN_PP_PRIMITIVES E:\global
_libs\boost_1_33_1\libs\mpl\preprocessed\map\map60.cpp 1>E:\global_libs\boost_1
_33_1\libs\mpl\preprocessed\map\map60.hpp

But the resulting files in pregenerated directories have the size 0. Doing the same thing by
passing map50.cpp works just fine and pregenerates new files. Is there smth, that I miss?

With Kind Regards,

Ovanes Markarian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net