tools for re-generating preprocessed headers

[SVN r18856]
This commit is contained in:
Aleksey Gurtovoy
2003-06-23 11:34:04 +00:00
parent 567c490a97
commit 406ae7d211
37 changed files with 255 additions and 108 deletions

View File

@@ -19,10 +19,14 @@
#include "boost/config.hpp"
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 \
#if !defined(BOOST_MPL_NO_BIND_TEMPLATE) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& ( defined(BOOST_MSVC) && BOOST_MSVC <= 1300 \
|| defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \
&& !defined(BOOST_MPL_NO_BIND_TEMPLATE)
)
# define BOOST_MPL_NO_BIND_TEMPLATE
#endif
#endif // BOOST_MPL_AUX_CONFIG_BIND_HPP_INCLUDED

View File

@@ -19,9 +19,12 @@
#include "boost/config.hpp"
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \
&& !defined(BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION)
#if !defined(BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG))
# define BOOST_NO_NON_TYPE_TEMPLATE_PARTIAL_SPECIALIZATION
#endif
// BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION is defined in "boost/config.hpp"

View File

@@ -24,11 +24,15 @@
// template< typename T > struct b;
// template< typename T, T n > struct b< a<T,n> > {};
#if defined(__EDG__) && (__EDG_VERSION__ <= 300 || !defined(BOOST_STRICT_CONFIG)) \
#if !defined(BOOST_NO_DEPENDENT_NON_TYPE_PARAMETER_IN_PARTIAL_SPECIALIZATION) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& ( defined(__EDG__) && (__EDG_VERSION__ <= 300 || !defined(BOOST_STRICT_CONFIG)) \
|| defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \
|| !defined(BOOST_STRICT_CONFIG)) \
&& !defined(BOOST_NO_DEPENDENT_NON_TYPE_PARAMETER_IN_PARTIAL_SPECIALIZATION)
)
# define BOOST_NO_DEPENDENT_NON_TYPE_PARAMETER_IN_PARTIAL_SPECIALIZATION
#endif
#endif // BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED

View File

@@ -25,17 +25,25 @@
// the owner class is a class template), and Borland 5.6 isn't even
// able to compile a definition of nested class template with DTP
#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 && \
(__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \
&& !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES)
#if !defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& defined(__BORLANDC__) && __BORLANDC__ >= 0x560 && \
(__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG))
# define BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES
#endif
#if defined(__MWERKS__) && __MWERKS__ <= 0x3001 \
#if !defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& ( defined(__MWERKS__) && __MWERKS__ <= 0x3001 \
|| defined(__BORLANDC__) && (__BORLANDC__ <= 0x570 || !defined(BOOST_STRICT_CONFIG)) \
|| defined(BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES) \
&& !defined(BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES)
)
# define BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES
#endif
#endif // BOOST_MPL_AUX_CONFIG_DTP_HPP_INCLUDED

View File

@@ -3,7 +3,7 @@
#define BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED
// + file: boost/mpl/aux_/config/overload_resolution.hpp
// + last modified: 02/may/03
// + last modified: 23/jun/03
// Copyright (c) 2002-03
// Aleksey Gurtovoy
@@ -20,15 +20,14 @@
#include "boost/mpl/aux_/config/workaround.hpp"
#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION)
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|| BOOST_WORKAROUND(__MWERKS__, < 0x3001)
#if !defined(BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE)
&& ( BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|| BOOST_WORKAROUND(__MWERKS__, < 0x3001) \
)
# define BOOST_MPL_BROKEN_OVERLOAD_RESOLUTION
#endif
#endif
#endif // BOOST_MPL_AUX_CONFIG_OVERLOAD_RESOLUTION_HPP_INCLUDED

View File

@@ -21,14 +21,21 @@
#if defined(BOOST_NO_TEMPLATE_TEMPLATES) \
&& ( !defined(BOOST_MSVC) || BOOST_MSVC < 1300 )
# define BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS
#endif
#if defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \
#if !defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& ( defined(__GNUC__) && (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 2 \
|| !defined(BOOST_STRICT_CONFIG)) \
|| defined(__BORLANDC__) && (__BORLANDC__ <= 0x561 || !defined(BOOST_STRICT_CONFIG)) \
&& !defined(BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING)
)
# define BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
#endif
#endif // BOOST_MPL_AUX_CONFIG_TTP_HPP_INCLUDED

