1 # // (C) Copyright Tobias Schwinger
3 # // Use modification and distribution are subject to the boost Software License
4 # // Version 1.0. (See http:/\/www.boost.org/LICENSE_1_0.txt).
6 # // Preprocess and run this script.
8 # // Invocation example using the GNU preprocessor:
10 # // g++ -I$BOOST_ROOT -x c++ preprocess.pl -E |perl
14 # // g++ -I$BOOST_ROOT -x c++ preprocess.pl -E >temp.pl
18 die("ERROR: this script has to be preprocessed, stopped");
22 use File
::Spec updir
,curdir
,catfile
,canonpath
,splitpath
,file_name_is_absolute
;
25 my $up = File
::Spec-
>updir();
27 # // Relative path to the destination directory.
28 my $path = File
::Spec-
>catdir($up,$up,$up,'boost','typeof');
31 /\/ Copyright
(C
) 2005 Arkadiy Vertleyb
32 /\/ Copyright
(C
) 2005 Peder Holt
34 /\/ Use modification
and distribution are subject to the boost Software License
,
35 /\/ Version
1.0. (See http
:/\/www
.boost
.org
/LICENSE_1_0
.txt
).
37 /\/ Preprocessed code
, do not edit manually
!
42 # // Find this script's directory if run directly from the shell (not piped)
43 $path = File
::Spec-
>canonpath
45 ( File
::Spec-
>file_name_is_absolute($0)
46 ?
$0 : (File
::Spec-
>curdir(),$0)
48 , File
::Spec-
>splitpath($path)
53 ?
"ERROR: please run from this script's directory, stopped"
54 : "ERROR: target directoty not found, stopped"
57 # // Tidy up the contents and write it to a file
58 sub write_down
(name
,contents
)
60 my($name,$contents) = @_;
63 my $fqfname = File
::Spec-
>catfile($path,$filename);
64 $contents =~ s
"(((\n|^)\s*\#[^\n]+)|(\s*\n)){2,}"\n"g; # "
65 print STDERR
"Writing file: '$filename'\n";
66 open my($file),">$fqfname"
67 or die "ERROR: unable to open file '$filename' for writing, stopped";
69 print $file $contents;
73 # // Include external components to ensure they don't end up in the recorded
75 #define BOOST_TYPEOF_PP_INCLUDE_EXTERNAL
76 my $sewer = <<'%--%-EOF-%--%'
77 #include <boost/typeof/vector.hpp>
78 #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED
83 #define BOOST_TYPEOF_PREPROCESSING_MODE
84 #define BOOST_TYPEOF_LIMIT_SIZE 50
85 #define BOOST_TYPEOF_PP_NEXT_SIZE 100
87 &write_down
('vector50.hpp',<<'%--%-EOF-%--%'
88 #include <boost/typeof/vector.hpp>
91 #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED
93 #undef BOOST_TYPEOF_LIMIT_SIZE
94 #define BOOST_TYPEOF_LIMIT_SIZE 100
95 #define BOOST_TYPEOF_PP_NEXT_SIZE 149
97 &write_down
('vector100.hpp',<<'%--%-EOF-%--%'
98 #include <boost/typeof/vector.hpp>
101 #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED
103 #undef BOOST_TYPEOF_LIMIT_SIZE
104 #define BOOST_TYPEOF_LIMIT_SIZE 150
105 #define BOOST_TYPEOF_PP_NEXT_SIZE 199
108 &write_down
('vector150.hpp',<<'%--%-EOF-%--%'
109 #include <boost/typeof/vector.hpp>
112 #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED
114 #undef BOOST_TYPEOF_LIMIT_SIZE
115 #define BOOST_TYPEOF_LIMIT_SIZE 200
116 #define BOOST_TYPEOF_PP_NEXT_SIZE 250
118 &write_down
('vector200.hpp',<<'%--%-EOF-%--%'
119 #include <boost/typeof/vector.hpp>