tools for re-generating preprocessed headers
[SVN r18856]
This commit is contained in:
1 parent
567c490a97
commit
406ae7d211
37 files changed
+255
-108
No files matched your search
@@ -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
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
#define BOOST_EXTENDED_TEMPLATE_PARAMETERS_MATCHING
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,4 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
#define BOOST_MSVC 1300
|
||||
#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
#define BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
@@ -0,0 +1,2 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
#define BOOST_BROKEN_DEFAULT_TEMPLATE_PARAMETERS_IN_NESTED_TEMPLATES
|
||||
@@ -0,0 +1,2 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
#define BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
@@ -0,0 +1 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
@@ -0,0 +1,2 @@
|
||||
#define BOOST_NO_CONFIG
|
||||
#define BOOST_MPL_TYPEOF_BASED_VECTOR_IMPL
|
||||
+19
-1
@@ -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
|
||||
|
||||
Executable
+1
@@ -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
|
||||
@@ -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"
|
||||
)
|
||||
Reference in new issue
Block a user