View File

@@ -20,9 +20,12 @@
// agurt, 10/jul/02: full-fledged __typeof is needed to permit the optimal
// vector implementation
#if defined(__MWERKS__) && __MWERKS__ >= 0x3001 \
&& !defined(BOOST_MPL_TYPEOF_BASED_VECTOR_IMPL)
#if !defined(BOOST_MPL_TYPEOF_BASED_VECTOR_IMPL) \
&& !defined(BOOST_MPL_PREPROCESSING_MODE) \
&& defined(__MWERKS__) && __MWERKS__ >= 0x3001
# define BOOST_MPL_TYPEOF_BASED_VECTOR_IMPL
#endif
#endif // BOOST_MPL_AUX_CONFIG_VECTOR_HPP_INCLUDED

View File

@@ -6,7 +6,6 @@ namespace mpl {
namespace aux {
template< long N > struct advance_backward;
template<>
struct advance_backward<0>
{
@@ -15,7 +14,6 @@ struct advance_backward<0>
typedef Iterator iter0;
typedef iter0 type;
};
};
template<>
@@ -27,7 +25,6 @@ struct advance_backward<1>
typedef typename iter0::prior iter1;
typedef iter1 type;
};
};
template<>
@@ -40,7 +37,6 @@ struct advance_backward<2>
typedef typename iter1::prior iter2;
typedef iter2 type;
};
};
template<>
@@ -54,7 +50,6 @@ struct advance_backward<3>
typedef typename iter2::prior iter3;
typedef iter3 type;
};
};
template<>
@@ -69,7 +64,6 @@ struct advance_backward<4>
typedef typename iter3::prior iter4;
typedef iter4 type;
};
};
template< long N >

View File

@@ -6,7 +6,6 @@ namespace mpl {
namespace aux {
template< long N > struct advance_forward;
template<>
struct advance_forward<0>
{
@@ -15,7 +14,6 @@ struct advance_forward<0>
typedef Iterator iter0;
typedef iter0 type;
};
};
template<>
@@ -27,7 +25,6 @@ struct advance_forward<1>
typedef typename iter0::next iter1;
typedef iter1 type;
};
};
template<>
@@ -40,7 +37,6 @@ struct advance_forward<2>
typedef typename iter1::next iter2;
typedef iter2 type;
};
};
template<>
@@ -54,7 +50,6 @@ struct advance_forward<3>
typedef typename iter2::next iter3;
typedef iter3 type;
};
};
template<>
@@ -69,7 +64,6 @@ struct advance_forward<4>
typedef typename iter3::next iter4;
typedef iter4 type;
};
};
template< long N >

View File

@@ -59,4 +59,3 @@ BOOST_MPL_AUX_VOID_SPEC_EXT(
)
}} // namespace boost::mpl

View File

@@ -107,6 +107,7 @@ struct apply5
};
// primary template (not a specialization!)
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5

View File

@@ -357,6 +357,7 @@ struct resolve_bind_arg<
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
// primary template (not a specialization!)
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5

View File

@@ -454,6 +454,7 @@ struct resolve_bind_arg<
BOOST_MPL_AUX_ARITY_SPEC(6, bind5)
// primary template (not a specialization!)
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5

View File

@@ -6,6 +6,7 @@ namespace mpl {
namespace aux {
// forward declaration
template<
long N
, typename First
@@ -220,4 +221,3 @@ struct fold_backward_impl< -1,Last,Last,State,BackwardOp,ForwardOp >
} // namespace aux
} // namespace mpl
} // namespace boost

View File

@@ -6,6 +6,7 @@ namespace mpl {
namespace aux {
// forward declaration
template<
long N
, typename First
@@ -174,4 +175,3 @@ struct fold_impl< -1,Last,Last,State,ForwardOp >
} // namespace aux
} // namespace mpl
} // namespace boost

View File

@@ -548,6 +548,7 @@ struct lambda_impl< protect<T>,Protect >
};
// specializations for main 'bind', 'bind1st' and 'bind2nd' forms
template<
typename F, typename T1, typename T2, typename T3, typename T4
, typename T5

View File

@@ -6,6 +6,7 @@ namespace mpl {
namespace aux {
// forward declaration
template<
long N
, typename First
@@ -219,4 +220,3 @@ struct iter_fold_backward_impl< -1,Last,Last,State,BackwardOp,ForwardOp >
} // namespace aux
} // namespace mpl
} // namespace boost

