Brian Silverman | bbdaf26 | 2018-08-04 23:57:04 -0700 | [diff] [blame^] | 1 | # // (C) Copyright Tobias Schwinger |
| 2 | # // |
| 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). |
| 5 | |
| 6 | # // Preprocess and run this script. |
| 7 | # // |
| 8 | # // Invocation example using the GNU preprocessor: |
| 9 | # // |
| 10 | # // g++ -I$BOOST_ROOT -x c++ preprocess.pl -E |perl |
| 11 | # // |
| 12 | # // or in two steps: |
| 13 | # // |
| 14 | # // g++ -I$BOOST_ROOT -x c++ preprocess.pl -E >temp.pl |
| 15 | # // perl temp.pl |
| 16 | |
| 17 | #define die(x) 1 |
| 18 | die("ERROR: this script has to be preprocessed, stopped"); |
| 19 | #undef die |
| 20 | |
| 21 | use strict vars; |
| 22 | use File::Spec updir,curdir,catfile,canonpath,splitpath,file_name_is_absolute; |
| 23 | |
| 24 | # // --- Settings |
| 25 | my $up = File::Spec->updir(); |
| 26 | |
| 27 | # // Relative path to the destination directory. |
| 28 | my $path = File::Spec->catdir($up,$up,$up,'boost','typeof'); |
| 29 | |
| 30 | my $license = qq@ |
| 31 | /\/ Copyright (C) 2005 Arkadiy Vertleyb |
| 32 | /\/ Copyright (C) 2005 Peder Holt |
| 33 | /\/ |
| 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). |
| 36 | |
| 37 | /\/ Preprocessed code, do not edit manually ! |
| 38 | |
| 39 | @; |
| 40 | # //--- |
| 41 | |
| 42 | # // Find this script's directory if run directly from the shell (not piped) |
| 43 | $path = File::Spec->canonpath |
| 44 | ( File::Spec->catfile |
| 45 | ( File::Spec->file_name_is_absolute($0) |
| 46 | ? $0 : (File::Spec->curdir(),$0) |
| 47 | , $up |
| 48 | , File::Spec->splitpath($path) |
| 49 | ) |
| 50 | ) unless ($0 eq '-'); |
| 51 | die |
| 52 | ( ($0 eq '-') |
| 53 | ? "ERROR: please run from this script's directory, stopped" |
| 54 | : "ERROR: target directoty not found, stopped" |
| 55 | ) unless (-d $path); |
| 56 | |
| 57 | # // Tidy up the contents and write it to a file |
| 58 | sub write_down(name,contents) |
| 59 | { |
| 60 | my($name,$contents) = @_; |
| 61 | my $filename = $name; |
| 62 | |
| 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"; |
| 68 | print $file $license; |
| 69 | print $file $contents; |
| 70 | close $file; |
| 71 | } |
| 72 | |
| 73 | # // Include external components to ensure they don't end up in the recorded |
| 74 | # // output |
| 75 | #define BOOST_TYPEOF_PP_INCLUDE_EXTERNAL |
| 76 | my $sewer = <<'%--%-EOF-%--%' |
| 77 | #include <boost/typeof/vector.hpp> |
| 78 | #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED |
| 79 | %--%-EOF-%--% |
| 80 | ; $sewer = ''; |
| 81 | |
| 82 | |
| 83 | #define BOOST_TYPEOF_PREPROCESSING_MODE |
| 84 | #define BOOST_TYPEOF_LIMIT_SIZE 50 |
| 85 | #define BOOST_TYPEOF_PP_NEXT_SIZE 100 |
| 86 | |
| 87 | &write_down('vector50.hpp',<<'%--%-EOF-%--%' |
| 88 | #include <boost/typeof/vector.hpp> |
| 89 | %--%-EOF-%--% |
| 90 | ); |
| 91 | #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED |
| 92 | |
| 93 | #undef BOOST_TYPEOF_LIMIT_SIZE |
| 94 | #define BOOST_TYPEOF_LIMIT_SIZE 100 |
| 95 | #define BOOST_TYPEOF_PP_NEXT_SIZE 149 |
| 96 | |
| 97 | &write_down('vector100.hpp',<<'%--%-EOF-%--%' |
| 98 | #include <boost/typeof/vector.hpp> |
| 99 | %--%-EOF-%--% |
| 100 | ); |
| 101 | #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED |
| 102 | |
| 103 | #undef BOOST_TYPEOF_LIMIT_SIZE |
| 104 | #define BOOST_TYPEOF_LIMIT_SIZE 150 |
| 105 | #define BOOST_TYPEOF_PP_NEXT_SIZE 199 |
| 106 | |
| 107 | |
| 108 | &write_down('vector150.hpp',<<'%--%-EOF-%--%' |
| 109 | #include <boost/typeof/vector.hpp> |
| 110 | %--%-EOF-%--% |
| 111 | ); |
| 112 | #undef BOOST_TYPEOF_VECTOR_HPP_INCLUDED |
| 113 | |
| 114 | #undef BOOST_TYPEOF_LIMIT_SIZE |
| 115 | #define BOOST_TYPEOF_LIMIT_SIZE 200 |
| 116 | #define BOOST_TYPEOF_PP_NEXT_SIZE 250 |
| 117 | |
| 118 | &write_down('vector200.hpp',<<'%--%-EOF-%--%' |
| 119 | #include <boost/typeof/vector.hpp> |
| 120 | %--%-EOF-%--% |
| 121 | ); |
| 122 | |