View File

@@ -126,4 +126,3 @@ struct iter_fold_if_impl
} // namespace aux
} // namespace mpl
} // namespace boost

View File

@@ -6,6 +6,7 @@ namespace mpl {
namespace aux {
// forward declaration
template<
long N
, typename First
@@ -173,4 +174,3 @@ struct iter_fold_impl< -1,Last,Last,State,ForwardOp >
} // namespace aux
} // namespace mpl
} // namespace boost

View File

@@ -38,9 +38,7 @@ struct list<
template<
typename T0, typename T1
>
struct list<
T0, T1, void_, void_, void_, void_, void_, void_, void_, void_
>
struct list< T0,T1,void_,void_,void_,void_,void_,void_,void_,void_ >
: list2< T0,T1 >
{
typedef list2< T0,T1 > type;
@@ -114,6 +112,7 @@ struct list< T0,T1,T2,T3,T4,T5,T6,T7,T8,void_ >
};
// primary template (not a specialization!)
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9

View File

@@ -135,6 +135,7 @@ struct list_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,LONG_MAX >
};
// primary template (not a specialization!)
template<
typename T
, long C0, long C1, long C2, long C3, long C4, long C5, long C6, long C7

View File

@@ -59,4 +59,3 @@ BOOST_MPL_AUX_VOID_SPEC_EXT(
)
}} // namespace boost::mpl

View File

@@ -12,43 +12,36 @@ using boost::mpl::_;
// agurt, 17/mar/02: one more placeholder for the last 'apply#'
// specialization
typedef arg<1> _1;
namespace placeholders {
using boost::mpl::_1;
}
typedef arg<2> _2;
namespace placeholders {
using boost::mpl::_2;
}
typedef arg<3> _3;
namespace placeholders {
using boost::mpl::_3;
}
typedef arg<4> _4;
namespace placeholders {
using boost::mpl::_4;
}
typedef arg<5> _5;
namespace placeholders {
using boost::mpl::_5;
}
typedef arg<6> _6;
namespace placeholders {
using boost::mpl::_6;
}
} // namespace mpl
} // namespace boost

View File

@@ -114,6 +114,7 @@ struct vector< T0,T1,T2,T3,T4,T5,T6,T7,T8,void_ >
};
// primary template (not a specialization!)
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9

View File

@@ -137,6 +137,7 @@ struct vector_c< T,C0,C1,C2,C3,C4,C5,C6,C7,C8,LONG_MAX >
};
// primary template (not a specialization!)
template<
typename T
, long C0, long C1, long C2, long C3, long C4, long C5, long C6, long C7

View File

@@ -0,0 +1,7 @@
#define BOOST_NO_CONFIG
#include "boost/preprocessor/config/config.hpp"
#define BOOST_NO_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES
#define BOOST_NO_TEMPLATE_TEMPLATES
#define __BORLANDC__ 0x561

View File

@@ -0,0 +1,7 @@
#define BOOST_NO_CONFIG
#include "boost/preprocessor/config/config.hpp"
#define BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES
#define BOOST_NO_TEMPLATE_TEMPLATES
#define __BORLANDC__ 0x551

View File

@@ -0,0 +1,3 @@
#define BOOST_NO_CONFIG
#define BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING

View File

@@ -0,0 +1,8 @@
#define BOOST_NO_CONFIG
#define BOOST_MSVC 1200
#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
#define BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS
#define BOOST_NO_CV_VOID_SPECIALIZATIONS
#define BOOST_NO_INTRINSIC_WCHAR_T
#define BOOST_NO_STD_ALLOCATOR

View File

@@ -0,0 +1,4 @@
#define BOOST_NO_CONFIG
#define BOOST_MSVC 1300
#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#define BOOST_NO_INCLASS_MEMBER_INITIALIZATION

View File

@@ -0,0 +1,2 @@
#define BOOST_NO_CONFIG
#define BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES

View File

@@ -0,0 +1,2 @@
#define BOOST_NO_CONFIG
#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

View File

@@ -0,0 +1 @@
#define BOOST_NO_CONFIG

View File

@@ -0,0 +1,2 @@
#define BOOST_NO_CONFIG
#define BOOST_MPL_TYPEOF_BASED_VECTOR_IMPL

View File

@@ -1,3 +1,17 @@
# Copyright (c) 2001-03
# Aleksey Gurtovoy
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. No representations are made about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# See http://www.boost.org/libs/mpl for documentation.
import fileinput
import os
import re
@@ -143,6 +157,8 @@ class pretty:
self.re_simple_list = re.compile(r'(\w+)\s*<((\w|,| |-|>|<)+)>')
self.re_static_const = re.compile(r'(\s*)((static\s+.*?|enum\s*{\s*)value\s*=)(.*?)(}?;)$')
self.re_typedefs = re.compile(r'(\s*)((\s*typedef\s*.*?;)+)\s*$')
self.re_closing_curly_brace = re.compile(r'^(}|struct\s+\w+);\s*$')
self.re_namespace_scope_templ = re.compile(r'^template\s*<\s*$')
def process(self, line):
@@ -166,7 +182,9 @@ class pretty:
return
# restoring some empty lines
if self.re_templ_decl.match(line) and self.re_typedef.match(self.prev_line):
if self.re_templ_decl.match(line) and self.re_typedef.match(self.prev_line) \
or not self.re_empty_line.match(line) and self.re_closing_curly_brace.match(self.prev_line) \
or self.re_namespace_scope_templ.match(line) and not self.re_empty_line.match(self.prev_line):
line = '\n%s' % line
# removing excessive empty lines

1
preprocessed/preprocess.cmd Executable file
View File

@@ -0,0 +1 @@
F:\mingw\bin\gcc.exe -E -C -P -I%1 -D BOOST_USER_CONFIG="<%1/libs/mpl/preprocessed/include/%2/user.hpp>" %3 >%4

View File

@@ -0,0 +1,80 @@
# Copyright (c) 2001-03
# Aleksey Gurtovoy
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appears in all copies and
# that both the copyright notice and this permission notice appear in
# supporting documentation. No representations are made about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# See http://www.boost.org/libs/mpl for documentation.
import shutil
import os.path
import os
import sys
def process( file, boost_root, dst_dir, mode ):
file_path = "%s.hpp" % os.path.splitext( file )[0]
os.system( "preprocess %s %s %s %s" % ( boost_root, mode, file, file_path ) )
os.rename( file_path, "%s.tmp" % file_path )
os.system( "pp.py %s.tmp %s" % ( file_path, file_path ) )
os.remove( "%s.tmp" % file_path )
filename = os.path.basename(file_path)
dst_dir = os.path.join( dst_dir, mode )
dst_file = os.path.join( dst_dir, filename )
if os.path.exists( dst_file ):
shutil.copymode( filename, dst_file )
shutil.copy( filename, dst_dir )
os.remove( filename )
def process_all( root, boost_root, dst_dir, mode ):
files = os.listdir( root )
for file in files:
path = os.path.join( root, file )
if os.path.splitext( file )[1] == ".cpp":
process( path, boost_root, dst_dir, mode )
else:
if os.path.isdir( path ):
process_all( path, boost_root, dst_dir, mode )
def main( all_modes, src_dir, dst_dir ):
if len( sys.argv ) < 2:
print "\nUsage:\n\t %s <mode> <boost_root> [<source_file>]" % os.path.basename( sys.argv[0] )
print "\nPurpose:\n\t updates preprocessed version(s) of the header(s) in \"%s\" directory" % dst_dir
print "\nExample:\n\t the following command will re-generate and update all 'apply.hpp' headers:"
print "\n\t\t %s all f:\\cvs\\boost apply.cpp" % os.path.basename( sys.argv[0] )
sys.exit( -1 )
if sys.argv[1] == "all":
modes = all_modes
else:
modes = [sys.argv[1]]
boost_root = sys.argv[2]
dst_dir = os.path.join( boost_root, dst_dir )
for mode in modes:
if len( sys.argv ) > 3:
file = os.path.join( os.path.join( os.getcwd(), src_dir ), sys.argv[3] )
process( file, boost_root, dst_dir, mode )
else:
process_all( os.path.join( os.getcwd(), src_dir ), boost_root, dst_dir, mode )
if __name__ == '__main__':
main(
["msvc60", "msvc70", "bcc", "bcc551", "gcc", "mwcw", "no_ctps", "plain"]
, "src"
, "boost\\mpl\\aux_\\preprocessed"
)